code
stringlengths
2
1.05M
import magicAdaptor from './magic'; import arrayAdaptor from './array/index'; var magicArrayAdaptor, MagicArrayWrapper; if ( magicAdaptor ) { magicArrayAdaptor = { filter: function ( object, keypath, ractive ) { return magicAdaptor.filter( object, keypath, ractive ) && arrayAdaptor.filter( object ); }, wrap: function ( ractive, array, keypath ) { return new MagicArrayWrapper( ractive, array, keypath ); } }; MagicArrayWrapper = function ( ractive, array, keypath ) { this.value = array; this.magic = true; this.magicWrapper = magicAdaptor.wrap( ractive, array, keypath ); this.arrayWrapper = arrayAdaptor.wrap( ractive, array, keypath ); // ugh, this really is a terrible hack Object.defineProperty( this, '__model', { get () { return this.arrayWrapper.__model; }, set ( model ) { this.arrayWrapper.__model = model; } }); }; MagicArrayWrapper.prototype = { get: function () { return this.value; }, teardown: function () { this.arrayWrapper.teardown(); this.magicWrapper.teardown(); }, reset: function ( value ) { return this.magicWrapper.reset( value ); } }; } export default magicArrayAdaptor;
require('../../modules/es.object.is-extensible'); module.exports = require('../../internals/path').Object.isExtensible;
module.exports = { 'desc' : 'List All Forms Deployed To An Environment', 'examples' : [{ cmd : 'fhc appforms environments forms list --environment=<ID Of Environment To List Forms>', desc : 'List All Forms Deployed To An Environment'}], 'demand' : ['environment'], 'alias' : {}, 'describe' : { 'environment': "ID Of Environment To List Forms" }, 'url' : function(params){ return "/api/v2/mbaas/" + params.environment + "/appforms/forms"; }, 'method' : 'get' };
/* * ============================================================= * dust helpers * ============================================================= * */ //umd pattern (function (root, factory) { if (typeof module !== 'undefined' && module.exports) { //commonjs module.exports = factory(require('dustjs'), require('dustjs-helpers')); } else if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['dustjs','dustjs-helpers','moment'], factory); } else { // Browser globals (root is window) root.returnExports = factory(root.dust,root.dust.helpers,root.moment); } }(this, function (dust,helpers,moment) { dust.helpers.formatDate=function(chunk, context, bodies, params){ var value = dust.helpers.tap(params.value, chunk, context); var format=params.format || 'MM-DD-YYYY'; if(value){ value=moment(value).format(format); }else{ value=''; } return chunk.write(value); }; dust.helpers.inline=dust.helpers.inline || {}; dust.helpers.inline.formatDate=function(val,format){ format=format || 'MM-DD-YYYY'; return (val) ? moment(val).format(format) : ''; }; return dust; }));
version https://git-lfs.github.com/spec/v1 oid sha256:08869a2140f73bac2be4473782de5830e8c9b0e78e547c6f6063eeb44c4c5e82 size 2327
'use strict'; describe('Directive: sumaCsvHourly', function () { // load the directive's module beforeEach(module('sumaAnalysis')); beforeEach(module('csvHourlyMock')); // load the directive's template beforeEach(module('views/directives/csv.html')); var element, scope, Ctrlscope, MockLink; beforeEach(inject(function ($rootScope, $compile, mockData, mockLink) { element = angular.element('<span suma-csv-hourly data="data" params="params"></span>'); MockLink = mockLink; scope = $rootScope.$new(); scope.data = mockData; scope.params = {}; scope.params.init = {title: 'Test'}; scope.params.sdate = '2014-01-01'; scope.params.edate = '2014-01-31'; scope.params.classifyCounts = {title: 'Test'}; scope.params.wholeSession = {title: 'Yes'}; scope.params.stime = ''; scope.params.etime = ''; scope.params.days = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su']; scope.params.excludeLocs = ['']; scope.params.excludeActs = ['']; scope.params.requireActs = ['']; scope.params.excludeActGrps = ['']; scope.params.requireActGrps = ['']; element = $compile(element)(scope); scope.$digest(); Ctrlscope = element.isolateScope(); })); it('should attach a data url to the element', function () { Ctrlscope.download(scope.data, scope.params); expect(Ctrlscope.href).to.equal(MockLink); }); });
const stampit = require('../src/stampit'); const _ = require('lodash'); const assert = require('assert'); // Composing behaviors. /** * Implements convertOne() method for future usage. */ const DbToApiCommodityConverter = stampit.methods({ convertOne(entity) { var keysMap = {_id: 'id'}; return _.mapKeys(_.pick(entity, ['category', '_id', 'name', 'price']), (v, k) => keysMap[k] || k); } }); /** * Abstract converter. Implements convert() which does argument validation and can convert both arrays and single items. * Requires this.convertOne() to be defined. */ const Converter = stampit.methods({ convert(entities) { if (!entities) { return; } if (!Array.isArray(entities)) { return this.convertOne(entities); } return _.map(entities, this.convertOne); } }); /** * Database querying implementation: findById() and find() * Requires this.schema to be defined. */ const MongoDb = stampit.methods({ findById(id) { return this.schema.findById(id); }, find(params) { return this.schema.find(params); } }); /** * The business logic. Defines getById() and search() which query DB and convert data with this.convert(). * Requires this.convert() to be defined. */ const Commodity = stampit.methods({ getById(id) { return this.findById(id).then(this.convert.bind(this)); }, search(fields = {price: {from: 0, to: Infinity}}) { return this.find({category: fields.categories, price: {gte: fields.price.from, lte: fields.price.to}}) .then(this.convert.bind(this)); } }) .compose(Converter, DbToApiCommodityConverter, MongoDb); // Adding the missing behavior // Production code would look like so: // const commodity = Commodity({ // schema: MongooseCommoditySchema // }); // commodity.getById(123).then(console.log); // commodity.find({categories: 'kettle', price: {from: 0, to: 20}}).then(console.log); // Unit testing code const _mockItem = {category: 'kettle', _id: 42, name: 'Samsung Kettle', price: 4.2}; const FakeDb = stampit.methods({ findById(id) { // Mocking the DB call return Promise.resolve(_mockItem); }, find(params) { // Mocking the DB call return Promise.resolve([_mockItem]); } }); const MockedCommodity = Commodity.compose(FakeDb); const commodity = MockedCommodity(); commodity.getById().then(data => { assert.equal(data.category, _mockItem.category); assert.equal(data.id, _mockItem._id); assert.equal(data.name, _mockItem.name); assert.equal(data.price, _mockItem.price); console.log('getById works!'); }).catch(console.error); commodity.search().then(data => { assert.equal(data.length, 1); assert.equal(data[0].category, _mockItem.category); assert.equal(data[0].id, _mockItem._id); assert.equal(data[0].name, _mockItem.name); assert.equal(data[0].price, _mockItem.price); console.log('search works!'); }).catch(console.error);
module.exports = function(grunt) { "use strict"; // List required source files that will be built into wysihtml5x.js var base = [ "src/wysihtml5.js", "src/polyfills.js", "node_modules/rangy/lib/rangy-core.js", "node_modules/rangy/lib/rangy-textrange.js", "node_modules/rangy/lib/rangy-selectionsaverestore.js", "lib/base/base.js", "src/browser.js", "src/lang/array.js", "src/lang/dispatcher.js", "src/lang/object.js", "src/lang/string.js", "src/dom/auto_link.js", "src/dom/class.js", "src/dom/contains.js", "src/dom/convert_to_list.js", "src/dom/copy_attributes.js", "src/dom/copy_styles.js", "src/dom/delegate.js", "src/dom/dom_node.js", "src/dom/get_as_dom.js", "src/dom/get_parent_element.js", "src/dom/get_style.js", "src/dom/get_textnodes.js", "src/dom/has_element_with_tag_name.js", "src/dom/has_element_with_class_name.js", "src/dom/insert.js", "src/dom/insert_css.js", "src/dom/line_breaks.js", "src/dom/observe.js", "src/dom/parse.js", "src/dom/remove_empty_text_nodes.js", "src/dom/rename_element.js", "src/dom/replace_with_child_nodes.js", "src/dom/resolve_list.js", "src/dom/sandbox.js", "src/dom/contenteditable_area.js", "src/dom/set_attributes.js", "src/dom/set_styles.js", "src/dom/simulate_placeholder.js", "src/dom/text_content.js", "src/dom/get_attribute.js", "src/dom/get_attributes.js", "src/dom/is_loaded_image.js", "src/dom/table.js", "src/dom/query.js", "src/dom/compare_document_position.js", "src/dom/unwrap.js", "src/dom/get_pasted_html.js", "src/dom/remove_invisible_spaces.js", "src/quirks/clean_pasted_html.js", "src/quirks/ensure_proper_clearing.js", "src/quirks/get_correct_inner_html.js", "src/quirks/redraw.js", "src/quirks/table_cells_selection.js", "src/quirks/style_parser.js", "src/selection/selection.js", "src/selection/html_applier.js", "src/commands.js", "src/commands/bold.js", "src/commands/createLink.js", "src/commands/removeLink.js", "src/commands/fontSize.js", "src/commands/fontSizeStyle.js", "src/commands/foreColor.js", "src/commands/foreColorStyle.js", "src/commands/bgColorStyle.js", "src/commands/formatBlock.js", "src/commands/formatCode.js", "src/commands/formatInline.js", "src/commands/insertBlockQuote.js", "src/commands/insertHTML.js", "src/commands/insertImage.js", "src/commands/insertLineBreak.js", "src/commands/insertOrderedList.js", "src/commands/insertUnorderedList.js", "src/commands/insertList.js", "src/commands/italic.js", "src/commands/justifyCenter.js", "src/commands/justifyLeft.js", "src/commands/justifyRight.js", "src/commands/justifyFull.js", "src/commands/alignRightStyle.js", "src/commands/alignLeftStyle.js", "src/commands/alignCenterStyle.js", "src/commands/alignJustifyStyle.js", "src/commands/redo.js", "src/commands/underline.js", "src/commands/undo.js", "src/commands/createTable.js", "src/commands/mergeTableCells.js", "src/commands/addTableCells.js", "src/commands/deleteTableCells.js", "src/commands/indentList.js", "src/commands/outdentList.js", "src/commands/subscript.js", "src/commands/superscript.js", "src/undo_manager.js", "src/views/view.js", "src/views/composer.js", "src/views/composer.style.js", "src/views/composer.observe.js", "src/views/synchronizer.js", "src/views/sourceview.js", "src/views/textarea.js", "src/editor.js" ]; // List of optional source files that will be built to wysihtml5x-toolbar.js var toolbar = [ "src/toolbar/dialog.js", "src/toolbar/speech.js", "src/toolbar/toolbar.js", "src/toolbar/dialog_createTable.js", "src/toolbar/dialog_foreColorStyle.js", "src/toolbar/dialog_fontSizeStyle.js" ]; // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), concat: { options: { separator: ';', process: function(src, filepath) { return src.replace(/@VERSION/g, grunt.config.get('pkg.version')); } }, dist: { src: base, dest: 'dist/<%= pkg.name %>.js' }, toolbar: { src: base.concat(toolbar), dest: 'dist/<%= pkg.name %>-toolbar.js' } }, uglify: { options: { banner: '/*! <%= pkg.name %> - v<%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>) */\n', sourceMap: true }, build: { files: { 'dist/<%= pkg.name %>.min.js': 'dist/<%= pkg.name %>.js', 'dist/<%= pkg.name %>-toolbar.min.js': 'dist/<%= pkg.name %>-toolbar.js' } } }, open: { test: { path: 'test/index.html' } } }); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-open'); grunt.registerTask('default', ['concat', 'uglify']); grunt.registerTask('test', ['open:test']); };
/** * SmartEditor2 NHN_Library:SE2.3.10.O11329:SmartEditor2.0-OpenSource * @version 11329 */ var nSE2Version = 11329;if(typeof window.nhn=='undefined') window.nhn = {}; /** * @fileOverview This file contains a function that takes care of various operations related to find and replace * @name N_FindReplace.js */ nhn.FindReplace = jindo.$Class({ sKeyword : "", window : null, document : null, bBrowserSupported : false, // true if End Of Contents is reached during last execution of find bEOC : false, $init : function(win){ this.sInlineContainer = "SPAN|B|U|I|S|STRIKE"; this.rxInlineContainer = new RegExp("^("+this.sInlineContainer+")$"); this.window = win; this.document = this.window.document; if(this.document.domain != this.document.location.hostname){ var oAgentInfo = jindo.$Agent(); var oNavigatorInfo = oAgentInfo.navigator(); if(oNavigatorInfo.firefox && oNavigatorInfo.version < 3){ this.bBrowserSupported = false; this.find = function(){return 3}; return; } } this.bBrowserSupported = true; }, /** * ํ•ด๋‹น๋…ธ๋“œ์˜ ๋‹ค์Œ element๋ฅผ ์ฐพ๋Š”๋‹ค. * ์ฐพ์„ ์ˆ˜ ์—†๊ฑฐ๋‚˜ body ์ด๋ฉด body๋ฅผ ๋ฆฌํ„ด */ _findNextElement : function(elNode){ if(!elNode || elNode.tagName == "BODY"){ return null; } var elNext = elNode.nextSibling; if(elNext){ return (elNext.nodeType == 1 ? elNext : this._findNextElement(elNext)); }else{ return this._findNextElement(elNode.parentNode); } }, // 0: found // 1: not found // 2: keyword required // 3: browser not supported find : function(sKeyword, bCaseMatch, bBackwards, bWholeWord){ var bSearchResult, bFreshSearch; this.window.focus(); if(!sKeyword) return 2; // try find starting from current cursor position this.bEOC = false; bSearchResult = this.findNext(sKeyword, bCaseMatch, bBackwards, bWholeWord); if(bSearchResult) return 0; // end of the contents could have been reached so search again from the beginning this.bEOC = true; bSearchResult = this.findNew(sKeyword, bCaseMatch, bBackwards, bWholeWord); if(bSearchResult) return 0; return 1; }, findNew : function (sKeyword, bCaseMatch, bBackwards, bWholeWord){ this.findReset(); return this.findNext(sKeyword, bCaseMatch, bBackwards, bWholeWord); }, findNext : function(sKeyword, bCaseMatch, bBackwards, bWholeWord){ var bSearchResult; bCaseMatch = bCaseMatch || false; bWholeWord = bWholeWord || false; bBackwards = bBackwards || false; if(this.window.find){ var bWrapAround = false; return this.window.find(sKeyword, bCaseMatch, bBackwards, bWrapAround, bWholeWord); } // IE solution if(this.document.body.createTextRange){ try{ var iOption = 0; if(bBackwards) iOption += 1; if(bWholeWord) iOption += 2; if(bCaseMatch) iOption += 4; this.window.focus(); if(this.document.selection){ this._range = this.document.selection.createRangeCollection().item(0); this._range.collapse(false); }else{ // [SMARTEDITORSUS-1528] IE11์ธ ๊ฒฝ์šฐ this._range = this.document.body.createTextRange(); var elNext = this._findNextElement(this.window.getSelection().focusNode); if(elNext){ this._range.moveToElementText(elNext); } } bSearchResult = this._range.findText(sKeyword, 1, iOption); this._range.select(); return bSearchResult; }catch(e){ return false; } } return false; }, findReset : function() { if (this.window.find){ this.window.getSelection().removeAllRanges(); return; } // IE solution if(this.document.body.createTextRange){ if(this.document.selection){ this._range = this.document.body.createTextRange(); this._range.collapse(true); this._range.select(); }else if(this.window.getSelection){ // [SMARTEDITORSUS-1528] IE11์ธ ๊ฒฝ์šฐ var oSelection = this.window.getSelection(); oSelection.removeAllRanges(); oSelection.selectAllChildren(this.document.body); oSelection.collapseToStart(); } } }, // 0: replaced & next word found // 1: replaced & next word not found // 2: not replaced & next word found // 3: not replaced & next word not found // 4: sOriginalWord required replace : function(sOriginalWord, Replacement, bCaseMatch, bBackwards, bWholeWord){ return this._replace(sOriginalWord, Replacement, bCaseMatch, bBackwards, bWholeWord); }, /** * [SMARTEDITORSUS-1591] ํฌ๋กฌ์—์„œ replaceAll ์‹œ selection ์„ ์ƒˆ๋กœ ๋งŒ๋“ค๋ฉด ์ฒซ๋ฒˆ์งธ ๋‹จ์–ด๊ฐ€ ์‚ญ์ œ๋˜์ง€ ์•Š๊ณ  ๋‚จ๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์–ด์„œ * selection ๊ฐ์ฒด๋ฅผ ๋ฐ›์•„์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก private ๋ฉ”์„œ๋“œ ์ถ”๊ฐ€ * TODO: ๊ทผ๋ณธ์ ์œผ๋กœ HuskyRange ๋ฅผ ๋ฆฌํŒฉํ† ๋งํ•  ํ•„์š”๊ฐ€ ์žˆ์Œ */ _replace : function(sOriginalWord, Replacement, bCaseMatch, bBackwards, bWholeWord, oSelection){ if(!sOriginalWord) return 4; oSelection = oSelection || new nhn.HuskyRange(this.window); oSelection.setFromSelection(); bCaseMatch = bCaseMatch || false; var bMatch, selectedText = oSelection.toString(); if(bCaseMatch) bMatch = (selectedText == sOriginalWord); else bMatch = (selectedText.toLowerCase() == sOriginalWord.toLowerCase()); if(!bMatch) return this.find(sOriginalWord, bCaseMatch, bBackwards, bWholeWord)+2; if(typeof Replacement == "function"){ // the returned oSelection must contain the replacement oSelection = Replacement(oSelection); }else{ oSelection.pasteText(Replacement); } // force it to find the NEXT occurance of sOriginalWord oSelection.select(); return this.find(sOriginalWord, bCaseMatch, bBackwards, bWholeWord); }, // returns number of replaced words // -1 : if original word is not given replaceAll : function(sOriginalWord, Replacement, bCaseMatch, bWholeWord){ if(!sOriginalWord) return -1; var bBackwards = false; var iReplaceResult; var iResult = 0; var win = this.window; if(this.find(sOriginalWord, bCaseMatch, bBackwards, bWholeWord) !== 0){ return iResult; } var oSelection = new nhn.HuskyRange(this.window); oSelection.setFromSelection(); // ์‹œ์ž‘์ ์˜ ๋ถ๋งˆํฌ๊ฐ€ ์ง€์›Œ์ง€๋ฉด์„œ ์‹œ์ž‘์ ์„ ์ง€๋‚˜์„œ replace๊ฐ€ ๋˜๋Š” ํ˜„์ƒ ๋ฐฉ์ง€์šฉ // ์ฒซ ๋‹จ์–ด ์•ž์ชฝ์— ํŠน์ˆ˜ ๋ฌธ์ž ์‚ฝ์ž… ํ•ด์„œ, replace์™€ ํ•จ๊ป˜ ๋ถ๋งˆํฌ๊ฐ€ ์‚ฌ๋ผ์ง€๋Š” ๊ฒƒ ๋ฐฉ์ง€ oSelection.collapseToStart(); var oTmpNode = this.window.document.createElement("SPAN"); oTmpNode.innerHTML = unescape("%uFEFF"); oSelection.insertNode(oTmpNode); oSelection.select(); var sBookmark = oSelection.placeStringBookmark(); this.bEOC = false; while(!this.bEOC){ iReplaceResult = this._replace(sOriginalWord, Replacement, bCaseMatch, bBackwards, bWholeWord, oSelection); if(iReplaceResult == 0 || iReplaceResult == 1){ iResult++; } } var startingPointReached = function(){ var oCurSelection = new nhn.HuskyRange(win); oCurSelection.setFromSelection(); oSelection.moveToBookmark(sBookmark); var pos = oSelection.compareBoundaryPoints(nhn.W3CDOMRange.START_TO_END, oCurSelection); if(pos == 1) return false; return true; }; iReplaceResult = 0; this.bEOC = false; while(!startingPointReached() && iReplaceResult == 0 && !this.bEOC){ iReplaceResult = this._replace(sOriginalWord, Replacement, bCaseMatch, bBackwards, bWholeWord, oSelection); if(iReplaceResult == 0 || iReplaceResult == 1){ iResult++; } } oSelection.moveToBookmark(sBookmark); oSelection.deleteContents(); // [SMARTEDITORSUS-1591] ํฌ๋กฌ์—์„œ ์ฒซ๋ฒˆ์งธ ๋‹จ์–ด๊ฐ€ ์‚ญ์ œ๋˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ์œผ๋ฏ€๋กœ select()๋ฉ”์„œ๋“œ๋Œ€์‹  deleteContents() ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค. oSelection.removeStringBookmark(sBookmark); // setTimeout ์—†์ด ๋ฐ”๋กœ ์ง€์šฐ๋ฉด IE8 ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ๋นˆ๋ฒˆํ•˜๊ฒŒ ์ฃฝ์–ด๋ฒ„๋ฆผ setTimeout(function(){ oTmpNode.parentNode.removeChild(oTmpNode); }, 0); return iResult; }, _isBlankTextNode : function(oNode){ if(oNode.nodeType == 3 && oNode.nodeValue == ""){return true;} return false; }, _getNextNode : function(elNode, bDisconnected){ if(!elNode || elNode.tagName == "BODY"){ return {elNextNode: null, bDisconnected: false}; } if(elNode.nextSibling){ elNode = elNode.nextSibling; while(elNode.firstChild){ if(elNode.tagName && !this.rxInlineContainer.test(elNode.tagName)){ bDisconnected = true; } elNode = elNode.firstChild; } return {elNextNode: elNode, bDisconnected: bDisconnected}; } return this._getNextNode(nhn.DOMFix.parentNode(elNode), bDisconnected); }, _getNextTextNode : function(elNode, bDisconnected){ var htNextNode, elNode; while(true){ htNextNode = this._getNextNode(elNode, bDisconnected); elNode = htNextNode.elNextNode; bDisconnected = htNextNode.bDisconnected; if(elNode && elNode.nodeType != 3 && !this.rxInlineContainer.test(elNode.tagName)){ bDisconnected = true; } if(!elNode || (elNode.nodeType==3 && !this._isBlankTextNode(elNode))){ break; } } return {elNextText: elNode, bDisconnected: bDisconnected}; }, _getFirstTextNode : function(){ // ๋ฌธ์„œ์—์„œ ์ œ์ผ ์•ž์ชฝ์— ์œ„์น˜ํ•œ ์•„๋ฌด ๋…ธ๋“œ ์ฐพ๊ธฐ var elFirstNode = this.document.body.firstChild; while(!!elFirstNode && elFirstNode.firstChild){ elFirstNode = elFirstNode.firstChild; } // ๋ฌธ์„œ์— ์•„๋ฌด ๋…ธ๋“œ๋„ ์—†์Œ if(!elFirstNode){ return null; } // ์ฒ˜์Œ ๋…ธ๋“œ๊ฐ€ ํ…์ŠคํŠธ ๋…ธ๋“œ๊ฐ€ ์•„๋‹ˆ๊ฑฐ๋‚˜ bogus ๋…ธ๋“œ๋ผ๋ฉด ๋‹ค์Œ ํ…์ŠคํŠธ ๋…ธ๋“œ๋ฅผ ์ฐพ์Œ if(elFirstNode.nodeType != 3 || this._isBlankTextNode(elFirstNode)){ var htTmp = this._getNextTextNode(elFirstNode, false); elFirstNode = htTmp.elNextText; } return elFirstNode; }, _addToTextMap : function(elNode, aTexts, aElTexts, nLen){ var nStartPos = aTexts[nLen].length; for(var i=0, nTo=elNode.nodeValue.length; i<nTo; i++){ aElTexts[nLen][nStartPos+i] = [elNode, i]; } aTexts[nLen] += elNode.nodeValue; }, _createTextMap : function(){ var aTexts = []; var aElTexts = []; var nLen=-1; var elNode = this._getFirstTextNode(); var htNextNode = {elNextText: elNode, bDisconnected: true}; while(elNode){ if(htNextNode.bDisconnected){ nLen++; aTexts[nLen] = ""; aElTexts[nLen] = []; } this._addToTextMap(htNextNode.elNextText, aTexts, aElTexts, nLen); htNextNode = this._getNextTextNode(elNode, false); elNode = htNextNode.elNextText; } return {aTexts: aTexts, aElTexts: aElTexts}; }, replaceAll_js : function(sOriginalWord, Replacement, bCaseMatch, bWholeWord){ try{ var t0 = new Date(); var htTmp = this._createTextMap(); var t1 = new Date(); var aTexts = htTmp.aTexts; var aElTexts = htTmp.aElTexts; // console.log(sOriginalWord); // console.log(aTexts); // console.log(aElTexts); var nMatchCnt = 0; var nOriginLen = sOriginalWord.length; // ๋‹จ์–ด ํ•œ๊ฐœ์”ฉ ๋น„๊ต for(var i=0, niLen=aTexts.length; i<niLen; i++){ var sText = aTexts[i]; // ๋‹จ์–ด ์•ˆ์— ํ•œ๊ธ€์ž์”ฉ ๋น„๊ต //for(var j=0, njLen=sText.length - nOriginLen; j<njLen; j++){ for(var j=sText.length-nOriginLen; j>=0; j--){ var sTmp = sText.substring(j, j+nOriginLen); if(bWholeWord && (j > 0 && sText.charAt(j-1).match(/[a-zA-Z๊ฐ€-ํžฃ]/)) ){ continue; } if(sTmp == sOriginalWord){ nMatchCnt++; var oSelection = new nhn.HuskyRange(this.window); // ๋งˆ์ง€๋ง‰ ๊ธ€์ž์˜ ๋’ท๋ถ€๋ถ„ ์ฒ˜๋ฆฌ var elContainer, nOffset; if(j+nOriginLen < aElTexts[i].length){ elContainer = aElTexts[i][j+nOriginLen][0]; nOffset = aElTexts[i][j+nOriginLen][1]; }else{ elContainer = aElTexts[i][j+nOriginLen-1][0]; nOffset = aElTexts[i][j+nOriginLen-1][1]+1; } oSelection.setEnd(elContainer, nOffset, true, true); oSelection.setStart(aElTexts[i][j][0], aElTexts[i][j][1], true); if(typeof Replacement == "function"){ // the returned oSelection must contain the replacement oSelection = Replacement(oSelection); }else{ oSelection.pasteText(Replacement); } j -= nOriginLen; } continue; } } /* var t2 = new Date(); console.log("OK"); console.log(sOriginalWord); console.log("MC:"+(t1-t0)); console.log("RP:"+(t2-t1)); */ return nMatchCnt; }catch(e){ /* console.log("ERROR"); console.log(sOriginalWord); console.log(new Date()-t0); */ return nMatchCnt; } } }); // "padding", "backgroundcolor", "border", "borderTop", "borderRight", "borderBottom", "borderLeft", "color", "textAlign", "fontWeight" nhn.husky.SE2M_TableTemplate = [ {}, /* // 0 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "0" }, htTableStyle : { border : "1px dashed #666666", borderRight : "0", borderBottom : "0" }, aRowStyle : [ { padding : "3px 0 2px 0", border : "1px dashed #666666", borderTop : "0", borderLeft : "0" } ] }, // 1 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "0" }, htTableStyle : { border : "1px solid #c7c7c7", borderRight : "0", borderBottom : "0" }, aRowStyle : [ { padding : "3px 0 2px 0", border : "1px solid #c7c7c7", borderTop : "0", borderLeft : "0" } ] }, // 2 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "1" }, htTableStyle : { border : "1px solid #c7c7c7" }, aRowStyle : [ { padding : "2px 0 1px 0", border : "1px solid #c7c7c7" } ] }, // 3 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "1" }, htTableStyle : { border : "1px double #c7c7c7" }, aRowStyle : [ { padding : "1px 0 0", border : "3px double #c7c7c7" } ] }, // 4 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "1" }, htTableStyle : { borderWidth : "2px 1px 1px 2px", borderStyle : "solid", borderColor : "#c7c7c7" }, aRowStyle : [ { padding : "2px 0 0", borderWidth : "1px 2px 2px 1px", borderStyle : "solid", borderColor : "#c7c7c7" } ] }, // 5 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "1" }, htTableStyle : { borderWidth : "1px 2px 2px 1px", borderStyle : "solid", borderColor : "#c7c7c7" }, aRowStyle : [ { padding : "1px 0 0", borderWidth : "2px 1px 1px 2px", borderStyle : "solid", borderColor : "#c7c7c7" } ] }, */ // Black theme ====================================================== // 6 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "1" }, htTableStyle : { backgroundColor : "#c7c7c7" }, aRowStyle : [ { padding : "3px 4px 2px", backgroundColor : "#ffffff", color : "#666666" } ] }, // 7 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "1" }, htTableStyle : { backgroundColor : "#c7c7c7" }, aRowStyle : [ { padding : "3px 4px 2px", backgroundColor : "#ffffff", color : "#666666" }, { padding : "3px 4px 2px", backgroundColor : "#f3f3f3", color : "#666666" } ] }, // 8 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "0" }, htTableStyle : { backgroundColor : "#ffffff", borderTop : "1px solid #c7c7c7" }, aRowStyle : [ { padding : "3px 4px 2px", borderBottom : "1px solid #c7c7c7", backgroundColor : "#ffffff", color : "#666666" }, { padding : "3px 4px 2px", borderBottom : "1px solid #c7c7c7", backgroundColor : "#f3f3f3", color : "#666666" } ] }, // 9 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "0" }, htTableStyle : { border : "1px solid #c7c7c7" }, ht1stRowStyle : { padding : "3px 4px 2px", backgroundColor : "#f3f3f3", color : "#666666", borderRight : "1px solid #e7e7e7", textAlign : "left", fontWeight : "normal" }, aRowStyle : [ { padding : "3px 4px 2px", backgroundColor : "#ffffff", borderTop : "1px solid #e7e7e7", borderRight : "1px solid #e7e7e7", color : "#666666" } ] }, // 10 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "1" }, htTableStyle : { backgroundColor : "#c7c7c7" }, aRowStyle : [ { padding : "3px 4px 2px", backgroundColor : "#f8f8f8", color : "#666666" }, { padding : "3px 4px 2px", backgroundColor : "#ebebeb", color : "#666666" } ] }, // 11 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "0" }, ht1stRowStyle : { padding : "3px 4px 2px", borderTop : "1px solid #000000", borderBottom : "1px solid #000000", backgroundColor : "#333333", color : "#ffffff", textAlign : "left", fontWeight : "normal" }, aRowStyle : [ { padding : "3px 4px 2px", borderBottom : "1px solid #ebebeb", backgroundColor : "#ffffff", color : "#666666" }, { padding : "3px 4px 2px", borderBottom : "1px solid #ebebeb", backgroundColor : "#f8f8f8", color : "#666666" } ] }, // 12 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "1" }, htTableStyle : { backgroundColor : "#c7c7c7" }, ht1stRowStyle : { padding : "3px 4px 2px", backgroundColor : "#333333", color : "#ffffff", textAlign : "left", fontWeight : "normal" }, ht1stColumnStyle : { padding : "3px 4px 2px", backgroundColor : "#f8f8f8", color : "#666666", textAlign : "left", fontWeight : "normal" }, aRowStyle : [ { padding : "3px 4px 2px", backgroundColor : "#ffffff", color : "#666666" } ] }, // 13 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "1" }, htTableStyle : { backgroundColor : "#c7c7c7" }, ht1stColumnStyle : { padding : "3px 4px 2px", backgroundColor : "#333333", color : "#ffffff", textAlign : "left", fontWeight : "normal" }, aRowStyle : [ { padding : "3px 4px 2px", backgroundColor : "#ffffff", color : "#666666" } ] }, // Blue theme ====================================================== // 14 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "1" }, htTableStyle : { backgroundColor : "#a6bcd1" }, aRowStyle : [ { padding : "3px 4px 2px", backgroundColor : "#ffffff", color : "#3d76ab" } ] }, // 15 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "1" }, htTableStyle : { backgroundColor : "#a6bcd1" }, aRowStyle : [ { padding : "3px 4px 2px", backgroundColor : "#ffffff", color : "#3d76ab" }, { padding : "3px 4px 2px", backgroundColor : "#f6f8fa", color : "#3d76ab" } ] }, // 16 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "0" }, htTableStyle : { backgroundColor : "#ffffff", borderTop : "1px solid #a6bcd1" }, aRowStyle : [ { padding : "3px 4px 2px", borderBottom : "1px solid #a6bcd1", backgroundColor : "#ffffff", color : "#3d76ab" }, { padding : "3px 4px 2px", borderBottom : "1px solid #a6bcd1", backgroundColor : "#f6f8fa", color : "#3d76ab" } ] }, // 17 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "0" }, htTableStyle : { border : "1px solid #a6bcd1" }, ht1stRowStyle : { padding : "3px 4px 2px", backgroundColor : "#f6f8fa", color : "#3d76ab", borderRight : "1px solid #e1eef7", textAlign : "left", fontWeight : "normal" }, aRowStyle : [ { padding : "3px 4px 2px", backgroundColor : "#ffffff", borderTop : "1px solid #e1eef7", borderRight : "1px solid #e1eef7", color : "#3d76ab" } ] }, // 18 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "1" }, htTableStyle : { backgroundColor : "#a6bcd1" }, aRowStyle : [ { padding : "3px 4px 2px", backgroundColor : "#fafbfc", color : "#3d76ab" }, { padding : "3px 4px 2px", backgroundColor : "#e6ecf2", color : "#3d76ab" } ] }, // 19 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "0" }, ht1stRowStyle : { padding : "3px 4px 2px", borderTop : "1px solid #466997", borderBottom : "1px solid #466997", backgroundColor : "#6284ab", color : "#ffffff", textAlign : "left", fontWeight : "normal" }, aRowStyle : [ { padding : "3px 4px 2px", borderBottom : "1px solid #ebebeb", backgroundColor : "#ffffff", color : "#3d76ab" }, { padding : "3px 4px 2px", borderBottom : "1px solid #ebebeb", backgroundColor : "#f6f8fa", color : "#3d76ab" } ] }, // 20 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "1" }, htTableStyle : { backgroundColor : "#a6bcd1" }, ht1stRowStyle : { padding : "3px 4px 2px", backgroundColor : "#6284ab", color : "#ffffff", textAlign : "left", fontWeight : "normal" }, ht1stColumnStyle : { padding : "3px 4px 2px", backgroundColor : "#f6f8fa", color : "#3d76ab", textAlign : "left", fontWeight : "normal" }, aRowStyle : [ { padding : "3px 4px 2px", backgroundColor : "#ffffff", color : "#3d76ab" } ] }, // 21 { htTableProperty : { border : "0", cellPadding : "0", cellSpacing : "1" }, htTableStyle : { backgroundColor : "#a6bcd1" }, ht1stColumnStyle : { padding : "3px 4px 2px", backgroundColor : "#6284ab", color : "#ffffff", textAlign : "left", fontWeight : "normal" }, aRowStyle : [ { padding : "3px 4px 2px", backgroundColor : "#ffffff", color : "#3d76ab" } ] } ]; if(typeof window.nhn=='undefined'){window.nhn = {};} if (!nhn.husky){nhn.husky = {};} nhn.husky.oMockDebugger = { log_MessageStart: function() {}, log_MessageEnd: function() {}, log_MessageStepStart: function() {}, log_MessageStepEnd: function() {}, log_CallHandlerStart: function() {}, log_CallHandlerEnd: function() {}, handleException: function() {}, setApp: function() {} }; //{ /** * @fileOverview This file contains Husky framework core * @name HuskyCore.js */ nhn.husky.HuskyCore = jindo.$Class({ name : "HuskyCore", aCallerStack : null, $init : function(htOptions){ this.htOptions = htOptions||{}; if( this.htOptions.oDebugger ){ if( !nhn.husky.HuskyCore._cores ) { nhn.husky.HuskyCore._cores = []; nhn.husky.HuskyCore.getCore = function() { return nhn.husky.HuskyCore._cores; }; } nhn.husky.HuskyCore._cores.push(this); this.htOptions.oDebugger.setApp(this); } // To prevent processing a Husky message before all the plugins are registered and ready, // Queue up all the messages here until the application's status is changed to READY this.messageQueue = []; this.oMessageMap = {}; this.oDisabledMessage = {}; this.aPlugins = []; this.appStatus = nhn.husky.APP_STATUS.NOT_READY; this.aCallerStack = []; this._fnWaitForPluginReady = jindo.$Fn(this._waitForPluginReady, this).bind(); // Register the core as a plugin so it can receive messages this.registerPlugin(this); }, setDebugger: function(oDebugger) { this.htOptions.oDebugger = oDebugger; oDebugger.setApp(this); }, exec : function(msg, args, oEvent){ // If the application is not yet ready just queue the message if(this.appStatus == nhn.husky.APP_STATUS.NOT_READY){ this.messageQueue[this.messageQueue.length] = {'msg':msg, 'args':args, 'event':oEvent}; return true; } this.exec = this._exec; this.exec(msg, args, oEvent); }, delayedExec : function(msg, args, nDelay, oEvent){ var fExec = jindo.$Fn(this.exec, this).bind(msg, args, oEvent); setTimeout(fExec, nDelay); }, _exec : function(msg, args, oEvent){ return (this._exec = this.htOptions.oDebugger?this._execWithDebugger:this._execWithoutDebugger).call(this, msg, args, oEvent); }, _execWithDebugger : function(msg, args, oEvent){ this.htOptions.oDebugger.log_MessageStart(msg, args); var bResult = this._doExec(msg, args, oEvent); this.htOptions.oDebugger.log_MessageEnd(msg, args); return bResult; }, _execWithoutDebugger : function(msg, args, oEvent){ return this._doExec(msg, args, oEvent); }, _doExec : function(msg, args, oEvent){ var bContinue = false; if(!this.oDisabledMessage[msg]){ var allArgs = []; if(args && args.length){ var iLen = args.length; for(var i=0; i<iLen; i++){allArgs[i] = args[i];} } if(oEvent){allArgs[allArgs.length] = oEvent;} bContinue = this._execMsgStep("BEFORE", msg, allArgs); if(bContinue){bContinue = this._execMsgStep("ON", msg, allArgs);} if(bContinue){bContinue = this._execMsgStep("AFTER", msg, allArgs);} } return bContinue; }, registerPlugin : function(oPlugin){ if(!oPlugin){throw("An error occured in registerPlugin(): invalid plug-in");} oPlugin.nIdx = this.aPlugins.length; oPlugin.oApp = this; this.aPlugins[oPlugin.nIdx] = oPlugin; // If the plugin does not specify that it takes time to be ready, change the stauts to READY right away if(oPlugin.status != nhn.husky.PLUGIN_STATUS.NOT_READY){oPlugin.status = nhn.husky.PLUGIN_STATUS.READY;} // If run() function had been called already, need to recreate the message map if(this.appStatus != nhn.husky.APP_STATUS.NOT_READY){ for(var funcName in oPlugin){ if(funcName.match(/^\$(LOCAL|BEFORE|ON|AFTER)_/)){ this.addToMessageMap(funcName, oPlugin); } } } this.exec("MSG_PLUGIN_REGISTERED", [oPlugin]); return oPlugin.nIdx; }, disableMessage : function(sMessage, bDisable){this.oDisabledMessage[sMessage] = bDisable;}, registerBrowserEvent : function(obj, sEvent, sMessage, aParams, nDelay){ aParams = aParams || []; var func = (nDelay)?jindo.$Fn(this.delayedExec, this).bind(sMessage, aParams, nDelay):jindo.$Fn(this.exec, this).bind(sMessage, aParams); return jindo.$Fn(func, this).attach(obj, sEvent); }, run : function(htOptions){ this.htRunOptions = htOptions || {}; // Change the status from NOT_READY to let exec to process all the way this._changeAppStatus(nhn.husky.APP_STATUS.WAITING_FOR_PLUGINS_READY); // Process all the messages in the queue var iQueueLength = this.messageQueue.length; for(var i=0; i<iQueueLength; i++){ var curMsgAndArgs = this.messageQueue[i]; this.exec(curMsgAndArgs.msg, curMsgAndArgs.args, curMsgAndArgs.event); } this._fnWaitForPluginReady(); }, acceptLocalBeforeFirstAgain : function(oPlugin, bAccept){ // LOCAL_BEFORE_FIRST will be fired again if oPlugin._husky_bRun == false oPlugin._husky_bRun = !bAccept; }, // Use this also to update the mapping createMessageMap : function(sMsgHandler){ this.oMessageMap[sMsgHandler] = []; var nLen = this.aPlugins.length; for(var i=0; i<nLen; i++){this._doAddToMessageMap(sMsgHandler, this.aPlugins[i]);} }, addToMessageMap : function(sMsgHandler, oPlugin){ // cannot "ADD" unless the map is already created. // the message will be added automatically to the mapping when it is first passed anyways, so do not add now if(!this.oMessageMap[sMsgHandler]){return;} this._doAddToMessageMap(sMsgHandler, oPlugin); }, _changeAppStatus : function(appStatus){ this.appStatus = appStatus; // Initiate MSG_APP_READY if the application's status is being switched to READY if(this.appStatus == nhn.husky.APP_STATUS.READY){this.exec("MSG_APP_READY");} }, _execMsgStep : function(sMsgStep, sMsg, args){ return (this._execMsgStep = this.htOptions.oDebugger?this._execMsgStepWithDebugger:this._execMsgStepWithoutDebugger).call(this, sMsgStep, sMsg, args); }, _execMsgStepWithDebugger : function(sMsgStep, sMsg, args){ this.htOptions.oDebugger.log_MessageStepStart(sMsgStep, sMsg, args); var bStatus = this._execMsgHandler("$"+sMsgStep+"_"+sMsg, args); this.htOptions.oDebugger.log_MessageStepEnd(sMsgStep, sMsg, args); return bStatus; }, _execMsgStepWithoutDebugger : function(sMsgStep, sMsg, args){ return this._execMsgHandler ("$"+sMsgStep+"_"+sMsg, args); }, _execMsgHandler : function(sMsgHandler, args){ var i; if(!this.oMessageMap[sMsgHandler]){ this.createMessageMap(sMsgHandler); } var aPlugins = this.oMessageMap[sMsgHandler]; var iNumOfPlugins = aPlugins.length; if(iNumOfPlugins === 0){return true;} var bResult = true; // two similar codes were written twice due to the performace. if(sMsgHandler.match(/^\$(BEFORE|ON|AFTER)_MSG_APP_READY$/)){ for(i=0; i<iNumOfPlugins; i++){ if(this._execHandler(aPlugins[i], sMsgHandler, args) === false){ bResult = false; break; } } }else{ for(i=0; i<iNumOfPlugins; i++){ if(!aPlugins[i]._husky_bRun){ aPlugins[i]._husky_bRun = true; if(typeof aPlugins[i].$LOCAL_BEFORE_FIRST == "function" && this._execHandler(aPlugins[i], "$LOCAL_BEFORE_FIRST", [sMsgHandler, args]) === false){continue;} } if(typeof aPlugins[i].$LOCAL_BEFORE_ALL == "function"){ if(this._execHandler(aPlugins[i], "$LOCAL_BEFORE_ALL", [sMsgHandler, args]) === false){continue;} } if(this._execHandler(aPlugins[i], sMsgHandler, args) === false){ bResult = false; break; } } } return bResult; }, _execHandler : function(oPlugin, sHandler, args){ return (this._execHandler = this.htOptions.oDebugger?this._execHandlerWithDebugger:this._execHandlerWithoutDebugger).call(this, oPlugin, sHandler, args); }, _execHandlerWithDebugger : function(oPlugin, sHandler, args){ this.htOptions.oDebugger.log_CallHandlerStart(oPlugin, sHandler, args); var bResult; try{ this.aCallerStack.push(oPlugin); bResult = oPlugin[sHandler].apply(oPlugin, args); this.aCallerStack.pop(); }catch(e){ this.htOptions.oDebugger.handleException(e); bResult = false; } this.htOptions.oDebugger.log_CallHandlerEnd(oPlugin, sHandler, args); return bResult; }, _execHandlerWithoutDebugger : function(oPlugin, sHandler, args){ this.aCallerStack.push(oPlugin); var bResult = oPlugin[sHandler].apply(oPlugin, args); this.aCallerStack.pop(); return bResult; }, _doAddToMessageMap : function(sMsgHandler, oPlugin){ if(typeof oPlugin[sMsgHandler] != "function"){return;} var aMap = this.oMessageMap[sMsgHandler]; // do not add if the plugin is already in the mapping for(var i=0, iLen=aMap.length; i<iLen; i++){ if(this.oMessageMap[sMsgHandler][i] == oPlugin){return;} } this.oMessageMap[sMsgHandler][i] = oPlugin; }, _waitForPluginReady : function(){ var bAllReady = true; for(var i=0; i<this.aPlugins.length; i++){ if(this.aPlugins[i].status == nhn.husky.PLUGIN_STATUS.NOT_READY){ bAllReady = false; break; } } if(bAllReady){ this._changeAppStatus(nhn.husky.APP_STATUS.READY); }else{ setTimeout(this._fnWaitForPluginReady, 100); } } }); //} nhn.husky.APP_STATUS = { 'NOT_READY' : 0, 'WAITING_FOR_PLUGINS_READY' : 1, 'READY' : 2 }; nhn.husky.PLUGIN_STATUS = { 'NOT_READY' : 0, 'READY' : 1 }; if(typeof window.nhn=='undefined'){window.nhn = {};} nhn.CurrentSelection_IE = function(){ this.getCommonAncestorContainer = function(){ try{ this._oSelection = this._document.selection; if(this._oSelection.type == "Control"){ return this._oSelection.createRange().item(0); }else{ return this._oSelection.createRangeCollection().item(0).parentElement(); } }catch(e){ return this._document.body; } }; this.isCollapsed = function(){ this._oSelection = this._document.selection; return this._oSelection.type == "None"; }; }; nhn.CurrentSelection_FF = function(){ this.getCommonAncestorContainer = function(){ return this._getSelection().commonAncestorContainer; }; this.isCollapsed = function(){ var oSelection = this._window.getSelection(); if(oSelection.rangeCount<1){ return true; } return oSelection.getRangeAt(0).collapsed; }; this._getSelection = function(){ try{ return this._window.getSelection().getRangeAt(0); }catch(e){ return this._document.createRange(); } }; }; nhn.CurrentSelection = new (jindo.$Class({ $init : function(){ var oAgentInfo = jindo.$Agent().navigator(); if(oAgentInfo.ie && document.selection){ nhn.CurrentSelection_IE.apply(this); }else{ nhn.CurrentSelection_FF.apply(this); } }, setWindow : function(oWin){ this._window = oWin; this._document = oWin.document; } }))(); /** * @fileOverview This file contains a cross-browser implementation of W3C's DOM Range * @name W3CDOMRange.js */ nhn.W3CDOMRange = jindo.$Class({ $init : function(win){ this.reset(win); }, reset : function(win){ this._window = win; this._document = this._window.document; this.collapsed = true; this.commonAncestorContainer = this._document.body; this.endContainer = this._document.body; this.endOffset = 0; this.startContainer = this._document.body; this.startOffset = 0; this.oBrowserSelection = new nhn.BrowserSelection(this._window); this.selectionLoaded = this.oBrowserSelection.selectionLoaded; }, cloneContents : function(){ var oClonedContents = this._document.createDocumentFragment(); var oTmpContainer = this._document.createDocumentFragment(); var aNodes = this._getNodesInRange(); if(aNodes.length < 1){return oClonedContents;} var oClonedContainers = this._constructClonedTree(aNodes, oTmpContainer); // oTopContainer = aNodes[aNodes.length-1].parentNode and this is not part of the initial array and only those child nodes should be cloned var oTopContainer = oTmpContainer.firstChild; if(oTopContainer){ var elCurNode = oTopContainer.firstChild; var elNextNode; while(elCurNode){ elNextNode = elCurNode.nextSibling; oClonedContents.appendChild(elCurNode); elCurNode = elNextNode; } } oClonedContainers = this._splitTextEndNodes({oStartContainer: oClonedContainers.oStartContainer, iStartOffset: this.startOffset, oEndContainer: oClonedContainers.oEndContainer, iEndOffset: this.endOffset}); if(oClonedContainers.oStartContainer && oClonedContainers.oStartContainer.previousSibling){ nhn.DOMFix.parentNode(oClonedContainers.oStartContainer).removeChild(oClonedContainers.oStartContainer.previousSibling); } if(oClonedContainers.oEndContainer && oClonedContainers.oEndContainer.nextSibling){ nhn.DOMFix.parentNode(oClonedContainers.oEndContainer).removeChild(oClonedContainers.oEndContainer.nextSibling); } return oClonedContents; }, _constructClonedTree : function(aNodes, oClonedParentNode){ var oClonedStartContainer = null; var oClonedEndContainer = null; var oStartContainer = this.startContainer; var oEndContainer = this.endContainer; var _recurConstructClonedTree = function(aAllNodes, iCurIdx, oClonedParentNode){ if(iCurIdx < 0){return iCurIdx;} var iChildIdx = iCurIdx-1; var oCurNodeCloneWithChildren = aAllNodes[iCurIdx].cloneNode(false); if(aAllNodes[iCurIdx] == oStartContainer){oClonedStartContainer = oCurNodeCloneWithChildren;} if(aAllNodes[iCurIdx] == oEndContainer){oClonedEndContainer = oCurNodeCloneWithChildren;} while(iChildIdx >= 0 && nhn.DOMFix.parentNode(aAllNodes[iChildIdx]) == aAllNodes[iCurIdx]){ iChildIdx = this._recurConstructClonedTree(aAllNodes, iChildIdx, oCurNodeCloneWithChildren); } // this may trigger an error message in IE when an erroneous script is inserted oClonedParentNode.insertBefore(oCurNodeCloneWithChildren, oClonedParentNode.firstChild); return iChildIdx; }; this._recurConstructClonedTree = _recurConstructClonedTree; aNodes[aNodes.length] = nhn.DOMFix.parentNode(aNodes[aNodes.length-1]); this._recurConstructClonedTree(aNodes, aNodes.length-1, oClonedParentNode); return {oStartContainer: oClonedStartContainer, oEndContainer: oClonedEndContainer}; }, cloneRange : function(){ return this._copyRange(new nhn.W3CDOMRange(this._window)); }, _copyRange : function(oClonedRange){ oClonedRange.collapsed = this.collapsed; oClonedRange.commonAncestorContainer = this.commonAncestorContainer; oClonedRange.endContainer = this.endContainer; oClonedRange.endOffset = this.endOffset; oClonedRange.startContainer = this.startContainer; oClonedRange.startOffset = this.startOffset; oClonedRange._document = this._document; return oClonedRange; }, collapse : function(toStart){ if(toStart){ this.endContainer = this.startContainer; this.endOffset = this.startOffset; }else{ this.startContainer = this.endContainer; this.startOffset = this.endOffset; } this._updateRangeInfo(); }, compareBoundaryPoints : function(how, sourceRange){ switch(how){ case nhn.W3CDOMRange.START_TO_START: return this._compareEndPoint(this.startContainer, this.startOffset, sourceRange.startContainer, sourceRange.startOffset); case nhn.W3CDOMRange.START_TO_END: return this._compareEndPoint(this.endContainer, this.endOffset, sourceRange.startContainer, sourceRange.startOffset); case nhn.W3CDOMRange.END_TO_END: return this._compareEndPoint(this.endContainer, this.endOffset, sourceRange.endContainer, sourceRange.endOffset); case nhn.W3CDOMRange.END_TO_START: return this._compareEndPoint(this.startContainer, this.startOffset, sourceRange.endContainer, sourceRange.endOffset); } }, _findBody : function(oNode){ if(!oNode){return null;} while(oNode){ if(oNode.tagName == "BODY"){return oNode;} oNode = nhn.DOMFix.parentNode(oNode); } return null; }, _compareEndPoint : function(oContainerA, iOffsetA, oContainerB, iOffsetB){ return this.oBrowserSelection.compareEndPoints(oContainerA, iOffsetA, oContainerB, iOffsetB); var iIdxA, iIdxB; if(!oContainerA || this._findBody(oContainerA) != this._document.body){ oContainerA = this._document.body; iOffsetA = 0; } if(!oContainerB || this._findBody(oContainerB) != this._document.body){ oContainerB = this._document.body; iOffsetB = 0; } var compareIdx = function(iIdxA, iIdxB){ // iIdxX == -1 when the node is the commonAncestorNode // if iIdxA == -1 // -> [[<nodeA>...<nodeB></nodeB>]]...</nodeA> // if iIdxB == -1 // -> <nodeB>...[[<nodeA></nodeA>...</nodeB>]] if(iIdxB == -1){iIdxB = iIdxA+1;} if(iIdxA < iIdxB){return -1;} if(iIdxA == iIdxB){return 0;} return 1; }; var oCommonAncestor = this._getCommonAncestorContainer(oContainerA, oContainerB); // ================================================================================================================================================ // Move up both containers so that both containers are direct child nodes of the common ancestor node. From there, just compare the offset // Add 0.5 for each contaienrs that has "moved up" since the actual node is wrapped by 1 or more parent nodes and therefore its position is somewhere between idx & idx+1 // <COMMON_ANCESTOR>NODE1<P>NODE2</P>NODE3</COMMON_ANCESTOR> // The position of NODE2 in COMMON_ANCESTOR is somewhere between after NODE1(idx1) and before NODE3(idx2), so we let that be 1.5 // container node A in common ancestor container var oNodeA = oContainerA; var oTmpNode = null; if(oNodeA != oCommonAncestor){ while((oTmpNode = nhn.DOMFix.parentNode(oNodeA)) != oCommonAncestor){oNodeA = oTmpNode;} iIdxA = this._getPosIdx(oNodeA)+0.5; }else{ iIdxA = iOffsetA; } // container node B in common ancestor container var oNodeB = oContainerB; if(oNodeB != oCommonAncestor){ while((oTmpNode = nhn.DOMFix.parentNode(oNodeB)) != oCommonAncestor){oNodeB = oTmpNode;} iIdxB = this._getPosIdx(oNodeB)+0.5; }else{ iIdxB = iOffsetB; } return compareIdx(iIdxA, iIdxB); }, _getCommonAncestorContainer : function(oNode1, oNode2){ oNode1 = oNode1 || this.startContainer; oNode2 = oNode2 || this.endContainer; var oComparingNode = oNode2; while(oNode1){ while(oComparingNode){ if(oNode1 == oComparingNode){return oNode1;} oComparingNode = nhn.DOMFix.parentNode(oComparingNode); } oComparingNode = oNode2; oNode1 = nhn.DOMFix.parentNode(oNode1); } return this._document.body; }, deleteContents : function(){ if(this.collapsed){return;} this._splitTextEndNodesOfTheRange(); var aNodes = this._getNodesInRange(); if(aNodes.length < 1){return;} var oPrevNode = aNodes[0].previousSibling; while(oPrevNode && this._isBlankTextNode(oPrevNode)){oPrevNode = oPrevNode.previousSibling;} var oNewStartContainer, iNewOffset = -1; if(!oPrevNode){ oNewStartContainer = nhn.DOMFix.parentNode(aNodes[0]); iNewOffset = 0; } for(var i=0; i<aNodes.length; i++){ var oNode = aNodes[i]; if(!oNode.firstChild || this._isAllChildBlankText(oNode)){ if(oNewStartContainer == oNode){ iNewOffset = this._getPosIdx(oNewStartContainer); oNewStartContainer = nhn.DOMFix.parentNode(oNode); } nhn.DOMFix.parentNode(oNode).removeChild(oNode); }else{ // move the starting point to out of the parent container if the starting point of parent container is meant to be removed // [<span>A]B</span> // -> []<span>B</span> // without these lines, the result would yeild to // -> <span>[]B</span> if(oNewStartContainer == oNode && iNewOffset === 0){ iNewOffset = this._getPosIdx(oNewStartContainer); oNewStartContainer = nhn.DOMFix.parentNode(oNode); } } } if(!oPrevNode){ this.setStart(oNewStartContainer, iNewOffset, true, true); }else{ if(oPrevNode.tagName == "BODY"){ this.setStartBefore(oPrevNode, true); }else{ this.setStartAfter(oPrevNode, true); } } this.collapse(true); }, extractContents : function(){ var oClonedContents = this.cloneContents(); this.deleteContents(); return oClonedContents; }, getInsertBeforeNodes : function(){ var oFirstNode = null; var oParentContainer; if(this.startContainer.nodeType == "3"){ oParentContainer = nhn.DOMFix.parentNode(this.startContainer); if(this.startContainer.nodeValue.length <= this.startOffset){ oFirstNode = this.startContainer.nextSibling; }else{ oFirstNode = this.startContainer.splitText(this.startOffset); } }else{ oParentContainer = this.startContainer; oFirstNode = nhn.DOMFix.childNodes(this.startContainer)[this.startOffset]; } if(!oFirstNode || !nhn.DOMFix.parentNode(oFirstNode)){oFirstNode = null;} return {elParent: oParentContainer, elBefore: oFirstNode}; }, insertNode : function(newNode){ var oInsertBefore = this.getInsertBeforeNodes(); oInsertBefore.elParent.insertBefore(newNode, oInsertBefore.elBefore); this.setStartBefore(newNode); }, selectNode : function(refNode){ this.reset(this._window); this.setStartBefore(refNode); this.setEndAfter(refNode); }, selectNodeContents : function(refNode){ this.reset(this._window); this.setStart(refNode, 0, true); this.setEnd(refNode, nhn.DOMFix.childNodes(refNode).length); }, _endsNodeValidation : function(oNode, iOffset){ if(!oNode || this._findBody(oNode) != this._document.body){throw new Error("INVALID_NODE_TYPE_ERR oNode is not part of current document");} if(oNode.nodeType == 3){ if(iOffset > oNode.nodeValue.length){iOffset = oNode.nodeValue.length;} }else{ if(iOffset > nhn.DOMFix.childNodes(oNode).length){iOffset = nhn.DOMFix.childNodes(oNode).length;} } return iOffset; }, setEnd : function(refNode, offset, bSafe, bNoUpdate){ if(!bSafe){offset = this._endsNodeValidation(refNode, offset);} this.endContainer = refNode; this.endOffset = offset; if(!bNoUpdate){ if(!this.startContainer || this._compareEndPoint(this.startContainer, this.startOffset, this.endContainer, this.endOffset) != -1){ this.collapse(false); }else{ this._updateRangeInfo(); } } }, setEndAfter : function(refNode, bNoUpdate){ if(!refNode){throw new Error("INVALID_NODE_TYPE_ERR in setEndAfter");} if(refNode.tagName == "BODY"){ this.setEnd(refNode, nhn.DOMFix.childNodes(refNode).length, true, bNoUpdate); return; } this.setEnd(nhn.DOMFix.parentNode(refNode), this._getPosIdx(refNode)+1, true, bNoUpdate); }, setEndBefore : function(refNode, bNoUpdate){ if(!refNode){throw new Error("INVALID_NODE_TYPE_ERR in setEndBefore");} if(refNode.tagName == "BODY"){ this.setEnd(refNode, 0, true, bNoUpdate); return; } this.setEnd(nhn.DOMFix.parentNode(refNode), this._getPosIdx(refNode), true, bNoUpdate); }, setStart : function(refNode, offset, bSafe, bNoUpdate){ if(!bSafe){offset = this._endsNodeValidation(refNode, offset);} this.startContainer = refNode; this.startOffset = offset; if(!bNoUpdate){ if(!this.endContainer || this._compareEndPoint(this.startContainer, this.startOffset, this.endContainer, this.endOffset) != -1){ this.collapse(true); }else{ this._updateRangeInfo(); } } }, setStartAfter : function(refNode, bNoUpdate){ if(!refNode){throw new Error("INVALID_NODE_TYPE_ERR in setStartAfter");} if(refNode.tagName == "BODY"){ this.setStart(refNode, nhn.DOMFix.childNodes(refNode).length, true, bNoUpdate); return; } this.setStart(nhn.DOMFix.parentNode(refNode), this._getPosIdx(refNode)+1, true, bNoUpdate); }, setStartBefore : function(refNode, bNoUpdate){ if(!refNode){throw new Error("INVALID_NODE_TYPE_ERR in setStartBefore");} if(refNode.tagName == "BODY"){ this.setStart(refNode, 0, true, bNoUpdate); return; } this.setStart(nhn.DOMFix.parentNode(refNode), this._getPosIdx(refNode), true, bNoUpdate); }, surroundContents : function(newParent){ newParent.appendChild(this.extractContents()); this.insertNode(newParent); this.selectNode(newParent); }, toString : function(){ var oTmpContainer = this._document.createElement("DIV"); oTmpContainer.appendChild(this.cloneContents()); return oTmpContainer.textContent || oTmpContainer.innerText || ""; }, // this.oBrowserSelection.getCommonAncestorContainer which uses browser's built-in API runs faster but may return an incorrect value. // Call this function to fix the problem. // // In IE, the built-in API would return an incorrect value when, // 1. commonAncestorContainer is not selectable // AND // 2. The selected area will look the same when its child node is selected // eg) // when <P><SPAN>TEST</SPAN></p> is selected, <SPAN>TEST</SPAN> will be returned as commonAncestorContainer fixCommonAncestorContainer : function(){ if(!jindo.$Agent().navigator().ie){ return; } this.commonAncestorContainer = this._getCommonAncestorContainer(); }, _isBlankTextNode : function(oNode){ if(oNode.nodeType == 3 && oNode.nodeValue == ""){return true;} return false; }, _isAllChildBlankText : function(elNode){ for(var i=0, nLen=elNode.childNodes.length; i<nLen; i++){ if(!this._isBlankTextNode(elNode.childNodes[i])){return false;} } return true; }, _getPosIdx : function(refNode){ var idx = 0; for(var node = refNode.previousSibling; node; node = node.previousSibling){idx++;} return idx; }, _updateRangeInfo : function(){ if(!this.startContainer){ this.reset(this._window); return; } // isCollapsed may not function correctly when the cursor is located, // (below a table) AND (at the end of the document where there's no P tag or anything else to actually hold the cursor) this.collapsed = this.oBrowserSelection.isCollapsed(this) || (this.startContainer === this.endContainer && this.startOffset === this.endOffset); // this.collapsed = this._isCollapsed(this.startContainer, this.startOffset, this.endContainer, this.endOffset); this.commonAncestorContainer = this.oBrowserSelection.getCommonAncestorContainer(this); // this.commonAncestorContainer = this._getCommonAncestorContainer(this.startContainer, this.endContainer); }, _isCollapsed : function(oStartContainer, iStartOffset, oEndContainer, iEndOffset){ var bCollapsed = false; if(oStartContainer == oEndContainer && iStartOffset == iEndOffset){ bCollapsed = true; }else{ var oActualStartNode = this._getActualStartNode(oStartContainer, iStartOffset); var oActualEndNode = this._getActualEndNode(oEndContainer, iEndOffset); // Take the parent nodes on the same level for easier comparison when they're next to each other // eg) From // <A> // <B> // <C> // </C> // </B> // <D> // <E> // <F> // </F> // </E> // </D> // </A> // , it's easier to compare the position of B and D rather than C and F because they are siblings // // If the range were collapsed, oActualEndNode will precede oActualStartNode by doing this oActualStartNode = this._getNextNode(this._getPrevNode(oActualStartNode)); oActualEndNode = this._getPrevNode(this._getNextNode(oActualEndNode)); if(oActualStartNode && oActualEndNode && oActualEndNode.tagName != "BODY" && (this._getNextNode(oActualEndNode) == oActualStartNode || (oActualEndNode == oActualStartNode && this._isBlankTextNode(oActualEndNode))) ){ bCollapsed = true; } } return bCollapsed; }, _splitTextEndNodesOfTheRange : function(){ var oEndPoints = this._splitTextEndNodes({oStartContainer: this.startContainer, iStartOffset: this.startOffset, oEndContainer: this.endContainer, iEndOffset: this.endOffset}); this.startContainer = oEndPoints.oStartContainer; this.startOffset = oEndPoints.iStartOffset; this.endContainer = oEndPoints.oEndContainer; this.endOffset = oEndPoints.iEndOffset; }, _splitTextEndNodes : function(oEndPoints){ oEndPoints = this._splitStartTextNode(oEndPoints); oEndPoints = this._splitEndTextNode(oEndPoints); return oEndPoints; }, _splitStartTextNode : function(oEndPoints){ var oStartContainer = oEndPoints.oStartContainer; var iStartOffset = oEndPoints.iStartOffset; var oEndContainer = oEndPoints.oEndContainer; var iEndOffset = oEndPoints.iEndOffset; if(!oStartContainer){return oEndPoints;} if(oStartContainer.nodeType != 3){return oEndPoints;} if(iStartOffset === 0){return oEndPoints;} if(oStartContainer.nodeValue.length <= iStartOffset){return oEndPoints;} var oLastPart = oStartContainer.splitText(iStartOffset); if(oStartContainer == oEndContainer){ iEndOffset -= iStartOffset; oEndContainer = oLastPart; } oStartContainer = oLastPart; iStartOffset = 0; return {oStartContainer: oStartContainer, iStartOffset: iStartOffset, oEndContainer: oEndContainer, iEndOffset: iEndOffset}; }, _splitEndTextNode : function(oEndPoints){ var oStartContainer = oEndPoints.oStartContainer; var iStartOffset = oEndPoints.iStartOffset; var oEndContainer = oEndPoints.oEndContainer; var iEndOffset = oEndPoints.iEndOffset; if(!oEndContainer){return oEndPoints;} if(oEndContainer.nodeType != 3){return oEndPoints;} if(iEndOffset >= oEndContainer.nodeValue.length){return oEndPoints;} if(iEndOffset === 0){return oEndPoints;} oEndContainer.splitText(iEndOffset); return {oStartContainer: oStartContainer, iStartOffset: iStartOffset, oEndContainer: oEndContainer, iEndOffset: iEndOffset}; }, _getNodesInRange : function(){ if(this.collapsed){return [];} var oStartNode = this._getActualStartNode(this.startContainer, this.startOffset); var oEndNode = this._getActualEndNode(this.endContainer, this.endOffset); return this._getNodesBetween(oStartNode, oEndNode); }, _getActualStartNode : function(oStartContainer, iStartOffset){ var oStartNode = oStartContainer; if(oStartContainer.nodeType == 3){ if(iStartOffset >= oStartContainer.nodeValue.length){ oStartNode = this._getNextNode(oStartContainer); if(oStartNode.tagName == "BODY"){oStartNode = null;} }else{ oStartNode = oStartContainer; } }else{ if(iStartOffset < nhn.DOMFix.childNodes(oStartContainer).length){ oStartNode = nhn.DOMFix.childNodes(oStartContainer)[iStartOffset]; }else{ oStartNode = this._getNextNode(oStartContainer); if(oStartNode.tagName == "BODY"){oStartNode = null;} } } return oStartNode; }, _getActualEndNode : function(oEndContainer, iEndOffset){ var oEndNode = oEndContainer; if(iEndOffset === 0){ oEndNode = this._getPrevNode(oEndContainer); if(oEndNode.tagName == "BODY"){oEndNode = null;} }else if(oEndContainer.nodeType == 3){ oEndNode = oEndContainer; }else{ oEndNode = nhn.DOMFix.childNodes(oEndContainer)[iEndOffset-1]; } return oEndNode; }, _getNextNode : function(oNode){ if(!oNode || oNode.tagName == "BODY"){return this._document.body;} if(oNode.nextSibling){return oNode.nextSibling;} return this._getNextNode(nhn.DOMFix.parentNode(oNode)); }, _getPrevNode : function(oNode){ if(!oNode || oNode.tagName == "BODY"){return this._document.body;} if(oNode.previousSibling){return oNode.previousSibling;} return this._getPrevNode(nhn.DOMFix.parentNode(oNode)); }, // includes partially selected // for <div id="a"><div id="b"></div></div><div id="c"></div>, _getNodesBetween(b, c) will yield to b, "a" and c _getNodesBetween : function(oStartNode, oEndNode){ var aNodesBetween = []; this._nNodesBetweenLen = 0; if(!oStartNode || !oEndNode){return aNodesBetween;} // IE may throw an exception on "oCurNode = oCurNode.nextSibling;" when oCurNode is 'invalid', not null or undefined but somehow 'invalid'. // It happened during browser's build-in UNDO with control range selected(table). try{ this._recurGetNextNodesUntil(oStartNode, oEndNode, aNodesBetween); }catch(e){ return []; } return aNodesBetween; }, _recurGetNextNodesUntil : function(oNode, oEndNode, aNodesBetween){ if(!oNode){return false;} if(!this._recurGetChildNodesUntil(oNode, oEndNode, aNodesBetween)){return false;} var oNextToChk = oNode.nextSibling; while(!oNextToChk){ if(!(oNode = nhn.DOMFix.parentNode(oNode))){return false;} aNodesBetween[this._nNodesBetweenLen++] = oNode; if(oNode == oEndNode){return false;} oNextToChk = oNode.nextSibling; } return this._recurGetNextNodesUntil(oNextToChk, oEndNode, aNodesBetween); }, _recurGetChildNodesUntil : function(oNode, oEndNode, aNodesBetween){ if(!oNode){return false;} var bEndFound = false; var oCurNode = oNode; if(oCurNode.firstChild){ oCurNode = oCurNode.firstChild; while(oCurNode){ if(!this._recurGetChildNodesUntil(oCurNode, oEndNode, aNodesBetween)){ bEndFound = true; break; } oCurNode = oCurNode.nextSibling; } } aNodesBetween[this._nNodesBetweenLen++] = oNode; if(bEndFound){return false;} if(oNode == oEndNode){return false;} return true; } }); nhn.W3CDOMRange.START_TO_START = 0; nhn.W3CDOMRange.START_TO_END = 1; nhn.W3CDOMRange.END_TO_END = 2; nhn.W3CDOMRange.END_TO_START = 3; /** * @fileOverview This file contains a cross-browser function that implements all of the W3C's DOM Range specification and some more * @name HuskyRange.js */ nhn.HuskyRange = jindo.$Class({ _rxCursorHolder : /^(?:\uFEFF|\u00A0|\u200B|<br>)$/i, setWindow : function(win){ this.reset(win || window); }, $init : function(win){ this.HUSKY_BOOMARK_START_ID_PREFIX = "husky_bookmark_start_"; this.HUSKY_BOOMARK_END_ID_PREFIX = "husky_bookmark_end_"; this.sBlockElement = "P|DIV|LI|H[1-6]|PRE"; this.sBlockContainer = "BODY|TABLE|TH|TR|TD|UL|OL|BLOCKQUOTE|FORM"; this.rxBlockElement = new RegExp("^("+this.sBlockElement+")$"); this.rxBlockContainer = new RegExp("^("+this.sBlockContainer+")$"); this.rxLineBreaker = new RegExp("^("+this.sBlockElement+"|"+this.sBlockContainer+")$"); this.setWindow(win); }, select : function(){ try{ this.oBrowserSelection.selectRange(this); }catch(e){} }, setFromSelection : function(iNum){ this.setRange(this.oBrowserSelection.getRangeAt(iNum), true); }, setRange : function(oW3CRange, bSafe){ this.reset(this._window); this.setStart(oW3CRange.startContainer, oW3CRange.startOffset, bSafe, true); this.setEnd(oW3CRange.endContainer, oW3CRange.endOffset, bSafe); }, setEndNodes : function(oSNode, oENode){ this.reset(this._window); this.setEndAfter(oENode, true); this.setStartBefore(oSNode); }, splitTextAtBothEnds : function(){ this._splitTextEndNodesOfTheRange(); }, getStartNode : function(){ if(this.collapsed){ if(this.startContainer.nodeType == 3){ if(this.startOffset === 0){return null;} if(this.startContainer.nodeValue.length <= this.startOffset){return null;} return this.startContainer; } return null; } if(this.startContainer.nodeType == 3){ if(this.startOffset >= this.startContainer.nodeValue.length){return this._getNextNode(this.startContainer);} return this.startContainer; }else{ if(this.startOffset >= nhn.DOMFix.childNodes(this.startContainer).length){return this._getNextNode(this.startContainer);} return nhn.DOMFix.childNodes(this.startContainer)[this.startOffset]; } }, getEndNode : function(){ if(this.collapsed){return this.getStartNode();} if(this.endContainer.nodeType == 3){ if(this.endOffset === 0){return this._getPrevNode(this.endContainer);} return this.endContainer; }else{ if(this.endOffset === 0){return this._getPrevNode(this.endContainer);} return nhn.DOMFix.childNodes(this.endContainer)[this.endOffset-1]; } }, getNodeAroundRange : function(bBefore, bStrict){ if(!this.collapsed){return this.getStartNode();} if(this.startContainer && this.startContainer.nodeType == 3){return this.startContainer;} //if(this.collapsed && this.startContainer && this.startContainer.nodeType == 3) return this.startContainer; //if(!this.collapsed || (this.startContainer && this.startContainer.nodeType == 3)) return this.getStartNode(); var oBeforeRange, oAfterRange, oResult; if(this.startOffset >= nhn.DOMFix.childNodes(this.startContainer).length){ oAfterRange = this._getNextNode(this.startContainer); }else{ oAfterRange = nhn.DOMFix.childNodes(this.startContainer)[this.startOffset]; } if(this.endOffset === 0){ oBeforeRange = this._getPrevNode(this.endContainer); }else{ oBeforeRange = nhn.DOMFix.childNodes(this.endContainer)[this.endOffset-1]; } if(bBefore){ oResult = oBeforeRange; if(!oResult && !bStrict){oResult = oAfterRange;} }else{ oResult = oAfterRange; if(!oResult && !bStrict){oResult = oBeforeRange;} } return oResult; }, _getXPath : function(elNode){ var sXPath = ""; while(elNode && elNode.nodeType == 1){ sXPath = "/" + elNode.tagName+"["+this._getPosIdx4XPath(elNode)+"]" + sXPath; elNode = nhn.DOMFix.parentNode(elNode); } return sXPath; }, _getPosIdx4XPath : function(refNode){ var idx = 0; for(var node = refNode.previousSibling; node; node = node.previousSibling){ if(node.tagName == refNode.tagName){idx++;} } return idx; }, // this was written specifically for XPath Bookmark and it may not perform correctly for general purposes _evaluateXPath : function(sXPath, oDoc){ sXPath = sXPath.substring(1, sXPath.length-1); var aXPath = sXPath.split(/\//); var elNode = oDoc.body; for(var i=2; i<aXPath.length && elNode; i++){ aXPath[i].match(/([^\[]+)\[(\d+)/i); var sTagName = RegExp.$1; var nIdx = RegExp.$2; var aAllNodes = nhn.DOMFix.childNodes(elNode); var aNodes = []; var nLength = aAllNodes.length; var nCount = 0; for(var ii=0; ii<nLength; ii++){ if(aAllNodes[ii].tagName == sTagName){aNodes[nCount++] = aAllNodes[ii];} } if(aNodes.length < nIdx){ elNode = null; }else{ elNode = aNodes[nIdx]; } } return elNode; }, _evaluateXPathBookmark : function(oBookmark){ var sXPath = oBookmark["sXPath"]; var nTextNodeIdx = oBookmark["nTextNodeIdx"]; var nOffset = oBookmark["nOffset"]; var elContainer = this._evaluateXPath(sXPath, this._document); if(nTextNodeIdx > -1 && elContainer){ var aChildNodes = nhn.DOMFix.childNodes(elContainer); var elNode = null; var nIdx = nTextNodeIdx; var nOffsetLeft = nOffset; while((elNode = aChildNodes[nIdx]) && elNode.nodeType == 3 && elNode.nodeValue.length < nOffsetLeft){ nOffsetLeft -= elNode.nodeValue.length; nIdx++; } elContainer = nhn.DOMFix.childNodes(elContainer)[nIdx]; nOffset = nOffsetLeft; } if(!elContainer){ elContainer = this._document.body; nOffset = 0; } return {elContainer: elContainer, nOffset: nOffset}; }, // this was written specifically for XPath Bookmark and it may not perform correctly for general purposes getXPathBookmark : function(){ var nTextNodeIdx1 = -1; var htEndPt1 = {elContainer: this.startContainer, nOffset: this.startOffset}; var elNode1 = this.startContainer; if(elNode1.nodeType == 3){ htEndPt1 = this._getFixedStartTextNode(); nTextNodeIdx1 = this._getPosIdx(htEndPt1.elContainer); elNode1 = nhn.DOMFix.parentNode(elNode1); } var sXPathNode1 = this._getXPath(elNode1); var oBookmark1 = {sXPath:sXPathNode1, nTextNodeIdx:nTextNodeIdx1, nOffset: htEndPt1.nOffset}; if(this.collapsed){ var oBookmark2 = {sXPath:sXPathNode1, nTextNodeIdx:nTextNodeIdx1, nOffset: htEndPt1.nOffset}; }else{ var nTextNodeIdx2 = -1; var htEndPt2 = {elContainer: this.endContainer, nOffset: this.endOffset}; var elNode2 = this.endContainer; if(elNode2.nodeType == 3){ htEndPt2 = this._getFixedEndTextNode(); nTextNodeIdx2 = this._getPosIdx(htEndPt2.elContainer); elNode2 = nhn.DOMFix.parentNode(elNode2); } var sXPathNode2 = this._getXPath(elNode2); var oBookmark2 = {sXPath:sXPathNode2, nTextNodeIdx:nTextNodeIdx2, nOffset: htEndPt2.nOffset}; } return [oBookmark1, oBookmark2]; }, moveToXPathBookmark : function(aBookmark){ if(!aBookmark){return false;} var oBookmarkInfo1 = this._evaluateXPathBookmark(aBookmark[0]); var oBookmarkInfo2 = this._evaluateXPathBookmark(aBookmark[1]); if(!oBookmarkInfo1["elContainer"] || !oBookmarkInfo2["elContainer"]){return;} this.startContainer = oBookmarkInfo1["elContainer"]; this.startOffset = oBookmarkInfo1["nOffset"]; this.endContainer = oBookmarkInfo2["elContainer"]; this.endOffset = oBookmarkInfo2["nOffset"]; return true; }, _getFixedTextContainer : function(elNode, nOffset){ while(elNode && elNode.nodeType == 3 && elNode.previousSibling && elNode.previousSibling.nodeType == 3){ nOffset += elNode.previousSibling.nodeValue.length; elNode = elNode.previousSibling; } return {elContainer:elNode, nOffset:nOffset}; }, _getFixedStartTextNode : function(){ return this._getFixedTextContainer(this.startContainer, this.startOffset); }, _getFixedEndTextNode : function(){ return this._getFixedTextContainer(this.endContainer, this.endOffset); }, placeStringBookmark : function(){ if(this.collapsed || jindo.$Agent().navigator().ie || jindo.$Agent().navigator().firefox){ return this.placeStringBookmark_NonWebkit(); }else{ return this.placeStringBookmark_Webkit(); } }, placeStringBookmark_NonWebkit : function(){ var sTmpId = (new Date()).getTime(); var oInsertionPoint = this.cloneRange(); oInsertionPoint.collapseToEnd(); var oEndMarker = this._document.createElement("SPAN"); oEndMarker.id = this.HUSKY_BOOMARK_END_ID_PREFIX+sTmpId; oInsertionPoint.insertNode(oEndMarker); var oInsertionPoint = this.cloneRange(); oInsertionPoint.collapseToStart(); var oStartMarker = this._document.createElement("SPAN"); oStartMarker.id = this.HUSKY_BOOMARK_START_ID_PREFIX+sTmpId; oInsertionPoint.insertNode(oStartMarker); // IE์—์„œ ๋นˆ SPAN์˜ ์•ž๋’ค๋กœ ์ปค์„œ๊ฐ€ ์ด๋™ํ•˜์ง€ ์•Š์•„ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒ ํ•  ์ˆ˜ ์žˆ์–ด, ๋ณด์ด์ง€ ์•Š๋Š” ํŠน์ˆ˜ ๋ฌธ์ž๋ฅผ ์ž„์‹œ๋กœ ๋„ฃ์–ด ์คŒ. if(jindo.$Agent().navigator().ie){ // SPAN์˜ ์œ„์น˜๊ฐ€ TD์™€ TD ์‚ฌ์ด์— ์žˆ์„ ๊ฒฝ์šฐ, ํ…์ŠคํŠธ ์‚ฝ์ž… ์‹œ ์•Œ์ˆ˜ ์—†๋Š” ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค. // TD์™€ TD์‚ฌ์ด์—์„œ๋Š” ํ…์ŠคํŠธ ์‚ฝ์ž…์ด ํ•„์š” ์—†์Œ์œผ๋กœ ๊ทธ๋ƒฅ try/catch๋กœ ์ฒ˜๋ฆฌ try{ oStartMarker.innerHTML = unescape("%uFEFF"); }catch(e){} try{ oEndMarker.innerHTML = unescape("%uFEFF"); }catch(e){} } this.moveToBookmark(sTmpId); return sTmpId; }, placeStringBookmark_Webkit : function(){ var sTmpId = (new Date()).getTime(); var elInsertBefore, elInsertParent; // Do not insert the bookmarks between TDs as it will break the rendering in Chrome/Safari // -> modify the insertion position from [<td>abc</td>]<td>abc</td> to <td>[abc]</td><td>abc</td> var oInsertionPoint = this.cloneRange(); oInsertionPoint.collapseToEnd(); elInsertBefore = this._document.createTextNode(""); oInsertionPoint.insertNode(elInsertBefore); elInsertParent = elInsertBefore.parentNode; if(elInsertBefore.previousSibling && elInsertBefore.previousSibling.tagName == "TD"){ elInsertParent = elInsertBefore.previousSibling; elInsertBefore = null; } var oEndMarker = this._document.createElement("SPAN"); oEndMarker.id = this.HUSKY_BOOMARK_END_ID_PREFIX+sTmpId; elInsertParent.insertBefore(oEndMarker, elInsertBefore); var oInsertionPoint = this.cloneRange(); oInsertionPoint.collapseToStart(); elInsertBefore = this._document.createTextNode(""); oInsertionPoint.insertNode(elInsertBefore); elInsertParent = elInsertBefore.parentNode; if(elInsertBefore.nextSibling && elInsertBefore.nextSibling.tagName == "TD"){ elInsertParent = elInsertBefore.nextSibling; elInsertBefore = elInsertParent.firstChild; } var oStartMarker = this._document.createElement("SPAN"); oStartMarker.id = this.HUSKY_BOOMARK_START_ID_PREFIX+sTmpId; elInsertParent.insertBefore(oStartMarker, elInsertBefore); //elInsertBefore.parentNode.removeChild(elInsertBefore); this.moveToBookmark(sTmpId); return sTmpId; }, cloneRange : function(){ return this._copyRange(new nhn.HuskyRange(this._window)); }, moveToBookmark : function(vBookmark){ if(typeof(vBookmark) != "object"){ return this.moveToStringBookmark(vBookmark); }else{ return this.moveToXPathBookmark(vBookmark); } }, getStringBookmark : function(sBookmarkID, bEndBookmark){ if(bEndBookmark){ return this._document.getElementById(this.HUSKY_BOOMARK_END_ID_PREFIX+sBookmarkID); }else{ return this._document.getElementById(this.HUSKY_BOOMARK_START_ID_PREFIX+sBookmarkID); } }, moveToStringBookmark : function(sBookmarkID, bIncludeBookmark){ var oStartMarker = this.getStringBookmark(sBookmarkID); var oEndMarker = this.getStringBookmark(sBookmarkID, true); if(!oStartMarker || !oEndMarker){return false;} this.reset(this._window); if(bIncludeBookmark){ this.setEndAfter(oEndMarker); this.setStartBefore(oStartMarker); }else{ this.setEndBefore(oEndMarker); this.setStartAfter(oStartMarker); } return true; }, removeStringBookmark : function(sBookmarkID){ /* var oStartMarker = this._document.getElementById(this.HUSKY_BOOMARK_START_ID_PREFIX+sBookmarkID); var oEndMarker = this._document.getElementById(this.HUSKY_BOOMARK_END_ID_PREFIX+sBookmarkID); if(oStartMarker) nhn.DOMFix.parentNode(oStartMarker).removeChild(oStartMarker); if(oEndMarker) nhn.DOMFix.parentNode(oEndMarker).removeChild(oEndMarker); */ this._removeAll(this.HUSKY_BOOMARK_START_ID_PREFIX+sBookmarkID); this._removeAll(this.HUSKY_BOOMARK_END_ID_PREFIX+sBookmarkID); }, _removeAll : function(sID){ var elNode; while((elNode = this._document.getElementById(sID))){ nhn.DOMFix.parentNode(elNode).removeChild(elNode); } }, collapseToStart : function(){ this.collapse(true); }, collapseToEnd : function(){ this.collapse(false); }, createAndInsertNode : function(sTagName){ var tmpNode = this._document.createElement(sTagName); this.insertNode(tmpNode); return tmpNode; }, getNodes : function(bSplitTextEndNodes, fnFilter){ if(bSplitTextEndNodes){this._splitTextEndNodesOfTheRange();} var aAllNodes = this._getNodesInRange(); var aFilteredNodes = []; if(!fnFilter){return aAllNodes;} for(var i=0; i<aAllNodes.length; i++){ if(fnFilter(aAllNodes[i])){aFilteredNodes[aFilteredNodes.length] = aAllNodes[i];} } return aFilteredNodes; }, getTextNodes : function(bSplitTextEndNodes){ var txtFilter = function(oNode){ if (oNode.nodeType == 3 && oNode.nodeValue != "\n" && oNode.nodeValue != ""){ return true; }else{ return false; } }; return this.getNodes(bSplitTextEndNodes, txtFilter); }, surroundContentsWithNewNode : function(sTagName){ var oNewParent = this._document.createElement(sTagName); this.surroundContents(oNewParent); return oNewParent; }, isRangeinRange : function(oAnoterRange, bIncludePartlySelected){ var startToStart = this.compareBoundaryPoints(this.W3CDOMRange.START_TO_START, oAnoterRange); var startToEnd = this.compareBoundaryPoints(this.W3CDOMRange.START_TO_END, oAnoterRange); var endToStart = this.compareBoundaryPoints(this.W3CDOMRange.ND_TO_START, oAnoterRange); var endToEnd = this.compareBoundaryPoints(this.W3CDOMRange.END_TO_END, oAnoterRange); if(startToStart <= 0 && endToEnd >= 0){return true;} if(bIncludePartlySelected){ if(startToEnd == 1){return false;} if(endToStart == -1){return false;} return true; } return false; }, isNodeInRange : function(oNode, bIncludePartlySelected, bContentOnly){ var oTmpRange = new nhn.HuskyRange(this._window); if(bContentOnly && oNode.firstChild){ oTmpRange.setStartBefore(oNode.firstChild); oTmpRange.setEndAfter(oNode.lastChild); }else{ oTmpRange.selectNode(oNode); } return this.isRangeInRange(oTmpRange, bIncludePartlySelected); }, pasteText : function(sText){ this.pasteHTML(sText.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/ /g, "&nbsp;").replace(/"/g, "&quot;")); }, pasteHTML : function(sHTML){ var oTmpDiv = this._document.createElement("DIV"); oTmpDiv.innerHTML = sHTML; if(!oTmpDiv.firstChild){ this.deleteContents(); return; } var oFirstNode = oTmpDiv.firstChild; var oLastNode = oTmpDiv.lastChild; var clone = this.cloneRange(); var sBM = clone.placeStringBookmark(); this.collapseToStart(); while(oTmpDiv.lastChild){this.insertNode(oTmpDiv.lastChild);} this.setEndNodes(oFirstNode, oLastNode); // delete the content later as deleting it first may mass up the insertion point // eg) <p>[A]BCD</p> ---paste O---> O<p>BCD</p> clone.moveToBookmark(sBM); clone.deleteContents(); clone.removeStringBookmark(sBM); }, toString : function(){ this.toString = nhn.W3CDOMRange.prototype.toString; return this.toString(); }, toHTMLString : function(){ var oTmpContainer = this._document.createElement("DIV"); oTmpContainer.appendChild(this.cloneContents()); return oTmpContainer.innerHTML; }, findAncestorByTagName : function(sTagName){ var oNode = this.commonAncestorContainer; while(oNode && oNode.tagName != sTagName){oNode = nhn.DOMFix.parentNode(oNode);} return oNode; }, selectNodeContents : function(oNode){ if(!oNode){return;} var oFirstNode = oNode.firstChild?oNode.firstChild:oNode; var oLastNode = oNode.lastChild?oNode.lastChild:oNode; this.reset(this._window); if(oFirstNode.nodeType == 3){ this.setStart(oFirstNode, 0, true); }else{ this.setStartBefore(oFirstNode); } if(oLastNode.nodeType == 3){ this.setEnd(oLastNode, oLastNode.nodeValue.length, true); }else{ this.setEndAfter(oLastNode); } }, /** * ๋…ธ๋“œ์˜ ์ทจ์†Œ์„ /๋ฐ‘์ค„ ์ •๋ณด๋ฅผ ํ™•์ธํ•œ๋‹ค * ๊ด€๋ จ BTS [SMARTEDITORSUS-26] * @param {Node} oNode ์ทจ์†Œ์„ /๋ฐ‘์ค„์„ ํ™•์ธํ•  ๋…ธ๋“œ * @param {String} sValue textDecoration ์ •๋ณด * @see nhn.HuskyRange#_checkTextDecoration */ _hasTextDecoration : function(oNode, sValue){ if(!oNode || !oNode.style){ return false; } if(oNode.style.textDecoration.indexOf(sValue) > -1){ return true; } if(sValue === "underline" && oNode.tagName === "U"){ return true; } if(sValue === "line-through" && (oNode.tagName === "S" || oNode.tagName === "STRIKE")){ return true; } return false; }, /** * ๋…ธ๋“œ์— ์ทจ์†Œ์„ /๋ฐ‘์ค„์„ ์ ์šฉํ•œ๋‹ค * ๊ด€๋ จ BTS [SMARTEDITORSUS-26] * [FF] ๋…ธ๋“œ์˜ Style ์— textDecoration ์„ ์ถ”๊ฐ€ํ•œ๋‹ค * [FF ์™ธ] U/STRIKE ํƒœ๊ทธ๋ฅผ ์ถ”๊ฐ€ํ•œ๋‹ค * @param {Node} oNode ์ทจ์†Œ์„ /๋ฐ‘์ค„์„ ์ ์šฉํ•  ๋…ธ๋“œ * @param {String} sValue textDecoration ์ •๋ณด * @see nhn.HuskyRange#_checkTextDecoration */ _setTextDecoration : function(oNode, sValue){ if (jindo.$Agent().navigator().firefox) { // FF oNode.style.textDecoration = (oNode.style.textDecoration) ? oNode.style.textDecoration + " " + sValue : sValue; } else{ if(sValue === "underline"){ oNode.innerHTML = "<U>" + oNode.innerHTML + "</U>" }else if(sValue === "line-through"){ oNode.innerHTML = "<STRIKE>" + oNode.innerHTML + "</STRIKE>" } } }, /** * ์ธ์ž๋กœ ์ „๋‹ฌ๋ฐ›์€ ๋…ธ๋“œ ์ƒ์œ„์˜ ์ทจ์†Œ์„ /๋ฐ‘์ค„ ์ •๋ณด๋ฅผ ํ™•์ธํ•˜์—ฌ ๋…ธ๋“œ์— ์ ์šฉํ•œ๋‹ค * ๊ด€๋ จ BTS [SMARTEDITORSUS-26] * @param {Node} oNode ์ทจ์†Œ์„ /๋ฐ‘์ค„์„ ์ ์šฉํ•  ๋…ธ๋“œ */ _checkTextDecoration : function(oNode){ if(oNode.tagName !== "SPAN"){ return; } var bUnderline = false, bLineThrough = false, sTextDecoration = "", oParentNode = null; oChildNode = oNode.firstChild; /* check child */ while(oChildNode){ if(oChildNode.nodeType === 1){ bUnderline = (bUnderline || oChildNode.tagName === "U"); bLineThrough = (bLineThrough || oChildNode.tagName === "S" || oChildNode.tagName === "STRIKE"); } if(bUnderline && bLineThrough){ return; } oChildNode = oChildNode.nextSibling; } oParentNode = nhn.DOMFix.parentNode(oNode); /* check parent */ while(oParentNode && oParentNode.tagName !== "BODY"){ if(oParentNode.nodeType !== 1){ oParentNode = nhn.DOMFix.parentNode(oParentNode); continue; } if(!bUnderline && this._hasTextDecoration(oParentNode, "underline")){ bUnderline = true; this._setTextDecoration(oNode, "underline"); // set underline } if(!bLineThrough && this._hasTextDecoration(oParentNode, "line-through")){ bLineThrough = true; this._setTextDecoration(oNode, "line-through"); // set line-through } if(bUnderline && bLineThrough){ return; } oParentNode = nhn.DOMFix.parentNode(oParentNode); } }, /** * Range์— ์†ํ•œ ๋…ธ๋“œ๋“ค์— ์Šคํƒ€์ผ์„ ์ ์šฉํ•œ๋‹ค * @param {Object} oStyle ์ ์šฉํ•  ์Šคํƒ€์ผ์„ ๊ฐ€์ง€๋Š” Object (์˜ˆ) ๊ธ€๊ผด ์ƒ‰ ์ ์šฉ์˜ ๊ฒฝ์šฐ { color : "#0075c8" } * @param {Object} [oAttribute] ์ ์šฉํ•  ์†์„ฑ์„ ๊ฐ€์ง€๋Š” Object (์˜ˆ) ๋งž์ถค๋ฒ” ๊ฒ€์‚ฌ์˜ ๊ฒฝ์šฐ { _sm2_spchk: "๊ฐ•๋‚จ์ฝฉ", class: "se2_check_spell" } * @param {String} [sNewSpanMarker] ์ƒˆ๋กœ ์ถ”๊ฐ€๋œ SPAN ๋…ธ๋“œ๋ฅผ ๋‚˜์ค‘์— ๋”ฐ๋กœ ์ฒ˜๋ฆฌํ•ด์•ผํ•˜๋Š” ๊ฒฝ์šฐ ๋งˆํ‚น์„ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๋ฌธ์ž์—ด * @param {Boolean} [bIncludeLI] LI ๋„ ์Šคํƒ€์ผ ์ ์šฉ์— ํฌํ•จํ•  ๊ฒƒ์ธ์ง€์˜ ์—ฌ๋ถ€ [COM-1051] _getStyleParentNodes ๋ฉ”์„œ๋“œ ์ฐธ๊ณ ํ•˜๊ธฐ * @param {Boolean} [bCheckTextDecoration] ์ทจ์†Œ์„ /๋ฐ‘์ค„ ์ฒ˜๋ฆฌ๋ฅผ ์ ์šฉํ•  ๊ฒƒ์ธ์ง€ ์—ฌ๋ถ€ [SMARTEDITORSUS-26] _setTextDecoration ๋ฉ”์„œ๋“œ ์ฐธ๊ณ ํ•˜๊ธฐ */ styleRange : function(oStyle, oAttribute, sNewSpanMarker, bIncludeLI, bCheckTextDecoration){ var aStyleParents = this.aStyleParents = this._getStyleParentNodes(sNewSpanMarker, bIncludeLI); if(aStyleParents.length < 1){return;} var sName, sValue; for(var i=0; i<aStyleParents.length; i++){ for(var x in oStyle){ sName = x; sValue = oStyle[sName]; if(typeof sValue != "string"){continue;} // [SMARTEDITORSUS-26] ๊ธ€๊ผด ์ƒ‰์„ ์ ์šฉํ•  ๋•Œ ์ทจ์†Œ์„ /๋ฐ‘์ค„์˜ ์ƒ‰์ƒ๋„ ์ฒ˜๋ฆฌ๋˜๋„๋ก ์ถ”๊ฐ€ if(bCheckTextDecoration && oStyle.color){ this._checkTextDecoration(aStyleParents[i]); } aStyleParents[i].style[sName] = sValue; } if(!oAttribute){continue;} for(var x in oAttribute){ sName = x; sValue = oAttribute[sName]; if(typeof sValue != "string"){continue;} if(sName == "class"){ jindo.$Element(aStyleParents[i]).addClass(sValue); }else{ aStyleParents[i].setAttribute(sName, sValue); } } } this.reset(this._window); this.setStartBefore(aStyleParents[0]); this.setEndAfter(aStyleParents[aStyleParents.length-1]); }, expandBothEnds : function(){ this.expandStart(); this.expandEnd(); }, expandStart : function(){ if(this.startContainer.nodeType == 3 && this.startOffset !== 0){return;} var elActualStartNode = this._getActualStartNode(this.startContainer, this.startOffset); elActualStartNode = this._getPrevNode(elActualStartNode); if(elActualStartNode.tagName == "BODY"){ this.setStartBefore(elActualStartNode); }else{ this.setStartAfter(elActualStartNode); } }, expandEnd : function(){ if(this.endContainer.nodeType == 3 && this.endOffset < this.endContainer.nodeValue.length){return;} var elActualEndNode = this._getActualEndNode(this.endContainer, this.endOffset); elActualEndNode = this._getNextNode(elActualEndNode); if(elActualEndNode.tagName == "BODY"){ this.setEndAfter(elActualEndNode); }else{ this.setEndBefore(elActualEndNode); } }, /** * Style ์„ ์ ์šฉํ•  ๋…ธ๋“œ๋ฅผ ๊ฐ€์ ธ์˜จ๋‹ค * @param {String} [sNewSpanMarker] ์ƒˆ๋กœ ์ถ”๊ฐ€ํ•˜๋Š” SPAN ๋…ธ๋“œ๋ฅผ ๋งˆํ‚น์„ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๋ฌธ์ž์—ด * @param {Boolean} [bIncludeLI] LI ๋„ ์Šคํƒ€์ผ ์ ์šฉ์— ํฌํ•จํ•  ๊ฒƒ์ธ์ง€์˜ ์—ฌ๋ถ€ * @return {Array} Style ์„ ์ ์šฉํ•  ๋…ธ๋“œ ๋ฐฐ์—ด */ _getStyleParentNodes : function(sNewSpanMarker, bIncludeLI){ this._splitTextEndNodesOfTheRange(); var oSNode = this.getStartNode(); var oENode = this.getEndNode(); var aAllNodes = this._getNodesInRange(); var aResult = []; var nResult = 0; var oNode, oTmpNode, iStartRelPos, iEndRelPos, oSpan; var nInitialLength = aAllNodes.length; var arAllBottomNodes = jindo.$A(aAllNodes).filter(function(v){return (!v.firstChild || (bIncludeLI && v.tagName=="LI"));}); // [COM-1051] ๋ณธ๋ฌธ๋‚ด์šฉ์„ ํ•œ ์ค„๋งŒ ์ž…๋ ฅํ•˜๊ณ  ๋ฒˆํ˜ธ ๋งค๊ธด ์ƒํƒœ์—์„œ ๊ธ€์žํฌ๊ธฐ๋ฅผ ๋ณ€๊ฒฝํ•˜๋ฉด ๋ฒˆํ˜ธํฌ๊ธฐ๋Š” ๋ณ€ํ•˜์ง€ ์•Š๋Š” ๋ฌธ์ œ // ๋ถ€๋ชจ ๋…ธ๋“œ ์ค‘ LI ๊ฐ€ ์žˆ๊ณ , ํ•ด๋‹น LI ์˜ ๋ชจ๋“  ์ž์‹ ๋…ธ๋“œ๊ฐ€ ์„ ํƒ๋œ ์ƒํƒœ๋ผ๋ฉด LI์—๋„ ์Šคํƒ€์ผ์„ ์ ์šฉํ•˜๋„๋ก ์ฒ˜๋ฆฌํ•จ // --- Range ์— LI ๊ฐ€ ํฌํ•จ๋˜์ง€ ์•Š์€ ๊ฒฝ์šฐ, LI ๋ฅผ ํฌํ•จํ•˜๋„๋ก ์ฒ˜๋ฆฌ var elTmpNode = this.commonAncestorContainer; if(bIncludeLI){ while(elTmpNode){ if(elTmpNode.tagName == "LI"){ if(this._isFullyContained(elTmpNode, arAllBottomNodes)){ aResult[nResult++] = elTmpNode; } break; } elTmpNode = elTmpNode.parentNode; } } for(var i=0; i<nInitialLength; i++){ oNode = aAllNodes[i]; if(!oNode){continue;} // --- Range ์— LI ๊ฐ€ ํฌํ•จ๋œ ๊ฒฝ์šฐ์— ๋Œ€ํ•œ LI ํ™•์ธ if(bIncludeLI && oNode.tagName == "LI" && this._isFullyContained(oNode, arAllBottomNodes)){ aResult[nResult++] = oNode; continue; } if(oNode.nodeType != 3){continue;} if(oNode.nodeValue == "" || oNode.nodeValue.match(/^(\r|\n)+$/)){continue;} var oParentNode = nhn.DOMFix.parentNode(oNode); // ๋ถ€๋ชจ ๋…ธ๋“œ๊ฐ€ SPAN ์ธ ๊ฒฝ์šฐ์—๋Š” ์ƒˆ๋กœ์šด SPAN ์„ ์ƒ์„ฑํ•˜์ง€ ์•Š๊ณ  SPAN ์„ ๋ฆฌํ„ด ๋ฐฐ์—ด์— ์ถ”๊ฐ€ํ•จ if(oParentNode.tagName == "SPAN"){ if(this._isFullyContained(oParentNode, arAllBottomNodes, oNode)){ aResult[nResult++] = oParentNode; continue; } }else{ // [SMARTEDITORSUS-1513] ์„ ํƒ๋œ ์˜์—ญ์„ single node๋กœ ๊ฐ์‹ธ๋Š” ์ƒ์œ„ span ๋…ธ๋“œ๊ฐ€ ์žˆ์œผ๋ฉด ๋ฆฌํ„ด ๋ฐฐ์—ด์— ์ถ”๊ฐ€ var oParentSingleSpan = this._findParentSingleSpan(oParentNode); if(oParentSingleSpan){ aResult[nResult++] = oParentSingleSpan; continue; } } oSpan = this._document.createElement("SPAN"); oParentNode.insertBefore(oSpan, oNode); oSpan.appendChild(oNode); aResult[nResult++] = oSpan; if(sNewSpanMarker){oSpan.setAttribute(sNewSpanMarker, "true");} } this.setStartBefore(oSNode); this.setEndAfter(oENode); return aResult; }, /** * [SMARTEDITORSUS-1513][SMARTEDITORSUS-1648] ํ•ด๋‹น๋…ธ๋“œ๊ฐ€ single child๋กœ ๋ฌถ์ด๋Š” ์ƒ์œ„ span ๋…ธ๋“œ๊ฐ€ ์žˆ๋Š”์ง€ ์ฐพ๋Š”๋‹ค. * @param {Node} oNode ๊ฒ€์‚ฌํ•  ๋…ธ๋“œ * @return {Element} ์ƒ์œ„ span ๋…ธ๋“œ, ์—†์œผ๋ฉด null */ _findParentSingleSpan : function(oNode){ if(!oNode){ return null; } // ZWNBSP ๋ฌธ์ž๊ฐ€ ๊ฐ™์ด ์žˆ๋Š” ๊ฒฝ์šฐ๋„ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์‹ค์ œ ๋…ธ๋“œ๋ฅผ ์นด์šดํŒ…ํ•ด์•ผ ํ•จ for(var i = 0, nCnt = 0, sValue, oChild, aChildNodes = oNode.childNodes; (oChild = aChildNodes[i]); i++){ sValue = oChild.nodeValue; if(this._rxCursorHolder.test(sValue)){ continue; }else{ nCnt++; } if(nCnt > 1){ // ์‹ฑ๊ธ€๋…ธ๋“œ๊ฐ€ ์•„๋‹ˆ๋ฉด ๋”์ด์ƒ ์ฐพ์ง€ ์•Š๊ณ  null ๋ฐ˜ํ™˜ return null; } } if(oNode.nodeName === "SPAN"){ return oNode; }else{ return this._findParentSingleSpan(oNode.parentNode); } }, /** * ์ปจํ…Œ์ด๋„ˆ ์—˜๋ฆฌ๋จผํŠธ(elContainer)์˜ ๋ชจ๋“  ์ž์‹๋…ธ๋“œ๊ฐ€ ๋…ธ๋“œ ๋ฐฐ์—ด(waAllNodes)์— ์†ํ•˜๋Š”์ง€ ํ™•์ธํ•œ๋‹ค * ์ฒซ ๋ฒˆ์งธ ์ž์‹ ๋…ธ๋“œ์™€ ๋งˆ์ง€๋ง‰ ์ž์‹ ๋…ธ๋“œ๊ฐ€ ๋…ธ๋“œ ๋ฐฐ์—ด์— ์†ํ•˜๋Š”์ง€๋ฅผ ํ™•์ธํ•œ๋‹ค * @param {Element} elContainer ์ปจํ…Œ์ด๋„ˆ ์—˜๋ฆฌ๋จผํŠธ * @param {jindo.$A} waAllNodes Node ์˜ $A ๋ฐฐ์—ด * @param {Node} [oNode] ์„ฑ๋Šฅ์„ ์œ„ํ•œ ์˜ต์…˜ ๋…ธ๋“œ๋กœ ์ปจํ…Œ์ด๋„ˆ์˜ ์ฒซ ๋ฒˆ์งธ ํ˜น์€ ๋งˆ์ง€๋ง‰ ์ž์‹ ๋…ธ๋“œ์™€ ๊ฐ™์œผ๋ฉด indexOf ํ•จ์ˆ˜ ์‚ฌ์šฉ์„ ์ค„์ผ ์ˆ˜ ์žˆ์Œ * @return {Array} Style ์„ ์ ์šฉํ•  ๋…ธ๋“œ ๋ฐฐ์—ด */ // check if all the child nodes of elContainer are in waAllNodes _isFullyContained : function(elContainer, waAllNodes, oNode){ var nSIdx, nEIdx; var oTmpNode = this._getVeryFirstRealChild(elContainer); // do quick checks before trying indexOf() because indexOf() function is very slow // oNode is optional if(oNode && oTmpNode == oNode){ nSIdx = 1; }else{ nSIdx = waAllNodes.indexOf(oTmpNode); } if(nSIdx != -1){ oTmpNode = this._getVeryLastRealChild(elContainer); if(oNode && oTmpNode == oNode){ nEIdx = 1; }else{ nEIdx = waAllNodes.indexOf(oTmpNode); } } return (nSIdx != -1 && nEIdx != -1); }, _getVeryFirstChild : function(oNode){ if(oNode.firstChild){return this._getVeryFirstChild(oNode.firstChild);} return oNode; }, _getVeryLastChild : function(oNode){ if(oNode.lastChild){return this._getVeryLastChild(oNode.lastChild);} return oNode; }, _getFirstRealChild : function(oNode){ var oFirstNode = oNode.firstChild; while(oFirstNode && oFirstNode.nodeType == 3 && oFirstNode.nodeValue == ""){oFirstNode = oFirstNode.nextSibling;} return oFirstNode; }, _getLastRealChild : function(oNode){ var oLastNode = oNode.lastChild; while(oLastNode && oLastNode.nodeType == 3 && oLastNode.nodeValue == ""){oLastNode = oLastNode.previousSibling;} return oLastNode; }, _getVeryFirstRealChild : function(oNode){ var oFirstNode = this._getFirstRealChild(oNode); if(oFirstNode){return this._getVeryFirstRealChild(oFirstNode);} return oNode; }, _getVeryLastRealChild : function(oNode){ var oLastNode = this._getLastRealChild(oNode); if(oLastNode){return this._getVeryLastChild(oLastNode);} return oNode; }, _getLineStartInfo : function(node){ var frontEndFinal = null; var frontEnd = node; var lineBreaker = node; var bParentBreak = false; var rxLineBreaker = this.rxLineBreaker; // vertical(parent) search function getLineStart(node){ if(!node){return;} if(frontEndFinal){return;} if(rxLineBreaker.test(node.tagName)){ lineBreaker = node; frontEndFinal = frontEnd; bParentBreak = true; return; }else{ frontEnd = node; } getFrontEnd(node.previousSibling); if(frontEndFinal){return;} getLineStart(nhn.DOMFix.parentNode(node)); } // horizontal(sibling) search function getFrontEnd(node){ if(!node){return;} if(frontEndFinal){return;} if(rxLineBreaker.test(node.tagName)){ lineBreaker = node; frontEndFinal = frontEnd; bParentBreak = false; return; } if(node.firstChild && node.tagName != "TABLE"){ var curNode = node.lastChild; while(curNode && !frontEndFinal){ getFrontEnd(curNode); curNode = curNode.previousSibling; } }else{ frontEnd = node; } if(!frontEndFinal){ getFrontEnd(node.previousSibling); } } if(rxLineBreaker.test(node.tagName)){ frontEndFinal = node; }else{ getLineStart(node); } return {oNode: frontEndFinal, oLineBreaker: lineBreaker, bParentBreak: bParentBreak}; }, _getLineEndInfo : function(node){ var backEndFinal = null; var backEnd = node; var lineBreaker = node; var bParentBreak = false; var rxLineBreaker = this.rxLineBreaker; // vertical(parent) search function getLineEnd(node){ if(!node){return;} if(backEndFinal){return;} if(rxLineBreaker.test(node.tagName)){ lineBreaker = node; backEndFinal = backEnd; bParentBreak = true; return; }else{ backEnd = node; } getBackEnd(node.nextSibling); if(backEndFinal){return;} getLineEnd(nhn.DOMFix.parentNode(node)); } // horizontal(sibling) search function getBackEnd(node){ if(!node){return;} if(backEndFinal){return;} if(rxLineBreaker.test(node.tagName)){ lineBreaker = node; backEndFinal = backEnd; bParentBreak = false; return; } if(node.firstChild && node.tagName != "TABLE"){ var curNode = node.firstChild; while(curNode && !backEndFinal){ getBackEnd(curNode); curNode = curNode.nextSibling; } }else{ backEnd = node; } if(!backEndFinal){ getBackEnd(node.nextSibling); } } if(rxLineBreaker.test(node.tagName)){ backEndFinal = node; }else{ getLineEnd(node); } return {oNode: backEndFinal, oLineBreaker: lineBreaker, bParentBreak: bParentBreak}; }, getLineInfo : function(bAfter){ var bAfter = bAfter || false; var oSNode = this.getStartNode(); var oENode = this.getEndNode(); // oSNode && oENode will be null if the range is currently collapsed and the cursor is not located in the middle of a text node. if(!oSNode){oSNode = this.getNodeAroundRange(!bAfter, true);} if(!oENode){oENode = this.getNodeAroundRange(!bAfter, true);} var oStart = this._getLineStartInfo(oSNode); var oStartNode = oStart.oNode; var oEnd = this._getLineEndInfo(oENode); var oEndNode = oEnd.oNode; if(oSNode != oStartNode || oENode != oEndNode){ // check if the start node is positioned after the range's ending point // or // if the end node is positioned before the range's starting point var iRelativeStartPos = this._compareEndPoint(nhn.DOMFix.parentNode(oStartNode), this._getPosIdx(oStartNode), this.endContainer, this.endOffset); var iRelativeEndPos = this._compareEndPoint(nhn.DOMFix.parentNode(oEndNode), this._getPosIdx(oEndNode)+1, this.startContainer, this.startOffset); if(!(iRelativeStartPos <= 0 && iRelativeEndPos >= 0)){ oSNode = this.getNodeAroundRange(false, true); oENode = this.getNodeAroundRange(false, true); oStart = this._getLineStartInfo(oSNode); oEnd = this._getLineEndInfo(oENode); } } return {oStart: oStart, oEnd: oEnd}; }, /** * ์ปค์„œํ™€๋”๋‚˜ ๊ณต๋ฐฑ์„ ์ œ์™ธํ•œ child ๋…ธ๋“œ๊ฐ€ ํ•˜๋‚˜๋งŒ ์žˆ๋Š” ๊ฒฝ์šฐ๋งŒ node ๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค. * @param {Node} oNode ํ™•์ธํ•  ๋…ธ๋“œ * @return {Node} single child node๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค. ์—†๊ฑฐ๋‚˜ ๋‘๊ฐœ ์ด์ƒ์ด๋ฉด null ์„ ๋ฐ˜ํ™˜ */ _findSingleChild : function(oNode){ if(!oNode){ return null; } var oSingleChild = null; // ZWNBSP ๋ฌธ์ž๊ฐ€ ๊ฐ™์ด ์žˆ๋Š” ๊ฒฝ์šฐ๋„ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์‹ค์ œ ๋…ธ๋“œ๋ฅผ ์นด์šดํŒ…ํ•ด์•ผ ํ•จ for(var i = 0, nCnt = 0, sValue, oChild, aChildNodes = oNode.childNodes; (oChild = aChildNodes[i]); i++){ sValue = oChild.nodeValue; if(this._rxCursorHolder.test(sValue)){ continue; }else{ oSingleChild = oChild; nCnt++; } if(nCnt > 1){ // ์‹ฑ๊ธ€๋…ธ๋“œ๊ฐ€ ์•„๋‹ˆ๋ฉด ๋”์ด์ƒ ์ฐพ์ง€ ์•Š๊ณ  null ๋ฐ˜ํ™˜ return null; } } return oSingleChild; }, /** * ํ•ด๋‹น์š”์†Œ์˜ ์ตœํ•˜์œ„๊นŒ์ง€ ๊ฒ€์ƒ‰ํ•ด ์ปค์„œํ™€๋”๋งŒ ๊ฐ์‹ธ๊ณ  ์žˆ๋Š”์ง€ ์—ฌ๋ถ€๋ฅผ ๋ฐ˜ํ™˜ * @param {Node} oNode ํ™•์ธํ•  ๋…ธ๋“œ * @return {Boolean} ์ปค์„œํ™€๋”๋งŒ ์žˆ๋Š” ๊ฒฝ์šฐ true ๋ฐ˜ํ™˜ */ _hasCursorHolderOnly : function(oNode){ if(!oNode || oNode.nodeType !== 1){ return false; } if(this._rxCursorHolder.test(oNode.innerHTML)){ return true; }else{ return this._hasCursorHolderOnly(this._findSingleChild(oNode)); } } }).extend(nhn.W3CDOMRange); /** * @fileOverview This file contains cross-browser selection function * @name BrowserSelection.js */ nhn.BrowserSelection = function(win){ this.init = function(win){ this._window = win || window; this._document = this._window.document; }; this.init(win); // [SMARTEDITORSUS-888] IE9 ์ดํ›„๋กœ document.createRange ๋ฅผ ์ง€์› /* var oAgentInfo = jindo.$Agent().navigator(); if(oAgentInfo.ie){ nhn.BrowserSelectionImpl_IE.apply(this); }else{ nhn.BrowserSelectionImpl_FF.apply(this); }*/ if(!!this._document.createRange){ nhn.BrowserSelectionImpl_FF.apply(this); }else{ nhn.BrowserSelectionImpl_IE.apply(this); } this.selectRange = function(oRng){ this.selectNone(); this.addRange(oRng); }; this.selectionLoaded = true; if(!this._oSelection){this.selectionLoaded = false;} }; nhn.BrowserSelectionImpl_FF = function(){ this._oSelection = this._window.getSelection(); this.getRangeAt = function(iNum){ iNum = iNum || 0; try{ var oFFRange = this._oSelection.getRangeAt(iNum); }catch(e){return new nhn.W3CDOMRange(this._window);} return this._FFRange2W3CRange(oFFRange); }; this.addRange = function(oW3CRange){ var oFFRange = this._W3CRange2FFRange(oW3CRange); this._oSelection.addRange(oFFRange); }; this.selectNone = function(){ this._oSelection.removeAllRanges(); }; this.getCommonAncestorContainer = function(oW3CRange){ var oFFRange = this._W3CRange2FFRange(oW3CRange); return oFFRange.commonAncestorContainer; }; this.isCollapsed = function(oW3CRange){ var oFFRange = this._W3CRange2FFRange(oW3CRange); return oFFRange.collapsed; }; this.compareEndPoints = function(elContainerA, nOffsetA, elContainerB, nOffsetB){ var oFFRangeA = this._document.createRange(); var oFFRangeB = this._document.createRange(); oFFRangeA.setStart(elContainerA, nOffsetA); oFFRangeB.setStart(elContainerB, nOffsetB); oFFRangeA.collapse(true); oFFRangeB.collapse(true); try{ return oFFRangeA.compareBoundaryPoints(1, oFFRangeB); }catch(e){ return 1; } }; this._FFRange2W3CRange = function(oFFRange){ var oW3CRange = new nhn.W3CDOMRange(this._window); oW3CRange.setStart(oFFRange.startContainer, oFFRange.startOffset, true); oW3CRange.setEnd(oFFRange.endContainer, oFFRange.endOffset, true); return oW3CRange; }; this._W3CRange2FFRange = function(oW3CRange){ var oFFRange = this._document.createRange(); oFFRange.setStart(oW3CRange.startContainer, oW3CRange.startOffset); oFFRange.setEnd(oW3CRange.endContainer, oW3CRange.endOffset); return oFFRange; }; }; nhn.BrowserSelectionImpl_IE = function(){ this._oSelection = this._document.selection; this.oLastRange = { oBrowserRange : null, elStartContainer : null, nStartOffset : -1, elEndContainer : null, nEndOffset : -1 }; this._updateLastRange = function(oBrowserRange, oW3CRange){ this.oLastRange.oBrowserRange = oBrowserRange; this.oLastRange.elStartContainer = oW3CRange.startContainer; this.oLastRange.nStartOffset = oW3CRange.startOffset; this.oLastRange.elEndContainer = oW3CRange.endContainer; this.oLastRange.nEndOffset = oW3CRange.endOffset; }; this.getRangeAt = function(iNum){ iNum = iNum || 0; var oW3CRange, oBrowserRange; if(this._oSelection.type == "Control"){ oW3CRange = new nhn.W3CDOMRange(this._window); var oSelectedNode = this._oSelection.createRange().item(iNum); // if the selction occurs in a different document, ignore if(!oSelectedNode || oSelectedNode.ownerDocument != this._document){return oW3CRange;} oW3CRange.selectNode(oSelectedNode); return oW3CRange; }else{ //oBrowserRange = this._oSelection.createRangeCollection().item(iNum); oBrowserRange = this._oSelection.createRange(); var oSelectedNode = oBrowserRange.parentElement(); // if the selction occurs in a different document, ignore if(!oSelectedNode || oSelectedNode.ownerDocument != this._document){ oW3CRange = new nhn.W3CDOMRange(this._window); return oW3CRange; } oW3CRange = this._IERange2W3CRange(oBrowserRange); return oW3CRange; } }; this.addRange = function(oW3CRange){ var oIERange = this._W3CRange2IERange(oW3CRange); oIERange.select(); }; this.selectNone = function(){ this._oSelection.empty(); }; this.getCommonAncestorContainer = function(oW3CRange){ return this._W3CRange2IERange(oW3CRange).parentElement(); }; this.isCollapsed = function(oW3CRange){ var oRange = this._W3CRange2IERange(oW3CRange); var oRange2 = oRange.duplicate(); oRange2.collapse(); return oRange.isEqual(oRange2); }; this.compareEndPoints = function(elContainerA, nOffsetA, elContainerB, nOffsetB){ var oIERangeA, oIERangeB; if(elContainerA === this.oLastRange.elStartContainer && nOffsetA === this.oLastRange.nStartOffset){ oIERangeA = this.oLastRange.oBrowserRange.duplicate(); oIERangeA.collapse(true); }else{ if(elContainerA === this.oLastRange.elEndContainer && nOffsetA === this.oLastRange.nEndOffset){ oIERangeA = this.oLastRange.oBrowserRange.duplicate(); oIERangeA.collapse(false); }else{ oIERangeA = this._getIERangeAt(elContainerA, nOffsetA); } } if(elContainerB === this.oLastRange.elStartContainer && nOffsetB === this.oLastRange.nStartOffset){ oIERangeB = this.oLastRange.oBrowserRange.duplicate(); oIERangeB.collapse(true); }else{ if(elContainerB === this.oLastRange.elEndContainer && nOffsetB === this.oLastRange.nEndOffset){ oIERangeB = this.oLastRange.oBrowserRange.duplicate(); oIERangeB.collapse(false); }else{ oIERangeB = this._getIERangeAt(elContainerB, nOffsetB); } } return oIERangeA.compareEndPoints("StartToStart", oIERangeB); }; this._W3CRange2IERange = function(oW3CRange){ if(this.oLastRange.elStartContainer === oW3CRange.startContainer && this.oLastRange.nStartOffset === oW3CRange.startOffset && this.oLastRange.elEndContainer === oW3CRange.endContainer && this.oLastRange.nEndOffset === oW3CRange.endOffset){ return this.oLastRange.oBrowserRange; } var oStartIERange = this._getIERangeAt(oW3CRange.startContainer, oW3CRange.startOffset); var oEndIERange = this._getIERangeAt(oW3CRange.endContainer, oW3CRange.endOffset); oStartIERange.setEndPoint("EndToEnd", oEndIERange); this._updateLastRange(oStartIERange, oW3CRange); return oStartIERange; }; this._getIERangeAt = function(oW3CContainer, iW3COffset){ var oIERange = this._document.body.createTextRange(); var oEndPointInfoForIERange = this._getSelectableNodeAndOffsetForIE(oW3CContainer, iW3COffset); var oSelectableNode = oEndPointInfoForIERange.oSelectableNodeForIE; var iIEOffset = oEndPointInfoForIERange.iOffsetForIE; oIERange.moveToElementText(oSelectableNode); oIERange.collapse(oEndPointInfoForIERange.bCollapseToStart); oIERange.moveStart("character", iIEOffset); return oIERange; }; this._getSelectableNodeAndOffsetForIE = function(oW3CContainer, iW3COffset){ // var oIERange = this._document.body.createTextRange(); var oNonTextNode = null; var aChildNodes = null; var iNumOfLeftNodesToCount = 0; if(oW3CContainer.nodeType == 3){ oNonTextNode = nhn.DOMFix.parentNode(oW3CContainer); aChildNodes = nhn.DOMFix.childNodes(oNonTextNode); iNumOfLeftNodesToCount = aChildNodes.length; }else{ oNonTextNode = oW3CContainer; aChildNodes = nhn.DOMFix.childNodes(oNonTextNode); //iNumOfLeftNodesToCount = iW3COffset; iNumOfLeftNodesToCount = (iW3COffset<aChildNodes.length)?iW3COffset:aChildNodes.length; } //@ room 4 improvement var oNodeTester = null; var iResultOffset = 0; var bCollapseToStart = true; for(var i=0; i<iNumOfLeftNodesToCount; i++){ oNodeTester = aChildNodes[i]; if(oNodeTester.nodeType == 3){ if(oNodeTester == oW3CContainer){break;} iResultOffset += oNodeTester.nodeValue.length; }else{ // oIERange.moveToElementText(oNodeTester); oNonTextNode = oNodeTester; iResultOffset = 0; bCollapseToStart = false; } } if(oW3CContainer.nodeType == 3){iResultOffset += iW3COffset;} return {oSelectableNodeForIE:oNonTextNode, iOffsetForIE: iResultOffset, bCollapseToStart: bCollapseToStart}; }; this._IERange2W3CRange = function(oIERange){ var oW3CRange = new nhn.W3CDOMRange(this._window); var oIEPointRange = null; var oPosition = null; oIEPointRange = oIERange.duplicate(); oIEPointRange.collapse(true); oPosition = this._getW3CContainerAndOffset(oIEPointRange, true); oW3CRange.setStart(oPosition.oContainer, oPosition.iOffset, true, true); var oCollapsedChecker = oIERange.duplicate(); oCollapsedChecker.collapse(true); if(oCollapsedChecker.isEqual(oIERange)){ oW3CRange.collapse(true); }else{ oIEPointRange = oIERange.duplicate(); oIEPointRange.collapse(false); oPosition = this._getW3CContainerAndOffset(oIEPointRange); oW3CRange.setEnd(oPosition.oContainer, oPosition.iOffset, true); } this._updateLastRange(oIERange, oW3CRange); return oW3CRange; }; this._getW3CContainerAndOffset = function(oIEPointRange, bStartPt){ var oRgOrigPoint = oIEPointRange; var oContainer = oRgOrigPoint.parentElement(); var offset = -1; var oRgTester = this._document.body.createTextRange(); var aChildNodes = nhn.DOMFix.childNodes(oContainer); var oPrevNonTextNode = null; var pointRangeIdx = 0; for(var i=0;i<aChildNodes.length;i++){ if(aChildNodes[i].nodeType == 3){continue;} oRgTester.moveToElementText(aChildNodes[i]); if(oRgTester.compareEndPoints("StartToStart", oIEPointRange)>=0){break;} oPrevNonTextNode = aChildNodes[i]; } var pointRangeIdx = i; if(pointRangeIdx !== 0 && aChildNodes[pointRangeIdx-1].nodeType == 3){ var oRgTextStart = this._document.body.createTextRange(); var oCurTextNode = null; if(oPrevNonTextNode){ oRgTextStart.moveToElementText(oPrevNonTextNode); oRgTextStart.collapse(false); oCurTextNode = oPrevNonTextNode.nextSibling; }else{ oRgTextStart.moveToElementText(oContainer); oRgTextStart.collapse(true); oCurTextNode = oContainer.firstChild; } var oRgTextsUpToThePoint = oRgOrigPoint.duplicate(); oRgTextsUpToThePoint.setEndPoint("StartToStart", oRgTextStart); var textCount = oRgTextsUpToThePoint.text.replace(/[\r\n]/g,"").length; while(textCount > oCurTextNode.nodeValue.length && oCurTextNode.nextSibling){ textCount -= oCurTextNode.nodeValue.length; oCurTextNode = oCurTextNode.nextSibling; } // this will enforce IE to re-reference oCurTextNode var oTmp = oCurTextNode.nodeValue; if(bStartPt && oCurTextNode.nextSibling && oCurTextNode.nextSibling.nodeType == 3 && textCount == oCurTextNode.nodeValue.length){ textCount -= oCurTextNode.nodeValue.length; oCurTextNode = oCurTextNode.nextSibling; } oContainer = oCurTextNode; offset = textCount; }else{ oContainer = oRgOrigPoint.parentElement(); offset = pointRangeIdx; } return {"oContainer" : oContainer, "iOffset" : offset}; }; }; nhn.DOMFix = new (jindo.$Class({ $init : function(){ if(jindo.$Agent().navigator().ie || jindo.$Agent().navigator().opera){ this.childNodes = this._childNodes_Fix; this.parentNode = this._parentNode_Fix; }else{ this.childNodes = this._childNodes_Native; this.parentNode = this._parentNode_Native; } }, _parentNode_Native : function(elNode){ return elNode.parentNode; }, _parentNode_Fix : function(elNode){ if(!elNode){return elNode;} while(elNode.previousSibling){elNode = elNode.previousSibling;} return elNode.parentNode; }, _childNodes_Native : function(elNode){ return elNode.childNodes; }, _childNodes_Fix : function(elNode){ var aResult = null; var nCount = 0; if(elNode){ var aResult = []; elNode = elNode.firstChild; while(elNode){ aResult[nCount++] = elNode; elNode=elNode.nextSibling; } } return aResult; } }))(); /*[ * ADD_APP_PROPERTY * * ์ฃผ์š” ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋ชจ๋“  ํ”Œ๋Ÿฌ๊ทธ์ธ์—์„œ this.oApp๋ฅผ ํ†ตํ•ด์„œ ์ง์ ‘ ์ ‘๊ทผ ๊ฐ€๋Šฅ ํ•˜๋„๋ก ๋“ฑ๋กํ•œ๋‹ค. * * sPropertyName string ๋“ฑ๋ก๋ช… * oProperty object ๋“ฑ๋ก์‹œํ‚ฌ ์˜ค๋ธŒ์ ํŠธ * ---------------------------------------------------------------------------]*/ /*[ * REGISTER_BROWSER_EVENT * * ํŠน์ • ๋ธŒ๋ผ์šฐ์ € ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒ ํ–ˆ์„๋•Œ Husky ๋ฉ”์‹œ์ง€๋ฅผ ๋ฐœ์ƒ ์‹œํ‚จ๋‹ค. * * obj HTMLElement ๋ธŒ๋ผ์šฐ์ € ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ ์‹œํ‚ฌ HTML ์—˜๋ฆฌ๋จผํŠธ * sEvent string ๋ฐœ์ƒ ๋Œ€๊ธฐ ํ•  ๋ธŒ๋ผ์šฐ์ € ์ด๋ฒคํŠธ * sMsg string ๋ฐœ์ƒ ํ•  Husky ๋ฉ”์‹œ์ง€ * aParams array ๋ฉ”์‹œ์ง€์— ๋„˜๊ธธ ํŒŒ๋ผ๋ฏธํ„ฐ * nDelay number ๋ธŒ๋ผ์šฐ์ € ์ด๋ฒคํŠธ ๋ฐœ์ƒ ํ›„ Husky ๋ฉ”์‹œ์ง€ ๋ฐœ์ƒ ์‚ฌ์ด์— ๋”œ๋ ˆ์ด๋ฅผ ์ฃผ๊ณ  ์‹ถ์„ ๊ฒฝ์šฐ ์„ค์ •. (1/1000์ดˆ ๋‹จ์œ„) * ---------------------------------------------------------------------------]*/ /*[ * DISABLE_MESSAGE * * ํŠน์ • ๋ฉ”์‹œ์ง€๋ฅผ ์ฝ”์–ด์—์„œ ๋ฌด์‹œํ•˜๊ณ  ๋ผ์šฐํŒ… ํ•˜์ง€ ์•Š๋„๋ก ๋น„ํ™œ์„ฑํ™” ํ•œ๋‹ค. * * sMsg string ๋น„ํ™œ์„ฑํ™” ์‹œํ‚ฌ ๋ฉ”์‹œ์ง€ * ---------------------------------------------------------------------------]*/ /*[ * ENABLE_MESSAGE * * ๋ฌด์‹œํ•˜๋„๋ก ์„ค์ •๋œ ๋ฉ”์‹œ์ง€๋ฅผ ๋ฌด์‹œํ•˜์ง€ ์•Š๋„๋ก ํ™œ์„ฑํ™” ํ•œ๋‹ค. * * sMsg string ํ™œ์„ฑํ™” ์‹œํ‚ฌ ๋ฉ”์‹œ์ง€ * ---------------------------------------------------------------------------]*/ /*[ * EXEC_ON_READY_FUNCTION * * oApp.run({fnOnAppReady:fnOnAppReady})์™€ ๊ฐ™์ด run ํ˜ธ์ถœ ์‹œ์ ์— ์ง€์ •๋œ ํ•จ์ˆ˜๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ ์ด๋ฅผ MSG_APP_READY ์‹œ์ ์— ์‹คํ–‰ ์‹œํ‚จ๋‹ค. * ์ฝ”์–ด์—์„œ ์ž๋™์œผ๋กœ ๋ฐœ์ƒ์‹œํ‚ค๋Š” ๋ฉ”์‹œ์ง€๋กœ ์ง์ ‘ ๋ฐœ์ƒ์‹œํ‚ค์ง€๋Š” ์•Š๋„๋ก ํ•œ๋‹ค. * * none * ---------------------------------------------------------------------------]*/ /** * @pluginDesc Husky Framework์—์„œ ์ž์ฃผ ์‚ฌ์šฉ๋˜๋Š” ๋ฉ”์‹œ์ง€๋ฅผ ์ฒ˜๋ฆฌํ•˜๋Š” ํ”Œ๋Ÿฌ๊ทธ์ธ */ nhn.husky.CorePlugin = jindo.$Class({ name : "CorePlugin", // nStatus = 0(request not sent), 1(request sent), 2(response received) // sContents = response htLazyLoadRequest_plugins : {}, htLazyLoadRequest_allFiles : {}, htHTMLLoaded : {}, $AFTER_MSG_APP_READY : function(){ this.oApp.exec("EXEC_ON_READY_FUNCTION", []); }, $ON_ADD_APP_PROPERTY : function(sPropertyName, oProperty){ this.oApp[sPropertyName] = oProperty; }, $ON_REGISTER_BROWSER_EVENT : function(obj, sEvent, sMsg, aParams, nDelay){ this.oApp.registerBrowserEvent(obj, sEvent, sMsg, aParams, nDelay); }, $ON_DISABLE_MESSAGE : function(sMsg){ this.oApp.disableMessage(sMsg, true); }, $ON_ENABLE_MESSAGE : function(sMsg){ this.oApp.disableMessage(sMsg, false); }, $ON_LOAD_FULL_PLUGIN : function(aFilenames, sClassName, sMsgName, oThisRef, oArguments){ var oPluginRef = oThisRef.$this || oThisRef; // var nIdx = _nIdx||0; var sFilename = aFilenames[0]; if(!this.htLazyLoadRequest_plugins[sFilename]){ this.htLazyLoadRequest_plugins[sFilename] = {nStatus:1, sContents:""}; } if(this.htLazyLoadRequest_plugins[sFilename].nStatus === 2){ //this.oApp.delayedExec("MSG_FULL_PLUGIN_LOADED", [sFilename, sClassName, sMsgName, oThisRef, oArguments, false], 0); this.oApp.exec("MSG_FULL_PLUGIN_LOADED", [sFilename, sClassName, sMsgName, oThisRef, oArguments, false]); }else{ this._loadFullPlugin(aFilenames, sClassName, sMsgName, oThisRef, oArguments, 0); } }, _loadFullPlugin : function(aFilenames, sClassName, sMsgName, oThisRef, oArguments, nIdx){ jindo.LazyLoading.load(nhn.husky.SE2M_Configuration.LazyLoad.sJsBaseURI+"/"+aFilenames[nIdx], jindo.$Fn(function(aFilenames, sClassName, sMsgName, oThisRef, oArguments, nIdx){ var sCurFilename = aFilenames[nIdx]; // plugin filename var sFilename = aFilenames[0]; if(nIdx == aFilenames.length-1){ this.htLazyLoadRequest_plugins[sFilename].nStatus=2; this.oApp.exec("MSG_FULL_PLUGIN_LOADED", [aFilenames, sClassName, sMsgName, oThisRef, oArguments]); return; } //this.oApp.exec("LOAD_FULL_PLUGIN", [aFilenames, sClassName, sMsgName, oThisRef, oArguments, nIdx+1]); this._loadFullPlugin(aFilenames, sClassName, sMsgName, oThisRef, oArguments, nIdx+1); }, this).bind(aFilenames, sClassName, sMsgName, oThisRef, oArguments, nIdx), "utf-8" ); }, $ON_MSG_FULL_PLUGIN_LOADED : function(aFilenames, sClassName, sMsgName, oThisRef, oArguments, oRes){ // oThisRef.$this๋Š” ํ˜„์žฌ ๋กœ๋“œ๋˜๋Š” ํ”Œ๋Ÿฌ๊ทธ์ธ์ด parent ์ธ์Šคํ„ด์Šค์ผ ๊ฒฝ์šฐ ์กด์žฌ ํ•จ. oThisRef.$this๋Š” ํ˜„์žฌ ํ”Œ๋Ÿฌ๊ทธ์ธ(oThisRef)๋ฅผ parent๋กœ ์‚ผ๊ณ  ์žˆ๋Š” ์ธ์Šคํ„ด์Šค // oThisRef์— $this ์†์„ฑ์ด ์—†๋‹ค๋ฉด parent๊ฐ€ ์•„๋‹Œ ์ผ๋ฐ˜ ์ธ์Šคํ„ด์Šค // oPluginRef๋Š” ๊ฒฐ๊ณผ์ ์œผ๋กœ ์ƒ์† ๊ด€๊ณ„๊ฐ€ ์žˆ๋‹ค๋ฉด ์ž์‹ ์ธ์Šคํ„ด์Šค๋ฅผ ์•„๋‹ˆ๋ผ๋ฉด ์ผ๋ฐ˜์ ์ธ ์ธ์Šคํ„ด์Šค๋ฅผ ๊ฐ€์ง var oPluginRef = oThisRef.$this || oThisRef; var sFilename = aFilenames; // now the source code is loaded, remove the loader handlers for(var i=0, nLen=oThisRef._huskyFLT.length; i<nLen; i++){ var sLoaderHandlerName = "$BEFORE_"+oThisRef._huskyFLT[i]; // if child class has its own loader function, remove the loader from current instance(parent) only var oRemoveFrom = (oThisRef.$this && oThisRef[sLoaderHandlerName])?oThisRef:oPluginRef; oRemoveFrom[sLoaderHandlerName] = null; this.oApp.createMessageMap(sLoaderHandlerName); } var oPlugin = eval(sClassName+".prototype"); //var oPlugin = eval("new "+sClassName+"()"); var bAcceptLocalBeforeFirstAgain = false; // if there were no $LOCAL_BEFORE_FIRST in already-loaded script, set to accept $LOCAL_BEFORE_FIRST next time as the function could be included in the lazy-loaded script. if(typeof oPluginRef["$LOCAL_BEFORE_FIRST"] !== "function"){ this.oApp.acceptLocalBeforeFirstAgain(oPluginRef, true); } for(var x in oPlugin){ // ์ž์‹ ์ธ์Šคํ„ด์Šค์— parent๋ฅผ overrideํ•˜๋Š” ํ•จ์ˆ˜๊ฐ€ ์—†๋‹ค๋ฉด parent ์ธ์Šคํ„ด์Šค์— ํ•จ์ˆ˜ ๋ณต์‚ฌ ํ•ด ์คŒ. ์ด๋•Œ ํ•จ์ˆ˜๋งŒ ๋ณต์‚ฌํ•˜๊ณ , ๋‚˜๋จธ์ง€ ์†์„ฑ๋“ค์€ ํ˜„์žฌ ์ธ์Šคํ„ด์Šค์— ์กด์žฌ ํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ์—๋งŒ ๋ณต์‚ฌ. if(oThisRef.$this && (!oThisRef[x] || (typeof oPlugin[x] === "function" && x != "constructor"))){ oThisRef[x] = jindo.$Fn(oPlugin[x], oPluginRef).bind(); } // ํ˜„์žฌ ์ธ์Šคํ„ด์Šค์— ํ•จ์ˆ˜ ๋ณต์‚ฌ ํ•ด ์คŒ. ์ด๋•Œ ํ•จ์ˆ˜๋งŒ ๋ณต์‚ฌํ•˜๊ณ , ๋‚˜๋จธ์ง€ ์†์„ฑ๋“ค์€ ํ˜„์žฌ ์ธ์Šคํ„ด์Šค์— ์กด์žฌ ํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ์—๋งŒ ๋ณต์‚ฌ if(oPlugin[x] && (!oPluginRef[x] || (typeof oPlugin[x] === "function" && x != "constructor"))){ oPluginRef[x] = oPlugin[x]; // ์ƒˆ๋กœ ์ถ”๊ฐ€๋˜๋Š” ํ•จ์ˆ˜๊ฐ€ ๋ฉ”์‹œ์ง€ ํ•ธ๋“ค๋Ÿฌ๋ผ๋ฉด ๋ฉ”์‹œ์ง€ ๋งคํ•‘์— ์ถ”๊ฐ€ ํ•ด ์คŒ if(x.match(/^\$(LOCAL|BEFORE|ON|AFTER)_/)){ this.oApp.addToMessageMap(x, oPluginRef); } } } if(bAcceptLocalBeforeFirstAgain){ this.oApp.acceptLocalBeforeFirstAgain(oPluginRef, true); } // re-send the message after all the jindo.$super handlers are executed if(!oThisRef.$this){ this.oApp.exec(sMsgName, oArguments); } }, $ON_LOAD_HTML : function(sId){ if(this.htHTMLLoaded[sId]) return; var elTextarea = jindo.$("_llh_"+sId); if(!elTextarea) return; this.htHTMLLoaded[sId] = true; var elTmp = document.createElement("DIV"); elTmp.innerHTML = elTextarea.value; while(elTmp.firstChild){ elTextarea.parentNode.insertBefore(elTmp.firstChild, elTextarea); } }, $ON_EXEC_ON_READY_FUNCTION : function(){ if(typeof this.oApp.htRunOptions.fnOnAppReady == "function"){this.oApp.htRunOptions.fnOnAppReady();} } }); //{ /** * @fileOverview This file contains Husky plugin that bridges the HuskyRange function * @name hp_HuskyRangeManager.js */ nhn.husky.HuskyRangeManager = jindo.$Class({ name : "HuskyRangeManager", oWindow : null, $init : function(win){ this.oWindow = win || window; }, $BEFORE_MSG_APP_READY : function(){ if(this.oWindow && this.oWindow.tagName == "IFRAME"){ this.oWindow = this.oWindow.contentWindow; nhn.CurrentSelection.setWindow(this.oWindow); } this.oApp.exec("ADD_APP_PROPERTY", ["getSelection", jindo.$Fn(this.getSelection, this).bind()]); this.oApp.exec("ADD_APP_PROPERTY", ["getEmptySelection", jindo.$Fn(this.getEmptySelection, this).bind()]); }, $ON_SET_EDITING_WINDOW : function(oWindow){ this.oWindow = oWindow; }, getEmptySelection : function(oWindow){ var oHuskyRange = new nhn.HuskyRange(oWindow || this.oWindow); return oHuskyRange; }, getSelection : function(oWindow){ this.oApp.exec("RESTORE_IE_SELECTION", []); var oHuskyRange = this.getEmptySelection(oWindow); // this may throw an exception if the selected is area is not yet shown try{ oHuskyRange.setFromSelection(); }catch(e){} return oHuskyRange; } }); //} //{ /** * @fileOverview This file contains Husky plugin that takes care of the operations related to the tool bar UI * @name hp_SE2M_Toolbar.js */ nhn.husky.SE2M_Toolbar = jindo.$Class({ name : "SE2M_Toolbar", toolbarArea : null, toolbarButton : null, uiNameTag : "uiName", // 0: unknown // 1: all enabled // 2: all disabled nUIStatus : 1, sUIClassPrefix : "husky_seditor_ui_", aUICmdMap : null, elFirstToolbarItem : null, _assignHTMLElements : function(oAppContainer){ oAppContainer = jindo.$(oAppContainer) || document; this.rxUI = new RegExp(this.sUIClassPrefix+"([^ ]+)"); //@ec[ this.toolbarArea = jindo.$$.getSingle(".se2_tool", oAppContainer); this.aAllUI = jindo.$$("[class*=" + this.sUIClassPrefix + "]", this.toolbarArea); this.elTextTool = jindo.$$.getSingle("div.husky_seditor_text_tool", this.toolbarArea); // [SMARTEDITORSUS-1124] ํ…์ŠคํŠธ ํˆด๋ฐ” ๋ฒ„ํŠผ์˜ ๋ผ์šด๋“œ ์ฒ˜๋ฆฌ //@ec] this.welToolbarArea = jindo.$Element(this.toolbarArea); for (var i = 0, nCount = this.aAllUI.length; i < nCount; i++) { if (this.rxUI.test(this.aAllUI[i].className)) { var sUIName = RegExp.$1; if(this.htUIList[sUIName] !== undefined){ continue; } this.htUIList[sUIName] = this.aAllUI[i]; this.htWrappedUIList[sUIName] = jindo.$Element(this.htUIList[sUIName]); } } if (jindo.$$.getSingle("DIV.se2_icon_tool") != null) { this.elFirstToolbarItem = jindo.$$.getSingle("DIV.se2_icon_tool UL.se2_itool1>li>button"); } }, $LOCAL_BEFORE_FIRST : function(sMsg) { var aToolItems = jindo.$$(">ul>li[class*=" + this.sUIClassPrefix + "]>button", this.elTextTool); var nItemLength = aToolItems.length; this.elFirstToolbarItem = this.elFirstToolbarItem || aToolItems[0]; this.elLastToolbarItem = aToolItems[nItemLength-1]; this.oApp.registerBrowserEvent(this.toolbarArea, "keydown", "NAVIGATE_TOOLBAR", []); }, $init : function(oAppContainer){ this.htUIList = {}; this.htWrappedUIList = {}; this.aUICmdMap = {}; this._assignHTMLElements(oAppContainer); this._setRoundedCornerButton(); // [SMARTEDITORSUS-1124] ํ…์ŠคํŠธ ํˆด๋ฐ” ๋ฒ„ํŠผ์˜ ๋ผ์šด๋“œ ์ฒ˜๋ฆฌ }, $ON_MSG_APP_READY : function(){ this.oApp.registerBrowserEvent(this.toolbarArea, "mouseover", "EVENT_TOOLBAR_MOUSEOVER", []); this.oApp.registerBrowserEvent(this.toolbarArea, "mouseout", "EVENT_TOOLBAR_MOUSEOUT", []); this.oApp.registerBrowserEvent(this.toolbarArea, "mousedown", "EVENT_TOOLBAR_MOUSEDOWN", []); /* var aBtns = jindo.$$("BUTTON", this.toolbarArea); for(var i=0; i<aBtns.length; i++){ this.oApp.registerBrowserEvent(aBtns[i], "focus", "EVENT_TOOLBAR_MOUSEOVER", []); this.oApp.registerBrowserEvent(aBtns[i], "blur", "EVENT_TOOLBAR_MOUSEOUT", []); } */ this.oApp.exec("ADD_APP_PROPERTY", ["getToolbarButtonByUIName", jindo.$Fn(this.getToolbarButtonByUIName, this).bind()]); //์›น์ ‘๊ทผ์„ฑ //์ด ๋‹จ๊ณ„์—์„œ oAppContainer๊ฐ€ ์ •์˜๋˜์ง€ ์•Š์€ ์ƒํƒœ๋ผ์„œ this.toolbarArea๋ณ€์ˆ˜๊ฐ’์„ ์‚ฌ์šฉํ•˜์ง€ ๋ชปํ•˜๊ณ  ์•„๋ž˜์™€ ๊ฐ™์ด ๋‹ค์‹œ ์ •์˜ํ•˜์˜€์Œ. var elTool = jindo.$$.getSingle(".se2_tool"); this.oApp.exec("REGISTER_HOTKEY", ["esc", "FOCUS_EDITING_AREA", [], elTool]); }, $ON_NAVIGATE_TOOLBAR : function(weEvent) { var TAB_KEY_CODE = 9; //์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•œ ์—˜๋ฆฌ๋จผํŠธ๊ฐ€ ๋งˆ์ง€๋ง‰ ์•„์ดํ…œ์ด๊ณ  TAB ํ‚ค๊ฐ€ ๋ˆŒ๋ ค์กŒ๋‹ค๋ฉด if ((weEvent.element == this.elLastToolbarItem) && (weEvent.key().keyCode == TAB_KEY_CODE) ) { if (weEvent.key().shift) { //do nothing } else { this.elFirstToolbarItem.focus(); weEvent.stopDefault(); } } //์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•œ ์—˜๋ฆฌ๋จผํŠธ๊ฐ€ ์ฒซ๋ฒˆ์งธ ์•„์ดํ…œ์ด๊ณ  TAB ํ‚ค๊ฐ€ ๋ˆŒ๋ ค์กŒ๋‹ค๋ฉด if (weEvent.element == this.elFirstToolbarItem && (weEvent.key().keyCode == TAB_KEY_CODE)) { if (weEvent.key().shift) { weEvent.stopDefault(); this.elLastToolbarItem.focus(); } } }, //ํฌ์ปค์Šค๊ฐ€ ํˆด๋ฐ”์— ์žˆ๋Š” ์ƒํƒœ์—์„œ ๋‹จ์ถ•ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ์—๋””ํŒ… ์˜์—ญ์œผ๋กœ ๋‹ค์‹œ ํฌ์ปค์Šค๊ฐ€ ๊ฐ€๋„๋ก ํ•˜๋Š” ํ•จ์ˆ˜. (์›น์ ‘๊ทผ์„ฑ) $ON_FOCUS_EDITING_AREA : function() { this.oApp.exec("FOCUS"); }, $ON_TOGGLE_TOOLBAR_ACTIVE_LAYER : function(elLayer, elBtn, sOpenCmd, aOpenArgs, sCloseCmd, aCloseArgs){ this.oApp.exec("TOGGLE_ACTIVE_LAYER", [elLayer, "MSG_TOOLBAR_LAYER_SHOWN", [elLayer, elBtn, sOpenCmd, aOpenArgs], sCloseCmd, aCloseArgs]); }, $ON_MSG_TOOLBAR_LAYER_SHOWN : function(elLayer, elBtn, aOpenCmd, aOpenArgs){ this.oApp.exec("POSITION_TOOLBAR_LAYER", [elLayer, elBtn]); if(aOpenCmd){ this.oApp.exec(aOpenCmd, aOpenArgs); } }, $ON_SHOW_TOOLBAR_ACTIVE_LAYER : function(elLayer, sCmd, aArgs, elBtn){ this.oApp.exec("SHOW_ACTIVE_LAYER", [elLayer, sCmd, aArgs]); this.oApp.exec("POSITION_TOOLBAR_LAYER", [elLayer, elBtn]); }, $ON_ENABLE_UI : function(sUIName){ this._enableUI(sUIName); }, $ON_DISABLE_UI : function(sUIName){ this._disableUI(sUIName); }, $ON_SELECT_UI : function(sUIName){ var welUI = this.htWrappedUIList[sUIName]; if(!welUI){ return; } welUI.removeClass("hover"); welUI.addClass("active"); }, $ON_DESELECT_UI : function(sUIName){ var welUI = this.htWrappedUIList[sUIName]; if(!welUI){ return; } welUI.removeClass("active"); }, /** * [SMARTEDITORSUS-1646] ํˆด๋ฐ”๋ฒ„ํŠผ ์„ ํƒ์ƒํƒœ๋ฅผ ํ† ๊ธ€๋งํ•œ๋‹ค. * @param {String} sUIName ํ† ๊ธ€๋งํ•  ํˆด๋ฐ”๋ฒ„ํŠผ ์ด๋ฆ„ */ $ON_TOGGLE_UI_SELECTED : function(sUIName){ var welUI = this.htWrappedUIList[sUIName]; if(!welUI){ return; } if(welUI.hasClass("active")){ welUI.removeClass("active"); }else{ welUI.removeClass("hover"); welUI.addClass("active"); } }, $ON_ENABLE_ALL_UI : function(htOptions){ if(this.nUIStatus === 1){ return; } var sUIName, className; htOptions = htOptions || {}; var waExceptions = jindo.$A(htOptions.aExceptions || []); for(sUIName in this.htUIList){ if(sUIName && !waExceptions.has(sUIName)){ this._enableUI(sUIName); } // if(sUIName) this.oApp.exec("ENABLE_UI", [sUIName]); } // jindo.$Element(this.toolbarArea).removeClass("off"); this.nUIStatus = 1; }, $ON_DISABLE_ALL_UI : function(htOptions){ if(this.nUIStatus === 2){ return; } var sUIName; htOptions = htOptions || {}; var waExceptions = jindo.$A(htOptions.aExceptions || []); var bLeavlActiveLayer = htOptions.bLeaveActiveLayer || false; if(!bLeavlActiveLayer){ this.oApp.exec("HIDE_ACTIVE_LAYER",[]); } for(sUIName in this.htUIList){ if(sUIName && !waExceptions.has(sUIName)){ this._disableUI(sUIName); } // if(sUIName) this.oApp.exec("DISABLE_UI", [sUIName]); } // jindo.$Element(this.toolbarArea).addClass("off"); this.nUIStatus = 2; }, $ON_MSG_STYLE_CHANGED : function(sAttributeName, attributeValue){ if(attributeValue === "@^"){ this.oApp.exec("SELECT_UI", [sAttributeName]); }else{ this.oApp.exec("DESELECT_UI", [sAttributeName]); } }, $ON_POSITION_TOOLBAR_LAYER : function(elLayer, htOption){ var nLayerLeft, nLayerRight, nToolbarLeft, nToolbarRight; elLayer = jindo.$(elLayer); htOption = htOption || {}; var elBtn = jindo.$(htOption.elBtn); var sAlign = htOption.sAlign; var nMargin = -1; if(!elLayer){ return; } if(elBtn && elBtn.tagName && elBtn.tagName == "BUTTON"){ elBtn.parentNode.appendChild(elLayer); } var welLayer = jindo.$Element(elLayer); if(sAlign != "right"){ elLayer.style.left = "0"; nLayerLeft = welLayer.offset().left; nLayerRight = nLayerLeft + elLayer.offsetWidth; nToolbarLeft = this.welToolbarArea.offset().left; nToolbarRight = nToolbarLeft + this.toolbarArea.offsetWidth; if(nLayerRight > nToolbarRight){ welLayer.css("left", (nToolbarRight-nLayerRight-nMargin)+"px"); } if(nLayerLeft < nToolbarLeft){ welLayer.css("left", (nToolbarLeft-nLayerLeft+nMargin)+"px"); } }else{ elLayer.style.right = "0"; nLayerLeft = welLayer.offset().left; nLayerRight = nLayerLeft + elLayer.offsetWidth; nToolbarLeft = this.welToolbarArea.offset().left; nToolbarRight = nToolbarLeft + this.toolbarArea.offsetWidth; if(nLayerRight > nToolbarRight){ welLayer.css("right", -1*(nToolbarRight-nLayerRight-nMargin)+"px"); } if(nLayerLeft < nToolbarLeft){ welLayer.css("right", -1*(nToolbarLeft-nLayerLeft+nMargin)+"px"); } } }, $ON_EVENT_TOOLBAR_MOUSEOVER : function(weEvent){ if(this.nUIStatus === 2){ return; } var aAffectedElements = this._getAffectedElements(weEvent.element); for(var i=0; i<aAffectedElements.length; i++){ if(!aAffectedElements[i].hasClass("active")){ aAffectedElements[i].addClass("hover"); } } }, $ON_EVENT_TOOLBAR_MOUSEOUT : function(weEvent){ if(this.nUIStatus === 2){ return; } var aAffectedElements = this._getAffectedElements(weEvent.element); for(var i=0; i<aAffectedElements.length; i++){ aAffectedElements[i].removeClass("hover"); } }, $ON_EVENT_TOOLBAR_MOUSEDOWN : function(weEvent){ var elTmp = weEvent.element; // Check if the button pressed is in active status and has a visible layer i.e. the button had been clicked and its layer is open already. (buttons like font styles-bold, underline-got no sub layer -> childNodes.length<=2) // -> In this case, do not close here(mousedown). The layer will be closed on "click". If we close the layer here, the click event will open it again because it toggles the visibility. while(elTmp){ if(elTmp.className && elTmp.className.match(/active/) && (elTmp.childNodes.length>2 || elTmp.parentNode.className.match(/se2_pair/))){ return; } elTmp = elTmp.parentNode; } this.oApp.exec("HIDE_ACTIVE_LAYER_IF_NOT_CHILD", [weEvent.element]); }, _enableUI : function(sUIName){ var i, nLen; this.nUIStatus = 0; var welUI = this.htWrappedUIList[sUIName]; var elUI = this.htUIList[sUIName]; if(!welUI){ return; } welUI.removeClass("off"); var aAllBtns = elUI.getElementsByTagName("BUTTON"); for(i=0, nLen=aAllBtns.length; i<nLen; i++){ aAllBtns[i].disabled = false; } // enable related commands var sCmd = ""; if(this.aUICmdMap[sUIName]){ for(i=0; i<this.aUICmdMap[sUIName].length;i++){ sCmd = this.aUICmdMap[sUIName][i]; this.oApp.exec("ENABLE_MESSAGE", [sCmd]); } } }, _disableUI : function(sUIName){ var i, nLen; this.nUIStatus = 0; var welUI = this.htWrappedUIList[sUIName]; var elUI = this.htUIList[sUIName]; if(!welUI){ return; } welUI.addClass("off"); welUI.removeClass("hover"); var aAllBtns = elUI.getElementsByTagName("BUTTON"); for(i=0, nLen=aAllBtns.length; i<nLen; i++){ aAllBtns[i].disabled = true; } // disable related commands var sCmd = ""; if(this.aUICmdMap[sUIName]){ for(i=0; i<this.aUICmdMap[sUIName].length;i++){ sCmd = this.aUICmdMap[sUIName][i]; this.oApp.exec("DISABLE_MESSAGE", [sCmd]); } } }, _getAffectedElements : function(el){ var elLi, welLi; // ๋ฒ„ํŠผ ํด๋ฆญ์‹œ์— return false๋ฅผ ํ•ด ์ฃผ์ง€ ์•Š์œผ๋ฉด chrome์—์„œ ๋ฒ„ํŠผ์ด ํฌ์ปค์Šค ๊ฐ€์ ธ๊ฐ€ ๋ฒ„๋ฆผ. // ์—๋””ํ„ฐ ๋กœ๋”ฉ ์‹œ์— ์ผ๊ด„์ฒ˜๋ฆฌ ํ•  ๊ฒฝ์šฐ ๋กœ๋”ฉ ์†๋„๊ฐ€ ๋А๋ ค์ง์œผ๋กœ hover์‹œ์— ํ•˜๋‚˜์”ฉ ์ฒ˜๋ฆฌ if(!el.bSE2_MDCancelled){ el.bSE2_MDCancelled = true; var aBtns = el.getElementsByTagName("BUTTON"); for(var i=0, nLen=aBtns.length; i<nLen; i++){ aBtns[i].onmousedown = function(){return false;}; } } if(!el || !el.tagName){ return []; } if((elLi = el).tagName == "BUTTON"){ // typical button // <LI> // <BUTTON> if((elLi = elLi.parentNode) && elLi.tagName == "LI" && this.rxUI.test(elLi.className)){ return [jindo.$Element(elLi)]; } // button pair // <LI> // <SPAN> // <BUTTON> // <SPAN> // <BUTTON> elLi = el; if((elLi = elLi.parentNode.parentNode) && elLi.tagName == "LI" && (welLi = jindo.$Element(elLi)).hasClass("se2_pair")){ return [welLi, jindo.$Element(el.parentNode)]; } return []; } // span in a button if((elLi = el).tagName == "SPAN"){ // <LI> // <BUTTON> // <SPAN> if((elLi = elLi.parentNode.parentNode) && elLi.tagName == "LI" && this.rxUI.test(elLi.className)){ return [jindo.$Element(elLi)]; } // <LI> // <SPAN> //๊ธ€๊ฐ๊ณผ ๊ธ€์–‘์‹ if((elLi = elLi.parentNode) && elLi.tagName == "LI" && this.rxUI.test(elLi.className)){ return [jindo.$Element(elLi)]; } } return []; }, /* * ํ…์ŠคํŠธ ํˆด๋ฐ”์˜ ๋ฒ„ํŠผ ๋ผ์šด๋”ฉ ์ฒ˜๋ฆฌ * [MOSS] "[UI๊ฐœ๋ฐœ1ํŒ€] ์Šค๋งˆํŠธ์—๋””ํ„ฐ ํ…์ŠคํŠธํˆด๋ฐ”๋ฒ„ํŠผ ๋ผ์šด๋”ฉ์ฒ˜๋ฆฌ๊ฐ€์ด๋“œ" ์ฐธ๊ณ  * - ๋ฒ„ํŠผ ๋ผ์šด๋“œ ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•œ tool_bg ํด๋ž˜์Šค ์ถ”๊ฐ€๋ฅผ ์œ„ํ•œ ์—˜๋ฆฌ๋จผํŠธ ํƒ์ƒ‰์€ _buttonRound ํด๋ž˜์Šค ์‚ฌ์šฉ (AU ์ถ”๊ฐ€ํด๋ž˜์Šค) */ _setRoundedCornerButton : function(){ var i, nLiLen, elLi, welLi, elSpan, aSingleLi, aFirstLi, aLastLi; aSingleLi = jindo.$$(">ul>li[class*=" + this.sUIClassPrefix + "]:only-child", this.elTextTool); // ๋‹จ๋…ํ˜• ๋ฒ„ํŠผ ์ขŒ/์šฐ์ธก ๋ผ์šด๋“œ ์ฒ˜๋ฆฌ for(i=0, nLiLen=aSingleLi.length; i<nLiLen; i++){ elLi = aSingleLi[i]; welLi = jindo.$Element(elLi); if(welLi.hasClass("husky_seditor_ui_text_more") || welLi.hasClass("husky_seditor_ui_photo_attach") || welLi.hasClass("husky_seditor_ui_map_attach")){ continue; } welLi.addClass("single_child"); jindo.$Element(jindo.$$.getSingle('button>span._buttonRound', elLi)).addClass("tool_bg"); } // ๋ฒ„ํŠผ ์ขŒ์ธก ๋ผ์šด๋“œ ์ฒ˜๋ฆฌ // โ€ป ์ฃผ์˜: ๋”๋ณด๊ธฐ ํ•˜์œ„์˜ ๋ฒ„ํŠผ ๋ผ์šด๋“œ ์ฒ˜๋ฆฌ์˜ ๊ฒฝ์šฐ๋„ ์žˆ์œผ๋ฏ€๋กœ ๋ฐ”๋กœ ํ•˜์œ„ UL์ด ์•„๋‹Œ ๊ฒฝ์šฐ๋„ ์žˆ์Œ aFirstLi = jindo.$$("ul>li[class*=" + this.sUIClassPrefix + "]:first-child", this.elTextTool); for(i=0, nLiLen=aFirstLi.length; i<nLiLen; i++){ elLi = aFirstLi[i]; welLi = jindo.$Element(elLi); if(welLi.hasClass("husky_seditor_ui_fontName") || welLi.hasClass("husky_seditor_ui_text_more") || welLi.hasClass("husky_seditor_ui_photo_attach") || welLi.hasClass("husky_seditor_ui_map_attach") || welLi.hasClass("single_child")){ continue; } welLi.addClass("first_child"); jindo.$Element(jindo.$$.getSingle('button>span._buttonRound', elLi)).addClass("tool_bg"); } // ๋ฒ„ํŠผ ์šฐ์ธก ๋ผ์šด๋“œ ์ฒ˜๋ฆฌ // โ€ป ์ฃผ์˜: ๋”๋ณด๊ธฐ ํ•˜์œ„์˜ ๋ฒ„ํŠผ ๋ผ์šด๋“œ ์ฒ˜๋ฆฌ์˜ ๊ฒฝ์šฐ๋„ ์žˆ์œผ๋ฏ€๋กœ ๋ฐ”๋กœ ํ•˜์œ„ UL์ด ์•„๋‹Œ ๊ฒฝ์šฐ๋„ ์žˆ์Œ aLastLi = jindo.$$("ul>li[class*=" + this.sUIClassPrefix + "]:last-child", this.elTextTool); for(i=0, nLiLen=aLastLi.length; i<nLiLen; i++){ elLi = aLastLi[i]; welLi = jindo.$Element(elLi); if(welLi.hasClass("husky_seditor_ui_fontSize") || welLi.hasClass("husky_seditor_ui_text_more") || welLi.hasClass("husky_seditor_ui_photo_attach") || welLi.hasClass("husky_seditor_ui_map_attach") || welLi.hasClass("single_child")){ continue; } welLi.addClass("last_child"); jindo.$Element(jindo.$$.getSingle('button>span._buttonRound', elLi)).addClass("tool_bg"); } }, $ON_REGISTER_UI_EVENT : function(sUIName, sEvent, sCmd, aParams){ //[SMARTEDITORSUS-966][IE8 ํ‘œ์ค€/IE 10] ํ˜ธํ™˜ ๋ชจ๋“œ๋ฅผ ์ œ๊ฑฐํ•˜๊ณ  ์‚ฌ์ง„ ์ฒจ๋ถ€ ์‹œ ์—๋””ํŒ… ์˜์—ญ์˜ // ์ปค์„œ ์ฃผ์œ„์— <sub><sup> ํƒœ๊ทธ๊ฐ€ ๋ถ™์–ด์„œ ๊ธ€์ž๊ฐ€ ๋งค์šฐ ์ž‘๊ฒŒ ๋˜๋Š” ํ˜„์ƒ //์›์ธ : ์•„๋ž˜์˜ [SMARTEDITORSUS-901] ์ˆ˜์ • ๋‚ด์šฉ์—์„œ ์œ—์ฒจ์ž ์•„๋žซ์ฒจ์ž ์ด๋ฒคํŠธ ๋“ฑ๋ก ์‹œ //ํ•ด๋‹น ํ”Œ๋Ÿฌ๊ทธ์ธ์ด ๋งˆํฌ์—…์— ์—†์œผ๋ฉด this.htUIList์— ์กด์žฌํ•˜์ง€ ์•Š์•„ getsingle ์‚ฌ์šฉ์‹œ ์‚ฌ์ง„์ฒจ๋ถ€์— ์ด๋ฒคํŠธ๊ฐ€ ๊ฑธ๋ ธ์Œ //ํ•ด๊ฒฐ : this.htUIList์— ์กด์žฌํ•˜์ง€ ์•Š์œผ๋ฉด ์ด๋ฒคํŠธ๋ฅผ ๋“ฑ๋กํ•˜์ง€ ์•Š์Œ if(!this.htUIList[sUIName]){ return; } // map cmd & ui var elButton; if(!this.aUICmdMap[sUIName]){this.aUICmdMap[sUIName] = [];} this.aUICmdMap[sUIName][this.aUICmdMap[sUIName].length] = sCmd; //[SMARTEDITORSUS-901]ํ”Œ๋Ÿฌ๊ทธ์ธ ํƒœ๊ทธ ์ฝ”๋“œ ์ถ”๊ฐ€ ์‹œ <li>ํƒœ๊ทธ์™€<button>ํƒœ๊ทธ ์‚ฌ์ด์— ๊ฐœํ–‰์ด ์žˆ์œผ๋ฉด ์ด๋ฒคํŠธ๊ฐ€ ๋“ฑ๋ก๋˜์ง€ ์•Š๋Š” ํ˜„์ƒ //์›์ธ : IE9, Chrome, FF, Safari ์—์„œ๋Š” ํƒœ๊ทธ๋ฅผ ๊ฐœํ–‰ ์‹œ ๊ทธ ๊ฐœํ–‰์„ text node๋กœ ์ธ์‹ํ•˜์—ฌ firstchild๊ฐ€ text ๋…ธ๋“œ๊ฐ€ ๋˜์–ด ๋ฒ„ํŠผ ์ด๋ฒคํŠธ๊ฐ€ ํ• ๋‹น๋˜์ง€ ์•Š์Œ //ํ•ด๊ฒฐ : firstchild์— ์ด๋ฒคํŠธ๋ฅผ ๊ฑฐ๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ, child ์ค‘ button ์ธ ๊ฒƒ์— ์ด๋ฒคํŠธ๋ฅผ ๊ฑธ๋„๋ก ๋ณ€๊ฒฝ elButton = jindo.$$.getSingle('button', this.htUIList[sUIName]); if(!elButton){return;} this.oApp.registerBrowserEvent(elButton, sEvent, sCmd, aParams); }, getToolbarButtonByUIName : function(sUIName){ return jindo.$$.getSingle("BUTTON", this.htUIList[sUIName]); } }); //} //{ /** * @fileOverview This file contains Husky plugin that takes care of the operations related to changing the editing mode using a Button element * @name hp_SE2M_EditingModeChanger.js */ nhn.husky.SE2M_EditingModeChanger = jindo.$Class({ name : "SE2M_EditingModeChanger", htConversionMode : null, $init : function(elAppContainer, htConversionMode){ this.htConversionMode = htConversionMode; this._assignHTMLElements(elAppContainer); }, _assignHTMLElements : function(elAppContainer){ elAppContainer = jindo.$(elAppContainer) || document; //@ec[ this.elWYSIWYGButton = jindo.$$.getSingle("BUTTON.se2_to_editor", elAppContainer); this.elHTMLSrcButton = jindo.$$.getSingle("BUTTON.se2_to_html", elAppContainer); this.elTEXTButton = jindo.$$.getSingle("BUTTON.se2_to_text", elAppContainer); this.elModeToolbar = jindo.$$.getSingle("DIV.se2_conversion_mode", elAppContainer); //@ec] this.welWYSIWYGButtonLi = jindo.$Element(this.elWYSIWYGButton.parentNode); this.welHTMLSrcButtonLi = jindo.$Element(this.elHTMLSrcButton.parentNode); this.welTEXTButtonLi = jindo.$Element(this.elTEXTButton.parentNode); }, $BEFORE_MSG_APP_READY : function(){ this.oApp.exec("ADD_APP_PROPERTY", ["isUseModeChanger", jindo.$Fn(this.isUseModeChanger, this).bind()]); }, $ON_MSG_APP_READY : function(){ this.oApp.registerBrowserEvent(this.elWYSIWYGButton, "click", "EVENT_CHANGE_EDITING_MODE_CLICKED", ["WYSIWYG"]); this.oApp.registerBrowserEvent(this.elHTMLSrcButton, "click", "EVENT_CHANGE_EDITING_MODE_CLICKED", ["HTMLSrc"]); this.oApp.registerBrowserEvent(this.elTEXTButton, "click", "EVENT_CHANGE_EDITING_MODE_CLICKED", ["TEXT", false]); this.showModeChanger(); if(this.isUseModeChanger() === false && this.oApp.isUseVerticalResizer() === false){ this.elModeToolbar.style.display = "none"; } }, // [SMARTEDITORSUS-906][SMARTEDITORSUS-1433] Editing Mode ์‚ฌ์šฉ ์—ฌ๋ถ€ ์ฒ˜๋ฆฌ (true:์‚ฌ์šฉํ•จ/ false:์‚ฌ์šฉํ•˜์ง€ ์•Š์Œ) showModeChanger : function(){ if(this.isUseModeChanger()){ this.elWYSIWYGButton.style.display = 'block'; this.elHTMLSrcButton.style.display = 'block'; this.elTEXTButton.style.display = 'block'; }else{ this.elWYSIWYGButton.style.display = 'none'; this.elHTMLSrcButton.style.display = 'none'; this.elTEXTButton.style.display = 'none'; } }, isUseModeChanger : function(){ return (typeof(this.htConversionMode) === 'undefined' || typeof(this.htConversionMode.bUseModeChanger) === 'undefined' || this.htConversionMode.bUseModeChanger === true) ? true : false; }, $ON_EVENT_CHANGE_EDITING_MODE_CLICKED : function(sMode, bNoAlertMsg){ if (sMode == 'TEXT') { //์—๋””ํ„ฐ ์˜์—ญ ๋‚ด์— ๋ชจ๋“  ๋‚ด์šฉ ๊ฐ€์ ธ์˜ด. var sContent = this.oApp.getIR(); // ๋‚ด์šฉ์ด ์žˆ์œผ๋ฉด ๊ฒฝ๊ณ ์ฐฝ ๋„์šฐ๊ธฐ if (sContent.length > 0 && !bNoAlertMsg) { if ( !confirm(this.oApp.$MSG("SE2M_EditingModeChanger.confirmTextMode")) ) { return false; } } this.oApp.exec("CHANGE_EDITING_MODE", [sMode]); }else{ this.oApp.exec("CHANGE_EDITING_MODE", [sMode]); } if ('HTMLSrc' == sMode) { this.oApp.exec('MSG_NOTIFY_CLICKCR', ['htmlmode']); } else if ('TEXT' == sMode) { this.oApp.exec('MSG_NOTIFY_CLICKCR', ['textmode']); } else { this.oApp.exec('MSG_NOTIFY_CLICKCR', ['editormode']); } }, $ON_DISABLE_ALL_UI : function(htOptions){ htOptions = htOptions || {}; var waExceptions = jindo.$A(htOptions.aExceptions || []); if(waExceptions.has("mode_switcher")){ return; } if(this.oApp.getEditingMode() == "WYSIWYG"){ this.welWYSIWYGButtonLi.removeClass("active"); this.elHTMLSrcButton.disabled = true; this.elTEXTButton.disabled = true; } else if (this.oApp.getEditingMode() == 'TEXT') { this.welTEXTButtonLi.removeClass("active"); this.elWYSIWYGButton.disabled = true; this.elHTMLSrcButton.disabled = true; }else{ this.welHTMLSrcButtonLi.removeClass("active"); this.elWYSIWYGButton.disabled = true; this.elTEXTButton.disabled = true; } }, $ON_ENABLE_ALL_UI : function(){ if(this.oApp.getEditingMode() == "WYSIWYG"){ this.welWYSIWYGButtonLi.addClass("active"); this.elHTMLSrcButton.disabled = false; this.elTEXTButton.disabled = false; } else if (this.oApp.getEditingMode() == 'TEXT') { this.welTEXTButtonLi.addClass("active"); this.elWYSIWYGButton.disabled = false; this.elHTMLSrcButton.disabled = false; }else{ this.welHTMLSrcButtonLi.addClass("active"); this.elWYSIWYGButton.disabled = false; this.elTEXTButton.disabled = false; } }, $ON_CHANGE_EDITING_MODE : function(sMode){ if(sMode == "HTMLSrc"){ this.welWYSIWYGButtonLi.removeClass("active"); this.welHTMLSrcButtonLi.addClass("active"); this.welTEXTButtonLi.removeClass("active"); this.elWYSIWYGButton.disabled = false; this.elHTMLSrcButton.disabled = true; this.elTEXTButton.disabled = false; this.oApp.exec("HIDE_ALL_DIALOG_LAYER"); this.oApp.exec("DISABLE_ALL_UI", [{aExceptions:["mode_switcher"]}]); } else if (sMode == 'TEXT') { this.welWYSIWYGButtonLi.removeClass("active"); this.welHTMLSrcButtonLi.removeClass("active"); this.welTEXTButtonLi.addClass("active"); this.elWYSIWYGButton.disabled = false; this.elHTMLSrcButton.disabled = false; this.elTEXTButton.disabled = true; this.oApp.exec("HIDE_ALL_DIALOG_LAYER"); this.oApp.exec("DISABLE_ALL_UI", [{aExceptions:["mode_switcher"]}]); }else{ this.welWYSIWYGButtonLi.addClass("active"); this.welHTMLSrcButtonLi.removeClass("active"); this.welTEXTButtonLi.removeClass("active"); this.elWYSIWYGButton.disabled = true; this.elHTMLSrcButton.disabled = false; this.elTEXTButton.disabled = false; this.oApp.exec("RESET_STYLE_STATUS"); this.oApp.exec("ENABLE_ALL_UI", []); } } }); //} /*[ * LOAD_CONTENTS_FIELD * * ์—๋””ํ„ฐ ์ดˆ๊ธฐํ™” ์‹œ์— ๋„˜์–ด์˜จ Contents(DB ์ €์žฅ ๊ฐ’)ํ•„๋“œ๋ฅผ ์ฝ์–ด ์—๋””ํ„ฐ์— ์„ค์ •ํ•œ๋‹ค. * * bDontAddUndo boolean Contents๋ฅผ ์„ค์ •ํ•˜๋ฉด์„œ UNDO ํžˆ์Šคํ† ๋ฆฌ๋Š” ์ถ”๊ฐ€ ํ•˜์ง€์•Š๋Š”๋‹ค. * ---------------------------------------------------------------------------]*/ /*[ * UPDATE_IR_FIELD * * ์—๋””ํ„ฐ์˜ IR๊ฐ’์„ IRํ•„๋“œ์— ์„ค์ • ํ•œ๋‹ค. * * none * ---------------------------------------------------------------------------]*/ /*[ * CHANGE_EDITING_MODE * * ์—๋””ํ„ฐ์˜ ํŽธ์ง‘ ๋ชจ๋“œ๋ฅผ ๋ณ€๊ฒฝํ•œ๋‹ค. * * sMode string ์ „ํ™˜ ํ•  ๋ชจ๋“œ๋ช… * bNoFocus boolean ๋ชจ๋“œ ์ „ํ™˜ ํ›„์— ์—๋””ํ„ฐ์— ํฌ์ปค์Šค๋ฅผ ๊ฐ•์ œ๋กœ ํ• ๋‹นํ•˜์ง€ ์•Š๋Š”๋‹ค. * ---------------------------------------------------------------------------]*/ /*[ * FOCUS * * ์—๋””ํ„ฐ ํŽธ์ง‘ ์˜์—ญ์— ํฌ์ปค์Šค๋ฅผ ์ค€๋‹ค. * * none * ---------------------------------------------------------------------------]*/ /*[ * SET_IR * * IR๊ฐ’์„ ์—๋””ํ„ฐ์— ์„ค์ • ํ•œ๋‹ค. * * none * ---------------------------------------------------------------------------]*/ /*[ * REGISTER_EDITING_AREA * * ํŽธ์ง‘ ์˜์—ญ์„ ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ๋“ฑ๋ก ์‹œํ‚จ๋‹ค. ์›ํ™œํ•œ ๋ชจ๋“œ ์ „ํ™˜๊ณผ IR๊ฐ’ ๊ณต์œ ๋“ฑ๋ฅผ ์œ„ํ•ด์„œ ์ดˆ๊ธฐํ™” ์‹œ์— ๋“ฑ๋ก์ด ํ•„์š”ํ•˜๋‹ค. * * oEditingAreaPlugin object ํŽธ์ง‘ ์˜์—ญ ํ”Œ๋Ÿฌ๊ทธ์ธ ์ธ์Šคํ„ด์Šค * ---------------------------------------------------------------------------]*/ /*[ * MSG_EDITING_AREA_RESIZE_STARTED * * ํŽธ์ง‘ ์˜์—ญ ์‚ฌ์ด์ฆˆ ์กฐ์ ˆ์ด ์‹œ์ž‘ ๋˜์—ˆ์Œ์„ ์•Œ๋ฆฌ๋Š” ๋ฉ”์‹œ์ง€. * * none * ---------------------------------------------------------------------------]*/ /*[ * RESIZE_EDITING_AREA * * ํŽธ์ง‘ ์˜์—ญ ์‚ฌ์ด์ฆˆ๋ฅผ ์„ค์ • ํ•œ๋‹ค. ๋ณ€๊ฒฝ ์ „ํ›„์— MSG_EDITIING_AREA_RESIZE_STARTED/MSG_EDITING_AREA_RESIZE_ENED๋ฅผ ๋ฐœ์ƒ ์‹œ์ผœ ์ค˜์•ผ ๋œ๋‹ค. * * ipNewWidth number ์ƒˆ ํญ * ipNewHeight number ์ƒˆ ๋†’์ด * ---------------------------------------------------------------------------]*/ /*[ * RESIZE_EDITING_AREA_BY * * ํŽธ์ง‘ ์˜์—ญ ์‚ฌ์ด์ฆˆ๋ฅผ ๋Š˜๋ฆฌ๊ฑฐ๋‚˜ ์ค„์ธ๋‹ค. ๋ณ€๊ฒฝ ์ „ํ›„์— MSG_EDITIING_AREA_RESIZE_STARTED/MSG_EDITING_AREA_RESIZE_ENED๋ฅผ ๋ฐœ์ƒ ์‹œ์ผœ ์ค˜์•ผ ๋œ๋‹ค. * ๋ณ€๊ฒฝ์น˜๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ์›๋ž˜ ์‚ฌ์ด์ฆˆ์—์„œ ๋ณ€๊ฒฝํ•˜์—ฌ px๋กœ ์ ์šฉํ•˜๋ฉฐ, width๊ฐ€ %๋กœ ์„ค์ •๋œ ๊ฒฝ์šฐ์—๋Š” ํญ ๋ณ€๊ฒฝ์น˜๊ฐ€ ์ž…๋ ฅ๋˜์–ด๋„ ์ ์šฉ๋˜์ง€ ์•Š๋Š”๋‹ค. * * ipWidthChange number ํญ ๋ณ€๊ฒฝ์น˜ * ipHeightChange number ๋†’์ด ๋ณ€๊ฒฝ์น˜ * ---------------------------------------------------------------------------]*/ /*[ * MSG_EDITING_AREA_RESIZE_ENDED * * ํŽธ์ง‘ ์˜์—ญ ์‚ฌ์ด์ฆˆ ์กฐ์ ˆ์ด ๋๋‚ฌ์Œ์„ ์•Œ๋ฆฌ๋Š” ๋ฉ”์‹œ์ง€. * * none * ---------------------------------------------------------------------------]*/ /** * @pluginDesc IR ๊ฐ’๊ณผ ๋ณต์ˆ˜๊ฐœ์˜ ํŽธ์ง‘ ์˜์—ญ์„ ๊ด€๋ฆฌํ•˜๋Š” ํ”Œ๋Ÿฌ๊ทธ์ธ */ nhn.husky.SE_EditingAreaManager = jindo.$Class({ name : "SE_EditingAreaManager", // Currently active plugin instance(SE_EditingArea_???) oActivePlugin : null, // Intermediate Representation of the content being edited. // This should be a textarea element. elContentsField : null, bIsDirty : false, bAutoResize : false, // [SMARTEDITORSUS-677] ์—๋””ํ„ฐ์˜ ์ž๋™ํ™•์žฅ ๊ธฐ๋Šฅ On/Off ์—ฌ๋ถ€ $init : function(sDefaultEditingMode, elContentsField, oDimension, fOnBeforeUnload, elAppContainer){ this.sDefaultEditingMode = sDefaultEditingMode; this.elContentsField = jindo.$(elContentsField); this._assignHTMLElements(elAppContainer); this.fOnBeforeUnload = fOnBeforeUnload; this.oEditingMode = {}; this.elContentsField.style.display = "none"; this.nMinWidth = parseInt((oDimension.nMinWidth || 60), 10); this.nMinHeight = parseInt((oDimension.nMinHeight || 60), 10); var oWidth = this._getSize([oDimension.nWidth, oDimension.width, this.elEditingAreaContainer.offsetWidth], this.nMinWidth); var oHeight = this._getSize([oDimension.nHeight, oDimension.height, this.elEditingAreaContainer.offsetHeight], this.nMinHeight); this.elEditingAreaContainer.style.width = oWidth.nSize + oWidth.sUnit; this.elEditingAreaContainer.style.height = oHeight.nSize + oHeight.sUnit; if(oWidth.sUnit === "px"){ elAppContainer.style.width = (oWidth.nSize + 2) + "px"; }else if(oWidth.sUnit === "%"){ elAppContainer.style.minWidth = this.nMinWidth + "px"; } }, _getSize : function(aSize, nMin){ var i, nLen, aRxResult, nSize, sUnit, sDefaultUnit = "px"; nMin = parseInt(nMin, 10); for(i=0, nLen=aSize.length; i<nLen; i++){ if(!aSize[i]){ continue; } if(!isNaN(aSize[i])){ nSize = parseInt(aSize[i], 10); sUnit = sDefaultUnit; break; } aRxResult = /([0-9]+)(.*)/i.exec(aSize[i]); if(!aRxResult || aRxResult.length < 2 || aRxResult[1] <= 0){ continue; } nSize = parseInt(aRxResult[1], 10); sUnit = aRxResult[2]; if(!sUnit){ sUnit = sDefaultUnit; } if(nSize < nMin && sUnit === sDefaultUnit){ nSize = nMin; } break; } if(!sUnit){ sUnit = sDefaultUnit; } if(isNaN(nSize) || (nSize < nMin && sUnit === sDefaultUnit)){ nSize = nMin; } return {nSize : nSize, sUnit : sUnit}; }, _assignHTMLElements : function(elAppContainer){ //@ec[ this.elEditingAreaContainer = jindo.$$.getSingle("DIV.husky_seditor_editing_area_container", elAppContainer); //@ec] // [SMARTEDITORSUS-1585] this.toolbarArea = jindo.$$.getSingle(".se2_tool", elAppContainer); // --[SMARTEDITORSUS-1585] }, $BEFORE_MSG_APP_READY : function(msg){ this.oApp.exec("ADD_APP_PROPERTY", ["elEditingAreaContainer", this.elEditingAreaContainer]); this.oApp.exec("ADD_APP_PROPERTY", ["welEditingAreaContainer", jindo.$Element(this.elEditingAreaContainer)]); this.oApp.exec("ADD_APP_PROPERTY", ["getEditingAreaHeight", jindo.$Fn(this.getEditingAreaHeight, this).bind()]); this.oApp.exec("ADD_APP_PROPERTY", ["getEditingAreaWidth", jindo.$Fn(this.getEditingAreaWidth, this).bind()]); this.oApp.exec("ADD_APP_PROPERTY", ["getRawContents", jindo.$Fn(this.getRawContents, this).bind()]); this.oApp.exec("ADD_APP_PROPERTY", ["getContents", jindo.$Fn(this.getContents, this).bind()]); this.oApp.exec("ADD_APP_PROPERTY", ["getIR", jindo.$Fn(this.getIR, this).bind()]); this.oApp.exec("ADD_APP_PROPERTY", ["setContents", this.setContents]); this.oApp.exec("ADD_APP_PROPERTY", ["setIR", this.setIR]); this.oApp.exec("ADD_APP_PROPERTY", ["getEditingMode", jindo.$Fn(this.getEditingMode, this).bind()]); }, $ON_MSG_APP_READY : function(){ this.htOptions = this.oApp.htOptions[this.name] || {}; this.sDefaultEditingMode = this.htOptions["sDefaultEditingMode"] || this.sDefaultEditingMode; this.iframeWindow = this.oApp.getWYSIWYGWindow(); this.oApp.exec("REGISTER_CONVERTERS", []); this.oApp.exec("CHANGE_EDITING_MODE", [this.sDefaultEditingMode, true]); this.oApp.exec("LOAD_CONTENTS_FIELD", [false]); //[SMARTEDITORSUS-1327] IE 7/8์—์„œ ALT+0์œผ๋กœ ํŒ์—… ๋„์šฐ๊ณ  escํด๋ฆญ์‹œ ํŒ์—…์ฐฝ ๋‹ซํžˆ๊ฒŒ ํ•˜๋ ค๋ฉด ์•„๋ž˜ ๋ถ€๋ถ„ ๊ผญ ํ•„์š”ํ•จ. this.oApp.exec("REGISTER_HOTKEY", ["esc", "CLOSE_LAYER_POPUP", [], document]); if(!!this.fOnBeforeUnload){ window.onbeforeunload = this.fOnBeforeUnload; }else{ window.onbeforeunload = jindo.$Fn(function(){ // [SMARTEDITORSUS-1028][SMARTEDITORSUS-1517] QuickEditor ์„ค์ • API ๊ฐœ์„ ์œผ๋กœ, submit ์ดํ›„ ๋ฐœ์ƒํ•˜๊ฒŒ ๋˜๋Š” beforeunload ์ด๋ฒคํŠธ ํ•ธ๋“ค๋ง ์ œ๊ฑฐ //this.oApp.exec("MSG_BEFOREUNLOAD_FIRED"); // --// [SMARTEDITORSUS-1028][SMARTEDITORSUS-1517] //if(this.getContents() != this.elContentsField.value || this.bIsDirty){ if(this.getRawContents() != this.sCurrentRawContents || this.bIsDirty){ return this.oApp.$MSG("SE_EditingAreaManager.onExit"); } }, this).bind(); } }, $ON_CLOSE_LAYER_POPUP : function() { this.oApp.exec("ENABLE_ALL_UI"); // ๋ชจ๋“  UI ํ™œ์„ฑํ™”. this.oApp.exec("DESELECT_UI", ["helpPopup"]); this.oApp.exec("HIDE_ALL_DIALOG_LAYER", []); this.oApp.exec("HIDE_EDITING_AREA_COVER"); // ํŽธ์ง‘ ์˜์—ญ ํ™œ์„ฑํ™”. this.oApp.exec("FOCUS"); }, $AFTER_MSG_APP_READY : function(){ this.oApp.exec("UPDATE_RAW_CONTENTS"); if(!!this.oApp.htOptions[this.name] && this.oApp.htOptions[this.name].bAutoResize){ this.bAutoResize = this.oApp.htOptions[this.name].bAutoResize; } this.startAutoResize(); // [SMARTEDITORSUS-677] ํŽธ์ง‘์˜์—ญ ์ž๋™ ํ™•์žฅ ์˜ต์…˜์ด TRUE์ด๋ฉด ์ž๋™ํ™•์žฅ ์‹œ์ž‘ }, $ON_LOAD_CONTENTS_FIELD : function(bDontAddUndo){ var sContentsFieldValue = this.elContentsField.value; // [SMARTEDITORSUS-177] [IE9] ๊ธ€ ์“ฐ๊ธฐ, ์ˆ˜์ • ์‹œ์— elContentsField ์— ๋“ค์–ด๊ฐ„ ๊ณต๋ฐฑ์„ ์ œ๊ฑฐ // [SMARTEDITORSUS-312] [FF4] ์ธ์šฉ๊ตฌ ์ฒซ๋ฒˆ์งธ,๋‘๋ฒˆ์งธ ๋””์ž์ธ 1ํšŒ ์„ ํƒ ์‹œ ์—๋””ํ„ฐ์— ์ ์šฉ๋˜์ง€ ์•Š์Œ sContentsFieldValue = sContentsFieldValue.replace(/^\s+/, ""); this.oApp.exec("SET_CONTENTS", [sContentsFieldValue, bDontAddUndo]); }, // ํ˜„์žฌ contents๋ฅผ form์˜ textarea์— ์„ธํŒ… ํ•ด ์คŒ. // form submit ์ „์— ์ด ๋ถ€๋ถ„์„ ์‹คํ–‰์‹œ์ผœ์•ผ ๋จ. $ON_UPDATE_CONTENTS_FIELD : function(){ //this.oIRField.value = this.oApp.getIR(); this.elContentsField.value = this.oApp.getContents(); this.oApp.exec("UPDATE_RAW_CONTENTS"); //this.sCurrentRawContents = this.elContentsField.value; }, // ์—๋””ํ„ฐ์˜ ํ˜„์žฌ ์ƒํƒœ๋ฅผ ๊ธฐ์–ตํ•ด ๋‘ . ํŽ˜์ด์ง€๋ฅผ ๋– ๋‚  ๋•Œ ์ด ๊ฐ’์ด ๋ณ€๊ฒฝ ๋๋Š”์ง€ ํ™•์ธ ํ•ด์„œ ๋‚ด์šฉ์ด ๋ณ€๊ฒฝ ๋๋‹ค๋Š” ๊ฒฝ๊ณ ์ฐฝ์„ ๋„์›€ // RawContents ๋Œ€์‹  contents๋ฅผ ์ด์šฉํ•ด๋„ ๋˜์ง€๋งŒ, contents ํš๋“์„ ์œ„ํ•ด์„œ๋Š” ๋ณ€ํ™˜๊ธฐ๋ฅผ ์‹คํ–‰ํ•ด์•ผ ๋˜๊ธฐ ๋•Œ๋ฌธ์— RawContents ์ด์šฉ $ON_UPDATE_RAW_CONTENTS : function(){ this.sCurrentRawContents = this.oApp.getRawContents(); }, $BEFORE_CHANGE_EDITING_MODE : function(sMode){ if(!this.oEditingMode[sMode]){ return false; } this.stopAutoResize(); // [SMARTEDITORSUS-677] ํ•ด๋‹น ํŽธ์ง‘ ๋ชจ๋“œ์—์„œ์˜ ์ž๋™ํ™•์žฅ์„ ์ค‘์ง€ํ•จ this._oPrevActivePlugin = this.oActivePlugin; this.oActivePlugin = this.oEditingMode[sMode]; }, $AFTER_CHANGE_EDITING_MODE : function(sMode, bNoFocus){ if(this._oPrevActivePlugin){ var sIR = this._oPrevActivePlugin.getIR(); this.oApp.exec("SET_IR", [sIR]); //this.oApp.exec("ENABLE_UI", [this._oPrevActivePlugin.sMode]); this._setEditingAreaDimension(); } //this.oApp.exec("DISABLE_UI", [this.oActivePlugin.sMode]); this.startAutoResize(); // [SMARTEDITORSUS-677] ๋ณ€๊ฒฝ๋œ ํŽธ์ง‘ ๋ชจ๋“œ์—์„œ์˜ ์ž๋™ํ™•์žฅ์„ ์‹œ์ž‘ if(!bNoFocus){ this.oApp.delayedExec("FOCUS", [], 0); } }, /** * ํŽ˜์ด์ง€๋ฅผ ๋– ๋‚  ๋•Œ alert์„ ํ‘œ์‹œํ• ์ง€ ์—ฌ๋ถ€๋ฅผ ์…‹ํŒ…ํ•˜๋Š” ํ•จ์ˆ˜. */ $ON_SET_IS_DIRTY : function(bIsDirty){ this.bIsDirty = bIsDirty; }, $ON_FOCUS : function(){ if(!this.oActivePlugin || typeof this.oActivePlugin.setIR != "function"){ return; } // [SMARTEDITORSUS-599] ipad ๋Œ€์‘ ์ด์Šˆ. // ios5์—์„œ๋Š” this.iframe.contentWindow focus๊ฐ€ ์—†์–ด์„œ ์ƒ๊ธด ์ด์Šˆ. // document๊ฐ€ ์•„๋‹Œ window์— focus() ์ฃผ์–ด์•ผ๋งŒ ๋ณธ๋ฌธ์— focus๊ฐ€ ๊ฐ€๊ณ  ์ž…๋ ฅ์ด๋จ. //[SMARTEDITORSUS-1017] [iOS5๋Œ€์‘] ๋ชจ๋“œ ์ „ํ™˜ ์‹œ textarea์— ํฌ์ปค์Šค๊ฐ€ ์žˆ์–ด๋„ ๊ธ€์ž๊ฐ€ ์ž…๋ ฅ์ด ์•ˆ๋˜๋Š” ํ˜„์ƒ //์›์ธ : WYSIWYG๋ชจ๋“œ๊ฐ€ ์•„๋‹ ๋•Œ์—๋„ iframe์˜ contentWindow์— focus๊ฐ€ ๊ฐ€๋ฉด์„œ focus๊ธฐ๋Šฅ์ด ์ž‘๋™ํ•˜์ง€ ์•Š์Œ //ํ•ด๊ฒฐ : WYSIWYG๋ชจ๋“œ ์ผ๋•Œ๋งŒ ์‹คํ–‰ ๋˜๋„๋ก ์กฐ๊ฑด์‹ ์ถ”๊ฐ€ ๋ฐ ๊ธฐ์กด์— blur์ฒ˜๋ฆฌ ์ฝ”๋“œ ์‚ญ์ œ //[SMARTEDITORSUS-1594] ํฌ๋กฌ์—์„œ ์›น์ ‘๊ทผ์„ฑ์šฉ ํ‚ค๋กœ ๋น ์ ธ๋‚˜๊ฐ„ ํ›„ ๋‹ค์‹œ ์ง„์ž…์‹œ ๊ฐ„ํ˜น ํฌ์ปค์‹ฑ์ด ์•ˆ๋˜๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์–ด iframe์— ํฌ์ปค์‹ฑ์„ ๋จผ์ € ์ฃผ๋„๋ก ์ˆ˜์ • if(!!this.iframeWindow && this.iframeWindow.document.hasFocus && !this.iframeWindow.document.hasFocus() && this.oActivePlugin.sMode == "WYSIWYG"){ this.iframeWindow.focus(); } this.oActivePlugin.focus(); }, $ON_IE_FOCUS : function(){ if(!this.oApp.oNavigator.ie){ return; } this.oApp.exec("FOCUS"); }, $ON_SET_CONTENTS : function(sContents, bDontAddUndoHistory){ this.setContents(sContents, bDontAddUndoHistory); }, $BEFORE_SET_IR : function(sIR, bDontAddUndoHistory){ bDontAddUndoHistory = bDontAddUndoHistory || false; if(!bDontAddUndoHistory){ this.oApp.exec("RECORD_UNDO_ACTION", ["BEFORE SET CONTENTS", {sSaveTarget:"BODY"}]); } }, $ON_SET_IR : function(sIR){ if(!this.oActivePlugin || typeof this.oActivePlugin.setIR != "function"){ return; } this.oActivePlugin.setIR(sIR); }, $AFTER_SET_IR : function(sIR, bDontAddUndoHistory){ bDontAddUndoHistory = bDontAddUndoHistory || false; if(!bDontAddUndoHistory){ this.oApp.exec("RECORD_UNDO_ACTION", ["AFTER SET CONTENTS", {sSaveTarget:"BODY"}]); } }, $ON_REGISTER_EDITING_AREA : function(oEditingAreaPlugin){ this.oEditingMode[oEditingAreaPlugin.sMode] = oEditingAreaPlugin; if(oEditingAreaPlugin.sMode == 'WYSIWYG'){ this.attachDocumentEvents(oEditingAreaPlugin.oEditingArea); } this._setEditingAreaDimension(oEditingAreaPlugin); }, $ON_MSG_EDITING_AREA_RESIZE_STARTED : function(){ // [SMARTEDITORSUS-1585] ๊ธ€๊ฐ, ๊ธ€์–‘์‹, ๊ธ€์žฅ์‹์„ ์—ด์—ˆ์„ ๋•Œ ๋ฆฌ์‚ฌ์ด์ง•์ด ๋ฐœ์ƒํ•˜๋ฉด ์ปค๋ฒ„์šฉ ๋ ˆ์ด์–ด๊ฐ€ ์‚ฌ๋ผ์ง€๋Š” ๋ฌธ์ œ ๊ฐœ์„  this._isLayerReasonablyShown = false; var elSelectedUI = jindo.$$.getSingle("ul[class^='se2_itool']>li.active", this.toolbarArea, {oneTimeOffCache : true}); if(elSelectedUI){ var elSelectedUIParent = elSelectedUI.parentNode; } // ๊ธ€๊ฐ ๋ฒ„ํŠผ์„ ํฌํ•จํ•œ ๋ถ€๋ชจ๋Š” ul.se2_itool2, ๊ธ€์žฅ์‹, ๊ธ€์–‘์‹ ๋ฒ„ํŠผ์„ ํฌํ•จํ•œ ๋ถ€๋ชจ๋Š” ul.se2_itool4 if(elSelectedUIParent && (elSelectedUIParent.className == "se2_itool2" || elSelectedUIParent.className == "se2_itool4")){ this._isLayerReasonablyShown = true; } // --[SMARTEDITORSUS-1585] this._fitElementInEditingArea(this.elEditingAreaContainer); this.oApp.exec("STOP_AUTORESIZE_EDITING_AREA"); // [SMARTEDITORSUS-677] ์‚ฌ์šฉ์ž๊ฐ€ ํŽธ์ง‘์˜์—ญ ์‚ฌ์ด์ฆˆ๋ฅผ ๋ณ€๊ฒฝํ•˜๋ฉด ์ž๋™ํ™•์žฅ ๊ธฐ๋Šฅ ์ค‘์ง€ this.oApp.exec("SHOW_EDITING_AREA_COVER"); this.elEditingAreaContainer.style.overflow = "hidden"; // this.elResizingBoard.style.display = "block"; this.iStartingHeight = parseInt(this.elEditingAreaContainer.style.height, 10); }, /** * [SMARTEDITORSUS-677] ํŽธ์ง‘์˜์—ญ ์ž๋™ํ™•์žฅ ๊ธฐ๋Šฅ์„ ์ค‘์ง€ํ•จ */ $ON_STOP_AUTORESIZE_EDITING_AREA : function(){ if(!this.bAutoResize){ return; } this.stopAutoResize(); this.bAutoResize = false; }, /** * [SMARTEDITORSUS-677] ํ•ด๋‹น ํŽธ์ง‘ ๋ชจ๋“œ์—์„œ์˜ ์ž๋™ํ™•์žฅ์„ ์‹œ์ž‘ํ•จ */ startAutoResize : function(){ if(!this.bAutoResize || !this.oActivePlugin || typeof this.oActivePlugin.startAutoResize != "function"){ return; } this.oActivePlugin.startAutoResize(); }, /** * [SMARTEDITORSUS-677] ํ•ด๋‹น ํŽธ์ง‘ ๋ชจ๋“œ์—์„œ์˜ ์ž๋™ํ™•์žฅ์„ ์ค‘์ง€ํ•จ */ stopAutoResize : function(){ if(!this.bAutoResize || !this.oActivePlugin || typeof this.oActivePlugin.stopAutoResize != "function"){ return; } this.oActivePlugin.stopAutoResize(); }, $ON_RESIZE_EDITING_AREA: function(ipNewWidth, ipNewHeight){ if(ipNewWidth !== null && typeof ipNewWidth !== "undefined"){ this._resizeWidth(ipNewWidth, "px"); } if(ipNewHeight !== null && typeof ipNewHeight !== "undefined"){ this._resizeHeight(ipNewHeight, "px"); } this._fitElementInEditingArea(this.elResizingBoard); this._setEditingAreaDimension(); }, _resizeWidth : function(ipNewWidth, sUnit){ var iNewWidth = parseInt(ipNewWidth, 10); if(iNewWidth < this.nMinWidth){ iNewWidth = this.nMinWidth; } if(ipNewWidth){ this.elEditingAreaContainer.style.width = iNewWidth + sUnit; } }, _resizeHeight : function(ipNewHeight, sUnit){ var iNewHeight = parseInt(ipNewHeight, 10); if(iNewHeight < this.nMinHeight){ iNewHeight = this.nMinHeight; } if(ipNewHeight){ this.elEditingAreaContainer.style.height = iNewHeight + sUnit; } }, $ON_RESIZE_EDITING_AREA_BY : function(ipWidthChange, ipHeightChange){ var iWidthChange = parseInt(ipWidthChange, 10); var iHeightChange = parseInt(ipHeightChange, 10); var iWidth; var iHeight; if(ipWidthChange !== 0 && this.elEditingAreaContainer.style.width.indexOf("%") === -1){ iWidth = this.elEditingAreaContainer.style.width?parseInt(this.elEditingAreaContainer.style.width, 10)+iWidthChange:null; } if(iHeightChange !== 0){ iHeight = this.elEditingAreaContainer.style.height?this.iStartingHeight+iHeightChange:null; } if(!ipWidthChange && !iHeightChange){ return; } this.oApp.exec("RESIZE_EDITING_AREA", [iWidth, iHeight]); }, $ON_MSG_EDITING_AREA_RESIZE_ENDED : function(FnMouseDown, FnMouseMove, FnMouseUp){ // [SMARTEDITORSUS-1585] ๊ธ€๊ฐ, ๊ธ€์–‘์‹, ๊ธ€์žฅ์‹์„ ์—ด์—ˆ์„ ๋•Œ ๋ฆฌ์‚ฌ์ด์ง•์ด ๋ฐœ์ƒํ•˜๋ฉด ์ปค๋ฒ„์šฉ ๋ ˆ์ด์–ด๊ฐ€ ์‚ฌ๋ผ์ง€๋Š” ๋ฌธ์ œ ๊ฐœ์„  if(!this._isLayerReasonablyShown){ this.oApp.exec("HIDE_EDITING_AREA_COVER"); } // --[SMARTEDITORSUS-1585] this.elEditingAreaContainer.style.overflow = ""; // this.elResizingBoard.style.display = "none"; this._setEditingAreaDimension(); }, $ON_SHOW_EDITING_AREA_COVER : function(){ // this.elEditingAreaContainer.style.overflow = "hidden"; if(!this.elResizingBoard){ this.createCoverDiv(); } this.elResizingBoard.style.display = "block"; }, $ON_HIDE_EDITING_AREA_COVER : function(){ // this.elEditingAreaContainer.style.overflow = ""; if(!this.elResizingBoard){ return; } this.elResizingBoard.style.display = "none"; }, $ON_KEEP_WITHIN_EDITINGAREA : function(elLayer, nHeight){ var nTop = parseInt(elLayer.style.top, 10); if(nTop + elLayer.offsetHeight > this.oApp.elEditingAreaContainer.offsetHeight){ if(typeof nHeight == "number"){ elLayer.style.top = nTop - elLayer.offsetHeight - nHeight + "px"; }else{ elLayer.style.top = this.oApp.elEditingAreaContainer.offsetHeight - elLayer.offsetHeight + "px"; } } var nLeft = parseInt(elLayer.style.left, 10); if(nLeft + elLayer.offsetWidth > this.oApp.elEditingAreaContainer.offsetWidth){ elLayer.style.left = this.oApp.elEditingAreaContainer.offsetWidth - elLayer.offsetWidth + "px"; } }, $ON_EVENT_EDITING_AREA_KEYDOWN : function(){ this.oApp.exec("HIDE_ACTIVE_LAYER", []); }, $ON_EVENT_EDITING_AREA_MOUSEDOWN : function(){ this.oApp.exec("HIDE_ACTIVE_LAYER", []); }, $ON_EVENT_EDITING_AREA_SCROLL : function(){ this.oApp.exec("HIDE_ACTIVE_LAYER", []); }, _setEditingAreaDimension : function(oEditingAreaPlugin){ oEditingAreaPlugin = oEditingAreaPlugin || this.oActivePlugin; this._fitElementInEditingArea(oEditingAreaPlugin.elEditingArea); }, _fitElementInEditingArea : function(el){ el.style.height = this.elEditingAreaContainer.offsetHeight+"px"; // el.style.width = this.elEditingAreaContainer.offsetWidth+"px"; // el.style.width = this.elEditingAreaContainer.style.width || (this.elEditingAreaContainer.offsetWidth+"px"); }, attachDocumentEvents : function(doc){ this.oApp.registerBrowserEvent(doc, "click", "EVENT_EDITING_AREA_CLICK"); this.oApp.registerBrowserEvent(doc, "dblclick", "EVENT_EDITING_AREA_DBLCLICK"); this.oApp.registerBrowserEvent(doc, "mousedown", "EVENT_EDITING_AREA_MOUSEDOWN"); this.oApp.registerBrowserEvent(doc, "mousemove", "EVENT_EDITING_AREA_MOUSEMOVE"); this.oApp.registerBrowserEvent(doc, "mouseup", "EVENT_EDITING_AREA_MOUSEUP"); this.oApp.registerBrowserEvent(doc, "mouseout", "EVENT_EDITING_AREA_MOUSEOUT"); this.oApp.registerBrowserEvent(doc, "mousewheel", "EVENT_EDITING_AREA_MOUSEWHEEL"); this.oApp.registerBrowserEvent(doc, "keydown", "EVENT_EDITING_AREA_KEYDOWN"); this.oApp.registerBrowserEvent(doc, "keypress", "EVENT_EDITING_AREA_KEYPRESS"); this.oApp.registerBrowserEvent(doc, "keyup", "EVENT_EDITING_AREA_KEYUP"); this.oApp.registerBrowserEvent(doc, "scroll", "EVENT_EDITING_AREA_SCROLL"); }, createCoverDiv : function(){ this.elResizingBoard = document.createElement("DIV"); this.elEditingAreaContainer.insertBefore(this.elResizingBoard, this.elEditingAreaContainer.firstChild); this.elResizingBoard.style.position = "absolute"; this.elResizingBoard.style.background = "#000000"; this.elResizingBoard.style.zIndex=100; this.elResizingBoard.style.border=1; this.elResizingBoard.style["opacity"] = 0.0; this.elResizingBoard.style.filter="alpha(opacity=0.0)"; this.elResizingBoard.style["MozOpacity"]=0.0; this.elResizingBoard.style["-moz-opacity"] = 0.0; this.elResizingBoard.style["-khtml-opacity"] = 0.0; this._fitElementInEditingArea(this.elResizingBoard); this.elResizingBoard.style.width = this.elEditingAreaContainer.offsetWidth+"px"; this.elResizingBoard.style.display = "none"; }, $ON_GET_COVER_DIV : function(sAttr,oReturn){ if(!!this.elResizingBoard) { oReturn[sAttr] = this.elResizingBoard; } }, getIR : function(){ if(!this.oActivePlugin){ return ""; } return this.oActivePlugin.getIR(); }, setIR : function(sIR, bDontAddUndo){ this.oApp.exec("SET_IR", [sIR, bDontAddUndo]); }, getRawContents : function(){ if(!this.oActivePlugin){ return ""; } return this.oActivePlugin.getRawContents(); }, getContents : function(){ var sIR = this.oApp.getIR(); var sContents; if(this.oApp.applyConverter){ sContents = this.oApp.applyConverter("IR_TO_DB", sIR, this.oApp.getWYSIWYGDocument()); }else{ sContents = sIR; } sContents = this._cleanContents(sContents); return sContents; }, _cleanContents : function(sContents){ return sContents.replace(new RegExp("(<img [^>]*>)"+unescape("%uFEFF")+"", "ig"), "$1"); }, setContents : function(sContents, bDontAddUndo){ var sIR; if(this.oApp.applyConverter){ sIR = this.oApp.applyConverter("DB_TO_IR", sContents, this.oApp.getWYSIWYGDocument()); }else{ sIR = sContents; } this.oApp.exec("SET_IR", [sIR, bDontAddUndo]); }, getEditingMode : function(){ return this.oActivePlugin.sMode; }, getEditingAreaWidth : function(){ return this.elEditingAreaContainer.offsetWidth; }, getEditingAreaHeight : function(){ return this.elEditingAreaContainer.offsetHeight; } }); //{ /** * @fileOverview This file contains Husky plugin that takes care of the operations related to resizing the editing area vertically * @name hp_SE_EditingAreaVerticalResizer.js */ nhn.husky.SE_EditingAreaVerticalResizer = jindo.$Class({ name : "SE_EditingAreaVerticalResizer", oResizeGrip : null, sCookieNotice : "bHideResizeNotice", nEditingAreaMinHeight : null, // [SMARTEDITORSUS-677] ํŽธ์ง‘ ์˜์—ญ์˜ ์ตœ์†Œ ๋†’์ด htConversionMode : null, $init : function(elAppContainer, htConversionMode){ this.htConversionMode = htConversionMode; this._assignHTMLElements(elAppContainer); }, $BEFORE_MSG_APP_READY : function(){ this.oApp.exec("ADD_APP_PROPERTY", ["isUseVerticalResizer", jindo.$Fn(this.isUseVerticalResizer, this).bind()]); }, $ON_MSG_APP_READY : function(){ //[SMARTEDITORSUS-941][iOS5๋Œ€์‘]์•„์ดํŒจ๋“œ์˜ ์ž๋™ ํ™•์žฅ ๊ธฐ๋Šฅ์ด ๋™์ž‘ํ•˜์ง€ ์•Š์„ ๋•Œ ์—๋””ํ„ฐ ์ฐฝ๋ณด๋‹ค ๊ธด ๋‚ด์šฉ์„ ์ž‘์„ฑํ•˜๋ฉด ์—๋””ํ„ฐ๋ฅผ ๋šซ๊ณ  ๋‚˜์˜ค๋Š” ํ˜„์ƒ //์›์ธ : ์ž๋™ํ™•์žฅ ๊ธฐ๋Šฅ์ด ์ •์ง€ ๋  ๊ฒฝ์šฐ iframe์— ์Šคํฌ๋กค์ด ์ƒ๊ธฐ์ง€ ์•Š๊ณ , ์ฐฝ์„ ๋šซ๊ณ  ๋‚˜์˜ด //ํ•ด๊ฒฐ : ํ•ญ์ƒ ์ž๋™ํ™•์žฅ ๊ธฐ๋Šฅ์ด ์ผœ์ ธ์žˆ๋„๋ก ๋ณ€๊ฒฝ. ์ž๋™ ํ™•์žฅ ๊ธฐ๋Šฅ ๊ด€๋ จํ•œ ์ด๋ฒคํŠธ ์ฝ”๋“œ๋„ ๋ชจ๋ฐ”์ผ ์‚ฌํŒŒ๋ฆฌ์—์„œ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ if(jindo.$Agent().navigator().msafari){ jindo.$Element(this.oResizeGrip).first().text('์ž…๋ ฅ์ฐฝ ๋†’์ด ์ž๋™ ์กฐ์ • ๋ฐ”'); this.oResizeGrip.disabled = true; return; } this.$FnMouseDown = jindo.$Fn(this._mousedown, this); this.$FnMouseMove = jindo.$Fn(this._mousemove, this); this.$FnMouseUp = jindo.$Fn(this._mouseup, this); this.$FnMouseOver = jindo.$Fn(this._mouseover, this); this.$FnMouseOut = jindo.$Fn(this._mouseout, this); this.$FnMouseDown.attach(this.oResizeGrip, "mousedown"); this.$FnMouseOver.attach(this.oResizeGrip, "mouseover"); this.$FnMouseOut.attach(this.oResizeGrip, "mouseout"); this.oApp.exec("REGISTER_HOTKEY", ["shift+esc", "FOCUS_RESIZER"]); this.oApp.exec("ADD_APP_PROPERTY", ["checkResizeGripPosition", jindo.$Fn(this.checkResizeGripPosition, this).bind()]); // [SMARTEDITORSUS-677] if(!!this.welNoticeLayer && !Number(jindo.$Cookie().get(this.sCookieNotice))){ this.welNoticeLayer.delegate("click", "BUTTON.bt_clse", jindo.$Fn(this._closeNotice, this).bind()); this.welNoticeLayer.show(); } if(!!this.oApp.getEditingAreaHeight){ this.nEditingAreaMinHeight = this.oApp.getEditingAreaHeight(); // [SMARTEDITORSUS-677] ํŽธ์ง‘ ์˜์—ญ์˜ ์ตœ์†Œ ๋†’์ด๋ฅผ ๊ฐ€์ ธ์™€ Gap ์ฒ˜๋ฆฌ ์‹œ ์‚ฌ์šฉ } this.showVerticalResizer(); if(this.isUseVerticalResizer() === false && this.oApp.isUseModeChanger() === false){ this.elModeToolbar.style.display = "none"; } }, // [SMARTEDITORSUS-906][SMARTEDITORSUS-1433] Resizbar ์‚ฌ์šฉ ์—ฌ๋ถ€ ์ฒ˜๋ฆฌ (true:์‚ฌ์šฉํ•จ/ false:์‚ฌ์šฉํ•˜์ง€ ์•Š์Œ) showVerticalResizer : function(){ if(this.isUseVerticalResizer()){ this.oResizeGrip.style.display = 'block'; }else{ this.oResizeGrip.style.display = 'none'; } }, isUseVerticalResizer : function(){ return (typeof(this.htConversionMode) === 'undefined' || typeof(this.htConversionMode.bUseVerticalResizer) === 'undefined' || this.htConversionMode.bUseVerticalResizer === true) ? true : false; }, /** * [SMARTEDITORSUS-677] [์—๋””ํ„ฐ ์ž๋™ํ™•์žฅ ON์ธ ๊ฒฝ์šฐ] * ์ž…๋ ฅ์ฐฝ ํฌ๊ธฐ ์กฐ์ ˆ ๋ฐ”์˜ ์œ„์น˜๋ฅผ ํ™•์ธํ•˜์—ฌ ๋ธŒ๋ผ์šฐ์ € ํ•˜๋‹จ์— ์œ„์น˜ํ•œ ๊ฒฝ์šฐ ์ž๋™ํ™•์žฅ์„ ๋ฉˆ์ถค */ checkResizeGripPosition : function(bExpand){ var oDocument = jindo.$Document(); var nGap = (jindo.$Element(this.oResizeGrip).offset().top - oDocument.scrollPosition().top + 25) - oDocument.clientSize().height; if(nGap <= 0){ return; } if(bExpand){ if(this.nEditingAreaMinHeight > this.oApp.getEditingAreaHeight() - nGap){ // [SMARTEDITORSUS-822] ์ˆ˜์ • ๋ชจ๋“œ์ธ ๊ฒฝ์šฐ์— ๋Œ€๋น„ nGap = (-1) * (this.nEditingAreaMinHeight - this.oApp.getEditingAreaHeight()); } // Gap ๋งŒํผ ํŽธ์ง‘์˜์—ญ ์‚ฌ์ด์ฆˆ๋ฅผ ์กฐ์ ˆํ•˜์—ฌ // ์‚ฌ์ง„ ์ฒจ๋ถ€๋‚˜ ๋ถ™์—ฌ๋„ฃ๊ธฐ ๋“ฑ์˜ ์‚ฌ์ด์ฆˆ๊ฐ€ ํฐ ๋‚ด์šฉ ์ถ”๊ฐ€๊ฐ€ ์žˆ์—ˆ์„ ๋•Œ ์ž…๋ ฅ์ฐฝ ํฌ๊ธฐ ์กฐ์ ˆ ๋ฐ”๊ฐ€ ์ˆจ๊ฒจ์ง€์ง€ ์•Š๋„๋ก ํ•จ this.oApp.exec("MSG_EDITING_AREA_RESIZE_STARTED"); this.oApp.exec("RESIZE_EDITING_AREA_BY", [0, (-1) * nGap]); this.oApp.exec("MSG_EDITING_AREA_RESIZE_ENDED"); } this.oApp.exec("STOP_AUTORESIZE_EDITING_AREA"); }, $ON_FOCUS_RESIZER : function(){ this.oApp.exec("IE_HIDE_CURSOR"); this.oResizeGrip.focus(); }, _assignHTMLElements : function(elAppContainer, htConversionMode){ //@ec[ this.oResizeGrip = jindo.$$.getSingle("BUTTON.husky_seditor_editingArea_verticalResizer", elAppContainer); this.elModeToolbar = jindo.$$.getSingle("DIV.se2_conversion_mode", elAppContainer); //@ec] this.welNoticeLayer = jindo.$Element(jindo.$$.getSingle("DIV.husky_seditor_resize_notice", elAppContainer)); this.welConversionMode = jindo.$Element(this.oResizeGrip.parentNode); }, _mouseover : function(oEvent){ oEvent.stopBubble(); this.welConversionMode.addClass("controller_on"); }, _mouseout : function(oEvent){ oEvent.stopBubble(); this.welConversionMode.removeClass("controller_on"); }, _mousedown : function(oEvent){ this.iStartHeight = oEvent.pos().clientY; this.iStartHeightOffset = oEvent.pos().layerY; this.$FnMouseMove.attach(document, "mousemove"); this.$FnMouseUp.attach(document, "mouseup"); this.iStartHeight = oEvent.pos().clientY; this.oApp.exec("HIDE_ACTIVE_LAYER"); this.oApp.exec("HIDE_ALL_DIALOG_LAYER"); this.oApp.exec("MSG_EDITING_AREA_RESIZE_STARTED", [this.$FnMouseDown, this.$FnMouseMove, this.$FnMouseUp]); }, _mousemove : function(oEvent){ var iHeightChange = oEvent.pos().clientY - this.iStartHeight; this.oApp.exec("RESIZE_EDITING_AREA_BY", [0, iHeightChange]); }, _mouseup : function(oEvent){ this.$FnMouseMove.detach(document, "mousemove"); this.$FnMouseUp.detach(document, "mouseup"); this.oApp.exec("MSG_EDITING_AREA_RESIZE_ENDED", [this.$FnMouseDown, this.$FnMouseMove, this.$FnMouseUp]); }, _closeNotice : function(){ this.welNoticeLayer.hide(); jindo.$Cookie().set(this.sCookieNotice, 1, 365*10); } }); //} //{ /** * @fileOverview This file contains Husky plugin that takes care of the operations directly related to editing the HTML source code using Textarea element * @name hp_SE_EditingArea_HTMLSrc.js * @required SE_EditingAreaManager */ nhn.husky.SE_EditingArea_HTMLSrc = jindo.$Class({ name : "SE_EditingArea_HTMLSrc", sMode : "HTMLSrc", bAutoResize : false, // [SMARTEDITORSUS-677] ํ•ด๋‹น ํŽธ์ง‘๋ชจ๋“œ์˜ ์ž๋™ํ™•์žฅ ๊ธฐ๋Šฅ On/Off ์—ฌ๋ถ€ nMinHeight : null, // [SMARTEDITORSUS-677] ํŽธ์ง‘ ์˜์—ญ์˜ ์ตœ์†Œ ๋†’์ด $init : function(sTextArea) { this.elEditingArea = jindo.$(sTextArea); }, $BEFORE_MSG_APP_READY : function() { this.oNavigator = jindo.$Agent().navigator(); this.oApp.exec("REGISTER_EDITING_AREA", [this]); }, $ON_MSG_APP_READY : function() { if(!!this.oApp.getEditingAreaHeight){ this.nMinHeight = this.oApp.getEditingAreaHeight(); // [SMARTEDITORSUS-677] ํŽธ์ง‘ ์˜์—ญ์˜ ์ตœ์†Œ ๋†’์ด๋ฅผ ๊ฐ€์ ธ์™€ ์ž๋™ ํ™•์žฅ ์ฒ˜๋ฆฌ๋ฅผ ํ•  ๋•Œ ์‚ฌ์šฉ } }, $ON_CHANGE_EDITING_MODE : function(sMode) { if (sMode == this.sMode) { this.elEditingArea.style.display = "block"; } else { this.elEditingArea.style.display = "none"; } }, $AFTER_CHANGE_EDITING_MODE : function(sMode, bNoFocus) { if (sMode == this.sMode && !bNoFocus) { var o = new TextRange(this.elEditingArea); o.setSelection(0, 0); //[SMARTEDITORSUS-1017] [iOS5๋Œ€์‘] ๋ชจ๋“œ ์ „ํ™˜ ์‹œ textarea์— ํฌ์ปค์Šค๊ฐ€ ์žˆ์–ด๋„ ๊ธ€์ž๊ฐ€ ์ž…๋ ฅ์ด ์•ˆ๋˜๋Š” ํ˜„์ƒ //์›์ธ : WYSIWYG๋ชจ๋“œ๊ฐ€ ์•„๋‹ ๋•Œ์—๋„ iframe์˜ contentWindow์— focus๊ฐ€ ๊ฐ€๋ฉด์„œ focus๊ธฐ๋Šฅ์ด ์ž‘๋™ํ•˜์ง€ ์•Š์Œ //ํ•ด๊ฒฐ : WYSIWYG๋ชจ๋“œ ์ผ๋•Œ๋งŒ ์‹คํ–‰ ๋˜๋„๋ก ์กฐ๊ฑด์‹ ์ถ”๊ฐ€ ๋ฐ ๊ธฐ์กด์— blur์ฒ˜๋ฆฌ ์ฝ”๋“œ ์‚ญ์ œ //๋ชจ๋ฐ”์ผ textarea์—์„œ๋Š” ์ง์ ‘ ํด๋ฆญ์„ํ•ด์•ผ๋งŒ ํ‚ค๋ณด๋“œ๊ฐ€ ๋จนํžˆ๊ธฐ ๋•Œ๋ฌธ์— ์šฐ์„ ์€ ์ปค์„œ๊ฐ€ ์•ˆ๋ณด์ด๊ฒŒ ํ•ด์„œ ์‚ฌ์šฉ์ž๊ฐ€ ์ง์ ‘ ํด๋ฆญ์„ ์œ ๋„. // if(!!this.oNavigator.msafari){ // this.elEditingArea.blur(); // } } }, /** * [SMARTEDITORSUS-677] HTML ํŽธ์ง‘ ์˜์—ญ ์ž๋™ ํ™•์žฅ ์ฒ˜๋ฆฌ ์‹œ์ž‘ */ startAutoResize : function(){ var htOption = { nMinHeight : this.nMinHeight, wfnCallback : jindo.$Fn(this.oApp.checkResizeGripPosition, this).bind() }; //[SMARTEDITORSUS-941][iOS5๋Œ€์‘]์•„์ดํŒจ๋“œ์˜ ์ž๋™ ํ™•์žฅ ๊ธฐ๋Šฅ์ด ๋™์ž‘ํ•˜์ง€ ์•Š์„ ๋•Œ ์—๋””ํ„ฐ ์ฐฝ๋ณด๋‹ค ๊ธด ๋‚ด์šฉ์„ ์ž‘์„ฑํ•˜๋ฉด ์—๋””ํ„ฐ๋ฅผ ๋šซ๊ณ  ๋‚˜์˜ค๋Š” ํ˜„์ƒ //์›์ธ : ์ž๋™ํ™•์žฅ ๊ธฐ๋Šฅ์ด ์ •์ง€ ๋  ๊ฒฝ์šฐ iframe์— ์Šคํฌ๋กค์ด ์ƒ๊ธฐ์ง€ ์•Š๊ณ , ์ฐฝ์„ ๋šซ๊ณ  ๋‚˜์˜ด //ํ•ด๊ฒฐ : ํ•ญ์ƒ ์ž๋™ํ™•์žฅ ๊ธฐ๋Šฅ์ด ์ผœ์ ธ์žˆ๋„๋ก ๋ณ€๊ฒฝ. ์ž๋™ ํ™•์žฅ ๊ธฐ๋Šฅ ๊ด€๋ จํ•œ ์ด๋ฒคํŠธ ์ฝ”๋“œ๋„ ๋ชจ๋ฐ”์ผ ์‚ฌํŒŒ๋ฆฌ์—์„œ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ if(this.oNavigator.msafari){ htOption.wfnCallback = function(){}; } this.bAutoResize = true; this.AutoResizer = new nhn.husky.AutoResizer(this.elEditingArea, htOption); this.AutoResizer.bind(); }, /** * [SMARTEDITORSUS-677] HTML ํŽธ์ง‘ ์˜์—ญ ์ž๋™ ํ™•์žฅ ์ฒ˜๋ฆฌ ์ข…๋ฃŒ */ stopAutoResize : function(){ this.AutoResizer.unbind(); }, getIR : function() { var sIR = this.getRawContents(); if (this.oApp.applyConverter) { sIR = this.oApp.applyConverter(this.sMode + "_TO_IR", sIR, this.oApp.getWYSIWYGDocument()); } return sIR; }, setIR : function(sIR) { if(sIR.toLowerCase() === "<br>" || sIR.toLowerCase() === "<p>&nbsp;</p>" || sIR.toLowerCase() === "<p><br></p>" || sIR.toLowerCase() === "<p></p>"){ sIR=""; } // [SMARTEDITORSUS-1589] ๋ฌธ์„œ ๋ชจ๋“œ๊ฐ€ Edge์ธ IE11์—์„œ WYSIWYG ๋ชจ๋“œ์™€ HTML ๋ชจ๋“œ ์ „ํ™˜ ์‹œ, ๋ฌธ๋ง์— ๋ฌด์˜๋ฏธํ•œ <br> ๋‘ ๊ฐœ๊ฐ€ ์ฒจ๊ฐ€๋˜๋Š” ํ˜„์ƒ์œผ๋กœ ํ•„ํ„ฐ๋ง ์ถ”๊ฐ€ var htBrowser = jindo.$Agent().navigator(); if(htBrowser.ie && htBrowser.nativeVersion == 11 && document.documentMode == 11){ // Edge ๋ชจ๋“œ์˜ documentMode ๊ฐ’์€ 11 sIR = sIR.replace(/(<br><br>$)/, ""); } // --[SMARTEDITORSUS-1589] var sContent = sIR; if (this.oApp.applyConverter) { sContent = this.oApp.applyConverter("IR_TO_" + this.sMode, sContent, this.oApp.getWYSIWYGDocument()); } this.setRawContents(sContent); }, setRawContents : function(sContent) { if (typeof sContent !== 'undefined') { this.elEditingArea.value = sContent; } }, getRawContents : function() { return this.elEditingArea.value; }, focus : function() { this.elEditingArea.focus(); } }); /** * Selection for textfield * @author hooriza */ if (typeof window.TextRange == 'undefined') { window.TextRange = {}; } TextRange = function(oEl, oDoc) { this._o = oEl; this._oDoc = (oDoc || document); }; TextRange.prototype.getSelection = function() { var obj = this._o; var ret = [-1, -1]; if(isNaN(this._o.selectionStart)) { obj.focus(); // textarea support added by nagoon97 var range = this._oDoc.body.createTextRange(); var rangeField = null; rangeField = this._oDoc.selection.createRange().duplicate(); range.moveToElementText(obj); rangeField.collapse(true); range.setEndPoint("EndToEnd", rangeField); ret[0] = range.text.length; rangeField = this._oDoc.selection.createRange().duplicate(); range.moveToElementText(obj); rangeField.collapse(false); range.setEndPoint("EndToEnd", rangeField); ret[1] = range.text.length; obj.blur(); } else { ret[0] = obj.selectionStart; ret[1] = obj.selectionEnd; } return ret; }; TextRange.prototype.setSelection = function(start, end) { var obj = this._o; if (typeof end == 'undefined') { end = start; } if (obj.setSelectionRange) { obj.setSelectionRange(start, end); } else if (obj.createTextRange) { var range = obj.createTextRange(); range.collapse(true); range.moveStart("character", start); range.moveEnd("character", end - start); range.select(); obj.blur(); } }; TextRange.prototype.copy = function() { var r = this.getSelection(); return this._o.value.substring(r[0], r[1]); }; TextRange.prototype.paste = function(sStr) { var obj = this._o; var sel = this.getSelection(); var value = obj.value; var pre = value.substr(0, sel[0]); var post = value.substr(sel[1]); value = pre + sStr + post; obj.value = value; var n = 0; if (typeof this._oDoc.body.style.maxHeight == "undefined") { var a = pre.match(/\n/gi); n = ( a !== null ? a.length : 0 ); } this.setSelection(sel[0] + sStr.length - n); }; TextRange.prototype.cut = function() { var r = this.copy(); this.paste(''); return r; }; //} /** * @fileOverview This file contains Husky plugin that takes care of the operations directly related to editing the HTML source code using Textarea element * @name hp_SE_EditingArea_TEXT.js * @required SE_EditingAreaManager */ nhn.husky.SE_EditingArea_TEXT = jindo.$Class({ name : "SE_EditingArea_TEXT", sMode : "TEXT", sRxConverter : '@[0-9]+@', bAutoResize : false, // [SMARTEDITORSUS-677] ํ•ด๋‹น ํŽธ์ง‘๋ชจ๋“œ์˜ ์ž๋™ํ™•์žฅ ๊ธฐ๋Šฅ On/Off ์—ฌ๋ถ€ nMinHeight : null, // [SMARTEDITORSUS-677] ํŽธ์ง‘ ์˜์—ญ์˜ ์ตœ์†Œ ๋†’์ด $init : function(sTextArea) { this.elEditingArea = jindo.$(sTextArea); }, $BEFORE_MSG_APP_READY : function() { this.oNavigator = jindo.$Agent().navigator(); this.oApp.exec("REGISTER_EDITING_AREA", [this]); this.oApp.exec("ADD_APP_PROPERTY", ["getTextAreaContents", jindo.$Fn(this.getRawContents, this).bind()]); }, $ON_MSG_APP_READY : function() { if(!!this.oApp.getEditingAreaHeight){ this.nMinHeight = this.oApp.getEditingAreaHeight(); // [SMARTEDITORSUS-677] ํŽธ์ง‘ ์˜์—ญ์˜ ์ตœ์†Œ ๋†’์ด๋ฅผ ๊ฐ€์ ธ์™€ ์ž๋™ ํ™•์žฅ ์ฒ˜๋ฆฌ๋ฅผ ํ•  ๋•Œ ์‚ฌ์šฉ } }, $ON_REGISTER_CONVERTERS : function() { this.oApp.exec("ADD_CONVERTER", ["IR_TO_TEXT", jindo.$Fn(this.irToText, this).bind()]); this.oApp.exec("ADD_CONVERTER", ["TEXT_TO_IR", jindo.$Fn(this.textToIr, this).bind()]); }, $ON_CHANGE_EDITING_MODE : function(sMode) { if (sMode == this.sMode) { this.elEditingArea.style.display = "block"; } else { this.elEditingArea.style.display = "none"; } }, $AFTER_CHANGE_EDITING_MODE : function(sMode, bNoFocus) { if (sMode == this.sMode && !bNoFocus) { var o = new TextRange(this.elEditingArea); o.setSelection(0, 0); } //[SMARTEDITORSUS-1017] [iOS5๋Œ€์‘] ๋ชจ๋“œ ์ „ํ™˜ ์‹œ textarea์— ํฌ์ปค์Šค๊ฐ€ ์žˆ์–ด๋„ ๊ธ€์ž๊ฐ€ ์ž…๋ ฅ์ด ์•ˆ๋˜๋Š” ํ˜„์ƒ //์›์ธ : WYSIWYG๋ชจ๋“œ๊ฐ€ ์•„๋‹ ๋•Œ์—๋„ iframe์˜ contentWindow์— focus๊ฐ€ ๊ฐ€๋ฉด์„œ focus๊ธฐ๋Šฅ์ด ์ž‘๋™ํ•˜์ง€ ์•Š์Œ //ํ•ด๊ฒฐ : WYSIWYG๋ชจ๋“œ ์ผ๋•Œ๋งŒ ์‹คํ–‰ ๋˜๋„๋ก ์กฐ๊ฑด์‹ ์ถ”๊ฐ€ ๋ฐ ๊ธฐ์กด์— blur์ฒ˜๋ฆฌ ์ฝ”๋“œ ์‚ญ์ œ //๋ชจ๋ฐ”์ผ textarea์—์„œ๋Š” ์ง์ ‘ ํด๋ฆญ์„ํ•ด์•ผ๋งŒ ํ‚ค๋ณด๋“œ๊ฐ€ ๋จนํžˆ๊ธฐ ๋•Œ๋ฌธ์— ์šฐ์„ ์€ ์ปค์„œ๊ฐ€ ์•ˆ๋ณด์ด๊ฒŒ ํ•ด์„œ ์‚ฌ์šฉ์ž๊ฐ€ ์ง์ ‘ ํด๋ฆญ์„ ์œ ๋„. // if(!!this.oNavigator.msafari){ // this.elEditingArea.blur(); // } }, irToText : function(sHtml) { var sContent = sHtml, nIdx = 0; var aTemp = sContent.match(new RegExp(this.sRxConverter)); // applyConverter์—์„œ ์ถ”๊ฐ€ํ•œ sTmpStr๋ฅผ ์ž ์‹œ ์ œ๊ฑฐํ•ด์ค€๋‹ค. if (aTemp !== null) { sContent = sContent.replace(new RegExp(this.sRxConverter), ""); } //0.์•ˆ๋ณด์ด๋Š” ๊ฐ’๋“ค์— ๋Œ€ํ•œ ์ •๋ฆฌ. (์—๋””ํ„ฐ ๋ชจ๋“œ์— view์™€ text๋ชจ๋“œ์˜ view๋ฅผ ๋™์ผํ•˜๊ฒŒ ํ•ด์ฃผ๊ธฐ ์œ„ํ•ด์„œ) sContent = sContent.replace(/\r/g, '');// MS์—‘์…€ ํ…Œ์ด๋ธ”์—์„œ tr๋ณ„๋กœ ๋ถ„๋ฆฌํ•ด์ฃผ๋Š” ์—ญํ• ์ด\r์ด๊ธฐ ๋•Œ๋ฌธ์— text๋ชจ๋“œ๋กœ ๋ณ€๊ฒฝ์‹œ์— ๊ฐ€๋…์„ฑ์„ ์œ„ํ•ด \r ์ œ๊ฑฐํ•˜๋Š” ๊ฒƒ์€ ์ž„์‹œ ๋ณด๋ฅ˜. - 11.01.28 by cielo sContent = sContent.replace(/[\n|\t]/g, ''); // ๊ฐœํ–‰๋ฌธ์ž, ์•ˆ๋ณด์ด๋Š” ๊ณต๋ฐฑ ์ œ๊ฑฐ sContent = sContent.replace(/[\v|\f]/g, ''); // ๊ฐœํ–‰๋ฌธ์ž, ์•ˆ๋ณด์ด๋Š” ๊ณต๋ฐฑ ์ œ๊ฑฐ //1. ๋จผ์ €, ๋นˆ ๋ผ์ธ ์ฒ˜๋ฆฌ . sContent = sContent.replace(/<p><br><\/p>/gi, '\n'); sContent = sContent.replace(/<P>&nbsp;<\/P>/gi, '\n'); //2. ๋นˆ ๋ผ์ธ ์ด์™ธ์— linebreak ์ฒ˜๋ฆฌ. sContent = sContent.replace(/<br(\s)*\/?>/gi, '\n'); // br ํƒœ๊ทธ๋ฅผ ๊ฐœํ–‰๋ฌธ์ž๋กœ sContent = sContent.replace(/<br(\s[^\/]*)?>/gi, '\n'); // br ํƒœ๊ทธ๋ฅผ ๊ฐœํ–‰๋ฌธ์ž๋กœ sContent = sContent.replace(/<\/p(\s[^\/]*)?>/gi, '\n'); // p ํƒœ๊ทธ๋ฅผ ๊ฐœํ–‰๋ฌธ์ž๋กœ sContent = sContent.replace(/<\/li(\s[^\/]*)?>/gi, '\n'); // li ํƒœ๊ทธ๋ฅผ ๊ฐœํ–‰๋ฌธ์ž๋กœ [SMARTEDITORSUS-107]๊ฐœํ–‰ ์ถ”๊ฐ€ sContent = sContent.replace(/<\/tr(\s[^\/]*)?>/gi, '\n'); // tr ํƒœ๊ทธ๋ฅผ ๊ฐœํ–‰๋ฌธ์ž๋กœ [SMARTEDITORSUS-107]๊ฐœํ–‰ ์ถ”๊ฐ€ // ๋งˆ์ง€๋ง‰ \n์€ ๋กœ์ง์ƒ ๋ถˆํ•„์š”ํ•œ linebreak๋ฅผ ์ œ๊ณตํ•˜๋ฏ€๋กœ ์ œ๊ฑฐํ•ด์ค€๋‹ค. nIdx = sContent.lastIndexOf('\n'); if (nIdx > -1 && sContent.substring(nIdx) == '\n') { sContent = sContent.substring(0, nIdx); } sContent = jindo.$S(sContent).stripTags().toString(); sContent = this.unhtmlSpecialChars(sContent); if (aTemp !== null) { // ์ œ๊ฑฐํ–ˆ๋˜sTmpStr๋ฅผ ์ถ”๊ฐ€ํ•ด์ค€๋‹ค. sContent = aTemp[0] + sContent; } return sContent; }, textToIr : function(sHtml) { if (!sHtml) { return; } var sContent = sHtml, aTemp = null; // applyConverter์—์„œ ์ถ”๊ฐ€ํ•œ sTmpStr๋ฅผ ์ž ์‹œ ์ œ๊ฑฐํ•ด์ค€๋‹ค. sTmpStr๋„ ํ•˜๋‚˜์˜ string์œผ๋กœ ์ธ์‹ํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๊ธฐ ๋•Œ๋ฌธ. aTemp = sContent.match(new RegExp(this.sRxConverter)); if (aTemp !== null) { sContent = sContent.replace(aTemp[0], ""); } sContent = this.htmlSpecialChars(sContent); sContent = this._addLineBreaker(sContent); if (aTemp !== null) { sContent = aTemp[0] + sContent; } return sContent; }, _addLineBreaker : function(sContent){ if(this.oApp.sLineBreaker === "BR"){ return sContent.replace(/\r?\n/g, "<BR>"); } var oContent = new StringBuffer(), aContent = sContent.split('\n'), // \n์„ ๊ธฐ์ค€์œผ๋กœ ๋ธ”๋Ÿญ์„ ๋‚˜๋ˆˆ๋‹ค. aContentLng = aContent.length, sTemp = ""; for (var i = 0; i < aContentLng; i++) { sTemp = jindo.$S(aContent[i]).trim().$value(); if (i === aContentLng -1 && sTemp === "") { break; } if (sTemp !== null && sTemp !== "") { oContent.append('<P>'); oContent.append(aContent[i]); oContent.append('</P>'); } else { if (!jindo.$Agent().navigator().ie) { oContent.append('<P><BR></P>'); } else { oContent.append('<P>&nbsp;<\/P>'); } } } return oContent.toString(); }, /** * [SMARTEDITORSUS-677] HTML ํŽธ์ง‘ ์˜์—ญ ์ž๋™ ํ™•์žฅ ์ฒ˜๋ฆฌ ์‹œ์ž‘ */ startAutoResize : function(){ var htOption = { nMinHeight : this.nMinHeight, wfnCallback : jindo.$Fn(this.oApp.checkResizeGripPosition, this).bind() }; //[SMARTEDITORSUS-941][iOS5๋Œ€์‘]์•„์ดํŒจ๋“œ์˜ ์ž๋™ ํ™•์žฅ ๊ธฐ๋Šฅ์ด ๋™์ž‘ํ•˜์ง€ ์•Š์„ ๋•Œ ์—๋””ํ„ฐ ์ฐฝ๋ณด๋‹ค ๊ธด ๋‚ด์šฉ์„ ์ž‘์„ฑํ•˜๋ฉด ์—๋””ํ„ฐ๋ฅผ ๋šซ๊ณ  ๋‚˜์˜ค๋Š” ํ˜„์ƒ //์›์ธ : ์ž๋™ํ™•์žฅ ๊ธฐ๋Šฅ์ด ์ •์ง€ ๋  ๊ฒฝ์šฐ iframe์— ์Šคํฌ๋กค์ด ์ƒ๊ธฐ์ง€ ์•Š๊ณ , ์ฐฝ์„ ๋šซ๊ณ  ๋‚˜์˜ด //ํ•ด๊ฒฐ : ํ•ญ์ƒ ์ž๋™ํ™•์žฅ ๊ธฐ๋Šฅ์ด ์ผœ์ ธ์žˆ๋„๋ก ๋ณ€๊ฒฝ. ์ž๋™ ํ™•์žฅ ๊ธฐ๋Šฅ ๊ด€๋ จํ•œ ์ด๋ฒคํŠธ ์ฝ”๋“œ๋„ ๋ชจ๋ฐ”์ผ ์‚ฌํŒŒ๋ฆฌ์—์„œ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ if(this.oNavigator.msafari){ htOption.wfnCallback = function(){}; } this.bAutoResize = true; this.AutoResizer = new nhn.husky.AutoResizer(this.elEditingArea, htOption); this.AutoResizer.bind(); }, /** * [SMARTEDITORSUS-677] HTML ํŽธ์ง‘ ์˜์—ญ ์ž๋™ ํ™•์žฅ ์ฒ˜๋ฆฌ ์ข…๋ฃŒ */ stopAutoResize : function(){ this.AutoResizer.unbind(); }, getIR : function() { var sIR = this.getRawContents(); if (this.oApp.applyConverter) { sIR = this.oApp.applyConverter(this.sMode + "_TO_IR", sIR, this.oApp.getWYSIWYGDocument()); } return sIR; }, setIR : function(sIR) { var sContent = sIR; if (this.oApp.applyConverter) { sContent = this.oApp.applyConverter("IR_TO_" + this.sMode, sContent, this.oApp.getWYSIWYGDocument()); } this.setRawContents(sContent); }, setRawContents : function(sContent) { if (typeof sContent !== 'undefined') { this.elEditingArea.value = sContent; } }, getRawContents : function() { return this.elEditingArea.value; }, focus : function() { this.elEditingArea.focus(); }, /** * HTML ํƒœ๊ทธ์— ํ•ด๋‹นํ•˜๋Š” ๊ธ€์ž๊ฐ€ ๋จนํžˆ์ง€ ์•Š๋„๋ก ๋ฐ”๊ฟ”์ฃผ๊ธฐ * * ๋™์ž‘) & ๋ฅผ &amp; ๋กœ, < ๋ฅผ &lt; ๋กœ, > ๋ฅผ &gt; ๋กœ ๋ฐ”๊ฟ”์ค€๋‹ค * * @param {String} sText * @return {String} */ htmlSpecialChars : function(sText) { return sText.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/ /g, '&nbsp;'); }, /** * htmlSpecialChars ์˜ ๋ฐ˜๋Œ€ ๊ธฐ๋Šฅ์˜ ํ•จ์ˆ˜ * * ๋™์ž‘) &amp, &lt, &gt, &nbsp ๋ฅผ ๊ฐ๊ฐ &, <, >, ๋นˆ์นธ์œผ๋กœ ๋ฐ”๊ฟ”์ค€๋‹ค * * @param {String} sText * @return {String} */ unhtmlSpecialChars : function(sText) { return sText.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&nbsp;/g, ' ').replace(/&amp;/g, '&'); } }); /*[ * REFRESH_WYSIWYG * * (FF์ „์šฉ) WYSIWYG ๋ชจ๋“œ๋ฅผ ๋น„ํ™œ์„ฑํ™” ํ›„ ๋‹ค์‹œ ํ™œ์„ฑํ™” ์‹œํ‚จ๋‹ค. FF์—์„œ WYSIWYG ๋ชจ๋“œ๊ฐ€ ์ผ๋ถ€ ๋น„ํ™œ์„ฑํ™” ๋˜๋Š” ๋ฌธ์ œ์šฉ * ์ฃผ์˜] REFRESH_WYSIWYGํ›„์—๋Š” ๋ณธ๋ฌธ์˜ selection์ด ๊นจ์ ธ์„œ ์ปค์„œ ์ œ์ผ ์•ž์œผ๋กœ ๊ฐ€๋Š” ํ˜„์ƒ์ด ์žˆ์Œ. (stringbookmark๋กœ ์ฒ˜๋ฆฌํ•ด์•ผํ•จ.) * * none * ---------------------------------------------------------------------------]*/ /*[ * ENABLE_WYSIWYG * * ๋น„ํ™œ์„ฑํ™”๋œ WYSIWYG ํŽธ์ง‘ ์˜์—ญ์„ ํ™œ์„ฑํ™” ์‹œํ‚จ๋‹ค. * * none * ---------------------------------------------------------------------------]*/ /*[ * DISABLE_WYSIWYG * * WYSIWYG ํŽธ์ง‘ ์˜์—ญ์„ ๋น„ํ™œ์„ฑํ™” ์‹œํ‚จ๋‹ค. * * none * ---------------------------------------------------------------------------]*/ /*[ * PASTE_HTML * * HTML์„ ํŽธ์ง‘ ์˜์—ญ์— ์‚ฝ์ž…ํ•œ๋‹ค. * * sHTML string ์‚ฝ์ž…ํ•  HTML * oPSelection object ๋ถ™์—ฌ ๋„ฃ๊ธฐ ํ•  ์˜์—ญ, ์ƒ๋žต์‹œ ํ˜„์žฌ ์ปค์„œ ์œ„์น˜ * ---------------------------------------------------------------------------]*/ /*[ * RESTORE_IE_SELECTION * * (IE์ „์šฉ) ์—๋””ํ„ฐ์—์„œ ํฌ์ปค์Šค๊ฐ€ ๋‚˜๊ฐ€๋Š” ์‹œ์ ์— ๊ธฐ์–ตํ•ด๋‘” ํฌ์ปค์Šค๋ฅผ ๋ณต๊ตฌํ•œ๋‹ค. * * none * ---------------------------------------------------------------------------]*/ /** * @pluginDesc WYSIWYG ๋ชจ๋“œ๋ฅผ ์ œ๊ณตํ•˜๋Š” ํ”Œ๋Ÿฌ๊ทธ์ธ */ nhn.husky.SE_EditingArea_WYSIWYG = jindo.$Class({ name : "SE_EditingArea_WYSIWYG", status : nhn.husky.PLUGIN_STATUS.NOT_READY, sMode : "WYSIWYG", iframe : null, doc : null, bStopCheckingBodyHeight : false, bAutoResize : false, // [SMARTEDITORSUS-677] ํ•ด๋‹น ํŽธ์ง‘๋ชจ๋“œ์˜ ์ž๋™ํ™•์žฅ ๊ธฐ๋Šฅ On/Off ์—ฌ๋ถ€ nBodyMinHeight : 0, nScrollbarWidth : 0, iLastUndoRecorded : 0, // iMinUndoInterval : 50, _nIFrameReadyCount : 50, bWYSIWYGEnabled : false, $init : function(iframe){ this.iframe = jindo.$(iframe); var oAgent = jindo.$Agent().navigator(); // IE์—์„œ ์—๋””ํ„ฐ ์ดˆ๊ธฐํ™” ์‹œ์— ์ž„์˜์ ์œผ๋กœ iframe์— ํฌ์ปค์Šค๋ฅผ ๋ฐ˜์ฏค(IME ์ž…๋ ฅ ์•ˆ๋˜๊ณ  ์ปค์„œ๋งŒ ๊นœ๋ฐ•์ด๋Š” ์ƒํƒœ) ์ฃผ๋Š” ํ˜„์ƒ์„ ๋ง‰๊ธฐ ์œ„ํ•ด์„œ ์ผ๋‹จ iframe์„ ์ˆจ๊ฒจ ๋’€๋‹ค๊ฐ€ CHANGE_EDITING_MODE์—์„œ ์œ„์ง€์œ… ์ „ํ™˜ ์‹œ ๋ณด์—ฌ์ค€๋‹ค. // ์ด๋Ÿฐ ํ˜„์ƒ์ด ๋‹ค์–‘ํ•œ ์š”์†Œ์— ์˜ํ•ด์„œ ๋ฐœ์ƒํ•˜๋ฉฐ ๋ฐœ๊ฒฌ๋œ ๋ช‡๊ฐ€์ง€ ๊ฒฝ์šฐ๋Š”, // - frameset์œผ๋กœ ํŽ˜์ด์ง€๋ฅผ ๊ตฌ์„ฑํ•œ ํ›„์— ํ•œ๊ฐœ์˜ frame์•ˆ์— ๋ฒ„ํŠผ์„ ๋‘์–ด ์—๋””ํ„ฐ๋กœ ๋งํฌ ํ•  ๊ฒฝ์šฐ // - iframe๊ณผ ๋™์ผ ํŽ˜์ด์ง€์— ์กด์žฌํ•˜๋Š” text field์— ๊ฐ’์„ ํ• ๋‹น ํ•  ๊ฒฝ์šฐ if(oAgent.ie){ this.iframe.style.display = "none"; } // IE8 : ์ฐพ๊ธฐ/๋ฐ”๊พธ๊ธฐ์—์„œ ๊ธ€์ž ์ผ๋ถ€์— ์Šคํƒ€์ผ์ด ์ ์šฉ๋œ ๊ฒฝ์šฐ ์ฐพ๊ธฐ๊ฐ€ ์•ˆ๋˜๋Š” ๋ธŒ๋ผ์šฐ์ € ๋ฒ„๊ทธ๋กœ ์ธํ•ด EmulateIE7 ํŒŒ์ผ์„ ์‚ฌ์šฉ // <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"> this.sBlankPageURL = "smart_editor2_inputarea.html"; this.sBlankPageURL_EmulateIE7 = "smart_editor2_inputarea_ie8.html"; this.aAddtionalEmulateIE7 = []; this.htOptions = nhn.husky.SE2M_Configuration.SE_EditingAreaManager; if (this.htOptions) { this.sBlankPageURL = this.htOptions.sBlankPageURL || this.sBlankPageURL; this.sBlankPageURL_EmulateIE7 = this.htOptions.sBlankPageURL_EmulateIE7 || this.sBlankPageURL_EmulateIE7; this.aAddtionalEmulateIE7 = this.htOptions.aAddtionalEmulateIE7 || this.aAddtionalEmulateIE7; } this.aAddtionalEmulateIE7.push(8); // IE8์€ Default ์‚ฌ์šฉ this.sIFrameSrc = this.sBlankPageURL; if(oAgent.ie && jindo.$A(this.aAddtionalEmulateIE7).has(oAgent.nativeVersion)) { this.sIFrameSrc = this.sBlankPageURL_EmulateIE7; } var sIFrameSrc = this.sIFrameSrc, iframe = this.iframe, fHandlerSuccess = jindo.$Fn(this.initIframe, this).bind(), fHandlerFail =jindo.$Fn(function(){this.iframe.src = sIFrameSrc;}, this).bind(); if(!oAgent.ie || (oAgent.version >=9 && !!document.addEventListener)){ iframe.addEventListener("load", fHandlerSuccess, false); iframe.addEventListener("error", fHandlerFail, false); }else{ iframe.attachEvent("onload", fHandlerSuccess); iframe.attachEvent("onerror", fHandlerFail); } iframe.src = sIFrameSrc; this.elEditingArea = iframe; }, $BEFORE_MSG_APP_READY : function(){ this.oEditingArea = this.iframe.contentWindow.document; this.oApp.exec("REGISTER_EDITING_AREA", [this]); this.oApp.exec("ADD_APP_PROPERTY", ["getWYSIWYGWindow", jindo.$Fn(this.getWindow, this).bind()]); this.oApp.exec("ADD_APP_PROPERTY", ["getWYSIWYGDocument", jindo.$Fn(this.getDocument, this).bind()]); this.oApp.exec("ADD_APP_PROPERTY", ["isWYSIWYGEnabled", jindo.$Fn(this.isWYSIWYGEnabled, this).bind()]); this.oApp.exec("ADD_APP_PROPERTY", ["getRawHTMLContents", jindo.$Fn(this.getRawHTMLContents, this).bind()]); this.oApp.exec("ADD_APP_PROPERTY", ["setRawHTMLContents", jindo.$Fn(this.setRawHTMLContents, this).bind()]); if (!!this.isWYSIWYGEnabled()) { this.oApp.exec('ENABLE_WYSIWYG_RULER', []); } this.oApp.registerBrowserEvent(this.getDocument().body, 'paste', 'EVENT_EDITING_AREA_PASTE'); }, $ON_MSG_APP_READY : function(){ if(!this.oApp.hasOwnProperty("saveSnapShot")){ this.$ON_EVENT_EDITING_AREA_MOUSEUP = function(){}; this._recordUndo = function(){}; } // uncomment this line if you wish to use the IE-style cursor in FF // this.getDocument().body.style.cursor = "text"; // Do not update this._oIERange until the document is actually clicked (focus was given by mousedown->mouseup) // Without this, iframe cannot be re-selected(by RESTORE_IE_SELECTION) if the document hasn't been clicked // mousedown on iframe -> focus goes into the iframe doc -> beforedeactivate is fired -> empty selection is saved by the plugin -> empty selection is recovered in RESTORE_IE_SELECTION this._bIERangeReset = true; if(this.oApp.oNavigator.ie){ jindo.$Fn( function(weEvent){ var oSelection = this.iframe.contentWindow.document.selection; if(oSelection && oSelection.type.toLowerCase() === 'control' && weEvent.key().keyCode === 8){ this.oApp.exec("EXECCOMMAND", ['delete', false, false]); weEvent.stop(); } this._bIERangeReset = false; }, this ).attach(this.iframe.contentWindow.document, "keydown"); jindo.$Fn( function(weEvent){ this._oIERange = null; this._bIERangeReset = true; }, this ).attach(this.iframe.contentWindow.document.body, "mousedown"); jindo.$Fn(this._onIEBeforeDeactivate, this).attach(this.iframe.contentWindow.document.body, "beforedeactivate"); jindo.$Fn( function(weEvent){ this._bIERangeReset = false; }, this ).attach(this.iframe.contentWindow.document.body, "mouseup"); }else{ //this.getDocument().execCommand('useCSS', false, false); //this.getDocument().execCommand('styleWithCSS', false, false); //this.document.execCommand("insertBrOnReturn", false, false); } // DTD๊ฐ€ quirks๊ฐ€ ์•„๋‹ ๊ฒฝ์šฐ body ๋†’์ด 100%๊ฐ€ ์ œ๋Œ€๋กœ ๋™์ž‘ํ•˜์ง€ ์•Š์•„์„œ ํƒ€์ž„์•„์›ƒ์„ ๋Œ๋ฉฐ ๋†’์ด๋ฅผ ์ˆ˜๋™์œผ๋กœ ๊ณ„์† ํ• ๋‹น ํ•ด ์คŒ // body ๋†’์ด๊ฐ€ ์ œ๋Œ€๋กœ ์„ค์ • ๋˜์ง€ ์•Š์„ ๊ฒฝ์šฐ, ๋ณด๊ธฐ์—๋Š” ์ด์ƒ์—†์–ด ๋ณด์ด๋‚˜ ๋งˆ์šฐ์Šค๋กœ ํ…์ŠคํŠธ ์„ ํƒ์ด ์ž˜ ์•ˆ๋œ๋‹ค๋“ ์ง€ ํ•˜๋Š” ์ด์Šˆ๊ฐ€ ์žˆ์Œ this.fnSetBodyHeight = jindo.$Fn(this._setBodyHeight, this).bind(); this.fnCheckBodyChange = jindo.$Fn(this._checkBodyChange, this).bind(); this.fnSetBodyHeight(); this._setScrollbarWidth(); }, /** * ์Šคํฌ๋กค๋ฐ”์˜ ์‚ฌ์ด์ฆˆ ์ธก์ •ํ•˜์—ฌ ์„ค์ • */ _setScrollbarWidth : function(){ var oDocument = this.getDocument(), elScrollDiv = oDocument.createElement("div"); elScrollDiv.style.width = "100px"; elScrollDiv.style.height = "100px"; elScrollDiv.style.overflow = "scroll"; elScrollDiv.style.position = "absolute"; elScrollDiv.style.top = "-9999px"; oDocument.body.appendChild(elScrollDiv); this.nScrollbarWidth = elScrollDiv.offsetWidth - elScrollDiv.clientWidth; oDocument.body.removeChild(elScrollDiv); }, /** * [SMARTEDITORSUS-677] ๋ถ™์—ฌ๋„ฃ๊ธฐ๋‚˜ ๋‚ด์šฉ ์ž…๋ ฅ์— ๋Œ€ํ•œ ํŽธ์ง‘์˜์—ญ ์ž๋™ ํ™•์žฅ ์ฒ˜๋ฆฌ */ $AFTER_EVENT_EDITING_AREA_KEYUP : function(oEvent){ if(!this.bAutoResize){ return; } var oKeyInfo = oEvent.key(); if((oKeyInfo.keyCode >= 33 && oKeyInfo.keyCode <= 40) || oKeyInfo.alt || oKeyInfo.ctrl || oKeyInfo.keyCode === 16){ return; } this._setAutoResize(); }, /** * [SMARTEDITORSUS-677] ๋ถ™์—ฌ๋„ฃ๊ธฐ๋‚˜ ๋‚ด์šฉ ์ž…๋ ฅ์— ๋Œ€ํ•œ ํŽธ์ง‘์˜์—ญ ์ž๋™ ํ™•์žฅ ์ฒ˜๋ฆฌ */ $AFTER_PASTE_HTML : function(){ if(!this.bAutoResize){ return; } this._setAutoResize(); }, /** * [SMARTEDITORSUS-677] WYSIWYG ํŽธ์ง‘ ์˜์—ญ ์ž๋™ ํ™•์žฅ ์ฒ˜๋ฆฌ ์‹œ์ž‘ */ startAutoResize : function(){ this.oApp.exec("STOP_CHECKING_BODY_HEIGHT"); this.bAutoResize = true; var oBrowser = this.oApp.oNavigator; // [SMARTEDITORSUS-887] [๋ธ”๋กœ๊ทธ 1๋‹จ] ์ž๋™ํ™•์žฅ ๋ชจ๋“œ์—์„œ ์—๋””ํ„ฐ ๊ฐ€๋กœ์‚ฌ์ด์ฆˆ๋ณด๋‹ค ํฐ ์‚ฌ์ง„์„ ์ถ”๊ฐ€ํ–ˆ์„ ๋•Œ ๊ฐ€๋กœ์Šคํฌ๋กค์ด ์•ˆ์ƒ๊ธฐ๋Š” ๋ฌธ์ œ if(oBrowser.ie && oBrowser.version < 9){ jindo.$Element(this.getDocument().body).css({ "overflow" : "visible" }); // { "overflowX" : "visible", "overflowY" : "hidden" } ์œผ๋กœ ์„ค์ •ํ•˜๋ฉด ์„ธ๋กœ ์Šคํฌ๋กค ๋ฟ ์•„๋‹ˆ๋ผ ๊ฐ€๋กœ ์Šคํฌ๋กค๋„ ๋ณด์ด์ง€ ์•Š๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์–ด // { "overflow" : "visible" } ๋กœ ์ฒ˜๋ฆฌํ•˜๊ณ  ์—๋””ํ„ฐ์˜ container ์‚ฌ์ด์ฆˆ๋ฅผ ๋Š˜๋ ค ์„ธ๋กœ ์Šคํฌ๋กค์ด ๋ณด์ด์ง€ ์•Š๋„๋ก ์ฒ˜๋ฆฌํ•ด์•ผ ํ•จ // [ํ•œ๊ณ„] ์ž๋™ ํ™•์žฅ ๋ชจ๋“œ์—์„œ ๋‚ด์šฉ์ด ๋Š˜์–ด๋‚  ๋•Œ ์„ธ๋กœ ์Šคํฌ๋กค์ด ๋ณด์˜€๋‹ค๊ฐ€ ์—†์–ด์ง€๋Š” ๋ฌธ์ œ }else{ jindo.$Element(this.getDocument().body).css({ "overflowX" : "visible", "overflowY" : "hidden" }); } this._setAutoResize(); this.nCheckBodyInterval = setInterval(this.fnCheckBodyChange, 500); this.oApp.exec("START_FLOAT_TOOLBAR"); // set scroll event }, /** * [SMARTEDITORSUS-677] WYSIWYG ํŽธ์ง‘ ์˜์—ญ ์ž๋™ ํ™•์žฅ ์ฒ˜๋ฆฌ ์ข…๋ฃŒ */ stopAutoResize : function(){ this.bAutoResize = false; clearInterval(this.nCheckBodyInterval); this.oApp.exec("STOP_FLOAT_TOOLBAR"); // remove scroll event jindo.$Element(this.getDocument().body).css({ "overflow" : "visible", "overflowY" : "visible" }); this.oApp.exec("START_CHECKING_BODY_HEIGHT"); }, /** * [SMARTEDITORSUS-677] ํŽธ์ง‘ ์˜์—ญ Body๊ฐ€ ๋ณ€๊ฒฝ๋˜์—ˆ๋Š”์ง€ ์ฃผ๊ธฐ์ ์œผ๋กœ ํ™•์ธ */ _checkBodyChange : function(){ if(!this.bAutoResize){ return; } var nBodyLength = this.getDocument().body.innerHTML.length; if(nBodyLength !== this.nBodyLength){ this.nBodyLength = nBodyLength; this._setAutoResize(); } }, /** * [SMARTEDITORSUS-677] ์ž๋™ ํ™•์žฅ ์ฒ˜๋ฆฌ์—์„œ ์ ์šฉํ•  Resize Body Height๋ฅผ ๊ตฌํ•จ */ _getResizeHeight : function(){ var elBody = this.getDocument().body, welBody, nBodyHeight, aCopyStyle = ['width', 'fontFamily', 'fontSize', 'fontWeight', 'fontStyle', 'lineHeight', 'letterSpacing', 'textTransform', 'wordSpacing'], oCss, i; if(!this.oApp.oNavigator.firefox && !this.oApp.oNavigator.safari){ if(this.oApp.oNavigator.ie && this.oApp.oNavigator.version === 8 && document.documentMode === 8){ jindo.$Element(elBody).css("height", "0px"); } nBodyHeight = parseInt(elBody.scrollHeight, 10); if(nBodyHeight < this.nBodyMinHeight){ nBodyHeight = this.nBodyMinHeight; } return nBodyHeight; } // Firefox && Safari if(!this.elDummy){ this.elDummy = document.createElement('div'); this.elDummy.className = "se2_input_wysiwyg"; this.oApp.elEditingAreaContainer.appendChild(this.elDummy); this.elDummy.style.cssText = 'position:absolute !important; left:-9999px !important; top:-9999px !important; z-index: -9999 !important; overflow: auto !important;'; this.elDummy.style.height = this.nBodyMinHeight + "px"; } welBody = jindo.$Element(elBody); i = aCopyStyle.length; oCss = {}; while(i--){ oCss[aCopyStyle[i]] = welBody.css(aCopyStyle[i]); } if(oCss.lineHeight.indexOf("px") > -1){ oCss.lineHeight = (parseInt(oCss.lineHeight, 10)/parseInt(oCss.fontSize, 10)); } jindo.$Element(this.elDummy).css(oCss); this.elDummy.innerHTML = elBody.innerHTML; nBodyHeight = this.elDummy.scrollHeight; return nBodyHeight; }, /** * [SMARTEDITORSUS-677] WYSIWYG ์ž๋™ ํ™•์žฅ ์ฒ˜๋ฆฌ */ _setAutoResize : function(){ var elBody = this.getDocument().body, welBody = jindo.$Element(elBody), nBodyHeight, nContainerHeight, oCurrentStyle, nStyleSize, bExpand = false, oBrowser = this.oApp.oNavigator; this.nTopBottomMargin = this.nTopBottomMargin || (parseInt(welBody.css("marginTop"), 10) + parseInt(welBody.css("marginBottom"), 10)); this.nBodyMinHeight = this.nBodyMinHeight || (this.oApp.getEditingAreaHeight() - this.nTopBottomMargin); if((oBrowser.ie && oBrowser.nativeVersion >= 9) || oBrowser.chrome){ // ๋‚ด์šฉ์ด ์ค„์–ด๋„ scrollHeight๊ฐ€ ์ค„์–ด๋“ค์ง€ ์•Š์Œ welBody.css("height", "0px"); this.iframe.style.height = "0px"; } nBodyHeight = this._getResizeHeight(); if(oBrowser.ie){ // ๋‚ด์šฉ ๋’ค๋กœ ๊ณต๊ฐ„์ด ๋‚จ์•„ ๋ณด์ผ ์ˆ˜ ์žˆ์œผ๋‚˜ ์ถ”๊ฐ€๋กœ Container๋†’์ด๋ฅผ ๋”ํ•˜์ง€ ์•Š์œผ๋ฉด // ๋‚ด์šฉ ๊ฐ€์žฅ ๋’ค์—์„œ Enter๋ฅผ ํ•˜๋Š” ๊ฒฝ์šฐ ์•„๋ž˜์œ„๋กœ ํ”๋“ค๋ ค ๋ณด์ด๋Š” ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒ if(nBodyHeight > this.nBodyMinHeight){ oCurrentStyle = this.oApp.getCurrentStyle(); nStyleSize = parseInt(oCurrentStyle.fontSize, 10) * oCurrentStyle.lineHeight; if(nStyleSize < this.nTopBottomMargin){ nStyleSize = this.nTopBottomMargin; } nContainerHeight = nBodyHeight + nStyleSize; nContainerHeight += 18; bExpand = true; }else{ nBodyHeight = this.nBodyMinHeight; nContainerHeight = this.nBodyMinHeight + this.nTopBottomMargin; } // }else if(oBrowser.safari){ // -- ์‚ฌํŒŒ๋ฆฌ์—์„œ ๋‚ด์šฉ์ด ์ค„์–ด๋“ค์ง€ ์•Š๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์–ด Firefox ๋ฐฉ์‹์œผ๋กœ ๋ณ€๊ฒฝํ•จ // // [Chrome/Safari] ํฌ๋กฌ์ด๋‚˜ ์‚ฌํŒŒ๋ฆฌ์—์„œ๋Š” Body์™€ iframe๋†’์ด์„œ ์„œ๋กœ ์—ฐ๊ด€๋˜์–ด ๋Š˜์–ด๋‚˜๋ฏ€๋กœ, // // nContainerHeight๋ฅผ ์ถ”๊ฐ€๋กœ ๋”ํ•˜๋Š” ๊ฒฝ์šฐ setTimeout ์‹œ ๋ฌดํ•œ ์ฆ์‹๋˜๋Š” ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Œ // nBodyHeight = nBodyHeight > this.nBodyMinHeight ? nBodyHeight - this.nTopBottomMargin : this.nBodyMinHeight; // nContainerHeight = nBodyHeight + this.nTopBottomMargin; }else{ // [FF] nContainerHeight๋ฅผ ์ถ”๊ฐ€๋กœ ๋”ํ•˜์˜€์Œ. setTimeout ์‹œ ๋ฌดํ•œ ์ฆ์‹๋˜๋Š” ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Œ if(nBodyHeight > this.nBodyMinHeight){ oCurrentStyle = this.oApp.getCurrentStyle(); nStyleSize = parseInt(oCurrentStyle.fontSize, 10) * oCurrentStyle.lineHeight; if(nStyleSize < this.nTopBottomMargin){ nStyleSize = this.nTopBottomMargin; } nContainerHeight = nBodyHeight + nStyleSize; bExpand = true; }else{ nBodyHeight = this.nBodyMinHeight; nContainerHeight = this.nBodyMinHeight + this.nTopBottomMargin; } } if(!oBrowser.firefox){ welBody.css("height", nBodyHeight + "px"); } this.iframe.style.height = nContainerHeight + "px"; // ํŽธ์ง‘์˜์—ญ IFRAME์˜ ๋†’์ด ๋ณ€๊ฒฝ this.oApp.welEditingAreaContainer.height(nContainerHeight); // ํŽธ์ง‘์˜์—ญ IFRAME์„ ๊ฐ์‹ธ๋Š” DIV ๋†’์ด ๋ณ€๊ฒฝ //[SMARTEDITORSUS-941][iOS5๋Œ€์‘]์•„์ดํŒจ๋“œ์˜ ์ž๋™ ํ™•์žฅ ๊ธฐ๋Šฅ์ด ๋™์ž‘ํ•˜์ง€ ์•Š์„ ๋•Œ ์—๋””ํ„ฐ ์ฐฝ๋ณด๋‹ค ๊ธด ๋‚ด์šฉ์„ ์ž‘์„ฑํ•˜๋ฉด ์—๋””ํ„ฐ๋ฅผ ๋šซ๊ณ  ๋‚˜์˜ค๋Š” ํ˜„์ƒ //์›์ธ : ์ž๋™ํ™•์žฅ ๊ธฐ๋Šฅ์ด ์ •์ง€ ๋  ๊ฒฝ์šฐ iframe์— ์Šคํฌ๋กค์ด ์ƒ๊ธฐ์ง€ ์•Š๊ณ , ์ฐฝ์„ ๋šซ๊ณ  ๋‚˜์˜ด //ํ•ด๊ฒฐ : ํ•ญ์ƒ ์ž๋™ํ™•์žฅ ๊ธฐ๋Šฅ์ด ์ผœ์ ธ์žˆ๋„๋ก ๋ณ€๊ฒฝ. ์ž๋™ ํ™•์žฅ ๊ธฐ๋Šฅ ๊ด€๋ จํ•œ ์ด๋ฒคํŠธ ์ฝ”๋“œ๋„ ๋ชจ๋ฐ”์ผ ์‚ฌํŒŒ๋ฆฌ์—์„œ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ if(!this.oApp.oNavigator.msafari){ this.oApp.checkResizeGripPosition(bExpand); } }, /** * ์Šคํฌ๋กค ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•ด ํŽธ์ง‘์˜์—ญ Body์˜ ์‚ฌ์ด์ฆˆ๋ฅผ ํ™•์ธํ•˜๊ณ  ์„ค์ •ํ•จ * ํŽธ์ง‘์˜์—ญ ์ž๋™ํ™•์žฅ ๊ธฐ๋Šฅ์ด Off์ธ ๊ฒฝ์šฐ์— ์ฃผ๊ธฐ์ ์œผ๋กœ ์‹คํ–‰๋จ */ _setBodyHeight : function(){ if( this.bStopCheckingBodyHeight ){ // ๋ฉˆ์ถฐ์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ true, ๊ณ„์† ์ฒดํฌํ•ด์•ผ ํ•˜๋ฉด false // ์œ„์ง€์œ… ๋ชจ๋“œ์—์„œ ๋‹ค๋ฅธ ๋ชจ๋“œ๋กœ ๋ณ€๊ฒฝํ•  ๋•Œ "document๋Š” css๋ฅผ ์‚ฌ์šฉ ํ• ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค." ๋ผ๋Š” error ๊ฐ€ ๋ฐœ์ƒ. // ๊ทธ๋ž˜์„œ on_change_mode์—์„œ bStopCheckingBodyHeight ๋ฅผ true๋กœ ๋ณ€๊ฒฝ์‹œ์ผœ์ค˜์•ผ ํ•จ. return; } var elBody = this.getDocument().body, welBody = jindo.$Element(elBody), nMarginTopBottom = parseInt(welBody.css("marginTop"), 10) + parseInt(welBody.css("marginBottom"), 10), nContainerOffset = this.oApp.getEditingAreaHeight(), nMinBodyHeight = nContainerOffset - nMarginTopBottom, nBodyHeight = welBody.height(), nScrollHeight, nNewBodyHeight; this.nTopBottomMargin = nMarginTopBottom; if(nBodyHeight === 0){ // [SMARTEDITORSUS-144] height ๊ฐ€ 0 ์ด๊ณ  ๋‚ด์šฉ์ด ์—†์œผ๋ฉด ํฌ๋กฌ10 ์—์„œ ์บ๋Ÿฟ์ด ๋ณด์ด์ง€ ์•Š์Œ welBody.css("height", nMinBodyHeight + "px"); setTimeout(this.fnSetBodyHeight, 500); return; } welBody.css("height", "0px"); // [SMARTEDITORSUS-257] IE9, ํฌ๋กฌ์—์„œ ๋‚ด์šฉ์„ ์‚ญ์ œํ•ด๋„ ์Šคํฌ๋กค์ด ๋‚จ์•„์žˆ๋Š” ๋ฌธ์ œ ์ฒ˜๋ฆฌ // body ์— ๋‚ด์šฉ์ด ์—†์–ด์ ธ๋„ scrollHeight ๊ฐ€ ์ค„์–ด๋“ค์ง€ ์•Š์•„ height ๋ฅผ ๊ฐ•์ œ๋กœ 0 ์œผ๋กœ ์„ค์ • nScrollHeight = parseInt(elBody.scrollHeight, 10); nNewBodyHeight = (nScrollHeight > nContainerOffset ? nScrollHeight - nMarginTopBottom : nMinBodyHeight); // nMarginTopBottom ์„ ๋นผ์ง€ ์•Š์œผ๋ฉด ์Šคํฌ๋กค์ด ๊ณ„์† ๋Š˜์–ด๋‚˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ์Œ (์ฐธ๊ณ  [BLOGSUS-17421]) if(this._isHorizontalScrollbarVisible()){ nNewBodyHeight -= this.nScrollbarWidth; } welBody.css("height", nNewBodyHeight + "px"); setTimeout(this.fnSetBodyHeight, 500); }, /** * ๊ฐ€๋กœ ์Šคํฌ๋กค๋ฐ” ์ƒ์„ฑ ํ™•์ธ */ _isHorizontalScrollbarVisible : function(){ var oDocument = this.getDocument(); if(oDocument.documentElement.clientWidth < oDocument.documentElement.scrollWidth){ //oDocument.body.clientWidth < oDocument.body.scrollWidth || return true; } return false; }, /** * body์˜ offset์ฒดํฌ๋ฅผ ๋ฉˆ์ถ”๊ฒŒ ํ•˜๋Š” ํ•จ์ˆ˜. */ $ON_STOP_CHECKING_BODY_HEIGHT :function(){ if(!this.bStopCheckingBodyHeight){ this.bStopCheckingBodyHeight = true; } }, /** * body์˜ offset์ฒดํฌ๋ฅผ ๊ณ„์† ์ง„ํ–‰. */ $ON_START_CHECKING_BODY_HEIGHT :function(){ if(this.bStopCheckingBodyHeight){ this.bStopCheckingBodyHeight = false; this.fnSetBodyHeight(); } }, $ON_IE_CHECK_EXCEPTION_FOR_SELECTION_PRESERVATION : function(){ // ํ˜„์žฌ ์„ ํƒ๋œ ์•จ๋ฆฌ๋จผํŠธ๊ฐ€ iframe์ด๋ผ๋ฉด, ์…€๋ ‰์…˜์„ ๋”ฐ๋กœ ๊ธฐ์–ต ํ•ด ๋‘์ง€ ์•Š์•„๋„ ์œ ์ง€ ๋จ์œผ๋กœ RESTORE_IE_SELECTION์„ ํƒ€์ง€ ์•Š๋„๋ก this._oIERange์„ ์ง€์›Œ์ค€๋‹ค. // (ํ•„์š” ์—†์„ ๋ฟ๋”๋Ÿฌ ์ €์žฅ ์‹œ ๋ฌธ์ œ ๋ฐœ์ƒ) var oSelection = this.getDocument().selection; if(oSelection && oSelection.type === "Control"){ this._oIERange = null; } /* // [SMARTEDITORSUS-978] HuskyRange.js ์˜ [SMARTEDITORSUS-888] ์ด์Šˆ ์ˆ˜์ •๊ณผ ๊ด€๋ จ var tmpSelection = this.getDocument().selection, oRange, elNode; if(tmpSelection.type === "Control"){ oRange = tmpSelection.createRange(); elNode = oRange.item(0); if(elNode && elNode.tagName === "IFRAME"){ this._oIERange = null; } } */ }, _onIEBeforeDeactivate : function(wev){ var tmpSelection, tmpRange; this.oApp.delayedExec("IE_CHECK_EXCEPTION_FOR_SELECTION_PRESERVATION", [], 0); if(this._oIERange){ return; } // without this, cursor won't make it inside a table. // mousedown(_oIERange gets reset) -> beforedeactivate(gets fired for table) -> RESTORE_IE_SELECTION if(this._bIERangeReset){ return; } this._oIERange = this.oApp.getSelection().cloneRange(); /* [SMARTEDITORSUS-978] HuskyRange.js ์˜ [SMARTEDITORSUS-888] ์ด์Šˆ ์ˆ˜์ •๊ณผ ๊ด€๋ จ tmpSelection = this.getDocument().selection; tmpRange = tmpSelection.createRange(); // Control range does not have parentElement if(tmpRange.parentElement && tmpRange.parentElement() && tmpRange.parentElement().tagName === "INPUT"){ this._oIERange = this._oPrevIERange; }else{ this._oIERange = tmpRange; } */ }, $ON_CHANGE_EDITING_MODE : function(sMode, bNoFocus){ if(sMode === this.sMode){ // [SMARTEDITORSUS-1213][IE9, 10] ์‚ฌ์ง„ ์‚ญ์ œ ํ›„ zindex 1000์ธ div๊ฐ€ ์ž”์กดํ•˜๋Š”๋ฐ, ๊ทธ ์œ„๋กœ ์ธ๋„ค์ผ drag๋ฅผ ์‹œ๋„ํ•˜๋‹ค ๋ณด๋‹ˆ drop์ด ๋ถˆ๊ฐ€๋Šฅ. var htBrowser = jindo.$Agent().navigator(); if(htBrowser.ie && htBrowser.nativeVersion > 8){ var elFirstChild = jindo.$$.getSingle("DIV.husky_seditor_editing_area_container").childNodes[0]; if((elFirstChild.tagName == "DIV") && (elFirstChild.style.zIndex == 1000)){ elFirstChild.parentNode.removeChild(elFirstChild); } } // --[SMARTEDITORSUS-1213] this.iframe.style.display = "block"; this.oApp.exec("REFRESH_WYSIWYG", []); this.oApp.exec("SET_EDITING_WINDOW", [this.getWindow()]); this.oApp.exec("START_CHECKING_BODY_HEIGHT"); }else{ this.iframe.style.display = "none"; this.oApp.exec("STOP_CHECKING_BODY_HEIGHT"); } }, $AFTER_CHANGE_EDITING_MODE : function(sMode, bNoFocus){ this._oIERange = null; }, $ON_REFRESH_WYSIWYG : function(){ if(!jindo.$Agent().navigator().firefox){ return; } this._disableWYSIWYG(); this._enableWYSIWYG(); }, $ON_ENABLE_WYSIWYG : function(){ this._enableWYSIWYG(); }, $ON_DISABLE_WYSIWYG : function(){ this._disableWYSIWYG(); }, $ON_IE_HIDE_CURSOR : function(){ if(!this.oApp.oNavigator.ie){ return; } this._onIEBeforeDeactivate(); // De-select the default selection. // [SMARTEDITORSUS-978] IE9์—์„œ removeAllRanges๋กœ ์ œ๊ฑฐ๋˜์ง€ ์•Š์•„ // ์ด์ „ IE์™€ ๋™์ผํ•˜๊ฒŒ empty ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•˜๋„๋ก ํ•˜์˜€์œผ๋‚˜ doc.selection.type์ด None์ธ ๊ฒฝ์šฐ ์—๋Ÿฌ // Range๋ฅผ ์žฌ์„ค์ • ํ•ด์ฃผ์–ด selectNone ์œผ๋กœ ์ฒ˜๋ฆฌ๋˜๋„๋ก ์˜ˆ์™ธ์ฒ˜๋ฆฌ var oSelection = this.oApp.getWYSIWYGDocument().selection; if(oSelection && oSelection.createRange){ try{ oSelection.empty(); }catch(e){ // [SMARTEDITORSUS-1003] IE9 / doc.selection.type === "None" oSelection = this.oApp.getSelection(); oSelection.select(); oSelection.oBrowserSelection.selectNone(); } }else{ this.oApp.getEmptySelection().oBrowserSelection.selectNone(); } }, $AFTER_SHOW_ACTIVE_LAYER : function(){ this.oApp.exec("IE_HIDE_CURSOR",[]); this.bActiveLayerShown = true; }, $BEFORE_EVENT_EDITING_AREA_KEYDOWN : function(oEvent){ this._bKeyDown = true; }, $ON_EVENT_EDITING_AREA_KEYDOWN : function(oEvent){ if(this.oApp.getEditingMode() !== this.sMode){ return; } var oKeyInfo = oEvent.key(); if(this.oApp.oNavigator.ie){ //var oKeyInfo = oEvent.key(); switch(oKeyInfo.keyCode){ case 33: this._pageUp(oEvent); break; case 34: this._pageDown(oEvent); break; case 8: // [SMARTEDITORSUS-495][SMARTEDITORSUS-548] IE์—์„œ ํ‘œ๊ฐ€ ์‚ญ์ œ๋˜์ง€ ์•Š๋Š” ๋ฌธ์ œ this._backspace(oEvent); break; default: } }else if(this.oApp.oNavigator.firefox){ // [SMARTEDITORSUS-151] FF ์—์„œ ํ‘œ๊ฐ€ ์‚ญ์ œ๋˜์ง€ ์•Š๋Š” ๋ฌธ์ œ if(oKeyInfo.keyCode === 8){ // backspace this._backspace(oEvent); } } this._recordUndo(oKeyInfo); // ์ฒซ๋ฒˆ์งธ Delete ํ‚ค ์ž…๋ ฅ ์ „์˜ ์ƒํƒœ๊ฐ€ ์ €์žฅ๋˜๋„๋ก KEYDOWN ์‹œ์ ์— ์ €์žฅ }, /** * [SMARTEDITORSUS-1575] ์ปค์„œํ™€๋” ์ œ๊ฑฐ * [SMARTEDITORSUS-151][SMARTEDITORSUS-495][SMARTEDITORSUS-548] IE์™€ FF์—์„œ ํ‘œ ์‚ญ์ œ */ _backspace : function(weEvent){ var oSelection = this.oApp.getSelection(), preNode = null; if(!oSelection.collapsed){ return; } preNode = oSelection.getNodeAroundRange(true, false); if(preNode && preNode.nodeType === 3){ if(/^[\n]*$/.test(preNode.nodeValue)){ preNode = preNode.previousSibling; }else if(preNode.nodeValue === "\u200B" || preNode.nodeValue === "\uFEFF"){ // [SMARTEDITORSUS-1575] ๊ณต๋ฐฑ๋Œ€์‹  ์ปค์„œํ™€๋” ์‚ฝ์ž…๋œ ์ƒํƒœ๋ผ์„œ ๋นˆ๋ผ์ธ์—์„œ ๋ฐฑ์ŠคํŽ˜์ด์Šค๋ฅผ ๋‘๋ฒˆ ์ณ์•ผ ์œ—์ชฝ๋ผ์ธ์œผ๋กœ ์˜ฌ๋ผ๊ฐ€๊ธฐ ๋•Œ๋ฌธ์— ํ•œ๋ฒˆ ์ณ์„œ ์˜ฌ๋ผ๊ฐˆ ์ˆ˜ ์žˆ๋„๋ก ์ปค์„œํ™€๋” ์ œ๊ฑฐ preNode.nodeValue = ""; } } if(!!preNode && preNode.nodeType === 1 && preNode.tagName === "TABLE"){ jindo.$Element(preNode).leave(); weEvent.stop(jindo.$Event.CANCEL_ALL); } }, $BEFORE_EVENT_EDITING_AREA_KEYUP : function(oEvent){ // IE(6) sometimes fires keyup events when it should not and when it happens the keyup event gets fired without a keydown event if(!this._bKeyDown){ return false; } this._bKeyDown = false; }, $ON_EVENT_EDITING_AREA_MOUSEUP : function(oEvent){ this.oApp.saveSnapShot(); }, $BEFORE_PASTE_HTML : function(){ if(this.oApp.getEditingMode() !== this.sMode){ this.oApp.exec("CHANGE_EDITING_MODE", [this.sMode]); } }, $ON_PASTE_HTML : function(sHTML, oPSelection, bNoUndo){ var oSelection, oNavigator, sTmpBookmark, oStartContainer, aImgChild, elLastImg, elChild, elNextChild; if(this.oApp.getEditingMode() !== this.sMode){ return; } if(!bNoUndo){ this.oApp.exec("RECORD_UNDO_BEFORE_ACTION", ["PASTE HTML"]); } oNavigator = jindo.$Agent().navigator(); oSelection = oPSelection || this.oApp.getSelection(); //[SMARTEDITORSUS-888] ๋ธŒ๋ผ์šฐ์ € ๋ณ„ ํ…Œ์ŠคํŠธ ํ›„ ์•„๋ž˜ ๋ถ€๋ถ„์ด ๋ถˆํ•„์š”ํ•˜์—ฌ ์ œ๊ฑฐํ•จ // - [SMARTEDITORSUS-387] IE9 ํ‘œ์ค€๋ชจ๋“œ์—์„œ ์—˜๋ฆฌ๋จผํŠธ ๋’ค์— ์–ด๋– ํ•œ ์—˜๋ฆฌ๋จผํŠธ๋„ ์—†๋Š” ์ƒํƒœ์—์„œ ์ปค์„œ๊ฐ€ ์•ˆ๋“ค์–ด๊ฐ€๋Š” ํ˜„์ƒ. // if(oNavigator.ie && oNavigator.nativeVersion >= 9 && document.documentMode >= 9){ // sHTML = sHTML + unescape("%uFEFF"); // } if(oNavigator.ie && oNavigator.nativeVersion == 8 && document.documentMode == 8){ sHTML = sHTML + unescape("%uFEFF"); } oSelection.pasteHTML(sHTML); // every browser except for IE may modify the innerHTML when it is inserted if(!oNavigator.ie){ sTmpBookmark = oSelection.placeStringBookmark(); this.oApp.getWYSIWYGDocument().body.innerHTML = this.oApp.getWYSIWYGDocument().body.innerHTML; oSelection.moveToBookmark(sTmpBookmark); oSelection.collapseToEnd(); oSelection.select(); oSelection.removeStringBookmark(sTmpBookmark); // [SMARTEDITORSUS-56] ์‚ฌ์ง„์„ ์—ฐ์†์œผ๋กœ ์ฒจ๋ถ€ํ•  ๊ฒฝ์šฐ ์—ฐ์ด์–ด ์‚ฝ์ž…๋˜์ง€ ์•Š๋Š” ํ˜„์ƒ์œผ๋กœ ์ด์Šˆ๋ฅผ ๋ฐœ๊ฒฌํ•˜๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. // ๊ทธ๋Ÿฌ๋‚˜ ์ด๋Š” ๋น„๋‹จ '๋‹ค์ˆ˜์˜ ์‚ฌ์ง„์„ ์ฒจ๋ถ€ํ•  ๊ฒฝ์šฐ'์—๋งŒ ๋ฐœ์ƒํ•˜๋Š” ๋ฌธ์ œ๋Š” ์•„๋‹ˆ์—ˆ๊ณ , // ์›์ธ ํ™•์ธ ๊ฒฐ๊ณผ ์ปจํ…์ธ  ์‚ฝ์ž… ํ›„ ๊ธฐ์กด Bookmark ์‚ญ์ œ ์‹œ ๊ฐฑ์‹ ๋œ Selection ์ด ์ œ๋Œ€๋กœ ๋ฐ˜์˜๋˜์ง€ ์•Š๋Š” ์ ์ด ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. // ์ด์—, Selection ์„ ๊ฐฑ์‹ ํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜์˜€์Šต๋‹ˆ๋‹ค. oSelection = this.oApp.getSelection(); //[SMARTEDITORSUS-831] ๋น„IE ๊ณ„์—ด ๋ธŒ๋ผ์šฐ์ €์—์„œ ์Šคํฌ๋กค๋ฐ”๊ฐ€ ์ƒ๊ธฐ๊ฒŒ ๋ฌธ์ž์ž…๋ ฅ ํ›„ ์—”ํ„ฐ ํด๋ฆญํ•˜์ง€ ์•Š์€ ์ƒํƒœ์—์„œ //์ด๋ฏธ์ง€ ํ•˜๋‚˜ ์‚ฝ์ž… ์‹œ ์ด๋ฏธ์ง€์— ํฌ์ปค์‹ฑ์ด ๋†“์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค. //์›์ธ : parameter๋กœ ๋„˜๊ฒจ ๋ฐ›์€ oPSelecion์— ๋ณ€๊ฒฝ๋œ ๊ฐ’์„ ๋ณต์‚ฌํ•ด ์ฃผ์ง€ ์•Š์•„์„œ ๋ฐœ์ƒ //ํ•ด๊ฒฐ : parameter๋กœ ๋„˜๊ฒจ ๋ฐ›์€ oPSelecion์— ๋ณ€๊ฒฝ๋œ ๊ฐ’์„ ๋ณต์‚ฌํ•ด์ค€๋‹ค // call by reference๋กœ ๋„˜๊ฒจ ๋ฐ›์•˜์œผ๋ฏ€๋กœ ์ง์ ‘ ๊ฐ์ฒด ์•ˆ์˜ ์ธ์ž ๊ฐ’์„ ๋ฐ”๊ฟ”์ฃผ๋Š” setRange ํ•จ์ˆ˜ ์‚ฌ์šฉ if(!!oPSelection){ oPSelection.setRange(oSelection); } }else{ // [SMARTEDITORSUS-428] [IE9.0] IE9์—์„œ ํฌ์ŠคํŠธ ์“ฐ๊ธฐ์— ์ ‘๊ทผํ•˜์—ฌ ๋งจ์œ„์— ์ž„์˜์˜ ๊ธ€๊ฐ ์ฒจ๋ถ€ ํ›„ ์—”ํ„ฐ๋ฅผ ํด๋ฆญ ์‹œ ๊ธ€๊ฐ์ด ์‚ฌ๋ผ์ง // PASTE_HTML ํ›„์— IFRAME ๋ถ€๋ถ„์ด ์„ ํƒ๋œ ์ƒํƒœ์—ฌ์„œ Enter ์‹œ ๋‚ด์šฉ์ด ์ œ๊ฑฐ๋˜์–ด ๋ฐœ์ƒํ•œ ๋ฌธ์ œ oSelection.collapseToEnd(); oSelection.select(); this._oIERange = null; this._bIERangeReset = false; } // [SMARTEDITORSUS-639] ์‚ฌ์ง„ ์ฒจ๋ถ€ ํ›„ ์ด๋ฏธ์ง€ ๋’ค์˜ ๊ณต๋ฐฑ์œผ๋กœ ์ธํ•ด ์Šคํฌ๋กค์ด ์ƒ๊ธฐ๋Š” ๋ฌธ์ œ if(sHTML.indexOf("<img") > -1){ oStartContainer = oSelection.startContainer; if(oStartContainer.nodeType === 1 && oStartContainer.tagName === "P"){ aImgChild = jindo.$Element(oStartContainer).child(function(v){ return (v.$value().nodeType === 1 && v.$value().tagName === "IMG"); }, 1); if(aImgChild.length > 0){ elLastImg = aImgChild[aImgChild.length - 1].$value(); elChild = elLastImg.nextSibling; while(elChild){ elNextChild = elChild.nextSibling; if (elChild.nodeType === 3 && (elChild.nodeValue === "&nbsp;" || elChild.nodeValue === unescape("%u00A0"))) { oStartContainer.removeChild(elChild); } elChild = elNextChild; } } } } if(!bNoUndo){ this.oApp.exec("RECORD_UNDO_AFTER_ACTION", ["PASTE HTML"]); } }, /** * [SMARTEDITORSUS-344]์‚ฌ์ง„/๋™์˜์ƒ/์ง€๋„ ์—ฐ์†์ฒจ๋ถ€์‹œ ํฌ์ปค์‹ฑ ๊ฐœ์„ ์ด์Šˆ๋กœ ์ถ”๊ฐ€๋˜ ํ•จ์ˆ˜. */ $ON_FOCUS_N_CURSOR : function (bEndCursor, sId){ var el, oSelection; if(sId && ( el = jindo.$(sId, this.getDocument()) )){ // ID๊ฐ€ ์ง€์ •๋œ ๊ฒฝ์šฐ, ๋ฌด์กฐ๊ฑด ํ•ด๋‹น ๋ถ€๋ถ„์œผ๋กœ ์ปค์„œ ์ด๋™ clearTimeout(this._nTimerFocus); // ์—ฐ์† ์‚ฝ์ž…๋  ๊ฒฝ์šฐ, ๋ฏธ์™„๋ฃŒ ํƒ€์ด๋จธ๋Š” ์ทจ์†Œํ•œ๋‹ค. this._nTimerFocus = setTimeout(jindo.$Fn(function(el){ this._scrollIntoView(el); this.oApp.exec("FOCUS"); }, this).bind(el), 300); return; } oSelection = this.oApp.getSelection(); if(!oSelection.collapsed){ // select ์˜์—ญ์ด ์žˆ๋Š” ๊ฒฝ์šฐ if(bEndCursor){ oSelection.collapseToEnd(); } else { oSelection.collapseToStart(); } oSelection.select(); }else if(bEndCursor){ // select ์˜์—ญ์ด ์—†๋Š” ์ƒํƒœ์—์„œ bEndCursor ์ด๋ฉด body ๋งจ ๋’ค๋กœ ์ด๋™์‹œํ‚จ๋‹ค. this.oApp.exec("FOCUS"); el = this.getDocument().body; oSelection.selectNode(el); oSelection.collapseToEnd(); oSelection.select(); this._scrollIntoView(el); }else{ // select ์˜์—ญ์ด ์—†๋Š” ์ƒํƒœ๋ผ๋ฉด focus๋งŒ ์ค€๋‹ค. this.oApp.exec("FOCUS"); } }, /* * ์—˜๋ฆฌ๋จผํŠธ์˜ top, bottom ๊ฐ’์„ ๋ฐ˜ํ™˜ */ _getElementVerticalPosition : function(el){ var nTop = 0, elParent = el, htPos = {nTop : 0, nBottom : 0}; if(!el){ return htPos; } while(elParent) { nTop += elParent.offsetTop; elParent = elParent.offsetParent; } htPos.nTop = nTop; htPos.nBottom = nTop + jindo.$Element(el).height(); return htPos; }, /* * Window์—์„œ ํ˜„์žฌ ๋ณด์—ฌ์ง€๋Š” ์˜์—ญ์˜ top, bottom ๊ฐ’์„ ๋ฐ˜ํ™˜ */ _getVisibleVerticalPosition : function(){ var oWindow, oDocument, nVisibleHeight, htPos = {nTop : 0, nBottom : 0}; oWindow = this.getWindow(); oDocument = this.getDocument(); nVisibleHeight = oWindow.innerHeight ? oWindow.innerHeight : oDocument.documentElement.clientHeight || oDocument.body.clientHeight; htPos.nTop = oWindow.pageYOffset || oDocument.documentElement.scrollTop; htPos.nBottom = htPos.nTop + nVisibleHeight; return htPos; }, /* * ์—˜๋ฆฌ๋จผํŠธ๊ฐ€ WYSIWYG Window์˜ Visible ๋ถ€๋ถ„์—์„œ ์™„์ „ํžˆ ๋ณด์ด๋Š” ์ƒํƒœ์ธ์ง€ ํ™•์ธ (์ผ๋ถ€๋งŒ ๋ณด์ด๋ฉด false) */ _isElementVisible : function(htElementPos, htVisiblePos){ return (htElementPos.nTop >= htVisiblePos.nTop && htElementPos.nBottom <= htVisiblePos.nBottom); }, /* * [SMARTEDITORSUS-824] [SMARTEDITORSUS-828] ์ž๋™ ์Šคํฌ๋กค ์ฒ˜๋ฆฌ */ _scrollIntoView : function(el){ var htElementPos = this._getElementVerticalPosition(el), htVisiblePos = this._getVisibleVerticalPosition(), nScroll = 0; if(this._isElementVisible(htElementPos, htVisiblePos)){ return; } if((nScroll = htElementPos.nBottom - htVisiblePos.nBottom) > 0){ this.getWindow().scrollTo(0, htVisiblePos.nTop + nScroll); // Scroll Down return; } this.getWindow().scrollTo(0, htElementPos.nTop); // Scroll Up }, $BEFORE_MSG_EDITING_AREA_RESIZE_STARTED : function(){ // FF์—์„œ Height์กฐ์ • ์‹œ์— ๋ณธ๋ฌธ์˜ _fitElementInEditingArea()ํ•จ์ˆ˜ ๋ถ€๋ถ„์—์„œ selection์ด ๊นจ์ง€๋Š” ํ˜„์ƒ์„ ์žก๊ธฐ ์œ„ํ•ด์„œ // StringBookmark๋ฅผ ์‚ฌ์šฉํ•ด์„œ ์œ„์น˜๋ฅผ ์ €์žฅํ•ด๋‘ . (step1) if(!jindo.$Agent().navigator().ie){ var oSelection = null; oSelection = this.oApp.getSelection(); this.sBM = oSelection.placeStringBookmark(); } }, $AFTER_MSG_EDITING_AREA_RESIZE_ENDED : function(FnMouseDown, FnMouseMove, FnMouseUp){ if(this.oApp.getEditingMode() !== this.sMode){ return; } this.oApp.exec("REFRESH_WYSIWYG", []); // bts.nhncorp.com/nhnbts/browse/COM-1042 // $BEFORE_MSG_EDITING_AREA_RESIZE_STARTED์—์„œ ์ €์žฅํ•œ StringBookmark๋ฅผ ์…‹ํŒ…ํ•ด์ฃผ๊ณ  ์‚ญ์ œํ•จ.(step2) if(!jindo.$Agent().navigator().ie){ var oSelection = this.oApp.getEmptySelection(); oSelection.moveToBookmark(this.sBM); oSelection.select(); oSelection.removeStringBookmark(this.sBM); } }, $ON_CLEAR_IE_BACKUP_SELECTION : function(){ this._oIERange = null; }, $ON_RESTORE_IE_SELECTION : function(){ if(this._oIERange){ // changing the visibility of the iframe can cause an exception try{ this._oIERange.select(); this._oPrevIERange = this._oIERange; this._oIERange = null; }catch(e){} } }, /** * EVENT_EDITING_AREA_PASTE ์˜ ON ๋ฉ”์‹œ์ง€ ํ•ธ๋“ค๋Ÿฌ * ์œ„์ง€์œ… ๋ชจ๋“œ์—์„œ ์—๋””ํ„ฐ ๋ณธ๋ฌธ์˜ paste ์ด๋ฒคํŠธ์— ๋Œ€ํ•œ ๋ฉ”์‹œ์ง€๋ฅผ ์ฒ˜๋ฆฌํ•œ๋‹ค. * paste ์‹œ์— ๋‚ด์šฉ์ด ๋ถ™์—ฌ์ง„ ๋ณธ๋ฌธ์˜ ๋‚ด์šฉ์„ ๋ฐ”๋กœ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์—†์–ด delay ๋ฅผ ์ค€๋‹ค. */ $ON_EVENT_EDITING_AREA_PASTE : function(oEvent){ this.oApp.delayedExec('EVENT_EDITING_AREA_PASTE_DELAY', [oEvent], 0); }, $ON_EVENT_EDITING_AREA_PASTE_DELAY : function(weEvent) { this._replaceBlankToNbsp(weEvent.element); }, // [SMARTEDITORSUS-855] IE์—์„œ ํŠน์ • ๋ธ”๋กœ๊ทธ ๊ธ€์„ ๋ณต์‚ฌํ•˜์—ฌ ๋ถ™์—ฌ๋„ฃ๊ธฐ ํ–ˆ์„ ๋•Œ ๊ฐœํ–‰์ด ์ œ๊ฑฐ๋˜๋Š” ๋ฌธ์ œ _replaceBlankToNbsp : function(el){ var oNavigator = this.oApp.oNavigator; if(!oNavigator.ie){ return; } if(oNavigator.nativeVersion !== 9 || document.documentMode !== 7) { // IE9 ํ˜ธํ™˜๋ชจ๋“œ์—์„œ๋งŒ ๋ฐœ์ƒ return; } if(el.nodeType !== 1){ return; } if(el.tagName === "BR"){ return; } var aEl = jindo.$$("p:empty()", this.oApp.getWYSIWYGDocument().body, { oneTimeOffCache:true }); jindo.$A(aEl).forEach(function(value, index, array) { value.innerHTML = "&nbsp;"; }); }, _pageUp : function(we){ var nEditorHeight = this._getEditorHeight(), htPos = jindo.$Document(this.oApp.getWYSIWYGDocument()).scrollPosition(), nNewTop; if(htPos.top <= nEditorHeight){ nNewTop = 0; }else{ nNewTop = htPos.top - nEditorHeight; } this.oApp.getWYSIWYGWindow().scrollTo(0, nNewTop); we.stop(); }, _pageDown : function(we){ var nEditorHeight = this._getEditorHeight(), htPos = jindo.$Document(this.oApp.getWYSIWYGDocument()).scrollPosition(), nBodyHeight = this._getBodyHeight(), nNewTop; if(htPos.top+nEditorHeight >= nBodyHeight){ nNewTop = nBodyHeight - nEditorHeight; }else{ nNewTop = htPos.top + nEditorHeight; } this.oApp.getWYSIWYGWindow().scrollTo(0, nNewTop); we.stop(); }, _getEditorHeight : function(){ return this.oApp.elEditingAreaContainer.offsetHeight - this.nTopBottomMargin; }, _getBodyHeight : function(){ return parseInt(this.getDocument().body.scrollHeight, 10); }, initIframe : function(){ try { if (!this.iframe.contentWindow.document || !this.iframe.contentWindow.document.body || this.iframe.contentWindow.document.location.href === 'about:blank'){ throw new Error('Access denied'); } var sCSSBaseURI = (!!nhn.husky.SE2M_Configuration.SE2M_CSSLoader && nhn.husky.SE2M_Configuration.SE2M_CSSLoader.sCSSBaseURI) ? nhn.husky.SE2M_Configuration.SE2M_CSSLoader.sCSSBaseURI : ""; if(!!nhn.husky.SE2M_Configuration.SE_EditingAreaManager.sCSSBaseURI){ sCSSBaseURI = nhn.husky.SE2M_Configuration.SE_EditingAreaManager.sCSSBaseURI; } // add link tag if (sCSSBaseURI){ var doc = this.getDocument(); var headNode = doc.getElementsByTagName("head")[0]; var linkNode = doc.createElement('link'); linkNode.type = 'text/css'; linkNode.rel = 'stylesheet'; linkNode.href = sCSSBaseURI + '/smart_editor2_in.css'; headNode.appendChild(linkNode); } this._enableWYSIWYG(); this.status = nhn.husky.PLUGIN_STATUS.READY; } catch(e) { if(this._nIFrameReadyCount-- > 0){ setTimeout(jindo.$Fn(this.initIframe, this).bind(), 100); }else{ throw("iframe for WYSIWYG editing mode can't be initialized. Please check if the iframe document exists and is also accessable(cross-domain issues). "); } } }, getIR : function(){ var sContent = this.iframe.contentWindow.document.body.innerHTML, sIR; if(this.oApp.applyConverter){ sIR = this.oApp.applyConverter(this.sMode+"_TO_IR", sContent, this.oApp.getWYSIWYGDocument()); }else{ sIR = sContent; } return sIR; }, setIR : function(sIR){ // [SMARTEDITORSUS-875] HTML ๋ชจ๋“œ์˜ beautify์—์„œ ์ถ”๊ฐ€๋œ ๊ณต๋ฐฑ์„ ๋‹ค์‹œ ์ œ๊ฑฐ //sIR = sIR.replace(/(>)([\n\r\t\s]*)([^<]?)/g, "$1$3").replace(/([\n\r\t\s]*)(<)/g, "$2") // --[SMARTEDITORSUS-875] var sContent, oNavigator = this.oApp.oNavigator, bUnderIE11 = oNavigator.ie && document.documentMode < 11, // IE11๋ฏธ๋งŒ sCursorHolder = bUnderIE11 ? "" : "<br>"; if(this.oApp.applyConverter){ sContent = this.oApp.applyConverter("IR_TO_"+this.sMode, sIR, this.oApp.getWYSIWYGDocument()); }else{ sContent = sIR; } // [SMARTEDITORSUS-1279] [IE9/10] pre ํƒœ๊ทธ ์•„๋ž˜์— \n์ด ํฌํ•จ๋˜๋ฉด ๊ฐœํ–‰์ด ๋˜์ง€ ์•Š๋Š” ์ด์Šˆ /*if(oNavigator.ie && oNavigator.nativeVersion >= 9 && document.documentMode >= 9){ // [SMARTEDITORSUS-704] \r\n์ด ์žˆ๋Š” ๊ฒฝ์šฐ IE9 ํ‘œ์ค€๋ชจ๋“œ์—์„œ ์ •๋ ฌ ์‹œ ๋ธŒ๋ผ์šฐ์ €๊ฐ€ <p>๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฌธ์ œ sContent = sContent.replace(/[\r\n]/g,""); }*/ this.iframe.contentWindow.document.body.innerHTML = sContent; // ํŽธ์ง‘๋‚ด์šฉ์ด ์—†๋Š” ๊ฒฝ์šฐ if((this.iframe.contentWindow.document.body.innerHTML).replace(/[\r\n\t\s]*/,"") === ""){ if(this.oApp.sLineBreaker !== "BR"){ sCursorHolder = "<p>" + sCursorHolder + "</p>"; } this.iframe.contentWindow.document.body.innerHTML = sCursorHolder; } // [COM-1142] IE์˜ ๊ฒฝ์šฐ <p>&nbsp;</p> ๋ฅผ <p></p> ๋กœ ๋ณ€ํ™˜ // [SMARTEDITORSUS-1623] IE11์€ <p></p>๋กœ ๋ณ€ํ™˜ํ•˜๋ฉด ๋ผ์ธ์ด ๋ถ™์–ด๋ฒ„๋ฆฌ๊ธฐ ๋•Œ๋ฌธ์— IE10๋งŒ ์ ์šฉํ•˜๋„๋ก ์ˆ˜์ • if(bUnderIE11 && this.oApp.getEditingMode() === this.sMode){ var pNodes = this.oApp.getWYSIWYGDocument().body.getElementsByTagName("P"); for(var i=0, nMax = pNodes.length; i < nMax; i++){ if(pNodes[i].childNodes.length === 1 && pNodes[i].innerHTML === "&nbsp;"){ pNodes[i].innerHTML = ''; } } } }, getRawContents : function(){ return this.iframe.contentWindow.document.body.innerHTML; }, getRawHTMLContents : function(){ return this.getRawContents(); }, setRawHTMLContents : function(sContents){ this.iframe.contentWindow.document.body.innerHTML = sContents; }, getWindow : function(){ return this.iframe.contentWindow; }, getDocument : function(){ return this.iframe.contentWindow.document; }, focus : function(){ //this.getWindow().focus(); this.getDocument().body.focus(); this.oApp.exec("RESTORE_IE_SELECTION", []); }, _recordUndo : function(oKeyInfo){ /** * 229: Korean/Eng * 16: shift * 33,34: page up/down * 35,36: end/home * 37,38,39,40: left, up, right, down * 32: space * 46: delete * 8: bksp */ if(oKeyInfo.keyCode >= 33 && oKeyInfo.keyCode <= 40){ // record snapshot this.oApp.saveSnapShot(); return; } if(oKeyInfo.alt || oKeyInfo.ctrl || oKeyInfo.keyCode === 16){ return; } if(this.oApp.getLastKey() === oKeyInfo.keyCode){ return; } this.oApp.setLastKey(oKeyInfo.keyCode); // && oKeyInfo.keyCode != 32 // ์†๋„ ๋ฌธ์ œ๋กœ ์ธํ•˜์—ฌ Space ๋Š” ์ œ์™ธํ•จ if(!oKeyInfo.enter && oKeyInfo.keyCode !== 46 && oKeyInfo.keyCode !== 8){ return; } this.oApp.exec("RECORD_UNDO_ACTION", ["KEYPRESS(" + oKeyInfo.keyCode + ")", {bMustBlockContainer:true}]); }, _enableWYSIWYG : function(){ //if (this.iframe.contentWindow.document.body.hasOwnProperty("contentEditable")){ if (this.iframe.contentWindow.document.body.contentEditable !== null) { this.iframe.contentWindow.document.body.contentEditable = true; } else { this.iframe.contentWindow.document.designMode = "on"; } this.bWYSIWYGEnabled = true; if(jindo.$Agent().navigator().firefox){ setTimeout(jindo.$Fn(function(){ //enableInlineTableEditing : Enables or disables the table row and column insertion and deletion controls. this.iframe.contentWindow.document.execCommand('enableInlineTableEditing', false, false); }, this).bind(), 0); } }, _disableWYSIWYG : function(){ //if (this.iframe.contentWindow.document.body.hasOwnProperty("contentEditable")){ if (this.iframe.contentWindow.document.body.contentEditable !== null){ this.iframe.contentWindow.document.body.contentEditable = false; } else { this.iframe.contentWindow.document.designMode = "off"; } this.bWYSIWYGEnabled = false; }, isWYSIWYGEnabled : function(){ return this.bWYSIWYGEnabled; } }); //} //{ /** * @pluginDesc WYSIWYG ์˜์—ญ์— ๋ถ™์—ฌ๋„ฃ์–ด์ง€๋Š” ์™ธ๋ถ€ ์ปจํ…์ธ ๋ฅผ ์ •์ œํ•˜๋Š” ํ”Œ๋Ÿฌ๊ทธ์ธ */ nhn.husky.SE_PasteHandler = jindo.$Class({ name : "SE_PasteHandler", $init : function(sParagraphContainer){ // ๋ฌธ๋‹จ ๋‹จ์œ„ this.sParagraphContainer = sParagraphContainer || "P"; /** * ๋ณธ๋ฌธ์— ๋ถ™์—ฌ๋„ฃ์–ด์ง„ ์ปจํ…์ธ  ์ค‘, * ์ด ํ”Œ๋Ÿฌ๊ทธ์ธ์—์„œ ์ •์ œํ•œ ์ปจํ…์ธ ๋กœ ์น˜ํ™˜ํ•  ๋Œ€์ƒ ํƒœ๊ทธ ์ด๋ฆ„์˜ ๋ชฉ๋ก * */ this.aConversionTarget = ["TABLE"]; this.htBrowser = jindo.$Agent().navigator(); }, $ON_MSG_APP_READY : function(){ if(!this.htBrowser.safari || (this.htBrowser.safari && this.htBrowser.version >= 6)){ this.elBody = this.oApp.getWYSIWYGDocument().body; this.wfnPasteHandler = jindo.$Fn(this._handlePaste, this); this.wfnPasteHandler.attach(this.elBody, "paste"); // ๋ถ™์—ฌ๋„ฃ๊ธฐ ์ž‘์—… ๊ณต๊ฐ„ ์ƒ์„ฑ์„ ์œ„ํ•œ ํ• ๋‹น this.elEditingAreaContainer = jindo.$$.getSingle("DIV.husky_seditor_editing_area_container", null, {oneTimeOffCache : true}); /** * [SMARTEDITORSUS-1676] * [IE 10-] IE 11์€ beforepaste ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ๋ฅผ ๋“ฑ๋กํ•˜๋ฉด * beforepaste ํ•ธ๋“ค๋Ÿฌ๊ฐ€ ๋‘ ๋ฒˆ ํ˜ธ์ถœ๋˜๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์Œ * */ if(this.htBrowser.ie && this.htBrowser.nativeVersion <= 10 && this.htBrowser.version <= 10){ this.wfnBeforePasteHandler = jindo.$Fn(this._handleBeforePaste, this); this.wfnBeforePasteHandler.attach(this.elBody, "beforePaste"); } // --[SMARTEDITORSUS-1676] } }, /** * [SMARTEDITORSUS-1676] * [IE 10-] ์ปจํ…์ธ ๋ฅผ ๋ถ™์—ฌ๋„ฃ๋Š” ๊ฒƒ์€ ๋ธŒ๋ผ์šฐ์ € ๊ณ ์œ ์˜ ๊ถŒํ•œ์ธ๋ฐ, * ๋ถ™์—ฌ๋„ฃ๊ธฐ ์ „ ์„ ํƒํ•œ ์˜์—ญ์ด ์—†์„ ๋•Œ * HuskyRange ๋ถ๋งˆํฌ๋ฅผ paste ์ด๋ฒคํŠธ์—์„œ ์‚ฝ์ž…ํ•˜๋ฉด * ๋ถ™์—ฌ๋„ฃ์–ด์งˆ ๋•Œ ์ด ๋ถ๋งˆํฌ๊ฐ€ ์ž ์‹๋˜๋Š” ํ˜„์ƒ์ด ์žˆ๋‹ค. * * ๋”ฐ๋ผ์„œ beforepaste ์ด๋ฒคํŠธ์— HuskyRange ๋ถ๋งˆํฌ๋ฅผ ์‚ฝ์ž…ํ•œ๋‹ค. * */ _handleBeforePaste : function(){ var oSelection = this.oApp.getSelection(); // ์šฐ์„  ์„ ํƒ๋œ ์˜์—ญ์ด ์žˆ๋‹ค๋ฉด ์„ ํƒ๋œ ์˜์—ญ ์•ˆ์˜ ์ปจํ…์ธ ๋ฅผ ์ง€์›€ if(!oSelection.collapsed){ oSelection.deleteContents(); } this._sBM_IE = oSelection.placeStringBookmark(); var elEndBookmark = oSelection.getStringBookmark(this._sBM_IE, true); /** * ๋ถ™์—ฌ๋„ฃ์„ ๋•Œ ๋ ˆ์ด์•„์›ƒ ์ƒ์—์„œ ๊ณต๊ฐ„์„ ์ฐจ์ง€ํ•˜๊ณ  ์žˆ์–ด์•ผ * ์ปจํ…์ธ ๊ฐ€ ์˜๋„ํ•œ ์œ„์น˜์— ๋ถ™์—ฌ๋„ฃ์–ด์ง€๋Š”๋ฐ, * * HuskyRange์—์„œ ๋ถ๋งˆํฌ ์šฉ๋„๋กœ ์‚ฝ์ž…ํ•˜๋Š” ๋นˆ <span>์œผ๋กœ๋Š” ์ด๋ฅผ ์ถฉ์กฑํ•  ์ˆ˜ ์—†๋‹ค. * * ์‹œ์ž‘ ๋ถ๋งˆํฌ์˜ ๋’ค์™€, ๋ ๋ถ๋งˆํฌ์˜ ์•ž์— * zero-width space ๋ฌธ์ž์ธ \u200b๋ฅผ ๋‹ด๊ณ  ์žˆ๋Š” * ํ…์ŠคํŠธ ๋…ธ๋“œ๋ฅผ ์‚ฝ์ž…ํ•ด ๋‘”๋‹ค. * */ var emptyTextNode = document.createTextNode(""); this.zwspStart = emptyTextNode.cloneNode(true); this.zwspStart.nodeValue = "\u200b"; this.zwspEnd = this.zwspStart.cloneNode(true); elEndBookmark.parentNode.insertBefore(this.zwspEnd, elEndBookmark); elEndBookmark.parentNode.insertBefore(this.zwspStart, this.zwspEnd); /** * oSelection.select()๋กœ ๋ชฉํ‘œ ์œ„์น˜์— ์ปค์„œ๋ฅผ ์œ„์น˜์‹œํ‚จ๋‹ค. * * <์‹œ์ž‘ ๋ถ๋งˆํฌ /><\u200b>[๋ชฉํ‘œ ์ปค์„œ ์œ„์น˜]<\u200b><๋ ๋ถ๋งˆํฌ /> * */ oSelection.setEndBefore(this.zwspEnd); oSelection.collapseToEnd(); oSelection.select(); }, _handlePaste : function(we){ if(this.htBrowser.chrome || (this.htBrowser.safari && this.htBrowser.version >= 6)){ /** * [Chrome, Safari6+] clipboard์—์„œ ๋„˜์–ด์˜จ style ์ •์˜๋ฅผ ์ €์žฅํ•ด ๋‘” ๋’ค, * ํŠน์ • ์—ด๋ฆฐ ํƒœ๊ทธ์— style์„ ์ ์šฉํ•ด์•ผ ํ•  ๊ฒฝ์šฐ ํ™œ์šฉํ•œ๋‹ค. * * MS Excel 2010 ๊ธฐ์ค€์œผ๋กœ * <td>์— ๋‹ด๊ธด class ๋ช…์„ ํš๋“ํ•œ ๋’ค, * ์ €์žฅํ•ด ๋‘” style์—์„œ ๋งค์นญํ•˜๋Š” ๊ฐ’์ด ์žˆ์œผ๋ฉด * style์„ ํ•ด๋‹น ํƒœ๊ทธ์— ์ ์šฉํ•œ๋‹ค. * * [IE] Text ํ˜•ํƒœ๋กœ๋งŒ ๊ฐ’์„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— style ์ •์˜ ์ €์žฅ ๋ถˆ๊ฐ€ * */ var sClipboardData = we._event.clipboardData.getData("text/html"); var elTmp = document.createElement("DIV"); elTmp.innerHTML = sClipboardData; var elStyle = jindo.$$.getSingle("style", elTmp, {oneTimeOffCache : true}); if(elStyle){ var sStyleFromClipboard = elStyle.innerHTML; // style="" ๋‚ด๋ถ€์— ์‚ฝ์ž…๋˜๋Š” ๊ฒฝ์šฐ, ์กฐํ™”๋ฅผ ์ด๋ฃจ์–ด์•ผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์Œ๋”ฐ์˜ดํ‘œ๋ฅผ ๋”ฐ์˜ดํ‘œ๋กœ ์น˜ํ™˜ sStyleFromClipboard = sStyleFromClipboard.replace(/"/g, "'"); this._sStyleFromClipboard = sStyleFromClipboard; } } this._preparePaste(); // ๋ธŒ๋ผ์šฐ์ €์˜ ๊ณ ์œ  ๋ถ™์—ฌ๋„ฃ๊ธฐ ๋™์ž‘์œผ๋กœ ์ปจํ…์ธ ๊ฐ€ ๋ณธ๋ฌธ ์˜์—ญ์— ๋ถ™์—ฌ๋„ฃ์–ด์ง„๋‹ค. setTimeout(jindo.$Fn(function(){ // [SMARTEDITORSUS-1676] /** * ์ปจํ…์ธ ๊ฐ€ ๋ถ™์—ฌ๋„ฃ์–ด์ง€๋Š” ๊ณผ์ •์—์„œ * ์ปจํ…์ธ ์˜ ์•ž ๋ถ€๋ถ„ ํ…์ŠคํŠธ ์ผ๋ถ€๋Š” * ์•ž์ชฝ zero-width space ํ…์ŠคํŠธ ๋…ธ๋“œ์— ๋ณ‘ํ•ฉ๋˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋‹ค. * * ๋”ฐ๋ผ์„œ ์ด ํ…์ŠคํŠธ ๋…ธ๋“œ ์ „์ฒด๋ฅผ ๋“ค์–ด๋‚ด๋Š” ๊ฒƒ์€ ์–ด๋ ต๊ณ , * ์‹œ์ž‘ ๋ถ€๋ถ„์— ๋‚จ์•„ ์žˆ๋Š” zero-width space ๋ฌธ์ž๋งŒ ์ œ๊ฑฐํ•  ์ˆ˜๋ฐ–์— ์—†๋‹ค. * */ var rxZwspStart = new RegExp("^[\u200b]"); if(!!this.zwspStart && !!this.zwspStart.nodeValue){ this.zwspStart.nodeValue = this.zwspStart.nodeValue.replace(rxZwspStart, ""); /** * ์ œ๊ฑฐ ํ›„ ๋นˆ ๊ฐ’์ด๋ผ๋ฉด, ์ธ์œ„์ ์œผ๋กœ ์‚ฝ์ž…ํ•ด ์ค€ ๋’ค์ชฝ zwsp ํ…์ŠคํŠธ ๋…ธ๋“œ๋ฅผ ์œ ์ง€ํ•  ํ•„์š”๊ฐ€ ์—†๋‹ค. * * [Chrome, Safari 6+] ๋‘ ๋ฒˆ์งธ ์กฐ๊ฑด์‹์ด ํ•„์š”ํ•˜๋‹ค. * ๋ถ™์—ฌ๋„ฃ์–ด์ง€๋Š” ์ปจํ…์ธ ๊ฐ€ line-height ์†์„ฑ์„ ๊ฐ€์ง„ span ํƒœ๊ทธ์ธ ๊ฒฝ์šฐ, * this.zwspEnd.parentNode๊ฐ€ ์‚ฌ๋ผ์ง€๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ๋‹ค. * ์ด์™€๋Š” ์ง์ ‘์ ์œผ๋กœ ๊ด€๋ จ๋˜์–ด ์žˆ์ง€ ์•Š์œผ๋‚˜, * Husky ๋ ๋ถ๋งˆํฌ์— ์ด line-height ์†์„ฑ์ด ๋ถ™๋Š” ๋ฌธ์ œ๋„ ์žˆ๋‹ค. * */ if(this.zwspStart.nodeValue == "" && !!this.zwspStart.paretNode){ this.zwspStart.parentNode.removeChild(this.zwspStart); } } /** * ๋’ค์ชฝ zero-width space๊ฐ€ ํฌํ•จ๋œ ํ…์ŠคํŠธ ๋…ธ๋“œ ๋งˆ์ง€๋ง‰์˜ * zero-width space ๋ฌธ์ž๋ฅผ ์ œ๊ฑฐํ•œ๋‹ค. * */ var rxZwspEnd = new RegExp("[\u200b]$"); if(!!this.zwspEnd && !!this.zwspEnd.nodeValue){ this.zwspEnd.nodeValue = this.zwspEnd.nodeValue.replace(rxZwspEnd, ""); /** * ์ œ๊ฑฐ ํ›„ ๋นˆ ๊ฐ’์ด๋ผ๋ฉด, ์ธ์œ„์ ์œผ๋กœ ์‚ฝ์ž…ํ•ด ์ค€ ๋’ค์ชฝ zwsp ํ…์ŠคํŠธ ๋…ธ๋“œ๋ฅผ ์œ ์ง€ํ•  ํ•„์š”๊ฐ€ ์—†๋‹ค. * * [Chrome, Safari 6+] ๋‘ ๋ฒˆ์งธ ์กฐ๊ฑด์‹์ด ํ•„์š”ํ•˜๋‹ค. * ๋ถ™์—ฌ๋„ฃ์–ด์ง€๋Š” ์ปจํ…์ธ ๊ฐ€ line-height ์†์„ฑ์„ ๊ฐ€์ง„ span ํƒœ๊ทธ์ธ ๊ฒฝ์šฐ, * this.zwspEnd.parentNode๊ฐ€ ์‚ฌ๋ผ์ง€๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ๋‹ค. * ์ด์™€๋Š” ์ง์ ‘์ ์œผ๋กœ ๊ด€๋ จ๋˜์–ด ์žˆ์ง€ ์•Š์œผ๋‚˜, * Husky ๋ ๋ถ๋งˆํฌ์— ์ด line-height ์†์„ฑ์ด ๋ถ™๋Š” ๋ฌธ์ œ๋„ ์žˆ๋‹ค. * */ if(this.zwspEnd.nodeValue == "" && !!this.zwspEnd.parentNode){ this.zwspEnd.parentNode.removeChild(this.zwspEnd); } } // [SMARTEDITORSUS-1661] try{ this._processPaste(); }catch(e){ // [SMARTEDITORSUS-1673] [SMARTEDITORSUS-1661]์˜ ๋ณต์› ๊ธฐ๋Šฅ์„ ์ œ๊ฑฐ // JEagleEye ๊ฐ์ฒด๊ฐ€ ์กด์žฌํ•˜๋ฉด ์˜ค๋ฅ˜ ์ „์†ก(BLOG) if(typeof(JEagleEyeClient) != "undefined"){ var line = e.lineNumber; if(!line){ line = 0; } var el = "hp_SE_PasteHandler.js/_handlePaste"; if(el){ var tmp = "http://blog.naver.com/"; tmp += el; el = tmp; } JEagleEyeClient.sendError(e, el, line); } // --[SMARTEDITORSUS-1661][SMARTEDITORSUS-1673] } // ๋ถ๋งˆํฌ ์ œ๊ฑฐ // [SMARTEDITORSUS-1687] var oSelection = this.oApp.getSelection(); this._moveToStringBookmark(oSelection); oSelection.collapseToEnd(); oSelection.select(); // --[SMARTEDITORSUS-1687] this._removeStringBookmark(oSelection); }, this).bind(), 0); }, /** * ๋ถ™์—ฌ๋„ฃ์–ด์ง€๋Š” ์™ธ๋ถ€ ํ”„๋กœ๊ทธ๋žจ์˜ ์ปจํ…์ธ ๋ฅผ ์กฐ์ž‘ํ•˜๊ธฐ ์œ„ํ•œ ์ค€๋น„๋ฅผ ํ•œ๋‹ค. * */ _preparePaste : function(){ this._saveOriginalContents(); }, /** * ๋ณธ๋ฌธ ์˜์—ญ์˜ ์›๋ฌธ์„ ์ €์žฅํ•ด ๋‘”๋‹ค. * */ _saveOriginalContents : function(){ var oSelection = this.oApp.getSelection(); // ์šฐ์„  ์„ ํƒ๋œ ์˜์—ญ์ด ์žˆ๋‹ค๋ฉด ๋‚ด๋ถ€ ์ปจํ…์ธ ๋ฅผ ์ง€์›€ if(!oSelection.isCollapsed){ oSelection.deleteContents(); } // [SMARTEDITORSUS-1676] if(!this._sBM_IE){ // [Non-IE 10-] IE 10-์€ beforepaste ๋‹จ๊ณ„์—์„œ Husky ๋ถ๋งˆํฌ๋ฅผ ์ด๋ฏธ ์‚ฝ์ž…ํ–ˆ๋‹ค. this._sBM = oSelection.placeStringBookmark(); var elEndBookmark = oSelection.getStringBookmark(this._sBM, true); var elStartBookmark = oSelection.getStringBookmark(this._sBM); /** * ๋ถ™์—ฌ๋„ฃ์„ ๋•Œ ๋ ˆ์ด์•„์›ƒ ์ƒ์—์„œ ๊ณต๊ฐ„์„ ์ฐจ์ง€ํ•˜๊ณ  ์žˆ์–ด์•ผ * ์ปจํ…์ธ ๊ฐ€ ์˜๋„ํ•œ ์œ„์น˜์— ๋ถ™์—ฌ๋„ฃ์–ด์ง€๋Š”๋ฐ, * * HuskyRange์—์„œ ๋ถ๋งˆํฌ ์šฉ๋„๋กœ ์‚ฝ์ž…ํ•˜๋Š” ๋นˆ <span>์œผ๋กœ๋Š” ์ด๋ฅผ ์ถฉ์กฑํ•  ์ˆ˜ ์—†๋‹ค. * * ์‹œ์ž‘ ๋ถ๋งˆํฌ์˜ ๋’ค์™€, ๋ ๋ถ๋งˆํฌ์˜ ์•ž์— * zero-width space ๋ฌธ์ž์ธ \u200b๋ฅผ ๋‹ด๊ณ  ์žˆ๋Š” * ํ…์ŠคํŠธ ๋…ธ๋“œ๋ฅผ ์‚ฝ์ž…ํ•ด ๋‘”๋‹ค. * */ var emptyTextNode = document.createTextNode(""); this.zwspStart = emptyTextNode.cloneNode(true); this.zwspStart.nodeValue = "\u200b"; this.zwspEnd = this.zwspStart.cloneNode(true); elEndBookmark.parentNode.insertBefore(this.zwspEnd, elEndBookmark); elEndBookmark.parentNode.insertBefore(this.zwspStart, this.zwspEnd); /** * oSelection.select()๋กœ ๋ชฉํ‘œ ์œ„์น˜์— ์ปค์„œ๋ฅผ ์œ„์น˜์‹œํ‚จ๋‹ค. * * <์‹œ์ž‘ ๋ถ๋งˆํฌ /><\u200b>[๋ชฉํ‘œ ์ปค์„œ ์œ„์น˜]<\u200b><๋ ๋ถ๋งˆํฌ /> * */ oSelection.setEndBefore(this.zwspEnd); oSelection.collapseToEnd(); oSelection.select(); /** * [IE 11]ํ…์ŠคํŠธ ํŽธ์ง‘๊ธฐ์˜ tab์ด ๋ถ™์—ฌ๋„ฃ์–ด์ง€๋Š” ์ปจํ…์ธ ์˜ ๊ฐ€์žฅ ๋งˆ์ง€๋ง‰์— ๋“ค์–ด๊ฐ€๋Š” ๊ฒฝ์šฐ, * \u200b๋ฅผ zwspEnd ๋…ธ๋“œ์—์„œ ์ฐพ์„ ์ˆ˜ ์—†๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์–ด์„œ * ์‚ฌ์ „์— ์ œ๊ฑฐํ•ด ์ค€๋‹ค. * */ if(this.htBrowser.ie && this.htBrowser.nativeVersion == 11 && this.htBrowser.version == 11){ //this.zwspEnd.nodeValue = ""; } } // --[SMARTEDITORSUS-1676] }, /** * ์™ธ๋ถ€ ํ”„๋กœ๊ทธ๋žจ์˜ ์ปจํ…์ธ ๊ฐ€ ์›๋ฌธ์— ๋ถ™์—ฌ๋„ฃ์–ด์ง€๋Š” ๊ณผ์ •์„ ์ง„ํ–‰ํ•œ๋‹ค. * */ _processPaste : function(){ this._savePastedContents(); // [SMARTEDITORSUS-1673] try{ if(!!this.elPasteHelper){ this._clearPasteHelper(); this._showPasteHelper(); }else{ // ๋ถ™์—ฌ๋„ฃ๊ธฐ ์ž‘์—… ๊ณต๊ฐ„ ์ƒ์„ฑ(์ตœ์ดˆ 1ํšŒ) this._createPasteHelper(); } // ์ž‘์—… ๊ณต๊ฐ„์— ๋ถ™์—ฌ๋„ฃ๊ธฐ this._loadToPasteHelper(); // ๋ถ™์—ฌ๋„ฃ๊ธฐ ์ž‘์—… ๊ณต๊ฐ„์— ๋ถ™์—ฌ๋„ฃ์€ ์ปจํ…์ธ ๋ฅผ ๋– ์„œ ๋ณธ๋ฌธ์˜ ํ•ด๋‹น ์˜์—ญ ๊ต์ฒด this._loadToBody(); this._hidePasteHelper(); }catch(e){ this._hidePasteHelper(); throw e; } this._hidePasteHelper(); // --[SMARTEDITORSUS-1673] }, /** * ๋ณธ๋ฌธ ์˜์—ญ์— ์™ธ๋ถ€ ํ”„๋กœ๊ทธ๋žจ์˜ ์ปจํ…์ธ ๊ฐ€ ๋ถ™์—ฌ๋„ฃ์–ด์ง€๋ฉด ์ด๋ฅผ ์ €์žฅํ•˜๊ณ , * SmartEditor์— ๋งž๊ฒŒ ํ•„ํ„ฐ๋งํ•œ๋‹ค. * */ _savePastedContents : function(){ // [SMARTEDITORSUS-1673] /** * ์‚ฝ์ž…๋œ ๋ถ๋งˆํฌ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•˜์—ฌ * ๋ถ™์—ฌ๋„ฃ์–ด์ง„ ์ปจํ…์ธ ๋ฅผ ๋ณต์‚ฌํ•ด ๋‘๊ณ , * ์ดํ›„ ์ด๋ฅผ ํ™œ์šฉํ•˜์—ฌ ๋ณ„๋„์˜ ๊ณต๊ฐ„์—์„œ ์ž‘์—… * */ var oSelection = this.oApp.getSelection(); this._moveToStringBookmark(oSelection); oSelection.select(); this.oSelectionClone = oSelection.cloneContents(); // ์ปจํ…์ธ  ๋ณต์‚ฌ๊ฐ€ ๋๋‚ฌ์œผ๋ฏ€๋กœ ์„ ํƒ ํ•ด์ œ oSelection.collapseToEnd(); oSelection.select(); var sTarget = this._outerHTML(this.oSelectionClone); // --[SMARTEDITORSUS-1673] this._isPastedContentsEmpty = true; // ๋ถ™์—ฌ๋„ฃ์–ด์ง„ ๋‚ด์šฉ์ด ์—†๋Š”์ง€ ํ™•์ธ if(sTarget != ""){ this._isPastedContentsEmpty = false; /** * [FireFox, Safari6+] clipboard์—์„œ style ์ •์˜๋ฅผ ์ €์žฅํ•  ์ˆ˜๋Š” ์—†์ง€๋งŒ, * ๋ณธ๋ฌธ์— ๋ถ™์—ฌ๋„ฃ์–ด์ง„ ๋’ค ํš๋“ํ•˜์—ฌ ์ €์žฅ ๊ฐ€๋Šฅ * * iWork Pages์˜ ๊ฒฝ์šฐ, ์ด์ „ ์‹œ์ ์—์„œ ๋“ค์–ด์˜จ ์Šคํƒ€์ผ ์ •๋ณด๊ฐ€ ์ด๋ฏธ ์กด์žฌํ•  ์ˆ˜๋„ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— * ๊ธฐ์กด ๋ณ€์ˆ˜์— ๊ฐ’์„ ๋”ํ•ด๋„ฃ๋Š” ๋ฐฉ์‹ ์‚ฌ์šฉ * * @XXX 27.0 ์—…๋ฐ์ดํŠธ ์ดํ›„ style ์ •๋ณด๊ฐ€ ๋„˜์–ด์˜ค์ง€ ์•Š์•„ ๊ฐ’์„ ์ €์žฅํ•  ์ˆ˜ ์—†์Œ * */ if(this.htBrowser.firefox || (this.htBrowser.safari && this.htBrowser.version >= 6)){ var aStyleFromClipboard = sTarget.match(/<style>([^<>]+)<\/style>/i); if(aStyleFromClipboard){ var sStyleFromClipboard = aStyleFromClipboard[1]; // style="" ๋‚ด๋ถ€์— ์‚ฝ์ž…๋˜๋Š” ๊ฒฝ์šฐ, ์กฐํ™”๋ฅผ ์ด๋ฃจ์–ด์•ผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์Œ๋”ฐ์˜ดํ‘œ๋ฅผ ๋”ฐ์˜ดํ‘œ๋กœ ์น˜ํ™˜ sStyleFromClipboard = sStyleFromClipboard.replace(/"/g, "'"); if(this._sStyleFromClipboard){ this._sStyleFromClipboard += sStyleFromClipboard; }else{ this._sStyleFromClipboard = sStyleFromClipboard; } } } // ๋ถ™์—ฌ๋„ฃ์–ด์ง„ ์ปจํ…์ธ ๋ฅผ ์ •์ œ this._sTarget = this._filterPastedContents(sTarget); } }, /** * [SMARTEDITORSUS-1673] ์›๋ฌธ์— ์‚ฝ์ž…ํ•ด ๋‘์—ˆ๋˜ ๋ถ๋งˆํฌ๋กœ ์ด๋™. * * ๋ถ™์—ฌ๋„ฃ๊ธฐ ์ด๋ฒคํŠธ ๋ฐœ์ƒ ์‹œ์ ์— ์›๋ฌธ์— ์‚ฝ์ž…ํ•ด ๋‘” ๋ถ๋งˆํฌ์ด๋‹ค. * */ _moveToStringBookmark : function(oSelection){ if(!!this._sBM_IE){ // [IE 10-] beforepaste ๋‹จ๊ณ„์—์„œ ๋ถ™์—ฌ๋„ฃ์–ด์ง„ ๋ถ๋งˆํฌ๋ฅผ selection์— ์‚ฌ์šฉ oSelection.moveToStringBookmark(this._sBM_IE); }else{ // paste ์ด๋ฒคํŠธ์—์„œ ๋ถ™์—ฌ๋„ฃ์–ด์ง„ ๋ถ๋งˆํฌ๋ฅผ selection์— ์‚ฌ์šฉ oSelection.moveToStringBookmark(this._sBM); } }, /** * [SMARTEDITORSUS-1673] X-Browsing ๋น„ํ˜ธํ™˜ ํ”„๋กœํผํ‹ฐ์ธ outerHTML fix * */ _outerHTML : function(el){ var sOuterHTML = ""; if(el.outerHTML){ sOuterHTML = el.outerHTML; }else{ var elTmp = document.createElement("DIV"); elTmp.appendChild(el.cloneNode(true)); sOuterHTML = elTmp.innerHTML; } return sOuterHTML; }, /** * SmartEditor์— ๋งž๋Š” ํ•„ํ„ฐ๋ง์„ ๊ฑฐ์นœ ์ปจํ…์ธ ๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค. * @param {String} ํ•„ํ„ฐ๋ง ๋Œ€์ƒ์ด ๋  HTML * */ _filterPastedContents : function(sOriginalContent){ // ๋ฌธ๋‹จ ๊ต์ฒด์™€ ๊ด€๋ จ๋œ ๋ณ€์ˆ˜ this._isPastedMultiParagraph = false; // ๋ถ™์—ฌ๋„ฃ์–ด์ง€๋Š” ์ปจํ…์ธ ๊ฐ€ ์—ฌ๋Ÿฌ ๋ฌธ๋‹จ์œผ๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธ this._aGoesPreviousParagraph = []; // ๋ฌธ๋‹จ์˜ ๋ถ„๋ฆฌ๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ, ์›๋ž˜์˜ ๋ถ๋งˆํฌ๊ฐ€ ์žˆ๋Š” ๋ฌธ๋‹จ์œผ๋กœ ๋„˜์–ด๊ฐˆ inline ์š”์†Œ๋“ค์˜ ์ง‘ํ•ฉ var bParagraphChangeStart = false, bParagraphChangeEnd = false, nParagraphHierarchy = 0, // ๋ช‡ ์ค‘์œผ๋กœ ์—ด๋ ค ์žˆ๋Š”์ง€ ํ™•์ธ nParagraphChangeCount = 0, // ๋ฌธ๋‹จ ๊ต์ฒด ํšŸ์ˆ˜ bParagraphIsOpen = false; // ํ˜„์žฌ ๋ฌธ๋‹จ์ด ์—ด๋ ค ์žˆ๋Š”์ง€ ํ™•์ธ var sMatch, // ํŒ๋ณ„์‹๊ณผ ์ผ์น˜ํ•˜๋Š” ๋ถ€๋ถ„ sResult, // ํŒ๋ณ„์‹๊ณผ ์ผ์น˜ํ•˜๋Š” ๋ถ€๋ถ„์ด ํ•„ํ„ฐ๋ง์„ ๊ฑฐ์ณ ์ตœ์ข…์ ์œผ๋กœ ๋ฐ˜ํ™˜๋˜๋Š” ํ˜•ํƒœ aResult = [], // ์ตœ์ข…์ ์œผ๋กœ ๋ฐ˜ํ™˜๋˜๋Š” ์ •์ œ๋œ ์ปจํ…์ธ ๋“ค์ด ๋‹ด๊ธด ๋ฐฐ์—ด nPreviousIndex = -1, // ์ง์ „ ์ž‘์—… ๋ถ€๋ถ„์ด ๊ฒฐ๊ณผ ๋ฐฐ์—ด์—์„œ ์ฐจ์ง€ํ•˜๋Š” index sTagName, // ํŒ๋ณ„์‹๊ณผ ์ผ์น˜ํ•˜๋Š” ๋ถ€๋ถ„์˜ ํƒœ๊ทธ๋ช… sPreviousContent = "", // ์ง์ „ ์‚ฝ์ž…๋œ ์ปจํ…์ธ  aMultiParagraphIndicator = ["BLOCKQUOTE", "DD", "DIV", "DL", "FORM", "H1", "H2", "H3", "H4", "H5", "H6", "HR", "OL", "P", "TABLE", "UL", "IFRAME"], // white list๋กœ ์—ฌ๋Ÿฌ ๋ฌธ๋‹จ์œผ๋กœ ์ฒ˜๋ฆฌํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ๋ฅผ ๊ตฌ๋ณ„ (https://developer.mozilla.org/ko/docs/HTML/Block-level_elements) rxMultiParagraphIndicator = new RegExp("^(" + aMultiParagraphIndicator.join("|") + ")$", "i"), // ํ˜„์žฌ ์ž‘์—…์ด ํ…Œ์ด๋ธ” ๋‚ด๋ถ€์—์„œ ์ด๋ฃจ์–ด์ง€๊ณ  ์žˆ๋Š”์ง€ ํ™•์ธ. tr, td์— style์ด ๋ช…์‹œ๋˜์–ด ์žˆ์ง€ ์•Š์€ ๊ฒฝ์šฐ ์‚ฌ์šฉ isInTableContext = false, nTdIndex = 0, // tr, td์˜ style ์บ์‹ฑ ์ค‘์— ํ˜„์žฌ ๋ช‡ ๋ฒˆ์งธ td์ธ์ง€ ํ™•์ธ์„ ์œ„ํ•จ nTdLength = 0, // ์บ์‹ฑ ์‹œ์ ์— ์ด td์˜ ์ˆ˜๋ฅผ ๊ตฌํ•จ aColumnWidth = [], // col์˜ width๋ฅผ ์ €์žฅํ•˜๋Š” ๋ฐฐ์—ด nRowHeight = 0; // tr์˜ height ์ €์žฅ์šฉ // [SMARTEDITORSUS-1671] ๋‹ค์ค‘ ํ…Œ์ด๋ธ”์˜ col ์บ์‹ฑ var nTableDepth = 0; var aaColumnWidth = []; // ์ด์ฐจ์› ๋ฐฐ์—ด // --[SMARTEDITORSUS-1671] // ํŒจํ„ด var rxOpeningTag = /^<[^?\/\s>]+(([\s]{0})|([\s]+[^>]+))>/, // ์—ด๋ฆฐ ํƒœ๊ทธ rxTagName = /^<[\/]?([^\s]+)(([\s]{0})|([\s]+[^>]+))>/, // ํƒœ๊ทธ๋ช… rxClosingTag = /^<\/[A-Za-z]+>/, // ๋‹ซํžŒ ํƒœ๊ทธ rxOpeningAndClosingTag = /^<[^>]+\/>/, // ์ž์ฒด๋กœ ์—ด๊ณ  ๋‹ซ๋Š” ํƒœ๊ทธ rxCommentTag = /^<!--[^<>]+-->/, // ์ฃผ์„์ด๋‚˜ ์ปค์Šคํ…€ ํƒœ๊ทธ rxOpeningCommentTag = /^<!--[^->]+>/, // ์—ด๋ฆฐ ์ฃผ์„ ํƒœ๊ทธ rxClosingCommentTag = /^<![^->]+-->/, // ๋‹ซํžŒ ์ฃผ์„ ํƒœ๊ทธ rxWhiteSpace = /^[\n\r\t\s]+/, // ๊ณต๋ฐฑ rxNonTag = /^[^<\n]+/, // ํƒœ๊ทธ ์•„๋‹Œ ์š”์†Œ rxExceptedOpeningTag = /^<[^<>]+>/, // ์–ด๋А ์กฐ๊ฑด๋„ ํ†ต๊ณผํ•˜์ง€ ์•Š์€, ์—ด๋ฆฐ ์˜ˆ์™ธ ํƒœ๊ทธ๋“ค rxExceptedClosingTag = /^<\/[^<>]+>/, // ์–ด๋А ์กฐ๊ฑด๋„ ํ†ต๊ณผํ•˜์ง€ ์•Š์€, ๋‹ซํžŒ ์˜ˆ์™ธ ํƒœ๊ทธ๋“ค // MS ํ”„๋กœ๊ทธ๋žจ์˜ ํ…Œ์ด๋ธ”์—์„œ ํŠนํžˆ ์‚ฌ์šฉํ•˜๋Š” ํŒจํ„ด rxMsoStyle = /(mso-[^:]+[\s]*:[\s]*)([^;"]*)([;]?)/gi, // Mso-๋กœ ์‹œ์ž‘ํ•˜๋Š” ์Šคํƒ€์ผ์ด ์žˆ๋Š”์ง€ ๊ฒ€์‚ฌ // [SMARTEDITORSUS-1673] rxStyle = /(style[\s]*=[\s]*)(["'])([^"']*)(["'])/i, // style ์†์„ฑ ํš๋“ rxClass = /class[\s]*=[\s]*(?:(?:["']([^"']*)["'])|([^\s>]+))/i, // --[SMARTEDITORSUS-1673] rxTableClassAdd = /(^<table)/gi, bColgroupAppeared, // [IE 8~11] MS Excel์—์„œ ์—ด๋ฆฐ ์ฑ„ ์‚ฝ์ž…๋˜๋Š” colgroup ํƒœ๊ทธ๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด, ๋ถ€๋“์ดํ•˜๊ฒŒ ์ˆ˜๋™์œผ๋กœ </colgroup>์„ ์ถ”๊ฐ€ํ•˜๊ธฐ ์œ„ํ•œ flag. <table> ๋‹จ์œ„๋กœ ์‚ฌ์šฉ rxApplied; // ๊ฒฐ๊ณผ ๋ฌธ์ž์—ด ์ž‘์—…์‹œ ์ ์šฉํ•˜๋Š” ํŒจํ„ด /** * depth๋ฅผ ํ™œ์šฉํ•œ white-list, black-list * * -depth ๋Š” ์—ด๋ฆฐ ํƒœ๊ทธ์ผ ๋•Œ +1, ๋‹ซํžŒ ํƒœ๊ทธ์ผ ๋•Œ -1 * -ํ—ˆ์šฉ/์ œ์™ธ ์‹œ์ž‘ depth๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์ฒ˜๋ฆฌ * */ var bInit = true, // ์ฒซ ๋ฒˆ์งธ ์ž‘์—…์ธ ๊ฒฝ์šฐ ๋ณด์ •์— ์‚ฌ์šฉ nDepth = 0, // ํ˜„์žฌ ์ฝ”๋“œ์˜ depth // ์ž‘์—… ๋Œ€์ƒ์„ ๊ธฐ์ค€์œผ๋กœ, ์ง์ „ ๋Œ€์ƒ ํŒ๋‹จ ๊ธฐ์ค€ wasSibling = true, // ๊ฐ™์€ depth์˜€๋Š”์ง€ ํ™•์ธ wasJustOpened = true, // ์ž‘์—… ํƒœ๊ทธ๊ฐ€ ๋‹ซํžŒ ํƒœ๊ทธ์ผ ๋•Œ, ์ง์ „ ์ž‘์—… ๋Œ€์ƒ์ด ์—ด๋ฆฐ ํƒœ๊ทธ๋ผ๋ฉด depth๋ฅผ ์œ ์ง€ํ•ด ์ฃผ๊ธฐ ์œ„ํ•œ flag wasClosed = true, // ๋‹ซํžŒ ํƒœ๊ทธ์˜€๋Š”์ง€ ํ™•์ธ // Open-only ๊ฐ์ง€ aOnlyOpeningTag = ["BR", "IMG", "COL", "HR"], // ์—ด๊ณ  ๋‹ซํžˆ๋Š” ํ˜•ํƒœ๊ฐ€ ์•„๋‹Œ ํƒœ๊ทธ๋“ค๋กœ, depth ๋ถˆ๋ณ€. rxOnlyOpeningTag = new RegExp("^(" + aOnlyOpeningTag.join("|") + ")$", "i"), bDepthChange, // depth ๋ณ€๊ฒฝ์ด ์—†๋Š” ํƒœ๊ทธ์ธ์ง€ ํŒ๋ณ„ํ•˜๋Š” ์šฉ๋„ /** * white-list ์š”์†Œ์— ํƒœ๊ทธ๋ฅผ ๋„ฃ์–ด๋†จ๋‹ค๋ฉด white-list ํƒœ๊ทธ ์ดํ•˜์˜ ์š”์†Œ๋งŒ์„ ํฌํ•จ์‹œํ‚ค๊ณ , * black-list ์š”์†Œ์— ํƒœ๊ทธ๋ฅผ ๋„ฃ์–ด๋†จ๋‹ค๋ฉด black-list ํƒœ๊ทธ๊ฐ€ ํฌํ•จ๋œ ๊ฒฝ์šฐ ์ดํ•˜์˜ ๋ชจ๋“  ์š”์†Œ๋ฅผ ์ œ์™ธํ•œ๋‹ค. * white-list๊ฐ€ ์šฐ์„ ์ˆœ์œ„๋ฅผ ๊ฐ€์ง€๋ฉฐ, white-list๊ฐ€ ์—†์„ ๊ฒฝ์šฐ์—๋งŒ black-list๊ฐ€ ์ ์šฉ๋œ๋‹ค. * */ // black-list aExcludedTag = ["SCRIPT", "STYLE"], // black-list ๋ชฉ๋ก rxExcludedTag = (aExcludedTag.length > 0) ? new RegExp("^(" + aExcludedTag.join("|") + ")$", "i") : null, bExclusionOpen = false, // ์ œ์™ธ๋˜๊ธฐ ์‹œ์ž‘ํ•˜๋Š” ํƒœ๊ทธ. ํ•˜์œ„ ์š”์†Œ๋Š” ๋ชจ๋‘ ์ œ์™ธ๋œ๋‹ค. bExclusionClose = false, // ์ œ์™ธ๊ฐ€ ๋๋‚˜๋Š” ํƒœ๊ทธ. ํ•˜์œ„ ์š”์†Œ๋Š” ๋ชจ๋‘ ์ œ์™ธ๋œ๋‹ค. bExclusionOpenAndClose = false, // ์—ด๋ฆฌ๊ณ  ๋‹ซํžˆ๋Š” ํƒœ๊ทธ๋กœ, ์ž์‹ ๋งŒ ์ œ์™ธ๋œ๋‹ค. nExclusiononStartDepth = 0, // ์ œ์™ธ๊ฐ€ ์‹œ์ž‘๋œ depth // whilte-list flag aAllowedTag = [], // white-list ๋ชฉ๋ก rxAllowedTag = (aAllowedTag.length > 0) ? new RegExp("^(" + aAllowedTag.join("|") + ")$", "i") : null, bInclusionOpen = false, // ํ—ˆ์šฉ๋˜๊ธฐ ์‹œ์ž‘ํ•˜๋Š” ํƒœ๊ทธ. ํ•˜์œ„ ์š”์†Œ๋Š” ๋ชจ๋‘ ํฌํ•จ๋œ๋‹ค. bInclusionClose = false, // ํ—ˆ์šฉ์ด ๋๋‚˜๋Š” ํƒœ๊ทธ. ํ•˜์œ„ ์š”์†Œ๋Š” ๋ชจ๋‘ ํฌํ•จ๋œ๋‹ค. bInclusionOpenAndClose = false, // ์—ด๋ฆฌ๊ณ  ๋‹ซํžˆ๋Š” ํƒœ๊ทธ๋กœ, ์ž์‹ ๋งŒ ํฌํ•จ๋œ๋‹ค. nInclusionStartDepth = 0; /** * ์›๋ณธ String์˜ ์•ž์—์„œ๋ถ€ํ„ฐ ์ฝ์–ด ๋‚˜๊ฐ€๋ฉฐ * ํŒจํ„ด๊ณผ ์ผ์น˜ํ•˜๋Š” ๋ถ€๋ถ„์„ ํ•˜๋‚˜์”ฉ ์ฒ˜๋ฆฌํ•˜๊ณ , * ์ž‘์—…์ด ๋๋‚œ ๋Œ€์ƒ์€ * ๊ฒฐ๊ณผ ๋ฐฐ์—ด๋กœ ๋ณด๋ƒ„๊ณผ ๋™์‹œ์— * ์›๋ž˜์˜ String์—์„œ ์ œ๊ฑฐํ•œ๋‹ค. * ๋” ์ด์ƒ ์ฒ˜๋ฆฌํ•  String์ด ์—†์„ ๋•Œ ์ข…๋ฃŒ. * */ while(sOriginalContent != ""){ sResult = "", sMatch = ""; // white/black-list ์ฒ˜๋ฆฌ์— ํ™œ์šฉ bDepthChange = true; /** * ์›๋ณธ String์˜ ๊ฐ€์žฅ ์•ž ๋ถ€๋ถ„์€ ์•„๋ž˜์˜ ํŒจํ„ด ๋ถ„๊ธฐ ์ค‘ ํ•˜๋‚˜์™€ ์ผ์น˜ํ•˜๋ฉฐ, * sMatch, sResult, rxApplied์˜ 3๊ฐ€์ง€ ๋ณ€์ˆ˜๋กœ ์ž‘์—…ํ•œ๋‹ค. * * sMatch : ํŒจํ„ด๊ณผ ์ผ์น˜ํ•˜๋Š” ๋ถ€๋ถ„์„ ์šฐ์„  ํš๋“. ์ž‘์—… ๋Œ€์ƒ์ด๋‹ค. * sResult : sMatch์—์„œ ์ •์ œ๊ฐ€ ์ด๋ฃจ์–ด์ง„ ๊ฒฐ๊ณผ๋ฌผ. ์ด๋“ค์˜ ์ง‘ํ•ฉ์ด์ž, ๋ฐ˜ํ™˜๊ฐ’๊ณผ ์—ฐ๊ฒฐ๋œ aResult์— ์ €์žฅ๋œ๋‹ค. * rxApplied : ์›๋ณธ String์—์„œ ์ž‘์—…์ด ๋๋‚œ ๋ถ€๋ถ„์„ ์ง€์šธ ๋•Œ ์žฌํ™œ์šฉ * */ if(rxOpeningAndClosingTag.test(sOriginalContent)){ // <tagName /> sMatch = sOriginalContent.match(rxOpeningAndClosingTag)[0]; // white/black-list ์ฒ˜๋ฆฌ๋ถ€ if(!wasSibling){ // ์ง์ „ ํƒœ๊ทธ๊ฐ€ ํ˜•์ œ๊ฐ€ ์•„๋‹Œ, ์—ด๋ ค ์žˆ๋Š” ๋ถ€๋ชจ ํƒœ๊ทธ์ธ ๊ฒฝ์šฐ. nDepth++; wasSibling = true; } wasJustOpened = false; // white/black-list ์ฒ˜๋ฆฌ๋ถ€ sResult = sMatch; rxApplied = rxOpeningAndClosingTag; }else if(rxClosingCommentTag.test(sOriginalContent)){ // <! text--> sMatch = sOriginalContent.match(rxClosingCommentTag)[0]; // white/black-list ์ฒ˜๋ฆฌ๋ถ€ if(wasJustOpened){ wasJustOpened = false; }else{ nDepth--; } // ์ œ์™ธ ๋Œ€์ƒ์ธ ๊ฒฝ์šฐ, ๋‹ซํžˆ๋Š” ํƒœ๊ทธ์˜ depth๊ฐ€ ์ตœ์ดˆ๋กœ ์ œ์™ธ๋˜๊ธฐ ์‹œ์ž‘ํ•œ ํƒœ๊ทธ์˜ depth์™€ ๊ฐ™์•„์•ผ ๋น„๋กœ์†Œ ์ œ์™ธ ์ข…๋ฃŒ if(bExclusionOpen){ if(nExclusiononStartDepth == nDepth){ bExclusionClose = true; } } if(bInclusionOpen){ if(nInclusionStartDepth == nDepth){ bInclusionClose = true; } } wasSibling = true; wasClosed = true; // --white/black-list ์ฒ˜๋ฆฌ๋ถ€ sResult = sMatch; rxApplied = rxClosingCommentTag; }else if(rxOpeningCommentTag.test(sOriginalContent)){ // <!-- text> sMatch = sOriginalContent.match(rxOpeningCommentTag)[0]; // white/black-list ์ฒ˜๋ฆฌ๋ถ€ if(!wasClosed || wasJustOpened){ if(!wasSibling){ nDepth++; } } // ์—ด๋ฆฐ ์กฐ๊ฑด๋ถ€ ์ฃผ์„์€ white/black list์™€ ๋ฌด๊ด€ํ•˜๊ฒŒ ์ œ์™ธ ๋Œ€์ƒ if(/^<!--\[if/.test(sMatch)){ if(!bExclusionOpen){ bExclusionOpen = true; // ์ตœ์ดˆ๋กœ ์ œ์™ธ๋˜๊ธฐ ์‹œ์ž‘ํ•œ ํƒœ๊ทธ์˜ depth๋ฅผ ๊ธฐ๋กํ•ด ๋‘”๋‹ค. if(nExclusiononStartDepth < nDepth){ nExclusiononStartDepth = nDepth; } } } wasSibling = false; wasJustOpened = true; // --white/black-list ์ฒ˜๋ฆฌ๋ถ€ sResult = sMatch; rxApplied = rxOpeningCommentTag; }else if(rxCommentTag.test(sOriginalContent)){ // <!-- text --> /* ์ˆœ์„œ๋„์น˜. rxOpeningTag ์ˆ˜์ •์œผ๋กœ beautify์™€๋Š” ๋‹ฌ๋ฆฌ comment๋ฅผ ํฌ๊ด„ํ•˜๊ฒŒ ๋˜์–ด ๋ฒ„๋ฆฌ๊ธฐ ๋•Œ๋ฌธ */ sMatch = sOriginalContent.match(rxCommentTag)[0]; // white/black-list ์ฒ˜๋ฆฌ๋ถ€ /** * <!--[if supportLists]-->, <!--[if supportFields]--> ๋“ฑ ๋ Œ๋”๋ง์— ํ™œ์šฉ๋˜๋Š” ์กฐ๊ฑด๋ถ€ ์ฃผ์„์ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ œ๊ฑฐํ•˜์ง€ ๋ชปํ•œ๋‹ค. * * ๋”ฐ๋ผ์„œ depth ์ฒ˜๋ฆฌ๋งŒ ์ด๋ฃจ์–ด์ง„๋‹ค. * */ if(!wasSibling){ nDepth++; wasSibling = true; } wasJustOpened = false; //-- white/black-list ์ฒ˜๋ฆฌ๋ถ€ sResult = sMatch; rxApplied = rxCommentTag; }else if(rxOpeningTag.test(sOriginalContent)){ // <tagName> sMatch = sOriginalContent.match(rxOpeningTag)[0]; // white/black-list ์ฒ˜๋ฆฌ๋ถ€ bDepthChange = true; sTagName = sMatch.replace(rxTagName, "$1"); if(rxOnlyOpeningTag.test(sTagName)){ bDepthChange = false; } if(bDepthChange){ // br, img ํƒœ๊ทธ๊ฐ€ ์•„๋‹Œ ์—ด๋ฆฐ ํƒœ๊ทธ if(!wasClosed || wasJustOpened){ nDepth++; } wasSibling = false; wasJustOpened = true; }else{ // Open-only elements if(!wasSibling){ nDepth++; wasSibling = true; } wasJustOpened = false; } // ์ œ์™ธ ๋Œ€์ƒ์ธ ํƒœ๊ทธ ๋ชฉ๋ก์˜ ์ด๋ฆ„๊ณผ ์ผ์น˜ํ•˜๋ฉด ์ œ์™ธ์‹œํ‚จ๋‹ค. if(!!rxAllowedTag){ var isInWhiteList = false; if(rxAllowedTag.test(sTagName)){ // white-list isInWhiteList = true; } if(isInWhiteList){ if(!bInclusionOpen){ bInclusionOpen = true; if(nInclusionStartDepth < nDepth){ nInclusionStartDepth = nDepth; } } }else{ // ์ œ์™ธ์ฒ˜๋ฆฌ ๊ณ„์† if(!bExclusionOpen){ bExclusionOpen = true; if(nExclusiononStartDepth < nDepth){ nExclusiononStartDepth = nDepth; } } } }else if(!!rxExcludedTag){ if(rxExcludedTag.test(sTagName)){ // black-list if(!bExclusionOpen){ bExclusionOpen = true; if(nExclusiononStartDepth < nDepth){ nExclusiononStartDepth = nDepth; } } } } // --white/black-list ์ฒ˜๋ฆฌ๋ถ€ // class attribute์˜ ๊ฐ’ ํš๋“ var sClassAttr = ""; if(rxClass.test(sMatch)){ // [SMARTEDITORSUS-1673] sClassAttr = sMatch.match(rxClass)[1] || sMatch.match(rxClass)[2]; // --[SMARTEDITORSUS-1673] } // ์‹ค์งˆ์ ์œผ๋กœ ์Šคํƒ€์ผ์ด๋‚˜ ํด๋ž˜์Šค ์กฐ์ž‘์ด ์ด๋ฃจ์–ด์ง€๋Š” ์ชฝ์€ ์—ด๋ฆฐ ํƒœ๊ทธ ๋ถ€๋ถ„ // &quot; ๋ฅผ ' ๋กœ ์น˜ํ™˜ sMatch = sMatch.replace(/&quot;/gi, "'"); // mso- ๋กœ ์‹œ์ž‘ํ•˜๋Š” style ์ œ๊ฑฐ sMatch = sMatch.replace(rxMsoStyle, ""); var _widthAttribute = "", _heightAttribute = "", _widthStyle = "", _heightStyle = "", _nWidth = "", _nHeight = "", _bWidthStyleReplaceNeed = false, _bHeightStyleReplaceNeed = false, // width, style ์ด attribute๋กœ ์กด์žฌํ•œ๋‹ค๋ฉด, ์ด๋ฅผ style๋กœ ๋ณ€ํ™˜ํ•ด ์ค˜์•ผ ํ•  ํ•„์š”๊ฐ€ ์žˆ์Œ // [SMARTEDITORSUS-1671] rxWidthAttribute = /([^\w-])(width[\s]*=[\s]*)(["']?)([A-Za-z0-9.]+[%]?)(["']?)/i, rxHeightAttribute = /([^\w-])(height[\s]*=[\s]*)(["']?)([A-Za-z0-9.]+[%]?)(["']?)/i, rxWidthStyle = /(["';\s])(width[\s]*:[\s]*)([A-Za-z0-9.]+[%]?)([;]?)/i, rxHeightStyle = /(["';\s])(height[\s]*:[\s]*)([A-Za-z0-9.]+[%]?)([;]?)/i; // --[SMARTEDITORSUS-1671] /** * ๋ชจ๋“  ์—ด๋ฆฐ ํƒœ๊ทธ ๊ณตํ†ต์ฒ˜๋ฆฌ์‚ฌํ•ญ. * * width, height๊ฐ€ attribute์— ํ• ๋‹น๋˜์–ด ์žˆ๊ฑฐ๋‚˜, ๊ทธ ๋‹จ์œ„๊ฐ€ px๊ฐ€ ์•„๋‹Œ pt์ธ ๊ฒฝ์šฐ์— * px ๋‹จ์œ„๋กœ style ์•ˆ์œผ๋กœ ๋ฐ”๊ฟ”๋„ฃ๋Š” ๋ณด์ •์ด ์ด๋ฃจ์–ด์ง„๋‹ค. * __se_tbl ํด๋ž˜์Šค๋ฅผ ๊ฐ€์ง„ SmartEditor์˜ ํ‘œ๋Š” * width, height์˜ ๋ฆฌ์‚ฌ์ด์ง•์ด ๋ฐœ์ƒํ•  ๋•Œ * ์‹ค์‹œ๊ฐ„ ๋ณ€ํ™”๊ฐ€ ์ ์šฉ๋˜๋Š” style์— ๊ทธ ๊ฒฐ๊ณผ๊ฐ’์„ px๋กœ ์ €์žฅํ•˜๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. * @see hp_SE2M_TableEditor.js * */ /** * [Chrome, FireFox, Safari6+] ์ €์žฅํ•ด ๋‘” style ์ •์˜๋กœ๋ถ€ํ„ฐ, * class ๋ช…์œผ๋กœ ์ ์šฉํ•ด์•ผ ํ•  style์ด ์žˆ๋Š” ๊ฒฝ์šฐ ์ถ”๊ฐ€ํ•ด ์ค€๋‹ค. * */ if(this.htBrowser.chrome || this.htBrowser.firefox || (this.htBrowser.safari && this.htBrowser.version >= 6)){ var aClass = []; if(sClassAttr && !/mso/i.test(sClassAttr)){ // MsoTableGrid ํด๋ž˜์Šค๊ฐ€ ํฌํ•จ๋œ ๊ฒฝ์šฐ(MS Word)๋Š” ์ œ์™ธ : style ์ •์˜๋ฅผ ๋ถˆ๋Ÿฌ์™€์„œ ์ ์šฉํ•˜๋ฉด ์˜คํžˆ๋ ค ๋ ˆ์ด์•„์›ƒ ๋น„์ •์ƒ aClass = sClassAttr.split(" "); } if(aClass && aClass.length > 0){ for(var i = 0, len = aClass.length; i < len; i++){ var sClass = aClass[i]; var sRx = sClass + "[\\n\\r\\t\\s]*{([^}]*)}"; var rxClassForStyle = new RegExp(sRx); var sMatchedStyle = ""; if(rxClassForStyle.test(this._sStyleFromClipboard)){ sMatchedStyle = this._sStyleFromClipboard.match(rxClassForStyle)[1]; } if(sMatchedStyle){ // ์œ„์—์„œ ๋งค์น˜๋˜๋Š” style์„ ํƒœ๊ทธ ์•ˆ์— ์ถ”๊ฐ€ํ•ด ์ค€๋‹ค. if(!!rxStyle.test(sMatch)){ sMatch = sMatch.replace(rxStyle, "$1$2" + sMatchedStyle + " $3$4"); }else{ // style๋งˆ์ € ์—†๋‹ค๋ฉด ์ƒˆ๋กœ ๋งŒ๋“ค์–ด ์ค€๋‹ค. sMatch = sMatch.replace(/(>)/g, " style=\"" + sMatchedStyle + "\"$1"); } } } } } // width attribute๊ฐ€ ์กด์žฌํ•œ๋‹ค๋ฉด if(rxWidthAttribute.test(sMatch)){ _widthAttribute = sMatch.match(rxWidthAttribute)[4]; // [SMARTEDITORSUS-1671] if(/pt/.test(_widthAttribute)){ _nWidth = parseFloat(_widthAttribute, 10) * 96 / 72 + "px"; // pt๋ฅผ px๋กœ ๋ณ€ํ™˜ }else if(/px/.test(_widthAttribute)){ // ๋ณ€ํ™˜์„ ๊ฑฐ์น  ํ•„์š” ์—†์Œ _nWidth = _widthAttribute; }else if(/%/.test(_widthAttribute)){ // % _nWidth = _widthAttribute; }else if(!/\d/.test(_widthAttribute)){ // auto, inherit, initial _nWidth = _widthAttribute; }else if(!/px/.test(_widthAttribute)){ // ์ˆซ์ž๋งŒ ์žˆ๋Š” ๊ฒฝ์šฐ _nWidth = _widthAttribute + "px"; } // --[SMARTEDITORSUS-1671] sMatch = sMatch.replace(rxWidthAttribute, "$1"); // style๋กœ ๋ณ€ํ™˜ํ•ด ์ค„ ํ•„์š”๊ฐ€ ์žˆ๋‹ค. _bWidthStyleReplaceNeed = true; }else{ _bWidthStyleReplaceNeed = false; } // width style์ด ์กด์žฌํ•œ๋‹ค๋ฉด if(rxWidthStyle.test(sMatch)){ _widthStyle = sMatch.match(rxWidthStyle)[3]; // [SMARTEDITORSUS-1671] _bWidthStyleReplaceNeed = true; if(/pt/.test(_widthStyle)){ _nWidth = parseFloat(_widthStyle, 10) * 96 / 72 + "px"; // pt๋ฅผ px๋กœ ๋ณ€ํ™˜ }else if(/px/.test(_widthStyle)){ // ๋ณ€ํ™˜์„ ๊ฑฐ์น  ํ•„์š” ์—†์Œ _bWidthStyleReplaceNeed = false; }else if(/%/.test(_widthStyle)){ // % _nWidth = _widthStyle; }else if(!/\d/.test(_widthStyle)){ // auto, inherit, initial _nWidth = _widthStyle; }else if(!/px/.test(_widthStyle)){ // ์ˆซ์ž๋งŒ ์žˆ๋Š” ๊ฒฝ์šฐ _nWidth = _widthStyle + "px"; } if(_bWidthStyleReplaceNeed){ sMatch = sMatch.replace(rxWidthStyle, "$1$2" + _nWidth + ";"); } // --[SMARTEDITORSUS-1671] }else{ if(_bWidthStyleReplaceNeed){ // [SMARTEDITORSUS-1671] if(_nWidth){ // attribute์—์„œ style์šฉ์œผ๋กœ ๋ณ€ํ™˜ํ•œ ๊ฐ’์„ ์‚ฌ์šฉ if(!!rxStyle.test(sMatch)){ sMatch = sMatch.replace(rxStyle, "$1$2width:" + _nWidth + "; $3$4"); }else{ // style๋งˆ์ € ์—†๋‹ค๋ฉด ์ƒˆ๋กœ ๋งŒ๋“ค์–ด ์ค€๋‹ค. sMatch = sMatch.replace(/(>)/g, " style=\"width:" + _nWidth + ";\"$1"); } } // --[SMARTEDITORSUS-1671] } } // height attribute๊ฐ€ ์กด์žฌํ•œ๋‹ค๋ฉด if(rxHeightAttribute.test(sMatch)){ _heightAttribute = sMatch.match(rxHeightAttribute)[4]; // [SMARTEDITORSUS-1671] if(/pt/.test(_heightAttribute)){ _nHeight = parseFloat(_heightAttribute, 10) * 96 / 72 + "px"; // pt๋ฅผ px๋กœ ๋ณ€ํ™˜ }else if(/px/.test(_heightAttribute)){ // ๋ณ€ํ™˜์„ ๊ฑฐ์น  ํ•„์š” ์—†์Œ _nHeight = _heightAttribute; }else if(/%/.test(_heightAttribute)){ // % _nHeight = _heightAttribute; }else if(!/\d/.test(_heightAttribute)){ // auto, inherit, initial _nHeight = _heightAttribute; }else if(!/px/.test(_heightAttribute)){ // ์ˆซ์ž๋งŒ ์žˆ๋Š” ๊ฒฝ์šฐ _nHeight = _heightAttribute + "px"; } // --[SMARTEDITORSUS-1671] sMatch = sMatch.replace(rxHeightAttribute, "$1"); // style๋กœ ๋ณ€ํ™˜ํ•ด ์ค„ ํ•„์š”๊ฐ€ ์žˆ๋‹ค. _bHeightStyleReplaceNeed = true; }else{ _bHeightStyleReplaceNeed = false; } // height style์ด ์กด์žฌํ•œ๋‹ค๋ฉด if(rxHeightStyle.test(sMatch)){ _heightStyle = sMatch.match(rxHeightStyle)[3]; // [SMARTEDITORSUS-1671] _bHeightStyleReplaceNeed = true; if(/pt/.test(_heightStyle)){ _nHeight = parseFloat(_heightStyle, 10) * 96 / 72 + "px"; // pt๋ฅผ px๋กœ ๋ณ€ํ™˜ }else if(/px/.test(_heightStyle)){ // ๋ณ€ํ™˜์„ ๊ฑฐ์น  ํ•„์š” ์—†์Œ _bHeightStyleReplaceNeed = false; }else if(/%/.test(_heightStyle)){ // % _nHeight = _heightStyle; }else if(!/\d/.test(_heightStyle)){ // auto, inherit, initial _nWidth = _heightStyle; }else if(!/px/.test(_heightStyle)){ // ์ˆซ์ž๋งŒ ์žˆ๋Š” ๊ฒฝ์šฐ _nHeight = _heightStyle + "px"; } if(_bHeightStyleReplaceNeed){ sMatch = sMatch.replace(rxHeightStyle, "$1$2" + _nHeight + ";"); } // --[SMARTEDITORSUS-1671] }else{ if(_bHeightStyleReplaceNeed){ // [SMARTEDITORSUS-1671] if(_nHeight){ // attribute์—์„œ style์šฉ์œผ๋กœ ๋ณ€ํ™˜ํ•œ ๊ฐ’์„ ์‚ฌ์šฉ if(!!rxStyle.test(sMatch)){ sMatch = sMatch.replace(rxStyle, "$1$2height:" + _nHeight + "; $3$4"); }else{ // style๋งˆ์ € ์—†๋‹ค๋ฉด ์ƒˆ๋กœ ๋งŒ๋“ค์–ด ์ค€๋‹ค. sMatch = sMatch.replace(/(>)/g, " style=\"height:" + _nHeight + ";\"$1"); } } // --[SMARTEDITORSUS-1671] } } /** * ๊ฐ ํƒœ๊ทธ์— ๋งž๋Š” ์ฒ˜๋ฆฌ๊ฐ€ ์ถ”๊ฐ€์ˆ˜ํ–‰๋˜๋Š” ๋ถ€๋ถ„. * * ํƒœ๊ทธ๋ช…์„ ํ™•์ธํ•œ ๋’ค ๋ถ„๊ธฐ์ฒ˜๋ฆฌ * */ sTagName = sMatch.replace(rxTagName, "$1"); if(/^TABLE$/i.test(sTagName)){ /** * [SMARTEDITORSUS-1673] ์™ธ๋ถ€์—์„œ ๋ถ™์—ฌ๋„ฃ์€ ํ…Œ์ด๋ธ”์— ๋Œ€ํ•˜์—ฌ __se_tbl_ext ํด๋ž˜์Šค ๋ถ€์—ฌ * */ if(sClassAttr){ if(!/__se_tbl/g.test(sClassAttr)){ var rxClass_rest = /(class[\s]*=[\s]*["'])([^"']*)(["'])/i; var rxSingleClass_underIE8 = /(class[\s]*=[\s]*)([^"'\s>]+)/i; if(rxClass_rest.test(sMatch)){ // class="className [className2...]" sMatch = sMatch.replace(rxClass_rest, "$1$2 __se_tbl_ext$3"); }else if(rxSingleClass_underIE8.test(sMatch)){ // [IE8-] class=className sMatch = sMatch.replace(rxSingleClass_underIE8, "$1\"$2 __se_tbl_ext\""); } //sMatch = sMatch.replace(rxTableClassModify, "$1$2 __se_tbl$3"); } }else{ sMatch = sMatch.replace(rxTableClassAdd, "$1 class=\"__se_tbl_ext\""); } // --[SMARTEDITORSUS-1673] // </table> ํƒœ๊ทธ๊ฐ€ ๋“ฑ์žฅํ•˜๊ธฐ ์ „๊นŒ์ง€ ์ž‘์—…์€ table ๋งฅ๋ฝ์—์„œ ์ด๋ฃจ์–ด์ง„๋‹ค. isInTableContext = true; // <colgroup> ์ž‘์—…์šฉ flag ์ดˆ๊ธฐํ™” bColgroupAppeared = false; // [SMARTEDITORSUS-1671] ํ…Œ์ด๋ธ”์„ ๋‹ค์ค‘์œผ๋กœ ๊ด€๋ฆฌ nTableDepth++; // --[SMARTEDITORSUS-1671] } /** * ๋ชจ๋“  ์…€์ด ๋™์ผํ•œ ๋„ˆ๋น„์™€ ๋†’์ด๊ฐ€ ์•„๋‹Œ ๊ฒฝ์šฐ, * <colgroup> ์ดํ•˜ <col>์— ๊ฐ™์€ ์—ด์— ํ•ด๋‹นํ•˜๋Š” ์…€์˜ ๋„ˆ๋น„๊ฐ€ ์ •์˜๋˜์–ด ์žˆ์œผ๋ฉฐ, * ๊ฐ™์€ ํ–‰์— ํ•ด๋‹นํ•˜๋Š” ์…€์˜ ๋†’์ด๋Š” <tr>์— ์ •์˜๋˜์–ด ์žˆ๋‹ค. * ์ด๋ฅผ ์ €์žฅํ•ด ๋‘๊ณ  ๊ฐ <td>์˜ ๋„ˆ๋น„์™€ ๋†’์ด์— ์ ์šฉํ•˜๋Š” ๋ฐ ์‚ฌ์šฉํ•œ๋‹ค. * * @XXX [SMARTEDITORSUS-1613] [NON-IE] * MS Excel 2010 ๊ธฐ์ค€์œผ๋กœ, 1ํšŒ ์ด์ƒ ๋ณ‘ํ•ฉ๋œ ํ‘œ๊ฐ€ ์‚ฝ์ž…๋  ๋•Œ๋Š” * class, width, height๋ฅผ ์ œ์™ธํ•œ ์ •๋ณด๋Š” ๊ฑฐ์˜ ๋„˜์–ด์˜ค์ง€ ์•Š๋Š”๋‹ค. * */ else if(/^COL$/i.test(sTagName)){ // <col>์— ํฌํ•จ๋œ width style ์ •๋ณด ์ €์žฅ _widthStyle = sMatch.match(rxWidthStyle)[3]; // span ๊ฐฏ์ˆ˜๋ฅผ ์„ธ์„œ row ์ˆ˜์ธ nTdLength ์—…๋ฐ์ดํŠธ var _nSpan = 0; if(/span[\s]*=[\s]*"([\d]+)"/.test(sMatch)){ _nSpan = sMatch.match(/span[\s]*=[\s]*"([\d]+)"/)[1]; } // [SMARTEDITORSUS-1671] ๋‹ค์ค‘ ํ…Œ์ด๋ธ”์˜ col ์บ์‹ฑ if(!!aaColumnWidth[nTableDepth] && typeof(aaColumnWidth[nTableDepth].length) === "number"){ aColumnWidth = aaColumnWidth[nTableDepth]; }else{ aColumnWidth = []; } if(_nSpan){ _nSpan = parseInt(_nSpan, 10); for(var i = 0; i < _nSpan; i++){ aColumnWidth.push(_widthStyle); nTdLength++; } }else{ nTdLength++; aColumnWidth.push(_widthStyle); } aaColumnWidth[nTableDepth] = aColumnWidth; // --[SMARTEDITORSUS-1671] }else if(/^TR$/i.test(sTagName)){ // height ๊ฐ’ ์ ์šฉ if(!(rxHeightStyle.test(sMatch))){ nRowHeight = null; }else{ // ์กด์žฌํ•˜๋ฉด td์— ์ ์šฉํ•˜๊ธฐ ์œ„ํ•ด ์ €์žฅ _heightStyle = sMatch.match(rxHeightStyle)[3]; nRowHeight = _heightStyle; } }else if(/^(TD|TH)$/i.test(sTagName)){ /** * border ์ฒ˜๋ฆฌ * * MS Excel 2010 ๊ธฐ์ค€์œผ๋กœ, * 0.5pt ๋‘๊ป˜๋กœ ๋„˜์–ด์˜จ border๋Š” 100% ๋ฐฐ์œจ์—์„œ ํ‘œํ˜„๋˜์ง€ ์•Š๊ธฐ์— * ์ผ๊ด„ 1px๋กœ ๋ณ€ํ™˜ํ•œ๋‹ค. * * ํ†ต์ƒ 0.84px ์ด์ƒ์ด๋ฉด 100% ๋ฐฐ์œจ์—์„œ ํ‘œํ˜„๋œ๋‹ค. * */ var rxBorderWidth_pointFive_first = /(:[\s]*)(.5pt|0.5pt)/gi; var rxBorderWidth_pointFive_rest = /([^:\d])(.5pt|0.5pt)/gi; sMatch = sMatch.replace(rxBorderWidth_pointFive_first, "$11px").replace(rxBorderWidth_pointFive_rest, "$11px"); // ๊ณตํ†ต ์ฒ˜๋ฆฌ ๋ถ€๋ถ„์—์„œ ์Šคํƒ€์ผ ์น˜ํ™˜ ๋กœ์ง์„ ๊ฑฐ์ณค๋‹ค๋ฉด, ์Šคํƒ€์ผ์ด ์ ์šฉ๋˜์–ด ์žˆ์–ด์•ผ ํ•จ if(!(rxWidthStyle.test(sMatch))){ // ์Šคํƒ€์ผ ๊ฐ’์ด ์—†์„ ๋•Œ, colgroup์—์„œ ์ €์žฅํ•œ ๊ฐ’์ด ์žˆ์œผ๋ฉด ์ด๋ฅผ ์ ์šฉํ•จ // [SMARTEDITORSUS-1671] aColumnWidth = aaColumnWidth[nTableDepth]; if(!!aColumnWidth && aColumnWidth.length > 0){ // ์ €์žฅํ•œ ๊ฐ’ ์žˆ์Œ var nColumnWidth = aColumnWidth[nTdIndex]; if(nColumnWidth){ if(!!rxStyle.test(sMatch)){ sMatch = sMatch.replace(rxStyle, "$1$2width:" + aColumnWidth[nTdIndex] + "; $3$4"); }else{ // style๋งˆ์ € ์—†๋‹ค๋ฉด ์ƒˆ๋กœ ๋งŒ๋“ค์–ด ์ค€๋‹ค. sMatch = sMatch.replace(/([^\s])([\s]*>|>)/, "$1 style=\"width:" + aColumnWidth[nTdIndex] + ";\"$2"); } } } // --[SMARTEDITORSUS-1671] } if(!(rxHeightStyle.test(sMatch))){ // ์Šคํƒ€์ผ ๊ฐ’์ด ์—†์„ ๋•Œ, td์—์„œ ์ €์žฅํ•œ ๊ฐ’์ด ์žˆ์œผ๋ฉด ์ด๋ฅผ ์ ์šฉํ•จ // [SMARTEDITORSUS-1671] if(!!nRowHeight){ if(!!rxStyle.test(sMatch)){ sMatch = sMatch.replace(rxStyle, "$1$2height:" + nRowHeight + "; $3$4"); }else{ // style๋งˆ์ € ์—†๋‹ค๋ฉด ์ƒˆ๋กœ ๋งŒ๋“ค์–ด ์ค€๋‹ค. sMatch = sMatch.replace(/([^\s])([\s]*>|>)/g, "$1 style=\"height:" + nRowHeight + ";\"$2"); } } // --[SMARTEDITORSUS-1671] } // ์ ์šฉํ•  ๋•Œ๋งˆ๋‹ค nTdIndex ์ฆ๊ฐ€ nTdIndex++; }else if(/^COLGROUP$/i.test(sTagName)){ // <colgroup> ์ž‘์—…์šฉ flag ์—…๋ฐ์ดํŠธ bColgroupAppeared = true; }else if(/^TBODY$/i.test(sTagName)){ // [IE 8~11] MS Excel, MS PowerPoint์—์„œ ์—ด๋ฆฐ ์ฑ„ ์‚ฝ์ž…๋˜๋Š” <colgroup> ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•ด, ๋ถ€๋“์ดํ•˜๊ฒŒ ์ˆ˜๋™์œผ๋กœ </colgroup> ์ถ”๊ฐ€ if(bColgroupAppeared){ sResult = "</colgroup>"; } } // ๋ฌธ๋‹จ ๊ต์ฒด๊ฐ€ ๋ฐœ์ƒํ•˜๋Š”์ง€๋ฅผ ๊ธฐ๋กํ•˜๋Š” flag if(rxMultiParagraphIndicator.test(sTagName)){ this._isPastedMultiParagraph = true; // ๋ถ™์—ฌ๋„ฃ์–ด์ง„ ์ปจํ…์ธ ๊ฐ€ ์—ฌ๋Ÿฌ ๋ฌธ๋‹จ์œผ๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธ bParagraphChangeStart = true; // ์ƒˆ๋กœ์šด ๋ฌธ๋‹จ์ด ์—ด๋ ธ์Œ์„ ํ‘œ์‹œ } sResult += sMatch; rxApplied = rxOpeningTag; }else if(rxWhiteSpace.test(sOriginalContent)){ // ๊ณต๋ฐฑ๋ฌธ์ž๋Š” ์ผ๋‹จ ๊ทธ๋Œ€๋กœ ํ†ต๊ณผ์‹œํ‚ด. ์ฐจํ›„ ์ฒ˜๋ฆฌ ๋ฐฉ์•ˆ์ด ์žˆ์„์ง€ ๋…ผ์˜ ํ•„์š” sMatch = sOriginalContent.match(rxWhiteSpace)[0]; sResult = sMatch; rxApplied = rxWhiteSpace; }else if(rxNonTag.test(sOriginalContent)){ // ํƒœ๊ทธ ์•„๋‹˜ sMatch = sOriginalContent.match(rxNonTag)[0]; // white/black-list ์ฒ˜๋ฆฌ๋ถ€ if(!wasSibling){ // ์ง์ „ ํƒœ๊ทธ๊ฐ€ ํ˜•์ œ๊ฐ€ ์•„๋‹Œ, ์—ด๋ ค ์žˆ๋Š” ๋ถ€๋ชจ ํƒœ๊ทธ์ธ ๊ฒฝ์šฐ. nDepth++; wasSibling = true; } wasJustOpened = false; // white/black-list ์ฒ˜๋ฆฌ๋ถ€ sResult = sMatch; rxApplied = rxNonTag; }else if(rxClosingTag.test(sOriginalContent)){ // </tagName> sMatch = sOriginalContent.match(rxClosingTag)[0]; // white/black-list ์ฒ˜๋ฆฌ๋ถ€ if(wasJustOpened){ // ํƒœ๊ทธ๊ฐ€ ์—ด๋ฆฌ์ž๋งˆ์ž ์ปจํ…์ธ  ์—†์ด ๋‹ซํž˜ ํƒœ๊ทธ๊ฐ€ ์ด์–ด์งˆ ๊ฒฝ์šฐ depth ๋ณ€๊ฒฝ ์—†์Œ wasJustOpened = false; }else{ nDepth--; } if(bExclusionOpen){ if(nExclusiononStartDepth == nDepth){ bExclusionClose = true; } } if(bInclusionOpen){ if(nInclusionStartDepth == nDepth){ bInclusionClose = true; } } wasSibling = true; wasClosed = true; // white/black-list ์ฒ˜๋ฆฌ๋ถ€ // <td> ๋‚ด์— ์•„๋ฌด๋Ÿฐ ์ปจํ…์ธ ๋„ ์—†๋‹ค๋ฉด ์ปค์„œ๊ฐ€ ๋‹ฟ์„ ์ˆ˜ ์—†๊ธฐ ๋•Œ๋ฌธ์— ์ฒ˜๋ฆฌํ•ด ์ฃผ๋Š” ๋ถ€๋ถ„ if(rxOpeningTag.test(sPreviousContent)){ if(isInTableContext){ sTagName = sPreviousContent.replace(rxTagName, "$1"); // ์ง์ „ ํƒœ๊ทธ๊ฐ€ Open-only element๊ฐ€ ์•„๋‹ ๊ฒฝ์šฐ์—๋งŒ ์ ์šฉ var bOpenOnly = false; if(rxOnlyOpeningTag.test(sTagName)){ bOpenOnly = true; } if(!bOpenOnly){ if(!(/husky_bookmark/g.test(sPreviousContent))){ // ์ด ์‹œ์ ์—์„œ ๋ฐ”๋กœ ์ „ ํƒœ๊ทธ๊ฐ€ ์—ด๋ฆฐ ํƒœ๊ทธ์˜€๋‹ค๋ฉด, &nbsp;๋ฅผ ๋„ฃ์–ด์ค˜์•ผ ์ปค์„œ ์œ„์น˜ ๊ฐ€๋Šฅ sResult = "&nbsp"; } } } } // ํƒœ๊ทธ๋ณ„ ๋ถ„๊ธฐ์ฒ˜๋ฆฌ sTagName = sMatch.replace(rxTagName, "$1"); /** * ๋ชจ๋“  ์…€์ด ๋™์ผํ•œ ๋„ˆ๋น„์™€ ๋†’์ด๊ฐ€ ์•„๋‹Œ ๊ฒฝ์šฐ, * ๊ฐ <td>์˜ ๋„ˆ๋น„์™€ ๋†’์ด์— ์ ์šฉํ•˜๋Š” ๋ฐ ์‚ฌ์šฉํ–ˆ๋˜ * ์ €์žฅ๊ฐ’๋“ค์„ ์ดˆ๊ธฐํ™”ํ•œ๋‹ค. * */ if(/^TABLE$/i.test(sTagName)){ // [SMARTEDITORSUS-1671] ๋‹ค์ค‘ ํ…Œ์ด๋ธ”์˜ col ์บ์‹ฑ aaColumnWidth[nTableDepth] = null; nTableDepth--; // --[SMARTEDITORSUS-1671] isInTableContext = false; nTdLength = 0; nTdIndex = 0; }else if(/^TR$/i.test(sTagName)){ nTdIndex = 0; } if(rxMultiParagraphIndicator.test(sTagName)){ // p, div, table, iframe bParagraphChangeEnd = true; // ์ƒˆ๋กœ์šด ๋ฌธ๋‹จ์ด ๋ง‰ ๋‹ซํ˜”์Œ์„ ํ‘œ์‹œ } // ๋นˆ <td>์˜€๋‹ค๋ฉด &npsp;๊ฐ€ ์ถ”๊ฐ€๋˜์–ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์—ฐ์‚ฐ์ž๊ฐ€ ๋‹ค๋ฅธ ๊ฒฝ์šฐ์™€๋Š” ๋‹ค๋ฆ„ sResult += sMatch; rxApplied = rxClosingTag; } // ์ง€๊ธˆ๊นŒ์ง€์˜ ์กฐ๊ฑด์— ๋ถ€ํ•ฉํ•˜์ง€ ์•Š๋Š” ๋ชจ๋“  ํƒœ๊ทธ๋Š” ์˜ˆ์™ธ ํƒœ๊ทธ๋กœ ์ฒ˜๋ฆฌํ•œ๋‹ค. MS Word์˜ <o:p> ๋“ฑ์ด ํ•ด๋‹น. else if(rxExceptedClosingTag.test(sOriginalContent)){ // </*unknown*> : similar to rxClosingCommentTag case sMatch = sOriginalContent.match(rxExceptedClosingTag)[0]; // white/black-list ์ฒ˜๋ฆฌ๋ถ€ if(wasJustOpened){ wasJustOpened = false; }else{ nDepth--; } wasSibling = true; wasClosed = true; // white/black-list ์ฒ˜๋ฆฌ๋ถ€ sResult = sMatch; rxApplied = rxExceptedClosingTag; }else if(rxExceptedOpeningTag.test(sOriginalContent)){ // <*unknown*> : similar to rxOpeningCommentTag case sMatch = sOriginalContent.match(rxExceptedOpeningTag)[0]; // white/black-list ์ฒ˜๋ฆฌ๋ถ€ if(!wasClosed || wasJustOpened){ if(!wasSibling){ nDepth++; } } wasSibling = false; wasJustOpened = true; // white/black-list ์ฒ˜๋ฆฌ๋ถ€ sResult = sMatch; rxApplied = rxExceptedOpeningTag; }else{ // unreachable point throw new Error("Unknown Node : If the content isn't invalid, please let us know."); } // sResult๋กœ ์ž‘์—… // ์ตœ์ดˆ ์ž‘์—… ์‹œ ์—ด๋ฆฐ ํƒœ๊ทธ๊ฐ€ ์˜ค๋Š” ๊ฒฝ์šฐ depth๋ฅผ 1์—์„œ 0์œผ๋กœ ๋ณด์ •. if(bInit){ if(wasJustOpened){ nDepth = 0; } } // ์ง์ „ ๊ฐ’ ๋น„๊ต์— ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด ์ •๋ณด ๊ฐฑ์‹  if(sResult != ""){ sPreviousContent = sResult; // ํ˜„์žฌ sResult๋Š”, ๋‹ค์Œ ์ž‘์—… ๋•Œ ์ง์ „ ๊ฐ’์„ ์ฐธ์กฐํ•ด์•ผ ํ•  ํ•„์š”๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ ์‚ฌ์šฉ๋œ๋‹ค. nPreviousIndex++; // ์›๋ณธ String์˜ ๋งจ ์•ž๋ถ€ํ„ฐ ์ฒซ ๋ฌธ๋‹จ ๊ต์ฒด๊ฐ€ ์ผ์–ด๋‚˜๊ธฐ๊นŒ์ง€์˜ ๋ชจ๋“  inline ์š”์†Œ๋“ค์„ ์ €์žฅํ•ด ๋‘๊ณ  ํ™œ์šฉ var sGoesPreviousParagraph = ""; if(!this._isPastedMultiParagraph){ // ์›๋ณธ String์˜ ๋งจ ์•ž๋ถ€ํ„ฐ ์ฒซ ๋ฌธ๋‹จ ๊ต์ฒด๊ฐ€ ์ผ์–ด๋‚˜๊ธฐ๊นŒ์ง€์˜ ๋ชจ๋“  inline ์š”์†Œ๋“ค์„ ์ €์žฅํ•ด ๋‘๊ณ  ํ™œ์šฉ sGoesPreviousParagraph = sResult; } if(!bParagraphChangeStart){ // ๋ฌธ๋งฅ ๊ต์ฒด๊ฐ€ ์•„์ง ์‹œ์ž‘๋˜์ง€ ์•Š์•˜์Œ // text_content -> <p>text_content if(!bParagraphIsOpen){ if(nParagraphHierarchy == 0){ // ์ตœ์ƒ์œ„ depth sResult = "<" + this.sParagraphContainer + ">" + sResult; bParagraphIsOpen = true; } } }else{ // ๋ฌธ๋งฅ ๊ต์ฒด๊ฐ€ ์‹œ์ž‘๋จ // <p>text_content + <table> -> <p>text_content + </p> <table> if(bParagraphIsOpen){ // ๋ฌธ๋งฅ์ด ์—ด๋ฆผ sResult = "</" + this.sParagraphContainer + ">" + sResult; bParagraphIsOpen = false; } nParagraphChangeCount++; nParagraphHierarchy++; } // ๋ฌธ๋งฅ ๊ต์ฒด๊ฐ€ ๋๋‚ฌ๋‹ค๋ฉด ๋ฌธ๋‹จ ๊ต์ฒด flag ์ดˆ๊ธฐํ™” if(bParagraphChangeEnd){ bParagraphChangeStart = false; bParagraphChangeEnd = false; nParagraphHierarchy--; } // 2ํšŒ์ฐจ ๋Œ์ž…์„ ์œ„ํ•œ bInit ์—…๋ฐ์ดํŠธ if(bInit){ bInit = false; } if(bExclusionOpen && !bInclusionOpen){ // ์—ด๋ฆฌ๊ฑฐ๋‚˜ ๋‹ซํžˆ๋Š” ํƒœ๊ทธ๊ฐ€ ์ œ์™ธ๋Œ€์ƒ์—๋งŒ ํฌํ•จ๋˜์—ˆ๋‹ค๋ฉด, ์ด ๋ถ€๋ถ„์„ ํ†ตํ•ด ํ•˜์œ„์š”์†Œ๋Š” ๋ชจ๋‘ ๊ฒฐ๊ณผ์—์„œ ์ œ์™ธ๋œ๋‹ค. if(bExclusionClose){ bExclusionOpen = false; bExclusionClose = false; // depth ์ดˆ๊ธฐํ™” nExclusiononStartDepth = 0; } }else{ // white/black-list์— ๋ถ€ํ•ฉํ•˜๋Š” ์š”์†Œ๋งŒ ์‚ฝ์ž…๋œ๋‹ค. // whilte-list flag ์ดˆ๊ธฐํ™” if(bInclusionOpen){ if(bInclusionClose){ bInclusionOpen = false; bInclusionClose = false; bInclusionOpenAndClose = false; // depth ์ดˆ๊ธฐํ™” nInclusionStartDepth = 0; } } if(!this._isPastedMultiParagraph){ this._aGoesPreviousParagraph.push(sGoesPreviousParagraph); } // ์ตœ์ข…์ ์œผ๋กœ ๋ฐ˜ํ™˜๋˜๋Š” ์ •์ฒด๋œ ์ปจํ…์ธ ๋“ค์ด ๋‹ด๊ธด ๋ฐฐ์—ด aResult.push(sResult); } // --white/black-list ์ฒ˜๋ฆฌ์™€ ๊ฒฐํ•ฉ } // ์ •์ œ๊ฐ€ ๋๋‚œ ์ปจํ…์ธ ๋Š” ์›๋ž˜ ์ปจํ…์ธ ์—์„œ ์ œ๊ฑฐ sOriginalContent = sOriginalContent.replace(rxApplied, ""); }; // --while // ์ตœ์ข… ๊ฒฐ๊ณผ ํ•œ ๋ฒˆ๋„ ๋ฌธ๋‹จ ๊ต์ฒด๊ฐ€ ์—†์—ˆ๋‹ค๋ฉด ์•ž์— ๋‹ฌ๋ฆฐ ๋ฌธ๋งฅ ๊ต์ฒด ํƒœ๊ทธ๋ฅผ ์ œ๊ฑฐํ•˜๊ณ , inline์œผ๋กœ ์‚ฝ์ž… ์ค€๋น„ if(nParagraphChangeCount == 0){ var rxParagraphContainer = new RegExp("^<" + this.sParagraphContainer + ">"); aResult[0] = aResult[0].replace(rxParagraphContainer, ""); } return aResult.join(""); }, /** * [SMARTEDITORSUS-1673] ๋ถ™์—ฌ๋„ฃ๊ธฐ ์ž‘์—… ๊ณต๊ฐ„(div.husky_seditor_paste_helper)์„ ์ƒ์„ฑ * */ _createPasteHelper : function(){ if(!this.elPasteHelper){ this.elPasteHelper = document.createElement("DIV"); this.elPasteHelper.className = "husky_seditor_paste_helper"; this.elPasteHelper.style.width = "0px"; this.elPasteHelper.style.height = "0px"; this.elPasteHelper.style.overflow = "auto"; this.elPasteHelper.contentEditable = "true"; this.elPasteHelper.style.position = "absolute"; this.elPasteHelper.style.top = "-9999px"; this.elPasteHelper.style.left = "-9999px"; this.elEditingAreaContainer.appendChild(this.elPasteHelper); } }, _showPasteHelper : function(){ if(!!this.elPasteHelper && this.elPasteHelper.style.display == "none"){ this.elPasteHelper.style.display = "block"; } }, _hidePasteHelper : function(){ if(!!this.elPasteHelper && this.elPasteHelper.style.display != "none"){ this.elPasteHelper.style.display = "none"; } }, /** * [SMARTEDITORSUS-1673] ๋ถ™์—ฌ๋„ฃ๊ธฐ ์ž‘์—… ๊ณต๊ฐ„์˜ ๋‚ด์šฉ์„ ๋น„์šฐ๊ณ , * ์ƒˆ๋กœ์šด ์ปจํ…์ธ  ์ž‘์—…์„ ์ค€๋น„ํ•œ๋‹ค. * */ _clearPasteHelper : function(){ if(!!this.elPasteHelper){ this.elPasteHelper.innerHTML = ""; } }, /** * [SMARTEDITORSUS-1673] ๋ถ™์—ฌ๋„ฃ์–ด์ง„ ์ปจํ…์ธ ๊ฐ€ ๊ฐ€๊ณต๋˜๊ณ  ๋‚˜๋ฉด, ์ด๋ฅผ ๋ถ™์—ฌ๋„ฃ๊ธฐ ์ž‘์—… ๊ณต๊ฐ„์— ๋ถ™์—ฌ๋„ฃ๋Š”๋‹ค. * */ _loadToPasteHelper : function(){ // ๋ถ™์—ฌ๋„ฃ์„ ์ปจํ…์ธ ๊ฐ€ ์—ฌ๋Ÿฌ ๋ฌธ๋‹จ์ผ ๊ฒฝ์šฐ ์ €์žฅํ•˜๋Š” ๋ฐฐ์—ด var aParagraph = []; // [SMARTEDITORSUS-874] [FireFox] br์ด ์žˆ๋Š” inline์˜ ๊ฒฝ์šฐ ์—ฌ๋Ÿฌ ๋ฌธ๋‹จ์œผ๋กœ ์žฌ๊ตฌ์„ฑ var bConsecutiveBR_firefox = false; if(!this._isPastedMultiParagraph){ // ๋ถ™์—ฌ๋„ฃ์–ด์ง€๋Š” ์ปจํ…์ธ ๊ฐ€ ํ•œ ๋‹จ๋ฝ ๋‚ด์— ๋“ค์–ด๊ฐˆ ์ˆ˜ ์žˆ๋Š” inline ์š”์†Œ๋งŒ์œผ๋กœ ๊ตฌ์„ฑ if(this.htBrowser.firefox){ if(/<br>/i.test(this._aGoesPreviousParagraph.join(""))){ // br์ด ์žˆ์–ด ๋ฌธ๋‹จ ๋ถ„๋ฆฌ๊ฐ€ ๊ฐ€๋Šฅํ•œ ๊ฒฝ์šฐ // ์—ฌ๊ธฐ์„œ flag ์—…๋ฐ์ดํŠธ ๋’ค ์•„๋ž˜์„œ ์ฒ˜๋ฆฌ bConsecutiveBR_firefox = true; /** * this._aGoesPreviousParagraph ์— ๋ชจ๋“  ๋‚ด์šฉ์ด ๋“ค์–ด๊ฐ€ ์žˆ๊ณ , * aParagraph์—๋Š” ์•„๋ฌด ๊ฐ’๋„ ๋“ค์–ด๊ฐ€ ์žˆ์ง€ ์•Š์„ ๊ฒƒ์ด๋‹ค. * * ์ด๋ฅผ ์กฐ์ž‘ํ•˜์—ฌ * this._aGoesPreviousParagraph์—๋Š” ์ฒซ <br><br> ์•ž์˜ ์ปจํ…์ธ ๋งŒ ๋‚จ๊ธฐ๊ณ  * aParagraph์—๋Š” ๋‚˜๋จธ์ง€ ์ปจํ…์ธ ๋ฅผ <p> ์ƒ์„ฑ ์—†์ด inline ๋‹จ์œ„๋กœ ์žฌํŽธ์„ฑํ•œ๋‹ค. * -<br>์ฒ˜๋ฆฌ ๊ธฐ์ค€ * --๋‹จ์ผ <br>์€ linebreaker๋กœ ๊ฐ„์ฃผ * --2ํšŒ์ฐจ ์—ฐ์†ํ•˜๋Š” <br>๋ถ€ํ„ฐ ๋ฌธ๋‹จ ๋ถ„๋ฆฌ * * ex 1) inline1์ด ์ตœ์ดˆ ์ปจํ…์ธ ์ธ ๊ฒฝ์šฐ * this._aGoesPreviousParagraph : * [inline1, <br>, <br>, inline2, <br>, inline3, <br>] * aParagraph : * [] * * - ์ž‘์—… ํ›„ * this._aGoesPreviousParagraph : * [inline1] * aParagraph : * [<br>, inline2, inline3] * * ex 2) <br>์ด ์ตœ์ดˆ ์ปจํ…์ธ ์ธ ๊ฒฝ์šฐ * this._aGoesPreviousParagraph : * [<br>, <br>, inline1, <br>, inline2, <br>] * aParagraph : * [] * * - ์ž‘์—… ํ›„ * this._aGoesPreviousParagraph : * [] * aParagraph : * [<br>, inline1, inline2] * * clone ๋ถ๋งˆํฌ์— ๋ฐ€์–ด๋„ฃ์–ด ๊ธฐ์กด ๋ฌธ๋‹จ์˜ ์Šคํƒ€์ผ์ด ์ ์šฉ๋˜๋„๋ก ํ•จ * */ // this._aGoesPreviousParagraph ์žฌ๊ตฌ์„ฑ _aGoesPreviousParagraph = this._aGoesPreviousParagraph; this._aGoesPreviousParagraph = []; // this._sTarget ์žฌ๊ตฌ์„ฑ var _aTmpParagraph = []; // ํ˜„์žฌ inline ์ž‘์—…์ค‘์ธ index var _nInlineIndex = -1; // ์ง์ „ ์š”์†Œ var _sPreviousContent = ""; // ํ˜„์žฌ ์ž‘์—… ์ค‘์ธ ์š”์†Œ๊ฐ€ <br>์ธ์ง€ ๊ฐ๋ณ„ var _isPreviousContentBR = false; // ์ง์ „ ์š”์†Œ๊ฐ€ <br>์ธ์ง€ ๊ฐ๋ณ„ var _isCurrentContentBR = false; // for๋ฌธ์œผ๋กœ ์ˆœํšŒ for(var i = 0, len = _aGoesPreviousParagraph.length; i < len; i++){ var _sCurrentContent = _aGoesPreviousParagraph[i]; _isCurrentContentBR = /<br>/i.test(_sCurrentContent); if(i == 0){ if(_isCurrentContentBR){ // <br>์ด๋ฉด linebraker๋กœ ๊ฐ„์ฃผํ•˜์—ฌ this._aGoesPreviousParagraph์— ํฌํ•จ์‹œํ‚ค์ง€ ์•Š์Œ }else{ // <br>์ด ์•„๋‹ˆ๋ฉด this._aGoesPreviousParagraph์˜ ์ฒซ ์š”์†Œ๋กœ ์ถ”๊ฐ€ํ•˜์—ฌ ์Šคํƒ€์ผ ์ ์šฉ this._aGoesPreviousParagraph.push(_sCurrentContent); } }else{ _isPreviousContentBR = /<br>/i.test(_sPreviousContent); if(_isPreviousContentBR){ // ๋ฌธ๋‹จํ™”ํ•˜์—ฌ this.__aTmpParagraph์— ์ถ”๊ฐ€ _aTmpParagraph.push(_sCurrentContent); _nInlineIndex++; }else{ if(_isCurrentContentBR){ // ํ˜„์žฌ ์š”์†Œ๊ฐ€ <br>์ด๋ฉด linebreaker๋กœ ๊ฐ„์ฃผํ•ด์„œ ๋ฒ„๋ฆผ }else{ // ํ˜„์žฌ ์š”์†Œ๊ฐ€ <br>์ด ์•„๋‹ˆ๋ฉด _aTmpParagraph์— inline ์ž‘์—… _aTmpParagraph[_nInlineIndex] += _sCurrentContent; } } } // ํ˜„์žฌ ์ž‘์—… ์š”์†Œ๋ฅผ ๋น„๊ต๋ฅผ ์œ„ํ•ด ์ง์ „ ์š”์†Œ ๊ฐ’์œผ๋กœ ์ €์žฅ _sPreviousContent = _sCurrentContent; } /** * aParagraph ๊ตฌ์„ฑ * aParagraph[index]์—๋Š” inline ์š”์†Œ๋ผ๋ฆฌ ํ•จ๊ป˜ ๋ญ‰์ณ์„œ Element ํ˜•ํƒœ๋กœ ๋“ค์–ด๊ฐ€์•ผ ํ•จ * ์ž„์‹œ <div>์— ๋„ฃ์–ด ์ถ”๊ฐ€ * */ for(var i = 0, len = _aTmpParagraph.length; i < len; i++){ var elTmp = document.createElement("DIV"); elTmp.innerHTML = _aTmpParagraph[i]; aParagraph.push(elTmp); } } } }else{ // [Non-FireFox] // ๋ณธ๋ฌธ์— ๋ถ™์—ฌ๋„ฃ์„ ๋•Œ๋Š” Node ํ˜•ํƒœ๋กœ ๋ณ€ํ™˜ var elTmp = document.createElement("DIV"); elTmp.innerHTML = this._sTarget; aParagraph = elTmp.childNodes; } // --[SMARTEDITORSUS-874] try{ if(this._aGoesPreviousParagraph.length > 0){ var sGoesPreviousParagraph = this._aGoesPreviousParagraph.join(""); var elTmp = document.createElement("DIV"); elTmp.innerHTML = sGoesPreviousParagraph; var _aGoesPreviousParagraph = elTmp.childNodes; // _aGoesPreviousParagraph ์‚ฝ์ž… for(var i = 0, len = _aGoesPreviousParagraph.length; i < len; i++){ this.elPasteHelper.appendChild(_aGoesPreviousParagraph[i].cloneNode(true)); } /** * inline ์š”์†Œ๋“ค์€ aParagraph[0]์— ๋ฌธ๋‹จ ํƒœ๊ทธ๋กœ ๊ฐ์‹ธ์ ธ ๋“ค์–ด ์žˆ์—ˆ๋‹ค. * ์ด๋ฅผ ์•ž์œผ๋กœ ๋ณธ๋ฌธ์— ์‚ฝ์ž…๋  ์š”์†Œ๋“ค์ธ aParagraph์—์„œ ์ œ๊ฑฐํ•ด์•ผ ํ•จ * */ // [FireFox] ์—ฐ์†๋œ <br> ์ฒ˜๋ฆฌ๊ฐ€ ๋“ค์–ด๊ฐ„ ๊ฒฝ์šฐ aParagraph์€ ๋ณด์ •ํ•  ํ•„์š”๊ฐ€ ์—†๋‹ค. if(!bConsecutiveBR_firefox){ // aParagraph์˜ 0๋ฒˆ ์ธ๋ฑ์Šค ์ œ๊ฑฐ if(aParagraph.length > 0){ if(!!aParagraph.splice){ aParagraph.splice(0, 1); }else{ // [IE8-] var waParagraph = jindo.$A(aParagraph); waParagraph.splice(0, 1); aParagraph = waParagraph.$value(); } } } } // aParagraph ์‚ฝ์ž… if(aParagraph.length > 0){ for(var i = 0, len = aParagraph.length; i < len; i++){ this.elPasteHelper.appendChild(aParagraph[i].cloneNode(true)); } } }catch(e){ throw e; } return; }, /** * [SMARTEDITORSUS-1673] ๋ถ™์—ฌ๋„ฃ๊ธฐ ์ž‘์—… ๊ณต๊ฐ„์— ๋ถ™์—ฌ๋„ฃ์€ ์ปจํ…์ธ  ์ค‘, * ๋ณธ๋ฌธ ์˜์—ญ์— ๋ถ™์—ฌ๋„ฃ์„ ์ปจํ…์ธ ๋ฅผ ์„ ๋ณ„ํ•˜์—ฌ * ๋ธŒ๋ผ์šฐ์ € ๊ณ ์œ ์˜ ๋ถ™์—ฌ๋„ฃ๊ธฐ ๊ธฐ๋Šฅ์œผ๋กœ ๋ณธ๋ฌธ ์˜์—ญ์— ๋ถ™์—ฌ๋„ฃ์€ ๊ธฐ์กด ์ปจํ…์ธ ์™€ ๊ต์ฒดํ•œ๋‹ค. * */ _loadToBody : function(){ var oSelection = this.oApp.getSelection(); // ๋ณธ๋ฌธ ์˜์—ญ์— ๋ถ™์—ฌ๋„ฃ๊ธฐ try{ /** * As-Is ์ปจํ…์ธ  * * ๋ณธ๋ฌธ ์˜์—ญ์— ๋ถ™์—ฌ๋„ฃ์–ด์ง„ ์ปจํ…์ธ  ์ค‘ ๊ฐ€๊ณต๋œ ์ปจํ…์ธ ๋กœ ์น˜ํ™˜๋  ๋Œ€์ƒ ๋ชฉ๋ก์„ ํš๋“ * */ this._moveToStringBookmark(oSelection); oSelection.select(); var aSelectedNode_original = oSelection.getNodes(); var aConversionIndex_original = this._markMatchedElementIndex(aSelectedNode_original, this.aConversionTarget); /** * To-Be ์ปจํ…์ธ  * * ๋ถ™์—ฌ๋„ฃ๊ธฐ ์ž‘์—… ๊ณต๊ฐ„์— ๋ถ™์—ฌ๋„ฃ์–ด์ง„ ์ปจํ…์ธ ๋ฅผ selection์œผ๋กœ ์žก์•„์„œ * ์„ ํƒ๋œ ๋ถ€๋ถ„์˜ ๋ชจ๋“  node๋ฅผ ํš๋“ํ•  ํ•„์š”๊ฐ€ ์žˆ๋‹ค. * * ๊ธฐ์กด์˜ this.oApp.getSelection()์€ * iframe#se2_iframe ์˜ window๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•œ selection์„ ์‚ฌ์šฉํ•œ๋‹ค. * ๋”ฐ๋ผ์„œ ํ•ด๋‹น ์—˜๋ฆฌ๋จผํŠธ ํ•˜์œ„์— ์†ํ•œ ์š”์†Œ๋“ค๋งŒ selection ์œผ๋กœ ํš๋“ํ•  ์ˆ˜ ์žˆ๋‹ค. * * ๋ถ™์—ฌ๋„ฃ๊ธฐ ์ž‘์—… ๊ณต๊ฐ„์œผ๋กœ ์‚ฌ์šฉ๋˜๋Š” div.husky_seditor_paste_helper ๋Š” * iframe#se2_iframe์˜ ํ˜•์ œ์ด๊ธฐ ๋•Œ๋ฌธ์— * this.oApp.getSelection()์œผ๋กœ๋Š” helper ์•ˆ์˜ ์ปจํ…์ธ ๋ฅผ ์„ ํƒํ•˜์ง€ ๋ชปํ•œ๋‹ค. * * ๋”ฐ๋ผ์„œ iframe#se2_iframe๊ณผ div.husky_seditor_paste_helper๋ฅผ ์•„์šฐ๋ฅด๋Š” * ๋ถ€๋ชจ window๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•œ selection์„ ์ƒ์„ฑํ•˜์—ฌ * div.husky_seditor_paste_helper ๋‚ด๋ถ€์˜ ์ปจํ…์ธ ๋ฅผ ์„ ํƒํ•ด์•ผ ํ•œ๋‹ค. * */ var oSelection_parent = this.oApp.getSelection(this.oApp.getWYSIWYGWindow().parent); oSelection_parent.setStartBefore(this.elPasteHelper.firstChild); oSelection_parent.setEndAfter(this.elPasteHelper.lastChild); oSelection_parent.select(); var aSelectedNode_filtered = oSelection_parent.getNodes(); var aConversionIndex_filtered = this._markMatchedElementIndex(aSelectedNode_filtered, this.aConversionTarget); // As-Is ์ปจํ…์ธ ๋ฅผ To-Be ์ปจํ…์ธ ๋กœ ๊ต์ฒด if(aConversionIndex_original.length > 0 && aConversionIndex_original.length == aConversionIndex_filtered.length){ for(var i = 0, len = aConversionIndex_original.length; i < len; i++){ var nConversionIndex_original = aConversionIndex_original[i]; var nConversionIndex_filtered = aConversionIndex_filtered[i]; var elConversion_as_is = aSelectedNode_original[nConversionIndex_original]; var elConversion_to_be = aSelectedNode_filtered[nConversionIndex_filtered]; elConversion_as_is.parentNode.replaceChild(elConversion_to_be.cloneNode(true), elConversion_as_is); } } // ๋ถ™์—ฌ๋„ฃ์–ด์ง„ ์ปจํ…์ธ ์˜ ๋งˆ์ง€๋ง‰์œผ๋กœ ์ปค์„œ๋ฅผ ์œ„์น˜ this._moveToStringBookmark(oSelection); oSelection.collapseToEnd(); oSelection.select(); }catch(e){ /** * processPaste()์—์„œ ์กฐ์ž‘๋œ ์ปจํ…์ธ ๊ฐ€ ๋ณธ๋ฌธ์— ์ด๋ฏธ ์‚ฝ์ž…๋œ ๊ฒฝ์šฐ * oSelectionClone์„ ๊ธฐ๋ฐ˜์œผ๋กœ ๋ธŒ๋ผ์šฐ์ € ๊ณ ์œ  ๊ธฐ๋Šฅ์œผ๋กœ ๋ถ™์—ฌ๋„ฃ์—ˆ๋˜ ์ปจํ…์ธ ๋ฅผ ๋ณต์›ํ•œ๋‹ค. * */ // ์‚ฝ์ž…๋œ ์ปจํ…์ธ  ์ œ๊ฑฐ this._moveToStringBookmark(oSelection); oSelection.select(); oSelection.deleteContents(); // oSelectionClone ๋ณต์› var elEndBookmark = this._getStringBookmark(oSelection, true); elEndBookmark.parentNode.insertBefore(this.oSelectionClone.cloneNode(true), elEndBookmark); // ์ปค์„œ ์›์œ„์น˜ this._moveToStringBookmark(oSelection); oSelection.collapseToEnd(); oSelection.select(); } }, /** * [SMARTEDITORSUS-1673] NodeList์˜ ์š”์†Œ ์ค‘ * ์ฃผ์–ด์ง„ ํƒœ๊ทธ๋ช…๊ณผ ์ผ์น˜ํ•˜๋Š” ์š”์†Œ๊ฐ€ * NodeList์—์„œ ์œ„์น˜ํ•˜๋Š” index๋ฅผ ๊ธฐ๋กํ•ด ๋‘”๋‹ค. * */ _markMatchedElementIndex : function(aNodeList, aTagName){ var aMatchedElementIndex = []; var sPattern = aTagName.join("|"); var rxTagName = new RegExp("^(" + sPattern + ")$", "i"); // ex) new RegExp("^(p|table|div)$", "i") for(var i = 0, len = aNodeList.length; i < len; i++){ var elNode = aNodeList[i]; if(rxTagName.test(elNode.nodeName)){ aMatchedElementIndex.push(i); } } return aMatchedElementIndex; }, /** * [SMARTEDITORSUS-1673] ์›๋ฌธ์— ์‚ฝ์ž…ํ•ด ๋‘” ๋ถ๋งˆํฌ๋ฅผ ํš๋“. * * ๋ถ™์—ฌ๋„ฃ๊ธฐ ์ด๋ฒคํŠธ ๋ฐœ์ƒ ์‹œ์ ์— ์›๋ฌธ์— ์‚ฝ์ž…ํ•ด ๋‘” ๋ถ๋งˆํฌ์ด๋‹ค. * */ _getStringBookmark : function(oSelection, bGetEndBookmark){ var elBookmark; if(!!this._sBM_IE){ // [IE 10-] beforepaste ๋‹จ๊ณ„์—์„œ ๋ถ™์—ฌ๋„ฃ์–ด์ง„ ๋ถ๋งˆํฌ๋ฅผ selection์— ์‚ฌ์šฉ elBookmark = oSelection.getStringBookmark(this._sBM_IE, bGetEndBookmark); }else{ // paste ์ด๋ฒคํŠธ์—์„œ ๋ถ™์—ฌ๋„ฃ์–ด์ง„ ๋ถ๋งˆํฌ๋ฅผ selection์— ์‚ฌ์šฉ elBookmark = oSelection.getStringBookmark(this._sBM, bGetEndBookmark); } return elBookmark; }, /** * [SMARTEDITORSUS-1673] ์›๋ฌธ์— ์‚ฝ์ž…ํ•ด ๋‘์—ˆ๋˜ ๋ถ๋งˆํฌ๋ฅผ ์‚ญ์ œ. * * ๋ถ™์—ฌ๋„ฃ๊ธฐ ์ด๋ฒคํŠธ ๋ฐœ์ƒ ์‹œ์ ์— ์›๋ฌธ์— ์‚ฝ์ž…ํ•ด ๋‘” ๋ถ๋งˆํฌ์ด๋‹ค. * */ _removeStringBookmark : function(oSelection){ if(!!this._sBM_IE){ // [IE 10-] beforepaste ๋‹จ๊ณ„์—์„œ ๋ถ™์—ฌ๋„ฃ์–ด์ง„ ๋ถ๋งˆํฌ๋ฅผ selection์— ์‚ฌ์šฉ if(oSelection.getStringBookmark(this._sBM_IE)){ oSelection.removeStringBookmark(this._sBM_IE); } }else{ // paste ์ด๋ฒคํŠธ์—์„œ ๋ถ™์—ฌ๋„ฃ์–ด์ง„ ๋ถ๋งˆํฌ๋ฅผ selection์— ์‚ฌ์šฉ if(oSelection.getStringBookmark(this._sBM)){ oSelection.removeStringBookmark(this._sBM); } } } }); //} /** * @pluginDesc Enterํ‚ค ์ž…๋ ฅ์‹œ์— ํ˜„์žฌ ์ค„์„ P ํƒœ๊ทธ๋กœ ๊ฐ๊ฑฐ๋‚˜ <br> ํƒœ๊ทธ๋ฅผ ์‚ฝ์ž…ํ•œ๋‹ค. */ nhn.husky.SE_WYSIWYGEnterKey = jindo.$Class({ name : "SE_WYSIWYGEnterKey", $init : function(sLineBreaker){ if(sLineBreaker == "BR"){ this.sLineBreaker = "BR"; }else{ this.sLineBreaker = "P"; } this.htBrowser = jindo.$Agent().navigator(); // [SMARTEDITORSUS-227] IE ์ธ ๊ฒฝ์šฐ์—๋„ ์—๋””ํ„ฐ Enter ์ฒ˜๋ฆฌ ๋กœ์ง์„ ์‚ฌ์šฉํ•˜๋„๋ก ์ˆ˜์ • if(this.htBrowser.opera && this.sLineBreaker == "P"){ this.$ON_MSG_APP_READY = function(){}; } /** * [SMARTEDITORSUS-230] ๋ฐ‘์ค„+์ƒ‰์ƒ๋ณ€๊ฒฝ ํ›„, ์—”ํ„ฐ์น˜๋ฉด ์Šคํฌ๋ฆฝํŠธ ์˜ค๋ฅ˜ * [SMARTEDITORSUS-180] [IE9] ๋ฐฐ๊ฒฝ์ƒ‰ ์ ์šฉ ํ›„, ์—”ํ„ฐํ‚ค 2ํšŒ์ด์ƒ ์ž…๋ ฅ์‹œ ์ปค์„œ์œ„์น˜๊ฐ€ ๋‹ค์Œ ๋ผ์ธ์œผ๋กœ ์ด๋™ํ•˜์ง€ ์•Š์Œ * ์˜ค๋ฅ˜ ํ˜„์ƒ : IE9 ์—์„œ ์—”ํ„ฐ ํ›„ ์ƒ์„ฑ๋œ P ํƒœ๊ทธ๊ฐ€ "๋นˆ SPAN ํƒœ๊ทธ๋งŒ ๊ฐ€์ง€๋Š” ๊ฒฝ์šฐ" P ํƒœ๊ทธ ์˜์—ญ์ด ๋ณด์ด์ง€ ์•Š๊ฑฐ๋‚˜ ํฌ์ปค์Šค๊ฐ€ ์œ„๋กœ ์˜ฌ๋ผ๊ฐ€ ๋ณด์ž„ * ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• : ์ปค์„œ ํ™€๋”๋กœ IE ์ด์™ธ์—์„œ๋Š” <br> ์„ ์‚ฌ์šฉ * - IE ์—์„œ๋Š” ๋ Œ๋”๋ง ์‹œ <br> ๋ถ€๋ถ„์—์„œ ๋น„์ •์ƒ์ ์ธ P ํƒœ๊ทธ๊ฐ€ ์ƒ์„ฑ๋˜์–ด [SMARTEDITORSUS-230] ์˜ค๋ฅ˜ ๋ฐœ์ƒ * unescape("%uFEFF") (BOM) ์„ ์ถ”๊ฐ€ * - IE9 ํ‘œ์ค€๋ชจ๋“œ์—์„œ [SMARTEDITORSUS-180] ์˜ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•จ * (unescape("%u2028") (Line separator) ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด P ๊ฐ€ ๋ณด์—ฌ์ง€๋‚˜ ์‚ฌ์ด๋“œ์ดํŽ™ํŠธ๊ฐ€ ์šฐ๋ ค๋˜์–ด ์‚ฌ์šฉํ•˜์ง€ ์•Š์Œ) * IE ๋ธŒ๋ผ์šฐ์ €์—์„œ Enter ์ฒ˜๋ฆฌ ์‹œ, &nbsp; ๋ฅผ ๋„ฃ์–ด์ฃผ๋ฏ€๋กœ ํ•ด๋‹น ๋ฐฉ์‹์„ ๊ทธ๋Œ€๋กœ ์‚ฌ์šฉํ•˜๋„๋ก ์ˆ˜์ •ํ•จ */ if(this.htBrowser.ie){ this._addCursorHolder = this._addCursorHolderSpace; //[SMARTEDITORSUS-1652] ๊ธ€์žํฌ๊ธฐ ์ง€์ •ํ›„ ์—”ํ„ฐ๋ฅผ ์น˜๋ฉด ๋นˆSPAN์œผ๋กœ ๊ฐ์‹ธ์ง€๋Š”๋ฐ IE์—์„œ ๋นˆSPAN์€ ๋†’์ด๊ฐ’์„ ๊ฐ–์ง€ ์•Š์•„ ์ปค์„œ๊ฐ€ ์˜ฌ๋ผ๊ฐ€ ๋ณด์ด๊ฒŒ ๋จ // ๋”ฐ๋ผ์„œ, IE์˜ ๊ฒฝ์šฐ ๋ธŒ๋ผ์šฐ์ €๋ชจ๋“œ์™€ ์ƒ๊ด€์—†์ด ๋‹ค์Œ๋ผ์ธ์˜ SPAN์— ๋ฌด์กฐ๊ฑด ExtraCursorHolder ๋ฅผ ๋„ฃ์–ด์ฃผ๋„๋ก ์ฝ”๋ฉ˜ํŠธ์ฒ˜๋ฆฌํ•จ // if(this.htBrowser.nativeVersion < 9 || document.documentMode < 9){ // this._addExtraCursorHolder = function(){}; // } }else{ this._addExtraCursorHolder = function(){}; this._addBlankText = function(){}; } }, $ON_MSG_APP_READY : function(){ this.oApp.exec("ADD_APP_PROPERTY", ["sLineBreaker", this.sLineBreaker]); this.oSelection = this.oApp.getEmptySelection(); this.tmpTextNode = this.oSelection._document.createTextNode(unescape("%u00A0")); // ๊ณต๋ฐฑ(&nbsp;) ์ถ”๊ฐ€ ์‹œ ์‚ฌ์šฉํ•  ๋…ธ๋“œ jindo.$Fn(this._onKeyDown, this).attach(this.oApp.getWYSIWYGDocument(), "keydown"); }, _onKeyDown : function(oEvent){ var oKeyInfo = oEvent.key(); if(oKeyInfo.shift){ return; } if(oKeyInfo.enter){ if(this.sLineBreaker == "BR"){ this._insertBR(oEvent); }else{ this._wrapBlock(oEvent); } } }, /** * [SMARTEDITORSUS-950] ์—๋””ํ„ฐ ์ ์šฉ ํŽ˜์ด์ง€์˜ Compatible meta IE=edge ์„ค์ • ์‹œ ์ค„๊ฐ„๊ฒฉ ๋ฒŒ์–ด์ง ์ด์Šˆ (<BR>) */ $ON_REGISTER_CONVERTERS : function(){ this.oApp.exec("ADD_CONVERTER", ["IR_TO_DB", jindo.$Fn(this.onIrToDB, this).bind()]); }, /** * IR_TO_DB ๋ณ€ํ™˜๊ธฐ ์ฒ˜๋ฆฌ * Chrome, FireFox์ธ ๊ฒฝ์šฐ์—๋งŒ ์•„๋ž˜์™€ ๊ฐ™์€ ์ฒ˜๋ฆฌ๋ฅผ ํ•ฉ๋‹ˆ๋‹ค. * : ์ €์žฅ ์‹œ ๋ณธ๋ฌธ ์˜์—ญ์—์„œ P ์•„๋ž˜์˜ ๋ชจ๋“  ํ•˜์œ„ ํƒœ๊ทธ ์ค‘ ๊ฐ€์žฅ ๋งˆ์ง€๋ง‰ childNode๊ฐ€ BR์ธ ๊ฒฝ์šฐ๋ฅผ ํƒ์ƒ‰ํ•˜์—ฌ ์ด๋ฅผ &nbsp;๋กœ ๋ณ€๊ฒฝํ•ด ์ค๋‹ˆ๋‹ค. */ onIrToDB : function(sHTML){ var sContents = sHTML, rxRegEx = /<br(\s[^>]*)?\/?>((?:<\/span>)?<\/p>)/gi, rxRegExWhitespace = /(<p[^>]*>)(?:[\s^>]*)(<\/p>)/gi; sContents = sContents.replace(rxRegEx, "&nbsp;$2"); sContents = sContents.replace(rxRegExWhitespace, "$1&nbsp;$2"); return sContents; }, // [IE] Selection ๋‚ด์˜ ๋…ธ๋“œ๋ฅผ ๊ฐ€์ ธ์™€ ๋นˆ ๋…ธ๋“œ์— unescape("%uFEFF") (BOM) ์„ ์ถ”๊ฐ€ _addBlankText : function(oSelection){ var oNodes = oSelection.getNodes(), i, nLen, oNode, oNodeChild, tmpTextNode; for(i=0, nLen=oNodes.length; i<nLen; i++){ oNode = oNodes[i]; if(oNode.nodeType !== 1 || oNode.tagName !== "SPAN"){ continue; } if(oNode.id.indexOf(oSelection.HUSKY_BOOMARK_START_ID_PREFIX) > -1 || oNode.id.indexOf(oSelection.HUSKY_BOOMARK_END_ID_PREFIX) > -1){ continue; } oNodeChild = oNode.firstChild; if(!oNodeChild || (oNodeChild.nodeType == 3 && nhn.husky.SE2M_Utils.isBlankTextNode(oNodeChild)) || (oNodeChild.nodeType == 1 && oNode.childNodes.length == 1 && (oNodeChild.id.indexOf(oSelection.HUSKY_BOOMARK_START_ID_PREFIX) > -1 || oNodeChild.id.indexOf(oSelection.HUSKY_BOOMARK_END_ID_PREFIX) > -1))){ tmpTextNode = oSelection._document.createTextNode(unescape("%uFEFF")); oNode.appendChild(tmpTextNode); } } }, // [IE ์ด์™ธ] ๋นˆ ๋…ธ๋“œ ๋‚ด์— ์ปค์„œ๋ฅผ ํ‘œ์‹œํ•˜๊ธฐ ์œ„ํ•œ ์ฒ˜๋ฆฌ _addCursorHolder : function(elWrapper){ var elStyleOnlyNode = elWrapper; if(elWrapper.innerHTML == "" || (elStyleOnlyNode = this._getStyleOnlyNode(elWrapper))){ elStyleOnlyNode.innerHTML = "<br>"; } if(!elStyleOnlyNode){ elStyleOnlyNode = this._getStyleNode(elWrapper); } return elStyleOnlyNode; }, // [IE] ๋นˆ ๋…ธ๋“œ ๋‚ด์— ์ปค์„œ๋ฅผ ํ‘œ์‹œํ•˜๊ธฐ ์œ„ํ•œ ์ฒ˜๋ฆฌ (_addSpace ์‚ฌ์šฉ) _addCursorHolderSpace : function(elWrapper){ var elNode; this._addSpace(elWrapper); elNode = this._getStyleNode(elWrapper); if(elNode.innerHTML == "" && elNode.nodeName.toLowerCase() != "param"){ try{ elNode.innerHTML = unescape("%uFEFF"); }catch(e) { } } return elNode; }, /** * [SMARTEDITORSUS-1513] ์‹œ์ž‘๋…ธ๋“œ์™€ ๋๋…ธ๋“œ ์‚ฌ์ด์— ์ฒซ๋ฒˆ์งธ BR์„ ์ฐพ๋Š”๋‹ค. BR์ด ์—†๋Š” ๊ฒฝ์šฐ ๋๋…ธ๋“œ๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค. * @param {Node} oStart ๊ฒ€์‚ฌํ•  ์‹œ์ž‘๋…ธ๋“œ * @param {Node} oEnd ๊ฒ€์‚ฌํ•  ๋๋…ธ๋“œ * @return {Node} ์ฒซ๋ฒˆ์งธ BR ํ˜น์€ ๋๋…ธ๋“œ๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค. */ _getBlockEndNode : function(oStart, oEnd){ if(!oStart){ return oEnd; }else if(oStart.nodeName === "BR"){ return oStart; }else if(oStart === oEnd){ return oEnd; }else{ return this._getBlockEndNode(oStart.nextSibling, oEnd); } }, _wrapBlock : function(oEvent, sWrapperTagName){ var oSelection = this.oApp.getSelection(), sBM = oSelection.placeStringBookmark(), oLineInfo = oSelection.getLineInfo(), oStart = oLineInfo.oStart, oEnd = oLineInfo.oEnd, oSWrapper, oEWrapper, elStyleOnlyNode; // line broke by sibling // or // the parent line breaker is just a block container if(!oStart.bParentBreak || oSelection.rxBlockContainer.test(oStart.oLineBreaker.tagName)){ oEvent.stop(); // ์„ ํƒ๋œ ๋‚ด์šฉ์€ ์‚ญ์ œ oSelection.deleteContents(); if(!!oStart.oNode.parentNode && oStart.oNode.parentNode.nodeType !== 11){ // LineBreaker ๋กœ ๊ฐ์‹ธ์„œ ๋ถ„๋ฆฌ oSWrapper = this.oApp.getWYSIWYGDocument().createElement(this.sLineBreaker); oSelection.moveToBookmark(sBM); //oSelection.moveToStringBookmark(sBM, true); oSelection.setStartBefore(oStart.oNode); this._addBlankText(oSelection); oSelection.surroundContents(oSWrapper); oSelection.collapseToEnd(); oEWrapper = this.oApp.getWYSIWYGDocument().createElement(this.sLineBreaker); // [SMARTEDITORSUS-1513] oStart.oNode์™€ oEnd.oNode ์‚ฌ์ด์— BR์ด ์žˆ๋Š” ๊ฒฝ์šฐ, ๋‹ค์Œ ์—”ํ„ฐ์‹œ ์Šคํƒ€์ผ์ด ๋น„์ •์ƒ์œผ๋กœ ๋ณต์‚ฌ๋˜๊ธฐ ๋•Œ๋ฌธ์— ์ค‘๊ฐ„์— BR์ด ์žˆ์œผ๋ฉด BR๊นŒ์ง€๋งŒ ์ž˜๋ผ์„œ ์„ธํŒ…ํ•œ๋‹ค. oSelection.setEndAfter(this._getBlockEndNode(oStart.oNode, oEnd.oNode)); this._addBlankText(oSelection); oSelection.surroundContents(oEWrapper); oSelection.moveToStringBookmark(sBM, true); // [SMARTEDITORSUS-180] ํฌ์ปค์Šค ๋ฆฌ์…‹ oSelection.collapseToEnd(); // [SMARTEDITORSUS-180] ํฌ์ปค์Šค ๋ฆฌ์…‹ oSelection.removeStringBookmark(sBM); oSelection.select(); // P๋กœ ๋ถ„๋ฆฌํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— BR์ด ๋“ค์–ด์žˆ์œผ๋ฉด ์ œ๊ฑฐํ•œ๋‹ค. if(oEWrapper.lastChild !== null && oEWrapper.lastChild.tagName == "BR"){ oEWrapper.removeChild(oEWrapper.lastChild); } // Cursor Holder ์ถ”๊ฐ€ // insert a cursor holder(br) if there's an empty-styling-only-tag surrounding current cursor elStyleOnlyNode = this._addCursorHolder(oEWrapper); if(oEWrapper.nextSibling && oEWrapper.nextSibling.tagName == "BR"){ oEWrapper.parentNode.removeChild(oEWrapper.nextSibling); } oSelection.selectNodeContents(elStyleOnlyNode); oSelection.collapseToStart(); oSelection.select(); this.oApp.exec("CHECK_STYLE_CHANGE", []); sBM = oSelection.placeStringBookmark(); setTimeout(jindo.$Fn(function(sBM){ var elBookmark = oSelection.getStringBookmark(sBM); if(!elBookmark){return;} oSelection.moveToStringBookmark(sBM); oSelection.select(); oSelection.removeStringBookmark(sBM); }, this).bind(sBM), 0); return; } } var elBookmark; // ์•„๋ž˜๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ๋ธŒ๋ผ์šฐ์ € ๊ธฐ๋ณธ ๊ธฐ๋Šฅ์— ๋งก๊ฒจ์„œ ์ฒ˜๋ฆฌํ•จ if(this.htBrowser.firefox){ elBookmark = oSelection.getStringBookmark(sBM, true); if(elBookmark && elBookmark.nextSibling && elBookmark.nextSibling.tagName == "IFRAME"){ setTimeout(jindo.$Fn(function(sBM){ var elBookmark = oSelection.getStringBookmark(sBM); if(!elBookmark){return;} oSelection.moveToStringBookmark(sBM); oSelection.select(); oSelection.removeStringBookmark(sBM); }, this).bind(sBM), 0); }else{ oSelection.removeStringBookmark(sBM); } }else if(this.htBrowser.ie){ elBookmark = oSelection.getStringBookmark(sBM, true); var elParentNode = elBookmark.parentNode, bAddUnderline = false, bAddLineThrough = false; if(!elBookmark || !elParentNode){// || elBookmark.nextSibling){ oSelection.removeStringBookmark(sBM); return; } oSelection.removeStringBookmark(sBM); // [SMARTEDITORSUS-1575] ์ด์Šˆ ์ฒ˜๋ฆฌ์— ๋”ฐ๋ผ ์•„๋ž˜ ๋ถ€๋ถ„์€ ๋ถˆํ•„์š”ํ•ด์กŒ์Œ (์ผ๋‹จ ์ฝ”๋ฉ˜ํŠธ์ฒ˜๋ฆฌ) // // -- [SMARTEDITORSUS-1452] // var bAddCursorHolder = (elParentNode.tagName === "DIV" && elParentNode.parentNode.tagName === "LI"); // if (elParentNode.innerHTML !== "" && elParentNode.innerHTML !== unescape("%uFEFF")) { // if (bAddCursorHolder) { // // setTimeout(jindo.$Fn(function() { // var oSelection = this.oApp.getSelection(); // oSelection.fixCommonAncestorContainer(); // var elLowerNode = oSelection.commonAncestorContainer; // elLowerNode = oSelection._getVeryFirstRealChild(elLowerNode); // // if (elLowerNode && (elLowerNode.innerHTML === "" || elLowerNode.innerHTML === unescape("%uFEFF"))) { // elLowerNode.innerHTML = unescape("%uFEFF"); // } // }, this).bind(elParentNode), 0); // } // } else { // if (bAddCursorHolder) { // var oSelection = this.oApp.getSelection(); // oSelection.fixCommonAncestorContainer(); // var elLowerNode = oSelection.commonAncestorContainer; // elLowerNode = oSelection._getVeryFirstRealChild(elLowerNode); // jindo.$Element(elLowerNode).leave(); // // setTimeout(jindo.$Fn(function() { // var oSelection = this.oApp.getSelection(); // oSelection.fixCommonAncestorContainer(); // var elLowerNode = oSelection.commonAncestorContainer; // elLowerNode = oSelection._getVeryFirstRealChild(elLowerNode); // // if (elLowerNode && (elLowerNode.innerHTML === "" || elLowerNode.innerHTML === unescape("%uFEFF"))) { // elLowerNode.innerHTML = unescape("%uFEFF"); // } // }, this).bind(elParentNode), 0); // } // } // // -- [SMARTEDITORSUS-1452] bAddUnderline = (elParentNode.tagName === "U" || nhn.husky.SE2M_Utils.findAncestorByTagName("U", elParentNode) !== null); bAddLineThrough = (elParentNode.tagName === "S" || elParentNode.tagName === "STRIKE" || (nhn.husky.SE2M_Utils.findAncestorByTagName("S", elParentNode) !== null && nhn.husky.SE2M_Utils.findAncestorByTagName("STRIKE", elParentNode) !== null)); // [SMARTEDITORSUS-26] Enter ํ›„์— ๋ฐ‘์ค„/์ทจ์†Œ์„ ์ด ๋ณต์‚ฌ๋˜์ง€ ์•Š๋Š” ๋ฌธ์ œ๋ฅผ ์ฒ˜๋ฆฌ (๋ธŒ๋ผ์šฐ์ € Enter ์ฒ˜๋ฆฌ ํ›„ ์‹คํ–‰๋˜๋„๋ก setTimeout ์‚ฌ์šฉ) if(bAddUnderline || bAddLineThrough){ setTimeout(jindo.$Fn(this._addTextDecorationTag, this).bind(bAddUnderline, bAddLineThrough), 0); return; } // [SMARTEDITORSUS-180] ๋นˆ SPAN ํƒœ๊ทธ์— ์˜ํ•ด ์—”ํ„ฐ ํ›„ ์—”ํ„ฐ๊ฐ€ ๋˜์ง€ ์•Š์€ ๊ฒƒ์œผ๋กœ ๋ณด์ด๋Š” ๋ฌธ์ œ (๋ธŒ๋ผ์šฐ์ € Enter ์ฒ˜๋ฆฌ ํ›„ ์‹คํ–‰๋˜๋„๋ก setTimeout ์‚ฌ์šฉ) setTimeout(jindo.$Fn(this._addExtraCursorHolder, this).bind(elParentNode), 0); }else{ oSelection.removeStringBookmark(sBM); } }, // [IE9 standard mode] ์—”ํ„ฐ ํ›„์˜ ์ƒ/ํ•˜๋‹จ P ํƒœ๊ทธ๋ฅผ ํ™•์ธํ•˜์—ฌ BOM, ๊ณต๋ฐฑ(&nbsp;) ์ถ”๊ฐ€ _addExtraCursorHolder : function(elUpperNode){ var oNodeChild, oPrevChild, elHtml; elUpperNode = this._getStyleOnlyNode(elUpperNode); // ์—”ํ„ฐ ํ›„์˜ ์ƒ๋‹จ SPAN ๋…ธ๋“œ์— BOM ์ถ”๊ฐ€ //if(!!elUpperNode && /^(B|EM|I|LABEL|SPAN|STRONG|SUB|SUP|U|STRIKE)$/.test(elUpperNode.tagName) === false){ if(!!elUpperNode && elUpperNode.tagName === "SPAN"){ // SPAN ์ธ ๊ฒฝ์šฐ์—๋งŒ ๋ฐœ์ƒํ•จ oNodeChild = elUpperNode.lastChild; while(!!oNodeChild){ // ๋นˆ Text ์ œ๊ฑฐ oPrevChild = oNodeChild.previousSibling; if(oNodeChild.nodeType !== 3){ oNodeChild = oPrevChild; continue; } if(nhn.husky.SE2M_Utils.isBlankTextNode(oNodeChild)){ oNodeChild.parentNode.removeChild(oNodeChild); } oNodeChild = oPrevChild; } elHtml = elUpperNode.innerHTML; if(elHtml.replace("\u200B","").replace("\uFEFF","") === ""){ elUpperNode.innerHTML = "\u200B"; } } // ์—”ํ„ฐ ํ›„์— ๋น„์–ด์žˆ๋Š” ํ•˜๋‹จ SPAN ๋…ธ๋“œ์— BOM ์ถ”๊ฐ€ var oSelection = this.oApp.getSelection(), sBM, elLowerNode, elParent; if(!oSelection.collapsed){ return; } oSelection.fixCommonAncestorContainer(); elLowerNode = oSelection.commonAncestorContainer; if(!elLowerNode){ return; } elLowerNode = oSelection._getVeryFirstRealChild(elLowerNode); if(elLowerNode.nodeType === 3){ elLowerNode = elLowerNode.parentNode; } if(!elLowerNode || elLowerNode.tagName !== "SPAN"){ return; } elHtml = elLowerNode.innerHTML; if(elHtml.replace("\u200B","").replace("\uFEFF","") === ""){ elLowerNode.innerHTML = "\u200B"; } // ๋ฐฑ์ŠคํŽ˜์ด์Šค์‹œ ์ปค์„œ๊ฐ€ ์›€์ง์ด์ง€ ์•Š๋„๋ก ์ปค์„œ๋ฅผ ์ปค์„œํ™€๋” ์•ž์ชฝ์œผ๋กœ ์˜ฎ๊ธด๋‹ค. oSelection.selectNodeContents(elLowerNode); oSelection.collapseToStart(); oSelection.select(); }, // [IE] P ํƒœ๊ทธ ๊ฐ€์žฅ ๋’ค ์ž์‹๋…ธ๋“œ๋กœ ๊ณต๋ฐฑ(&nbsp;)์„ ๊ฐ’์œผ๋กœ ํ•˜๋Š” ํ…์ŠคํŠธ ๋…ธ๋“œ๋ฅผ ์ถ”๊ฐ€ _addSpace : function(elNode){ var tmpTextNode, elChild, elNextChild, bHasNBSP, aImgChild, elLastImg; if(!elNode){ return; } if(elNode.nodeType === 3){ return elNode.parentNode; } if(elNode.tagName !== "P"){ return elNode; } aImgChild = jindo.$Element(elNode).child(function(v){ return (v.$value().nodeType === 1 && v.$value().tagName === "IMG"); }, 1); if(aImgChild.length > 0){ elLastImg = aImgChild[aImgChild.length - 1].$value(); elChild = elLastImg.nextSibling; while(elChild){ elNextChild = elChild.nextSibling; if (elChild.nodeType === 3 && (elChild.nodeValue === "&nbsp;" || elChild.nodeValue === unescape("%u00A0") || elChild.nodeValue === "\u200B")) { elNode.removeChild(elChild); } elChild = elNextChild; } return elNode; } elChild = elNode.firstChild; elNextChild = elChild; bHasNBSP = false; while(elChild){ // &nbsp;๋ฅผ ๋ถ™์ผ๊บผ๋‹ˆ๊นŒ P ๋ฐ”๋กœ ์•„๋ž˜์˜ "%uFEFF"๋Š” ์ œ๊ฑฐํ•จ elNextChild = elChild.nextSibling; if(elChild.nodeType === 3){ if(elChild.nodeValue === unescape("%uFEFF")){ elNode.removeChild(elChild); } if(!bHasNBSP && (elChild.nodeValue === "&nbsp;" || elChild.nodeValue === unescape("%u00A0") || elChild.nodeValue === "\u200B")){ bHasNBSP = true; } } elChild = elNextChild; } if(!bHasNBSP){ tmpTextNode = this.tmpTextNode.cloneNode(); elNode.appendChild(tmpTextNode); } return elNode; // [SMARTEDITORSUS-418] return ์—˜๋ฆฌ๋จผํŠธ ์ถ”๊ฐ€ }, // [IE] ์—”ํ„ฐ ํ›„์— ์ทจ์†Œ์„ /๋ฐ‘์ค„ ํƒœ๊ทธ๋ฅผ ์ž„์˜๋กœ ์ถ”๊ฐ€ (์ทจ์†Œ์„ /๋ฐ‘์ค„์— ์ƒ‰์ƒ์„ ํ‘œ์‹œํ•˜๊ธฐ ์œ„ํ•จ) _addTextDecorationTag : function(bAddUnderline, bAddLineThrough){ var oTargetNode, oNewNode, oSelection = this.oApp.getSelection(); if(!oSelection.collapsed){ return; } oTargetNode = oSelection.startContainer; while(oTargetNode){ if(oTargetNode.nodeType === 3){ oTargetNode = nhn.DOMFix.parentNode(oTargetNode); break; } if(!oTargetNode.childNodes || oTargetNode.childNodes.length === 0){ // oTargetNode.innerHTML = "\u200B"; break; } oTargetNode = oTargetNode.firstChild; } if(!oTargetNode){ return; } if(oTargetNode.tagName === "U" || oTargetNode.tagName === "S" || oTargetNode.tagName === "STRIKE"){ return; } if(bAddUnderline){ oNewNode = oSelection._document.createElement("U"); oTargetNode.appendChild(oNewNode); oTargetNode = oNewNode; } if(bAddLineThrough){ oNewNode = oSelection._document.createElement("STRIKE"); oTargetNode.appendChild(oNewNode); } oNewNode.innerHTML = "\u200B"; oSelection.selectNodeContents(oNewNode); oSelection.collapseToEnd(); // End ๋กœ ํ•ด์•ผ ์ƒˆ๋กœ ์ƒ์„ฑ๋œ ๋…ธ๋“œ ์•ˆ์œผ๋กœ Selection ์ด ๋“ค์–ด๊ฐ oSelection.select(); }, // returns inner-most styling node // -> returns span3 from <span1><span2><span3>aaa</span></span></span> _getStyleNode : function(elNode){ while(elNode.firstChild && this.oSelection._isBlankTextNode(elNode.firstChild)){ elNode.removeChild(elNode.firstChild); } var elFirstChild = elNode.firstChild; if(!elFirstChild){ return elNode; } if(elFirstChild.nodeType === 3 || (elFirstChild.nodeType === 1 && (elFirstChild.tagName == "IMG" || elFirstChild.tagName == "BR" || elFirstChild.tagName == "HR" || elFirstChild.tagName == "IFRAME"))){ return elNode; } return this._getStyleNode(elNode.firstChild); }, // returns inner-most styling only node if there's any. // -> returns span3 from <span1><span2><span3></span></span></span> _getStyleOnlyNode : function(elNode){ if(!elNode){ return null; } // the final styling node must allow appending children // -> this doesn't seem to work for FF if(!elNode.insertBefore){ return null; } if(elNode.tagName == "IMG" || elNode.tagName == "BR" || elNode.tagName == "HR" || elNode.tagName == "IFRAME"){ return null; } while(elNode.firstChild && this.oSelection._isBlankTextNode(elNode.firstChild)){ elNode.removeChild(elNode.firstChild); } if(elNode.childNodes.length>1){ return null; } if(!elNode.firstChild){ return elNode; } // [SMARTEDITORSUS-227] TEXT_NODE ๊ฐ€ return ๋˜๋Š” ๋ฌธ์ œ๋ฅผ ์ˆ˜์ •ํ•จ. IE ์—์„œ TEXT_NODE ์˜ innrHTML ์— ์ ‘๊ทผํ•˜๋ฉด ์˜ค๋ฅ˜ ๋ฐœ์ƒ if(elNode.firstChild.nodeType === 3){ return nhn.husky.SE2M_Utils.isBlankTextNode(elNode.firstChild) ? elNode : null; //return (elNode.firstChild.textContents === null || elNode.firstChild.textContents === "") ? elNode : null; } return this._getStyleOnlyNode(elNode.firstChild); }, _insertBR : function(oEvent){ oEvent.stop(); var oSelection = this.oApp.getSelection(); var elBR = this.oApp.getWYSIWYGDocument().createElement("BR"); oSelection.insertNode(elBR); oSelection.selectNode(elBR); oSelection.collapseToEnd(); if(!this.htBrowser.ie){ var oLineInfo = oSelection.getLineInfo(); var oEnd = oLineInfo.oEnd; // line break by Parent // <div> 1234<br></div>์ธ๊ฒฝ์šฐ, FF์—์„œ๋Š” ๋‹ค์Œ ๋ผ์ธ์œผ๋กœ ์ปค์„œ ์ด๋™์ด ์•ˆ ์ผ์–ด๋‚จ. // ๊ทธ๋ž˜์„œ <div> 1234<br><br type='_moz'/></div> ์ด์™€ ๊ฐ™์ด ์ƒ์„ฑํ•ด์ฃผ์–ด์•ผ ์—๋””ํ„ฐ ์ƒ์— 2์ค„๋กœ ๋˜์–ด ๋ณด์ž„. if(oEnd.bParentBreak){ while(oEnd.oNode && oEnd.oNode.nodeType == 3 && oEnd.oNode.nodeValue == ""){ oEnd.oNode = oEnd.oNode.previousSibling; } var nTmp = 1; if(oEnd.oNode == elBR || oEnd.oNode.nextSibling == elBR){ nTmp = 0; } if(nTmp === 0){ oSelection.pasteHTML("<br type='_moz'/>"); oSelection.collapseToEnd(); } } } // the text cursor won't move to the next line without this oSelection.insertNode(this.oApp.getWYSIWYGDocument().createTextNode("")); oSelection.select(); } }); //} /** * ColorPicker Component * @author gony */ nhn.ColorPicker = jindo.$Class({ elem : null, huePanel : null, canvasType : "Canvas", _hsvColor : null, $init : function(oElement, oOptions) { this.elem = jindo.$Element(oElement).empty(); this.huePanel = null; this.cursor = jindo.$Element("<div>").css("overflow", "hidden"); this.canvasType = jindo.$(oElement).filters?"Filter":jindo.$("<canvas>").getContext?"Canvas":null; if(!this.canvasType) { return false; } this.option({ huePanel : null, huePanelType : "horizontal" }); this.option(oOptions); if (this.option("huePanel")) { this.huePanel = jindo.$Element(this.option("huePanel")).empty(); } // rgb this._hsvColor = this._hsv(0,100,100); // #FF0000 // event binding for(var name in this) { if (/^_on[A-Z][a-z]+[A-Z][a-z]+$/.test(name)) { this[name+"Fn"] = jindo.$Fn(this[name], this); } } this._onDownColorFn.attach(this.elem, "mousedown"); if (this.huePanel) { this._onDownHueFn.attach(this.huePanel, "mousedown"); } // paint this.paint(); }, rgb : function(rgb) { this.hsv(this._rgb2hsv(rgb.r, rgb.g, rgb.b)); }, hsv : function(hsv) { if (typeof hsv == "undefined") { return this._hsvColor; } var rgb = null; var w = this.elem.width(); var h = this.elem.height(); var cw = this.cursor.width(); var ch = this.cursor.height(); var x = 0, y = 0; if (this.huePanel) { rgb = this._hsv2rgb(hsv.h, 100, 100); this.elem.css("background", "#"+this._rgb2hex(rgb.r, rgb.g, rgb.b)); x = hsv.s/100 * w; y = (100-hsv.v)/100 * h; } else { var hw = w / 2; if (hsv.v > hsv.s) { hsv.v = 100; x = hsv.s/100 * hw; } else { hsv.s = 100; x = (100-hsv.v)/100 * hw + hw; } y = hsv.h/360 * h; } x = Math.max(Math.min(x-1,w-cw), 1); y = Math.max(Math.min(y-1,h-ch), 1); this.cursor.css({left:x+"px",top:y+"px"}); this._hsvColor = hsv; rgb = this._hsv2rgb(hsv.h, hsv.s, hsv.v); this.fireEvent("colorchange", {type:"colorchange", element:this, currentElement:this, rgbColor:rgb, hexColor:"#"+this._rgb2hex(rgb.r, rgb.g, rgb.b), hsvColor:hsv} ); }, paint : function() { if (this.huePanel) { // paint color panel this["_paintColWith"+this.canvasType](); // paint hue panel this["_paintHueWith"+this.canvasType](); } else { // paint color panel this["_paintOneWith"+this.canvasType](); } // draw cursor this.cursor.appendTo(this.elem); this.cursor.css({position:"absolute",top:"1px",left:"1px",background:"white",border:"1px solid black"}).width(3).height(3); this.hsv(this._hsvColor); }, _paintColWithFilter : function() { // white : left to right jindo.$Element("<div>").css({ position : "absolute", top : 0, left : 0, width : "100%", height : "100%", filter : "progid:DXImageTransform.Microsoft.Gradient(GradientType=1,StartColorStr='#FFFFFFFF',EndColorStr='#00FFFFFF')" }).appendTo(this.elem); // black : down to up jindo.$Element("<div>").css({ position : "absolute", top : 0, left : 0, width : "100%", height : "100%", filter : "progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#00000000',EndColorStr='#FF000000')" }).appendTo(this.elem); }, _paintColWithCanvas : function() { var cvs = jindo.$Element("<canvas>").css({width:"100%",height:"100%"}); cvs.appendTo(this.elem.empty()); var ctx = cvs.attr("width", cvs.width()).attr("height", cvs.height()).$value().getContext("2d"); var lin = null; var w = cvs.width(); var h = cvs.height(); // white : left to right lin = ctx.createLinearGradient(0,0,w,0); lin.addColorStop(0, "rgba(255,255,255,1)"); lin.addColorStop(1, "rgba(255,255,255,0)"); ctx.fillStyle = lin; ctx.fillRect(0,0,w,h); // black : down to top lin = ctx.createLinearGradient(0,0,0,h); lin.addColorStop(0, "rgba(0,0,0,0)"); lin.addColorStop(1, "rgba(0,0,0,1)"); ctx.fillStyle = lin; ctx.fillRect(0,0,w,h); }, _paintOneWithFilter : function() { var sp, ep, s_rgb, e_rgb, s_hex, e_hex; var h = this.elem.height(); for(var i=1; i < 7; i++) { sp = Math.floor((i-1)/6 * h); ep = Math.floor(i/6 * h); s_rgb = this._hsv2rgb((i-1)/6*360, 100, 100); e_rgb = this._hsv2rgb(i/6*360, 100, 100); s_hex = "#FF"+this._rgb2hex(s_rgb.r, s_rgb.g, s_rgb.b); e_hex = "#FF"+this._rgb2hex(e_rgb.r, e_rgb.g, e_rgb.b); jindo.$Element("<div>").css({ position : "absolute", left : 0, width : "100%", top : sp + "px", height : (ep-sp) + "px", filter : "progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='"+s_hex+"',EndColorStr='"+e_hex+"')" }).appendTo(this.elem); } // white : left to right jindo.$Element("<div>").css({ position : "absolute", top : 0, left : 0, width : "50%", height : "100%", filter : "progid:DXImageTransform.Microsoft.Gradient(GradientType=1,StartColorStr='#FFFFFFFF',EndColorStr='#00FFFFFF')" }).appendTo(this.elem); // black : down to up jindo.$Element("<div>").css({ position : "absolute", top : 0, right : 0, width : "50%", height : "100%", filter : "progid:DXImageTransform.Microsoft.Gradient(GradientType=1,StartColorStr='#00000000',EndColorStr='#FF000000')" }).appendTo(this.elem); }, _paintOneWithCanvas : function() { var rgb = {r:0, g:0, b:0}; var cvs = jindo.$Element("<canvas>").css({width:"100%",height:"100%"}); cvs.appendTo(this.elem.empty()); var ctx = cvs.attr("width", cvs.width()).attr("height", cvs.height()).$value().getContext("2d"); var w = cvs.width(); var h = cvs.height(); var lin = ctx.createLinearGradient(0,0,0,h); for(var i=0; i < 7; i++) { rgb = this._hsv2rgb(i/6*360, 100, 100); lin.addColorStop(i/6, "rgb("+rgb.join(",")+")"); } ctx.fillStyle = lin; ctx.fillRect(0,0,w,h); lin = ctx.createLinearGradient(0,0,w,0); lin.addColorStop(0, "rgba(255,255,255,1)"); lin.addColorStop(0.5, "rgba(255,255,255,0)"); lin.addColorStop(0.5, "rgba(0,0,0,0)"); lin.addColorStop(1, "rgba(0,0,0,1)"); ctx.fillStyle = lin; ctx.fillRect(0,0,w,h); }, _paintHueWithFilter : function() { var sp, ep, s_rgb, e_rgb, s_hex, e_hex; var vert = (this.option().huePanelType == "vertical"); var w = this.huePanel.width(); var h = this.huePanel.height(); var elDiv = null; var nPanelBorderWidth = parseInt(this.huePanel.css('borderWidth'), 10); if (!!isNaN(nPanelBorderWidth)) { nPanelBorderWidth = 0; } w -= nPanelBorderWidth * 2; // borderWidth๋ฅผ ์ œ์™ธํ•œ ๋‚ด์ธก ํญ์„ ๊ตฌํ•จ for(var i=1; i < 7; i++) { sp = Math.floor((i-1)/6 * (vert?h:w)); ep = Math.floor(i/6 * (vert?h:w)); s_rgb = this._hsv2rgb((i-1)/6*360, 100, 100); e_rgb = this._hsv2rgb(i/6*360, 100, 100); s_hex = "#FF"+this._rgb2hex(s_rgb.r, s_rgb.g, s_rgb.b); e_hex = "#FF"+this._rgb2hex(e_rgb.r, e_rgb.g, e_rgb.b); elDiv = jindo.$Element("<div>").css({ position : "absolute", filter : "progid:DXImageTransform.Microsoft.Gradient(GradientType="+(vert?0:1)+",StartColorStr='"+s_hex+"',EndColorStr='"+e_hex+"')" }); var width = (ep - sp) + 1; // IE์—์„œ ํญ์„ ๋„“ํ˜€์ฃผ์ง€ ์•Š์œผ๋ฉด ํ™•๋Œ€ ์‹œ ๋ฒŒ์–ด์ง, ๊ทธ๋ž˜์„œ 1px ๋ณด์ • elDiv.appendTo(this.huePanel); elDiv.css(vert?"left":"top", 0).css(vert?"width":"height", '100%'); elDiv.css(vert?"top":"left", sp + "px").css(vert?"height":"width", width + "px"); } }, _paintHueWithCanvas : function() { var opt = this.option(), rgb; var vtc = (opt.huePanelType == "vertical"); var cvs = jindo.$Element("<canvas>").css({width:"100%",height:"100%"}); cvs.appendTo(this.huePanel.empty()); var ctx = cvs.attr("width", cvs.width()).attr("height", cvs.height()).$value().getContext("2d"); var lin = ctx.createLinearGradient(0,0,vtc?0:cvs.width(),vtc?cvs.height():0); for(var i=0; i < 7; i++) { rgb = this._hsv2rgb(i/6*360, 100, 100); lin.addColorStop(i/6, "rgb("+rgb.join(",")+")"); } ctx.fillStyle = lin; ctx.fillRect(0,0,cvs.width(),cvs.height()); }, _rgb2hsv : function(r,g,b) { var h = 0, s = 0, v = Math.max(r,g,b), min = Math.min(r,g,b), delta = v - min; s = (v ? delta/v : 0); if (s) { if (r == v) { h = 60 * (g - b) / delta; } else if (g == v) { h = 120 + 60 * (b - r) / delta; } else if (b == v) { h = 240 + 60 * (r - g) / delta; } if (h < 0) { h += 360; } } h = Math.floor(h); s = Math.floor(s * 100); v = Math.floor(v / 255 * 100); return this._hsv(h,s,v); }, _hsv2rgb : function(h,s,v) { h = (h % 360) / 60; s /= 100; v /= 100; var r=0, g=0, b=0; var i = Math.floor(h); var f = h-i; var p = v*(1-s); var q = v*(1-s*f); var t = v*(1-s*(1-f)); switch (i) { case 0: r=v; g=t; b=p; break; case 1: r=q; g=v; b=p; break; case 2: r=p; g=v; b=t; break; case 3: r=p; g=q; b=v; break; case 4: r=t; g=p; b=v; break; case 5: r=v; g=p; b=q;break; case 6: break; } r = Math.floor(r*255); g = Math.floor(g*255); b = Math.floor(b*255); return this._rgb(r,g,b); }, _rgb2hex : function(r,g,b) { r = r.toString(16); if (r.length == 1) { r = '0'+r; } g = g.toString(16); if (g.length==1) { g = '0'+g; } b = b.toString(16); if (b.length==1) { b = '0'+b; } return r+g+b; }, _hex2rgb : function(hex) { var m = hex.match(/#?([0-9a-f]{6}|[0-9a-f]{3})/i); if (m[1].length == 3) { m = m[1].match(/./g).filter(function(c) { return c+c; }); } else { m = m[1].match(/../g); } return { r : Number("0x" + m[0]), g : Number("0x" + m[1]), b : Number("0x" + m[2]) }; }, _rgb : function(r,g,b) { var ret = [r,g,b]; ret.r = r; ret.g = g; ret.b = b; return ret; }, _hsv : function(h,s,v) { var ret = [h,s,v]; ret.h = h; ret.s = s; ret.v = v; return ret; }, _onDownColor : function(e) { if (!e.mouse().left) { return false; } var pos = e.pos(); this._colPagePos = [pos.pageX, pos.pageY]; this._colLayerPos = [pos.layerX, pos.layerY]; this._onUpColorFn.attach(document, "mouseup"); this._onMoveColorFn.attach(document, "mousemove"); this._onMoveColor(e); }, _onUpColor : function(e) { this._onUpColorFn.detach(document, "mouseup"); this._onMoveColorFn.detach(document, "mousemove"); }, _onMoveColor : function(e) { var hsv = this._hsvColor; var pos = e.pos(); var x = this._colLayerPos[0] + (pos.pageX - this._colPagePos[0]); var y = this._colLayerPos[1] + (pos.pageY - this._colPagePos[1]); var w = this.elem.width(); var h = this.elem.height(); x = Math.max(Math.min(x, w), 0); y = Math.max(Math.min(y, h), 0); if (this.huePanel) { hsv.s = hsv[1] = x / w * 100; hsv.v = hsv[2] = (h - y) / h * 100; } else { hsv.h = y/h*360; var hw = w/2; if (x < hw) { hsv.s = x/hw * 100; hsv.v = 100; } else { hsv.s = 100; hsv.v = (w-x)/hw * 100; } } this.hsv(hsv); e.stop(); }, _onDownHue : function(e) { if (!e.mouse().left) { return false; } var pos = e.pos(); this._huePagePos = [pos.pageX, pos.pageY]; this._hueLayerPos = [pos.layerX, pos.layerY]; this._onUpHueFn.attach(document, "mouseup"); this._onMoveHueFn.attach(document, "mousemove"); this._onMoveHue(e); }, _onUpHue : function(e) { this._onUpHueFn.detach(document, "mouseup"); this._onMoveHueFn.detach(document, "mousemove"); }, _onMoveHue : function(e) { var hsv = this._hsvColor; var pos = e.pos(); var cur = 0, len = 0; var x = this._hueLayerPos[0] + (pos.pageX - this._huePagePos[0]); var y = this._hueLayerPos[1] + (pos.pageY - this._huePagePos[1]); if (this.option().huePanelType == "vertical") { cur = y; len = this.huePanel.height(); } else { cur = x; len = this.huePanel.width(); } hsv.h = hsv[0] = (Math.min(Math.max(cur, 0), len)/len * 360)%360; this.hsv(hsv); e.stop(); } }).extend(jindo.Component); //{ /** * @fileOverview This file contains Husky plugin that takes care of Accessibility about SmartEditor2. * @name hp_SE2M_Accessibility.js */ nhn.husky.SE2M_Accessibility = jindo.$Class({ name : "SE2M_Accessibility", /* * elAppContainer : mandatory * sLocale, sEditorType : optional */ $init: function(elAppContainer, sLocale, sEditorType) { this._assignHTMLElements(elAppContainer); if(!!sLocale){ this.sLang = sLocale; } if(!!sEditorType){ this.sType = sEditorType; } }, _assignHTMLElements : function(elAppContainer){ this.elHelpPopupLayer = jindo.$$.getSingle("DIV.se2_accessibility", elAppContainer); this.welHelpPopupLayer = jindo.$Element(this.elHelpPopupLayer); //close buttons this.oCloseButton = jindo.$$.getSingle("BUTTON.se2_close", this.elHelpPopupLayer); this.oCloseButton2 = jindo.$$.getSingle("BUTTON.se2_close2", this.elHelpPopupLayer); this.nDefaultTop = 150; // [SMARTEDITORSUS-1594] ํฌ์ปค์Šค ํƒ์ƒ‰์— ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด ํ• ๋‹น this.elAppContainer = elAppContainer; // --[SMARTEDITORSUS-1594] }, $ON_MSG_APP_READY : function(){ this.htAccessOption = nhn.husky.SE2M_Configuration.SE2M_Accessibility || {}; this.oApp.exec("REGISTER_HOTKEY", ["alt+F10", "FOCUS_TOOLBAR_AREA", []]); this.oApp.exec("REGISTER_HOTKEY", ["alt+COMMA", "FOCUS_BEFORE_ELEMENT", []]); this.oApp.exec("REGISTER_HOTKEY", ["alt+PERIOD", "FOCUS_NEXT_ELEMENT", []]); if ((this.sType == 'basic' || this.sType == 'light') && (this.sLang != 'ko_KR')) { //do nothing return; } else { this.oApp.exec("REGISTER_HOTKEY", ["alt+0", "OPEN_HELP_POPUP", []]); //[SMARTEDITORSUS-1327] IE 7/8์—์„œ ALT+0์œผ๋กœ ํŒ์—… ๋„์šฐ๊ณ  escํด๋ฆญ์‹œ ํŒ์—…์ฐฝ ๋‹ซํžˆ๊ฒŒ ํ•˜๋ ค๋ฉด ์•„๋ž˜ ๋ถ€๋ถ„ ๊ผญ ํ•„์š”ํ•จ. (target์€ document๊ฐ€ ๋˜์–ด์•ผ ํ•จ!) this.oApp.exec("REGISTER_HOTKEY", ["esc", "CLOSE_HELP_POPUP", [], document]); } //[SMARTEDITORSUS-1353] if (this.htAccessOption.sTitleElementId) { this.oApp.registerBrowserEvent(document.getElementById(this.htAccessOption.sTitleElementId), "keydown", "MOVE_TO_EDITAREA", []); } }, $ON_MOVE_TO_EDITAREA : function(weEvent) { var TAB_KEY_CODE = 9; if (weEvent.key().keyCode == TAB_KEY_CODE) { if(weEvent.key().shift) {return;} this.oApp.delayedExec("FOCUS", [], 0); } }, $LOCAL_BEFORE_FIRST : function(sMsg){ jindo.$Fn(jindo.$Fn(this.oApp.exec, this.oApp).bind("CLOSE_HELP_POPUP", [this.oCloseButton]), this).attach(this.oCloseButton, "click"); jindo.$Fn(jindo.$Fn(this.oApp.exec, this.oApp).bind("CLOSE_HELP_POPUP", [this.oCloseButton2]), this).attach(this.oCloseButton2, "click"); //๋ ˆ์ด์–ด์˜ ์ด๋™ ๋ฒ”์œ„ ์„ค์ •. var elIframe = this.oApp.getWYSIWYGWindow().frameElement; this.htOffsetPos = jindo.$Element(elIframe).offset(); this.nEditorWidth = elIframe.offsetWidth; this.htInitialPos = this.welHelpPopupLayer.offset(); var htScrollXY = this.oApp.oUtils.getScrollXY(); this.nLayerWidth = 590; this.nLayerHeight = 480; this.htTopLeftCorner = {x:parseInt(this.htOffsetPos.left, 10), y:parseInt(this.htOffsetPos.top, 10)}; //[css markup] left:11 top:74๋กœ ๋˜์–ด ์žˆ์Œ }, /** * [SMARTEDITORSUS-1594] * SE2M_Configuration_General์—์„œ ํฌ์ปค์Šค๋ฅผ ์ด๋™ํ•  ์—๋””ํ„ฐ ์˜์—ญ ์ดํ›„์˜ ์—˜๋ ˆ๋จผํŠธ๋ฅผ ์ง€์ •ํ•ด ๋‘์—ˆ๋‹ค๋ฉด, ์„ค์ •๊ฐ’์„ ๋”ฐ๋ฅธ๋‹ค. * ์ง€์ •ํ•˜์ง€ ์•Š์•˜๊ฑฐ๋‚˜ ๋นˆ String์ด๋ผ๋ฉด, elAppContainer๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์ž๋™ ํƒ์ƒ‰ํ•œ๋‹ค. * */ $ON_FOCUS_NEXT_ELEMENT : function() { // ํฌ์ปค์Šค ์บ์‹ฑ this._currentNextFocusElement = null; // ์ƒˆ๋กœ์šด ํฌ์ปค์Šค ์ด๋™์ด ๋ฐœ์ƒํ•  ๋•Œ๋งˆ๋‹ค ์บ์‹ฑ ์ดˆ๊ธฐํ™” if(this.htAccessOption.sNextElementId){ this._currentNextFocusElement = document.getElementById(this.htAccessOption.sNextElementId); }else{ this._currentNextFocusElement = this._findNextFocusElement(this.elAppContainer); } if(this._currentNextFocusElement){ window.focus(); // [SMARTEDITORSUS-1360] IE7์—์„œ๋Š” element์— ๋Œ€ํ•œ focus๋ฅผ ์ฃผ๊ธฐ ์œ„ํ•ด ์„ ํ–‰๋˜์–ด์•ผ ํ•œ๋‹ค. this._currentNextFocusElement.focus(); }else if(parent && parent.nhn && parent.nhn.husky && parent.nhn.husky.EZCreator && parent.nhn.husky.EZCreator.elIFrame){ parent.focus(); if(this._currentNextFocusElement = this._findNextFocusElement(parent.nhn.husky.EZCreator.elIFrame)){ this._currentNextFocusElement.focus(); } } }, /** * [SMARTEDITORSUS-1594] DIV#smart_editor2 ๋‹ค์Œ ์š”์†Œ์—์„œ ๊ฐ€์žฅ ๊ฐ€๊นŒ์šด ํฌ์ปค์Šค์šฉ ํƒœ๊ทธ๋ฅผ ํƒ์ƒ‰ * */ _findNextFocusElement : function(targetElement){ var target = null; var el = targetElement.nextSibling; while(el){ if(el.nodeType !== 1){ // Element Node๋งŒ์„ ๋Œ€์ƒ์œผ๋กœ ํ•œ๋‹ค. // ๋Œ€์ƒ ๋…ธ๋“œ ๋Œ€์‹  nextSibling์„ ์ฐพ๋˜, ๋ถ€๋ชจ๋ฅผ ๊ฑฐ์Šฌ๋Ÿฌ ์˜ฌ๋ผ๊ฐˆ ์ˆ˜๋„ ์žˆ๋‹ค. // document.body๊นŒ์ง€ ๊ฑฐ์Šฌ๋Ÿฌ ์˜ฌ๋ผ๊ฐ€๊ฒŒ ๋˜๋ฉด ํƒ์ƒ‰ ์ข…๋ฃŒ el = this._switchToSiblingOrNothing(el); if(!el){ break; }else{ continue; } } // ๋Œ€์ƒ ๋…ธ๋“œ๋ฅผ ๊ธฐ์ค€์œผ๋กœ, ์ „์œ„์ˆœํšŒ๋กœ ์กฐ๊ฑด์— ๋ถ€ํ•ฉํ•˜๋Š” ๋…ธ๋“œ ํƒ์ƒ‰ this._recursivePreorderTraversalFilter(el, this._isFocusTag); if(this._nextFocusElement){ target = this._nextFocusElement; // ํƒ์ƒ‰์— ์‚ฌ์šฉํ–ˆ๋˜ ๋ณ€์ˆ˜ ์ดˆ๊ธฐํ™” this._bStopFindingNextElement = false; this._nextFocusElement = null; break; }else{ // ๋Œ€์ƒ ๋…ธ๋“œ ๋Œ€์‹  nextSibling์„ ์ฐพ๋˜, ๋ถ€๋ชจ๋ฅผ ๊ฑฐ์Šฌ๋Ÿฌ ์˜ฌ๋ผ๊ฐˆ ์ˆ˜๋„ ์žˆ๋‹ค. // document.body๊นŒ์ง€ ๊ฑฐ์Šฌ๋Ÿฌ ์˜ฌ๋ผ๊ฐ€๊ฒŒ ๋˜๋ฉด ํƒ์ƒ‰ ์ข…๋ฃŒ el = this._switchToSiblingOrNothing(el); if(!el){ break; } } } // target์ด ์กด์žฌํ•˜์ง€ ์•Š์œผ๋ฉด null ๋ฐ˜ํ™˜ return target; }, /** * [SMARTEDITORSUS-1594] ๋Œ€์ƒ ๋…ธ๋“œ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•˜์—ฌ, nextSibling ๋˜๋Š” previousSibling์„ ์ฐพ๋Š”๋‹ค. * nextSibling ๋˜๋Š” previousSibling์ด ์—†๋‹ค๋ฉด, * ๋ถ€๋ชจ๋ฅผ ๊ฑฐ์Šฌ๋Ÿฌ ์˜ฌ๋ผ๊ฐ€๋ฉด์„œ ์ฒซ nextSibling ๋˜๋Š” previousSibling์„ ์ฐพ๋Š”๋‹ค. * document์˜ body๊นŒ์ง€ ์˜ฌ๋ผ๊ฐ€๋„ nextSibling ๋˜๋Š” previousSibling์ด ๋‚˜ํƒ€๋‚˜์ง€ ์•Š๋Š”๋‹ค๋ฉด * ํƒ์ƒ‰ ๋Œ€์ƒ์œผ๋กœ null์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค. * @param {NodeElement} ๋Œ€์ƒ ๋…ธ๋“œ (์ฃผ์˜:NodeElement์— ๋Œ€ํ•œ null ์ฒดํฌ ์•ˆํ•จ) * @param {Boolean} ์ƒ๋žตํ•˜๊ฑฐ๋‚˜ false์ด๋ฉด nextSibling์„ ์ฐพ๊ณ , true์ด๋ฉด previousSibling์„ ์ฐพ๋Š”๋‹ค. * */ _switchToSiblingOrNothing : function(targetElement, isPreviousOrdered){ var el = targetElement; if(isPreviousOrdered){ if(el.previousSibling){ el = el.previousSibling; }else{ // ํ˜•์ œ๊ฐ€ ์—†๋‹ค๋ฉด ๋ถ€๋ชจ๋ฅผ ๊ฑฐ์Šฌ๋Ÿฌ ์˜ฌ๋ผ๊ฐ€๋ฉด์„œ ํƒ์ƒ‰ // ์ด ๋ฃจํ”„์˜ ์ข…๋ฃŒ ์กฐ๊ฑด // 1. ๋ถ€๋ชจ๋ฅผ ๊ฑฐ์Šฌ๋Ÿฌ ์˜ฌ๋ผ๊ฐ€๋‹ค๊ฐ€ el์ด document.body๊ฐ€ ๋˜๋Š” ์‹œ์  // - ๋” ์ด์ƒ previousSibling์„ ํƒ์ƒ‰ํ•  ์ˆ˜ ์—†์Œ // 2. el์ด ๋ถ€๋ชจ๋กœ ๋Œ€์ฒด๋œ ๋’ค previousSibling์ด ์กด์žฌํ•˜๋Š” ๊ฒฝ์šฐ while(el.nodeName.toUpperCase() != "BODY" && !el.previousSibling){ el = el.parentNode; } if(el.nodeName.toUpperCase() == "BODY"){ el = null; }else{ el = el.previousSibling; } } }else{ if(el.nextSibling){ el = el.nextSibling; }else{ // ํ˜•์ œ๊ฐ€ ์—†๋‹ค๋ฉด ๋ถ€๋ชจ๋ฅผ ๊ฑฐ์Šฌ๋Ÿฌ ์˜ฌ๋ผ๊ฐ€๋ฉด์„œ ํƒ์ƒ‰ // ์ด ๋ฃจํ”„์˜ ์ข…๋ฃŒ ์กฐ๊ฑด // 1. ๋ถ€๋ชจ๋ฅผ ๊ฑฐ์Šฌ๋Ÿฌ ์˜ฌ๋ผ๊ฐ€๋‹ค๊ฐ€ el์ด document.body๊ฐ€ ๋˜๋Š” ์‹œ์  // - ๋” ์ด์ƒ nextSibling์„ ํƒ์ƒ‰ํ•  ์ˆ˜ ์—†์Œ // 2. el์ด ๋ถ€๋ชจ๋กœ ๋Œ€์ฒด๋œ ๋’ค nextSibling์ด ์กด์žฌํ•˜๋Š” ๊ฒฝ์šฐ while(el.nodeName.toUpperCase() != "BODY" && !el.nextSibling){ el = el.parentNode; } if(el.nodeName.toUpperCase() == "BODY"){ el = null; }else{ el = el.nextSibling; } } } return el; }, /** * [SMARTEDITORSUS-1594] ๋Œ€์ƒ ๋…ธ๋“œ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•˜๋Š” ํŠธ๋ฆฌ๋ฅผ ์ „์œ„์ˆœํšŒ๋ฅผ ๊ฑฐ์ณ, ํ•„ํ„ฐ ์กฐ๊ฑด์— ๋ถ€ํ•ฉํ•˜๋Š” ์ฒซ ๋…ธ๋“œ๋ฅผ ์ฐพ๋Š”๋‹ค. * @param {NodeElement} ํƒ์ƒ‰ํ•˜๋ ค๋Š” ํŠธ๋ฆฌ์˜ ๋ฃจํŠธ ๋…ธ๋“œ * @param {Function} ํ•„ํ„ฐ ์กฐ๊ฑด์œผ๋กœ ์‚ฌ์šฉํ•  ํ•จ์ˆ˜ * @param {Boolean} ์ƒ๋žตํ•˜๊ฑฐ๋‚˜ false์ด๋ฉด ์ˆœ์ˆ˜ ์ „์œ„์ˆœํšŒ(๋ฃจํŠธ - ์ขŒ์ธก - ์šฐ์ธก ์ˆœ)๋กœ ํƒ์ƒ‰ํ•˜๊ณ , true์ด๋ฉด ๋ฐ˜๋Œ€ ๋ฐฉํ–ฅ์˜ ์ „์œ„์ˆœํšŒ(๋ฃจํŠธ - ์šฐ์ธก - ์ขŒ์ธก)๋กœ ํƒ์ƒ‰ํ•œ๋‹ค. * */ _recursivePreorderTraversalFilter : function(node, filterFunction, isReversed){ var self = this; // ํ˜„์žฌ ๋…ธ๋“œ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•„ํ„ฐ๋ง var _bStopFindingNextElement = filterFunction.apply(node); if(_bStopFindingNextElement){ // ์ตœ์ดˆ๋กœ ํฌ์ปค์Šค ํƒœ๊ทธ๋ฅผ ์ฐพ๋Š”๋‹ค๋ฉด ํƒ์ƒ‰ ์ค‘๋‹จ์šฉ flag ๋ณ€๊ฒฝ self._bStopFindingNextElement = true; if(isReversed){ self._previousFocusElement = node; }else{ self._nextFocusElement = node; } return; }else{ // ํ•„ํ„ฐ๋ง ์กฐ๊ฑด์— ๋ถ€ํ•ฉํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด, ์ž์‹๋“ค์„ ๊ธฐ์ค€์œผ๋กœ ๋ฐ˜๋ณตํ•˜๊ฒŒ ๋œ๋‹ค. if(isReversed){ for(var len = node.childNodes.length, i = len - 1; i >= 0; i--){ self._recursivePreorderTraversalFilter(node.childNodes[i], filterFunction, true); if(!!this._bStopFindingNextElement){ break; } } }else{ for(var i=0, len = node.childNodes.length; i < len; i++){ self._recursivePreorderTraversalFilter(node.childNodes[i], filterFunction); if(!!this._bStopFindingNextElement){ break; } } } } }, /** * [SMARTEDITORSUS-1594] ํ•„ํ„ฐ ํ•จ์ˆ˜๋กœ, ์ด ๋…ธ๋“œ๊ฐ€ tab ํ‚ค๋กœ ํฌ์ปค์Šค๋ฅผ ์ด๋™ํ•˜๋Š” ํƒœ๊ทธ์— ํ•ด๋‹นํ•˜๋Š”์ง€ ํ™•์ธํ•œ๋‹ค. * */ _isFocusTag : function(){ var self = this; // tab ํ‚ค๋กœ ํฌ์ปค์Šค๋ฅผ ์žก์•„์ฃผ๋Š” ํƒœ๊ทธ ๋ชฉ๋ก var aFocusTagViaTabKey = ["A", "BUTTON", "INPUT", "TEXTAREA"]; // ํฌ์ปค์Šค ํƒœ๊ทธ๊ฐ€ ํ˜„์žฌ ๋…ธ๋“œ์— ์กด์žฌํ•˜๋Š”์ง€ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•œ flag var bFocusTagExists = false; for(var i = 0, len = aFocusTagViaTabKey.length; i < len; i++){ if(self.nodeType === 1 && self.nodeName && self.nodeName.toUpperCase() == aFocusTagViaTabKey[i] && !self.disabled && jindo.$Element(self).visible()){ bFocusTagExists = true; break; } } return bFocusTagExists; }, /** * [SMARTEDITORSUS-1594] * SE2M_Configuration_General์—์„œ ํฌ์ปค์Šค๋ฅผ ์ด๋™ํ•  ์—๋””ํ„ฐ ์˜์—ญ ์ด์ „์˜ ์—˜๋ ˆ๋จผํŠธ๋ฅผ ์ง€์ •ํ•ด ๋‘์—ˆ๋‹ค๋ฉด, ์„ค์ •๊ฐ’์„ ๋”ฐ๋ฅธ๋‹ค. * ์ง€์ •ํ•˜์ง€ ์•Š์•˜๊ฑฐ๋‚˜ ๋นˆ String์ด๋ผ๋ฉด, elAppContainer๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์ž๋™ ํƒ์ƒ‰ํ•œ๋‹ค. * */ $ON_FOCUS_BEFORE_ELEMENT : function() { // ํฌ์ปค์Šค ์บ์‹ฑ this._currentPreviousFocusElement = null; // ์ƒˆ๋กœ์šด ํฌ์ปค์Šค ์ด๋™์ด ๋ฐœ์ƒํ•  ๋•Œ๋งˆ๋‹ค ์บ์‹ฑ ์ดˆ๊ธฐํ™” if(this.htAccessOption.sBeforeElementId){ this._currentPreviousFocusElement = document.getElementById(this.htAccessOption.sBeforeElementId); }else{ this._currentPreviousFocusElement = this._findPreviousFocusElement(this.elAppContainer); // ์‚ฝ์ž…๋  ๋Œ€์ƒ } if(this._currentPreviousFocusElement){ window.focus(); // [SMARTEDITORSUS-1360] IE7์—์„œ๋Š” element์— ๋Œ€ํ•œ focus๋ฅผ ์ฃผ๊ธฐ ์œ„ํ•ด ์„ ํ–‰๋˜์–ด์•ผ ํ•œ๋‹ค. this._currentPreviousFocusElement.focus(); }else if(parent && parent.nhn && parent.nhn.husky && parent.nhn.husky.EZCreator && parent.nhn.husky.EZCreator.elIFrame){ parent.focus(); if(this._currentPreviousFocusElement = this._findPreviousFocusElement(parent.nhn.husky.EZCreator.elIFrame)){ this._currentPreviousFocusElement.focus(); } } }, /** * [SMARTEDITORSUS-1594] DIV#smart_editor2 ์ด์ „ ์š”์†Œ์—์„œ ๊ฐ€์žฅ ๊ฐ€๊นŒ์šด ํฌ์ปค์Šค์šฉ ํƒœ๊ทธ๋ฅผ ํƒ์ƒ‰ * */ _findPreviousFocusElement : function(targetElement){ var target = null; var el = targetElement.previousSibling; while(el){ if(el.nodeType !== 1){ // Element Node๋งŒ์„ ๋Œ€์ƒ์œผ๋กœ ํ•œ๋‹ค. // ๋Œ€์ƒ ๋…ธ๋“œ ๋Œ€์‹  previousSibling์„ ์ฐพ๋˜, ๋ถ€๋ชจ๋ฅผ ๊ฑฐ์Šฌ๋Ÿฌ ์˜ฌ๋ผ๊ฐˆ ์ˆ˜๋„ ์žˆ๋‹ค. // document.body๊นŒ์ง€ ๊ฑฐ์Šฌ๋Ÿฌ ์˜ฌ๋ผ๊ฐ€๊ฒŒ ๋˜๋ฉด ํƒ์ƒ‰ ์ข…๋ฃŒ el = this._switchToSiblingOrNothing(el, /*isReversed*/true); if(!el){ break; }else{ continue; } } // ๋Œ€์ƒ ๋…ธ๋“œ๋ฅผ ๊ธฐ์ค€์œผ๋กœ, ์—ญ ์ „์œ„์ˆœํšŒ๋กœ ์กฐ๊ฑด์— ๋ถ€ํ•ฉํ•˜๋Š” ๋…ธ๋“œ ํƒ์ƒ‰ this._recursivePreorderTraversalFilter(el, this._isFocusTag, true); if(this._previousFocusElement){ target = this._previousFocusElement; // ํƒ์ƒ‰์— ์‚ฌ์šฉํ–ˆ๋˜ ๋ณ€์ˆ˜ ์ดˆ๊ธฐํ™” this._bStopFindingNextElement = false; this._previousFocusElement = null; break; }else{ // ๋Œ€์ƒ ๋…ธ๋“œ ๋Œ€์‹  previousSibling์„ ์ฐพ๋˜, ๋ถ€๋ชจ๋ฅผ ๊ฑฐ์Šฌ๋Ÿฌ ์˜ฌ๋ผ๊ฐˆ ์ˆ˜๋„ ์žˆ๋‹ค. // document.body๊นŒ์ง€ ๊ฑฐ์Šฌ๋Ÿฌ ์˜ฌ๋ผ๊ฐ€๊ฒŒ ๋˜๋ฉด ํƒ์ƒ‰ ์ข…๋ฃŒ el = this._switchToSiblingOrNothing(el, /*isReversed*/true); if(!el){ break; } } } // target์ด ์กด์žฌํ•˜์ง€ ์•Š์œผ๋ฉด null ๋ฐ˜ํ™˜ return target; }, $ON_FOCUS_TOOLBAR_AREA : function(){ this.oButton = jindo.$$.getSingle("BUTTON.se2_font_family", this.elAppContainer); if(this.oButton && !this.oButton.disabled){ // [SMARTEDITORSUS-1369] IE9์ดํ•˜์—์„œ disabled ์š”์†Œ์— ํฌ์ปค์Šค๋ฅผ ์ฃผ๋ฉด ์˜ค๋ฅ˜ ๋ฐœ์ƒ window.focus(); this.oButton.focus(); } }, $ON_OPEN_HELP_POPUP : function() { this.oApp.exec("DISABLE_ALL_UI", [{aExceptions: ["se2_accessibility"]}]); this.oApp.exec("SHOW_EDITING_AREA_COVER"); this.oApp.exec("SELECT_UI", ["se2_accessibility"]); //์•„๋ž˜ ์ฝ”๋“œ ์—†์–ด์•ผ ๋ธ”๋กœ๊ทธ์—์„œ๋„ ๋™์ผํ•œ ์œ„์น˜์— ํŒ์—… ๋œธ.. //this.elHelpPopupLayer.style.top = this.nDefaultTop+"px"; this.nCalcX = this.htTopLeftCorner.x + this.oApp.getEditingAreaWidth() - this.nLayerWidth; this.nCalcY = this.htTopLeftCorner.y - 30; // ๋ธ”๋กœ๊ทธ๋ฒ„์ „์ด ์•„๋‹Œ ๊ฒฝ์šฐ ์—๋””ํ„ฐ์˜์—ญ์„ ๋ฒ—์–ด๋‚˜๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ๊ธฐ๋ณธํˆด๋ฐ”(30px) ํฌ๊ธฐ๋งŒํผ ์˜ฌ๋ ค์คŒ this.oApp.exec("SHOW_DIALOG_LAYER", [this.elHelpPopupLayer, { elHandle: this.elTitle, nMinX : this.htTopLeftCorner.x + 0, nMinY : this.nDefaultTop + 77, nMaxX : this.nCalcX, nMaxY : this.nCalcY }]); // offset (nTop:Numeric, nLeft:Numeric) this.welHelpPopupLayer.offset(this.nCalcY, (this.nCalcX)/2); //[SMARTEDITORSUS-1327] IE์—์„œ ํฌ์ปค์Šค ์ด์Šˆ๋กœ IE์— ๋Œ€ํ•ด์„œ๋งŒ window.focus์‹คํ–‰ํ•จ. if(jindo.$Agent().navigator().ie) { window.focus(); } var self = this; setTimeout(function(){ try{ self.oCloseButton2.focus(); }catch(e){ } },200); }, $ON_CLOSE_HELP_POPUP : function() { this.oApp.exec("ENABLE_ALL_UI"); // ๋ชจ๋“  UI ํ™œ์„ฑํ™”. this.oApp.exec("DESELECT_UI", ["helpPopup"]); this.oApp.exec("HIDE_ALL_DIALOG_LAYER", []); this.oApp.exec("HIDE_EDITING_AREA_COVER"); // ํŽธ์ง‘ ์˜์—ญ ํ™œ์„ฑํ™”. this.oApp.exec("FOCUS"); } }); //} //{ /** * @fileOverview This file contains Husky plugin that takes care of changing the background color * @name hp_SE2M_BGColor.js */ nhn.husky.SE2M_BGColor = jindo.$Class({ name : "SE2M_BGColor", rxColorPattern : /^#?[0-9a-fA-F]{6}$|^rgb\(\d+, ?\d+, ?\d+\)$/i, $init : function(elAppContainer){ this._assignHTMLElements(elAppContainer); }, _assignHTMLElements : function(elAppContainer){ //@ec[ this.elLastUsed = jindo.$$.getSingle("SPAN.husky_se2m_BGColor_lastUsed", elAppContainer); this.elDropdownLayer = jindo.$$.getSingle("DIV.husky_se2m_BGColor_layer", elAppContainer); this.elBGColorList = jindo.$$.getSingle("UL.husky_se2m_bgcolor_list", elAppContainer); this.elPaletteHolder = jindo.$$.getSingle("DIV.husky_se2m_BGColor_paletteHolder", this.elDropdownLayer); //@ec] this._setLastUsedBGColor("#777777"); }, $BEFORE_MSG_APP_READY : function() { this.oApp.exec("ADD_APP_PROPERTY", ["getLastUsedBackgroundColor", jindo.$Fn(this.getLastUsedBGColor, this).bind()]); }, $ON_MSG_APP_READY : function(){ this.oApp.exec("REGISTER_UI_EVENT", ["BGColorA", "click", "APPLY_LAST_USED_BGCOLOR"]); this.oApp.exec("REGISTER_UI_EVENT", ["BGColorB", "click", "TOGGLE_BGCOLOR_LAYER"]); this.oApp.registerBrowserEvent(this.elBGColorList, "click", "EVENT_APPLY_BGCOLOR", []); }, //@lazyload_js APPLY_LAST_USED_BGCOLOR,TOGGLE_BGCOLOR_LAYER[ $ON_TOGGLE_BGCOLOR_LAYER : function(){ this.oApp.exec("TOGGLE_TOOLBAR_ACTIVE_LAYER", [this.elDropdownLayer, null, "BGCOLOR_LAYER_SHOWN", [], "BGCOLOR_LAYER_HIDDEN", []]); this.oApp.exec('MSG_NOTIFY_CLICKCR', ['bgcolor']); }, $ON_BGCOLOR_LAYER_SHOWN : function(){ this.oApp.exec("SELECT_UI", ["BGColorB"]); this.oApp.exec("SHOW_COLOR_PALETTE", ["APPLY_BGCOLOR", this.elPaletteHolder]); }, $ON_BGCOLOR_LAYER_HIDDEN : function(){ this.oApp.exec("DESELECT_UI", ["BGColorB"]); this.oApp.exec("RESET_COLOR_PALETTE", []); }, $ON_EVENT_APPLY_BGCOLOR : function(weEvent){ var elButton = weEvent.element; // Safari/Chrome/Opera may capture the event on Span while(elButton.tagName == "SPAN"){elButton = elButton.parentNode;} if(elButton.tagName != "BUTTON"){return;} var sBGColor, sFontColor; sBGColor = elButton.style.backgroundColor; sFontColor = elButton.style.color; this.oApp.exec("APPLY_BGCOLOR", [sBGColor, sFontColor]); }, $ON_APPLY_LAST_USED_BGCOLOR : function(){ this.oApp.exec("APPLY_BGCOLOR", [this.sLastUsedColor]); this.oApp.exec('MSG_NOTIFY_CLICKCR', ['bgcolor']); }, $ON_APPLY_BGCOLOR : function(sBGColor, sFontColor){ if(!this.rxColorPattern.test(sBGColor)){ alert(this.oApp.$MSG("SE_Color.invalidColorCode")); return; } this._setLastUsedBGColor(sBGColor); var oStyle = {"backgroundColor": sBGColor}; if(sFontColor){oStyle.color = sFontColor;} this.oApp.exec("SET_WYSIWYG_STYLE", [oStyle]); this.oApp.exec("HIDE_ACTIVE_LAYER"); }, //@lazyload_js] _setLastUsedBGColor : function(sBGColor){ this.sLastUsedColor = sBGColor; this.elLastUsed.style.backgroundColor = this.sLastUsedColor; }, getLastUsedBGColor : function(){ return (!!this.sLastUsedColor) ? this.sLastUsedColor : '#777777'; } }); //} //{ /** * @fileOverview This file contains Husky plugin that takes care of the operations directly related to the color palette * @name hp_SE2M_ColorPalette.js */ nhn.husky.SE2M_ColorPalette = jindo.$Class({ name : "SE2M_ColorPalette", elAppContainer : null, bUseRecentColor : false, nLimitRecentColor : 17, rxRGBColorPattern : /rgb\((\d+), ?(\d+), ?(\d+)\)/i, rxColorPattern : /^#?[0-9a-fA-F]{6}$|^rgb\(\d+, ?\d+, ?\d+\)$/i, aRecentColor : [], // ์ตœ๊ทผ ์‚ฌ์šฉํ•œ ์ƒ‰ ๋ชฉ๋ก, ๊ฐ€์žฅ ์ตœ๊ทผ์— ๋“ฑ๋กํ•œ ์ƒ‰์˜ index๊ฐ€ ๊ฐ€์žฅ ์ž‘์Œ URL_COLOR_LIST : "", URL_COLOR_ADD : "", URL_COLOR_UPDATE : "", sRecentColorTemp : "<li><button type=\"button\" title=\"{RGB_CODE}\" style=\"background:{RGB_CODE}\"><span><span>{RGB_CODE}</span></span></button></li>", $init : function(elAppContainer){ this.elAppContainer = elAppContainer; }, $ON_MSG_APP_READY : function(){}, _assignHTMLElements : function(oAppContainer){ var htConfiguration = nhn.husky.SE2M_Configuration.SE2M_ColorPalette; if(htConfiguration){ this.bUseRecentColor = htConfiguration.bUseRecentColor || false; this.URL_COLOR_ADD = htConfiguration.addColorURL || "http://api.se2.naver.com/1/colortable/TextAdd.nhn"; this.URL_COLOR_UPDATE = htConfiguration.updateColorURL || "http://api.se2.naver.com/1/colortable/TextUpdate.nhn"; this.URL_COLOR_LIST = htConfiguration.colorListURL || "http://api.se2.naver.com/1/colortable/TextList.nhn"; } this.elColorPaletteLayer = jindo.$$.getSingle("DIV.husky_se2m_color_palette", oAppContainer); this.elColorPaletteLayerColorPicker = jindo.$$.getSingle("DIV.husky_se2m_color_palette_colorpicker", this.elColorPaletteLayer); this.elRecentColorForm = jindo.$$.getSingle("form", this.elColorPaletteLayerColorPicker); this.elBackgroundColor = jindo.$$.getSingle("ul.husky_se2m_bgcolor_list", oAppContainer); this.elInputColorCode = jindo.$$.getSingle("INPUT.husky_se2m_cp_colorcode", this.elColorPaletteLayerColorPicker); this.elPreview = jindo.$$.getSingle("SPAN.husky_se2m_cp_preview", this.elColorPaletteLayerColorPicker); this.elCP_ColPanel = jindo.$$.getSingle("DIV.husky_se2m_cp_colpanel", this.elColorPaletteLayerColorPicker); this.elCP_HuePanel = jindo.$$.getSingle("DIV.husky_se2m_cp_huepanel", this.elColorPaletteLayerColorPicker); this.elCP_ColPanel.style.position = "relative"; this.elCP_HuePanel.style.position = "relative"; this.elColorPaletteLayerColorPicker.style.display = "none"; this.elMoreBtn = jindo.$$.getSingle("BUTTON.husky_se2m_color_palette_more_btn", this.elColorPaletteLayer); this.welMoreBtn = jindo.$Element(this.elMoreBtn); this.elOkBtn = jindo.$$.getSingle("BUTTON.husky_se2m_color_palette_ok_btn", this.elColorPaletteLayer); if(this.bUseRecentColor){ this.elColorPaletteLayerRecent = jindo.$$.getSingle("DIV.husky_se2m_color_palette_recent", this.elColorPaletteLayer); this.elRecentColor = jindo.$$.getSingle("ul.se2_pick_color", this.elColorPaletteLayerRecent); this.elDummyNode = jindo.$$.getSingle("ul.se2_pick_color > li", this.elColorPaletteLayerRecent) || null; this.elColorPaletteLayerRecent.style.display = "none"; } }, $LOCAL_BEFORE_FIRST : function(){ this._assignHTMLElements(this.elAppContainer); if(this.elDummyNode){ jindo.$Element(jindo.$$.getSingle("ul.se2_pick_color > li", this.elColorPaletteLayerRecent)).leave(); } if( this.bUseRecentColor ){ this._ajaxRecentColor(this._ajaxRecentColorCallback); } this.oApp.registerBrowserEvent(this.elColorPaletteLayer, "click", "EVENT_CLICK_COLOR_PALETTE"); this.oApp.registerBrowserEvent(this.elBackgroundColor, "mouseover", "EVENT_MOUSEOVER_COLOR_PALETTE"); this.oApp.registerBrowserEvent(this.elColorPaletteLayer, "mouseover", "EVENT_MOUSEOVER_COLOR_PALETTE"); this.oApp.registerBrowserEvent(this.elBackgroundColor, "mouseout", "EVENT_MOUSEOUT_COLOR_PALETTE"); this.oApp.registerBrowserEvent(this.elColorPaletteLayer, "mouseout", "EVENT_MOUSEOUT_COLOR_PALETTE"); }, $ON_EVENT_MOUSEOVER_COLOR_PALETTE : function(oEvent){ var elHovered = oEvent.element; while(elHovered && elHovered.tagName && elHovered.tagName.toLowerCase() != "li"){ elHovered = elHovered.parentNode; } //์กฐ๊ฑด ์ถ”๊ฐ€-by cielo 2010.04.20 if(!elHovered || !elHovered.nodeType || elHovered.nodeType == 9){return;} if(elHovered.className == "" || (!elHovered.className) || typeof(elHovered.className) == 'undefined'){jindo.$Element(elHovered).addClass("hover");} }, $ON_EVENT_MOUSEOUT_COLOR_PALETTE : function(oEvent){ var elHovered = oEvent.element; while(elHovered && elHovered.tagName && elHovered.tagName.toLowerCase() != "li"){ elHovered = elHovered.parentNode; } if(!elHovered){return;} if(elHovered.className == "hover"){jindo.$Element(elHovered).removeClass("hover");} }, $ON_EVENT_CLICK_COLOR_PALETTE : function(oEvent){ var elClicked = oEvent.element; while(elClicked.tagName == "SPAN"){elClicked = elClicked.parentNode;} if(elClicked.tagName && elClicked.tagName == "BUTTON"){ if(elClicked == this.elMoreBtn){ this.oApp.exec("TOGGLE_COLOR_PICKER"); return; } this.oApp.exec("APPLY_COLOR", [elClicked]); } }, $ON_APPLY_COLOR : function(elButton){ var sColorCode = this.elInputColorCode.value, welColorParent = null; if(sColorCode.indexOf("#") == -1){ sColorCode = "#" + sColorCode; this.elInputColorCode.value = sColorCode; } // ์ž…๋ ฅ ๋ฒ„ํŠผ์ธ ๊ฒฝ์šฐ if(elButton == this.elOkBtn){ if(!this._verifyColorCode(sColorCode)){ this.elInputColorCode.value = ""; alert(this.oApp.$MSG("SE_Color.invalidColorCode")); this.elInputColorCode.focus(); return; } this.oApp.exec("COLOR_PALETTE_APPLY_COLOR", [sColorCode,true]); return; } // ์ƒ‰์ƒ ๋ฒ„ํŠผ์ธ ๊ฒฝ์šฐ welColorParent = jindo.$Element(elButton.parentNode.parentNode.parentNode); sColorCode = elButton.title; if(welColorParent.hasClass("husky_se2m_color_palette")){ // ํ…œํ”Œ๋ฆฟ ์ƒ‰์ƒ ์ ์šฉ this.oApp.exec("COLOR_PALETTE_APPLY_COLOR", [sColorCode, nhn.husky.SE2M_Configuration.SE2M_ColorPalette.bAddRecentColorFromDefault]); }else if(welColorParent.hasClass("husky_se2m_color_palette_recent")){ // ์ตœ๊ทผ ์ƒ‰์ƒ ์ ์šฉ this.oApp.exec("COLOR_PALETTE_APPLY_COLOR", [sColorCode,true]); } }, $ON_RESET_COLOR_PALETTE : function(){ this._initColor(); }, $ON_TOGGLE_COLOR_PICKER : function(){ if(this.elColorPaletteLayerColorPicker.style.display == "none"){ this.oApp.exec("SHOW_COLOR_PICKER"); }else{ this.oApp.exec("HIDE_COLOR_PICKER"); } }, $ON_SHOW_COLOR_PICKER : function(){ this.elColorPaletteLayerColorPicker.style.display = ""; this.cpp = new nhn.ColorPicker(this.elCP_ColPanel, {huePanel:this.elCP_HuePanel}); var fn = jindo.$Fn(function(oEvent) { this.elPreview.style.backgroundColor = oEvent.hexColor; this.elInputColorCode.value = oEvent.hexColor; }, this).bind(); this.cpp.attach("colorchange", fn); this.$ON_SHOW_COLOR_PICKER = this._showColorPickerMain; this.$ON_SHOW_COLOR_PICKER(); }, $ON_HIDE_COLOR_PICKER : function(){ this.elColorPaletteLayerColorPicker.style.display = "none"; this.welMoreBtn.addClass("se2_view_more"); this.welMoreBtn.removeClass("se2_view_more2"); }, $ON_SHOW_COLOR_PALETTE : function(sCallbackCmd, oLayerContainer){ this.sCallbackCmd = sCallbackCmd; this.oLayerContainer = oLayerContainer; this.oLayerContainer.insertBefore(this.elColorPaletteLayer, null); this.elColorPaletteLayer.style.display = "block"; this.oApp.delayedExec("POSITION_TOOLBAR_LAYER", [this.elColorPaletteLayer.parentNode.parentNode], 0); }, $ON_HIDE_COLOR_PALETTE : function(){ this.elColorPaletteLayer.style.display = "none"; }, $ON_COLOR_PALETTE_APPLY_COLOR : function(sColorCode , bAddRecentColor){ bAddRecentColor = (!bAddRecentColor)? false : bAddRecentColor; sColorCode = this._getHexColorCode(sColorCode); //๋”๋ณด๊ธฐ ๋ ˆ์ด์–ด์—์„œ ์ ์šฉํ•œ ์ƒ‰์ƒ๋งŒ ์ตœ๊ทผ ์‚ฌ์šฉํ•œ ์ƒ‰์— ์ถ”๊ฐ€ํ•œ๋‹ค. if( this.bUseRecentColor && !!bAddRecentColor ){ this.oApp.exec("ADD_RECENT_COLOR", [sColorCode]); } this.oApp.exec(this.sCallbackCmd, [sColorCode]); }, $ON_EVENT_MOUSEUP_COLOR_PALETTE : function(oEvent){ var elButton = oEvent.element; if(! elButton.style.backgroundColor){return;} this.oApp.exec("COLOR_PALETTE_APPLY_COLOR", [elButton.style.backgroundColor,false]); }, $ON_ADD_RECENT_COLOR : function(sRGBCode){ var bAdd = (this.aRecentColor.length === 0); this._addRecentColor(sRGBCode); if(bAdd){ this._ajaxAddColor(); }else{ this._ajaxUpdateColor(); } this._redrawRecentColorElement(); }, _verifyColorCode : function(sColorCode){ return this.rxColorPattern.test(sColorCode); }, _getHexColorCode : function(sColorCode){ if(this.rxRGBColorPattern.test(sColorCode)){ var dec2Hex = function(sDec){ var sTmp = parseInt(sDec, 10).toString(16); if(sTmp.length<2){sTmp = "0"+sTmp;} return sTmp.toUpperCase(); }; var sR = dec2Hex(RegExp.$1); var sG = dec2Hex(RegExp.$2); var sB = dec2Hex(RegExp.$3); sColorCode = "#"+sR+sG+sB; } return sColorCode; }, _addRecentColor : function(sRGBCode){ var waRecentColor = jindo.$A(this.aRecentColor); waRecentColor = waRecentColor.refuse(sRGBCode); waRecentColor.unshift(sRGBCode); if(waRecentColor.length() > this.nLimitRecentColor){ waRecentColor.length(this.nLimitRecentColor); } this.aRecentColor = waRecentColor.$value(); }, _redrawRecentColorElement : function(){ var aRecentColorHtml = [], nRecentColor = this.aRecentColor.length, i; if(nRecentColor === 0){ return; } for(i=0; i<nRecentColor; i++){ aRecentColorHtml.push(this.sRecentColorTemp.replace(/\{RGB_CODE\}/gi, this.aRecentColor[i])); } this.elRecentColor.innerHTML = aRecentColorHtml.join(""); this.elColorPaletteLayerRecent.style.display = "block"; }, _ajaxAddColor : function(){ jindo.$Ajax(this.URL_COLOR_ADD, { type : "jsonp", onload: function(){} }).request({ text_key : "colortable", text_data : this.aRecentColor.join(",") }); }, _ajaxUpdateColor : function(){ jindo.$Ajax(this.URL_COLOR_UPDATE, { type : "jsonp", onload: function(){} }).request({ text_key : "colortable", text_data : this.aRecentColor.join(",") }); }, _showColorPickerMain : function(){ this._initColor(); this.elColorPaletteLayerColorPicker.style.display = ""; this.welMoreBtn.removeClass("se2_view_more"); this.welMoreBtn.addClass("se2_view_more2"); }, _initColor : function(){ if(this.cpp){this.cpp.rgb({r:0,g:0,b:0});} this.elPreview.style.backgroundColor = '#'+'000000'; this.elInputColorCode.value = '#'+'000000'; this.oApp.exec("HIDE_COLOR_PICKER"); }, _ajaxRecentColor : function(fCallback){ jindo.$Ajax(this.URL_COLOR_LIST, { type : "jsonp", onload : jindo.$Fn(fCallback, this).bind() }).request(); }, _ajaxRecentColorCallback : function(htResponse){ var aColorList = htResponse.json()["result"], waColorList, i, nLen; if(!aColorList || !!aColorList.error){ return; } waColorList = jindo.$A(aColorList).filter(this._verifyColorCode, this); if(waColorList.length() > this.nLimitRecentColor){ waColorList.length(this.nLimitRecentColor); } aColorList = waColorList.reverse().$value(); for(i = 0, nLen = aColorList.length; i < nLen; i++){ this._addRecentColor(this._getHexColorCode(aColorList[i])); } this._redrawRecentColorElement(); } }).extend(jindo.Component); //} //{ /** * @fileOverview This file contains Husky plugin that takes care of the basic editor commands * @name hp_SE_ExecCommand.js */ nhn.husky.SE2M_ExecCommand = jindo.$Class({ name : "SE2M_ExecCommand", oEditingArea : null, oUndoOption : null, _rxTable : /^(?:TBODY|TR|TD)$/i, $init : function(oEditingArea){ this.oEditingArea = oEditingArea; this.nIndentSpacing = 40; this.rxClickCr = new RegExp('^bold|underline|italic|strikethrough|justifyleft|justifycenter|justifyright|justifyfull|insertorderedlist|insertunorderedlist|outdent|indent$', 'i'); }, $BEFORE_MSG_APP_READY : function(){ // the right document will be available only when the src is completely loaded if(this.oEditingArea && this.oEditingArea.tagName == "IFRAME"){ this.oEditingArea = this.oEditingArea.contentWindow.document; } }, $ON_MSG_APP_READY : function(){ this.oApp.exec("REGISTER_HOTKEY", ["ctrl+b", "EXECCOMMAND", ["bold", false, false]]); this.oApp.exec("REGISTER_HOTKEY", ["ctrl+u", "EXECCOMMAND", ["underline", false, false]]); this.oApp.exec("REGISTER_HOTKEY", ["ctrl+i", "EXECCOMMAND", ["italic", false, false]]); this.oApp.exec("REGISTER_HOTKEY", ["ctrl+d", "EXECCOMMAND", ["strikethrough", false, false]]); this.oApp.exec("REGISTER_HOTKEY", ["meta+b", "EXECCOMMAND", ["bold", false, false]]); this.oApp.exec("REGISTER_HOTKEY", ["meta+u", "EXECCOMMAND", ["underline", false, false]]); this.oApp.exec("REGISTER_HOTKEY", ["meta+i", "EXECCOMMAND", ["italic", false, false]]); this.oApp.exec("REGISTER_HOTKEY", ["meta+d", "EXECCOMMAND", ["strikethrough", false, false]]); this.oApp.exec("REGISTER_HOTKEY", ["tab", "INDENT"]); this.oApp.exec("REGISTER_HOTKEY", ["shift+tab", "OUTDENT"]); //this.oApp.exec("REGISTER_HOTKEY", ["tab", "EXECCOMMAND", ["indent", false, false]]); //this.oApp.exec("REGISTER_HOTKEY", ["shift+tab", "EXECCOMMAND", ["outdent", false, false]]); this.oApp.exec("REGISTER_UI_EVENT", ["bold", "click", "EXECCOMMAND", ["bold", false, false]]); this.oApp.exec("REGISTER_UI_EVENT", ["underline", "click", "EXECCOMMAND", ["underline", false, false]]); this.oApp.exec("REGISTER_UI_EVENT", ["italic", "click", "EXECCOMMAND", ["italic", false, false]]); this.oApp.exec("REGISTER_UI_EVENT", ["lineThrough", "click", "EXECCOMMAND", ["strikethrough", false, false]]); this.oApp.exec("REGISTER_UI_EVENT", ["superscript", "click", "EXECCOMMAND", ["superscript", false, false]]); this.oApp.exec("REGISTER_UI_EVENT", ["subscript", "click", "EXECCOMMAND", ["subscript", false, false]]); this.oApp.exec("REGISTER_UI_EVENT", ["justifyleft", "click", "EXECCOMMAND", ["justifyleft", false, false]]); this.oApp.exec("REGISTER_UI_EVENT", ["justifycenter", "click", "EXECCOMMAND", ["justifycenter", false, false]]); this.oApp.exec("REGISTER_UI_EVENT", ["justifyright", "click", "EXECCOMMAND", ["justifyright", false, false]]); this.oApp.exec("REGISTER_UI_EVENT", ["justifyfull", "click", "EXECCOMMAND", ["justifyfull", false, false]]); this.oApp.exec("REGISTER_UI_EVENT", ["orderedlist", "click", "EXECCOMMAND", ["insertorderedlist", false, false]]); this.oApp.exec("REGISTER_UI_EVENT", ["unorderedlist", "click", "EXECCOMMAND", ["insertunorderedlist", false, false]]); this.oApp.exec("REGISTER_UI_EVENT", ["outdent", "click", "EXECCOMMAND", ["outdent", false, false]]); this.oApp.exec("REGISTER_UI_EVENT", ["indent", "click", "EXECCOMMAND", ["indent", false, false]]); // this.oApp.exec("REGISTER_UI_EVENT", ["styleRemover", "click", "EXECCOMMAND", ["RemoveFormat", false, false]]); this.oNavigator = jindo.$Agent().navigator(); if(!this.oNavigator.safari && !this.oNavigator.chrome){ this._getDocumentBR = function(){}; this._fixDocumentBR = function(){}; } if(!this.oNavigator.ie){ this._fixCorruptedBlockQuote = function(){}; if(!this.oNavigator.chrome){ this._insertBlankLine = function(){}; } } if(!this.oNavigator.firefox){ this._extendBlock = function(){}; } }, $ON_INDENT : function(){ this.oApp.delayedExec("EXECCOMMAND", ["indent", false, false], 0); }, $ON_OUTDENT : function(){ this.oApp.delayedExec("EXECCOMMAND", ["outdent", false, false], 0); }, /** * TBODY, TR, TD ์‚ฌ์ด์— ์žˆ๋Š” ํ…์ŠคํŠธ๋…ธ๋“œ์ธ์ง€ ํŒ๋ณ„ํ•œ๋‹ค. * @param oNode {Node} ๊ฒ€์‚ฌํ•  ๋…ธ๋“œ * @return {Boolean} TBODY, TR, TD ์‚ฌ์ด์— ์žˆ๋Š” ํ…์ŠคํŠธ๋…ธ๋“œ์ธ์ง€ ์—ฌ๋ถ€ */ _isTextBetweenTable : function(oNode){ var oTmpNode; if(oNode && oNode.nodeType === 3){ // ํ…์ŠคํŠธ ๋…ธ๋“œ if((oTmpNode = oNode.previousSibling) && this._rxTable.test(oTmpNode.nodeName)){ return true; } if((oTmpNode = oNode.nextSibling) && this._rxTable.test(oTmpNode.nodeName)){ return true; } } return false; }, $BEFORE_EXECCOMMAND : function(sCommand, bUserInterface, vValue, htOptions){ var elTmp, oSelection; //๋ณธ๋ฌธ์— ์ „ํ˜€ ํด๋ฆญ์ด ํ•œ๋ฒˆ๋„ ์•ˆ ์ผ์–ด๋‚œ ์ƒํƒœ์—์„œ ํฌ๋กฌ๊ณผ IE์—์„œ EXECCOMMAND๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ์•ˆ ๋จนํžˆ๋Š” ํ˜„์ƒ. this.oApp.exec("FOCUS"); this._bOnlyCursorChanged = false; oSelection = this.oApp.getSelection(); // [SMARTEDITORSUS-1584] IE์—์„œ ํ…Œ์ด๋ธ”๊ด€๋ จ ํƒœ๊ทธ ์‚ฌ์ด์˜ ํ…์ŠคํŠธ๋…ธ๋“œ๊ฐ€ ํฌํ•จ๋œ ์ฑ„๋กœ execCommand ๊ฐ€ ์‹คํ–‰๋˜๋ฉด // ํ…Œ์ด๋ธ” ํƒœ๊ทธ๋“ค ์‚ฌ์ด์— ๋”๋ฏธ P ํƒœ๊ทธ๊ฐ€ ์ถ”๊ฐ€๋œ๋‹ค. // ํ…Œ์ด๋ธ”๊ด€๋ จ ํƒœ๊ทธ ์‚ฌ์ด์— ํƒœ๊ทธ๊ฐ€ ์žˆ์œผ๋ฉด ๋ฌธ๋ฒ•์— ์–ด๊ธ‹๋‚˜๊ธฐ ๋•Œ๋ฌธ์— getContents ์‹œ ์ด ๋”๋ฏธ P ํƒœ๊ทธ๋“ค์ด ๋ฐ–์œผ๋กœ ๋น ์ ธ๋‚˜๊ฐ€๊ฒŒ ๋œ๋‹ค. // ๋•Œ๋ฌธ์— execCommand ์‹คํ–‰๋˜๊ธฐ ์ „์— ์…€๋ ‰์…˜์— ํ…Œ์ด๋ธ”๊ด€๋ จ ํƒœ๊ทธ ์‚ฌ์ด์˜ ํ…์ŠคํŠธ๋…ธ๋“œ๋ฅผ ์ฐพ์•„๋‚ด ์ง€์›Œ์ค€๋‹ค. for(var i = 0, aNodes = oSelection.getNodes(), oNode;(oNode = aNodes[i]); i++){ if(this._isTextBetweenTable(oNode)){ // TODO: ๋…ธ๋“œ๋ฅผ ์‚ญ์ œํ•˜์ง€ ์•Š๊ณ  Selection ์—์„œ๋งŒ ๋บ„์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์€ ์—†์„๊นŒ? oNode.parentNode.removeChild(oNode); } } if(/^insertorderedlist|insertunorderedlist$/i.test(sCommand)){ this._getDocumentBR(); } if(/^justify*/i.test(sCommand)){ this._removeSpanAlign(); } if(sCommand.match(/^bold|underline|italic|strikethrough|superscript|subscript$/i)){ this.oUndoOption = {bMustBlockElement:true}; if(nhn.CurrentSelection.isCollapsed()){ this._bOnlyCursorChanged = true; } } if(sCommand == "indent" || sCommand == "outdent"){ if(!htOptions){htOptions = {};} htOptions["bDontAddUndoHistory"] = true; } if((!htOptions || !htOptions["bDontAddUndoHistory"]) && !this._bOnlyCursorChanged){ if(/^justify*/i.test(sCommand)){ this.oUndoOption = {sSaveTarget:"BODY"}; }else if(sCommand === "insertorderedlist" || sCommand === "insertunorderedlist"){ this.oUndoOption = {bMustBlockContainer:true}; } this.oApp.exec("RECORD_UNDO_BEFORE_ACTION", [sCommand, this.oUndoOption]); } if(this.oNavigator.ie && this.oApp.getWYSIWYGDocument().selection){ if(this.oApp.getWYSIWYGDocument().selection.type === "Control"){ oSelection = this.oApp.getSelection(); oSelection.select(); } } if(sCommand == "insertorderedlist" || sCommand == "insertunorderedlist"){ this._insertBlankLine(); } }, $ON_EXECCOMMAND : function(sCommand, bUserInterface, vValue){ var bSelectedBlock = false; var htSelectedTDs = {}; var oSelection = this.oApp.getSelection(); bUserInterface = (bUserInterface == "" || bUserInterface)?bUserInterface:false; vValue = (vValue == "" || vValue)?vValue:false; this.oApp.exec("IS_SELECTED_TD_BLOCK",['bIsSelectedTd',htSelectedTDs]); bSelectedBlock = htSelectedTDs.bIsSelectedTd; if( bSelectedBlock){ if(sCommand == "indent"){ this.oApp.exec("SET_LINE_BLOCK_STYLE", [null, jindo.$Fn(this._indentMargin, this).bind()]); }else if(sCommand == "outdent"){ this.oApp.exec("SET_LINE_BLOCK_STYLE", [null, jindo.$Fn(this._outdentMargin, this).bind()]); }else{ this._setBlockExecCommand(sCommand, bUserInterface, vValue); } } else { switch(sCommand){ case "indent": case "outdent": this.oApp.exec("RECORD_UNDO_BEFORE_ACTION", [sCommand]); // bookmark ์„ค์ • var sBookmark = oSelection.placeStringBookmark(); if(sCommand === "indent"){ this.oApp.exec("SET_LINE_STYLE", [null, jindo.$Fn(this._indentMargin, this).bind(), {bDoNotSelect : true, bDontAddUndoHistory : true}]); }else{ this.oApp.exec("SET_LINE_STYLE", [null, jindo.$Fn(this._outdentMargin, this).bind(), {bDoNotSelect : true, bDontAddUndoHistory : true}]); } oSelection.moveToStringBookmark(sBookmark); oSelection.select(); oSelection.removeStringBookmark(sBookmark); //bookmark ์‚ญ์ œ setTimeout(jindo.$Fn(function(sCommand){ this.oApp.exec("RECORD_UNDO_AFTER_ACTION", [sCommand]); }, this).bind(sCommand), 25); break; case "justifyleft": case "justifycenter": case "justifyright": case "justifyfull": var oSelectionClone = this._extendBlock(); // FF this.oEditingArea.execCommand(sCommand, bUserInterface, vValue); if(!!oSelectionClone){ oSelectionClone.select(); } break; default: //if(this.oNavigator.firefox){ //this.oEditingArea.execCommand("styleWithCSS", bUserInterface, false); //} // [SMARTEDITORSUS-1646] [SMARTEDITORSUS-1653] collapsed ์ƒํƒœ์ด๋ฉด execCommand ๊ฐ€ ์‹คํ–‰๋˜๊ธฐ ์ „์— ZWSP๋ฅผ ๋„ฃ์–ด์ค€๋‹ค. if(oSelection.collapsed){ // collapsed ์ธ ๊ฒฝ์šฐ var sBM = oSelection.placeStringBookmark(), oBM = oSelection.getStringBookmark(sBM), oHolderNode = oBM.previousSibling; // execCommand๋ฅผ ์‹คํ–‰ํ• ๋•Œ๋งˆ๋‹ค ZWSP๊ฐ€ ํฌํ•จ๋œ ๋”๋ฏธ ํƒœ๊ทธ๊ฐ€ ์ž๊พธ ์ƒ๊ธธ ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ด๋ฏธ ์žˆ์œผ๋ฉด ์žˆ๋Š” ๊ฑธ๋กœ ์‚ฌ์šฉํ•œ๋‹ค. if(!oHolderNode || oHolderNode.nodeValue !== "\u200B"){ oHolderNode = this.oApp.getWYSIWYGDocument().createTextNode("\u200B"); oSelection.insertNode(oHolderNode); } oSelection.removeStringBookmark(sBM); // ๋ฏธ๋ฆฌ ์ง€์›Œ์ฃผ์ง€ ์•Š์œผ๋ฉด ๋”๋ฏธ ํƒœ๊ทธ๊ฐ€ ์ƒ๊ธธ ์ˆ˜ ์žˆ๋‹ค. oSelection.selectNodeContents(oHolderNode); oSelection.select(); this.oEditingArea.execCommand(sCommand, bUserInterface, vValue); oSelection.collapseToEnd(); oSelection.select(); // [SMARTEDITORSUS-1658] ๋’ค์ชฝ์— ๋”๋ฏธํƒœ๊ทธ๊ฐ€ ์žˆ์œผ๋ฉด ์ œ๊ฑฐํ•ด์ค€๋‹ค. var oSingleNode = this._findSingleNode(oHolderNode); if(oSingleNode && oSelection._hasCursorHolderOnly(oSingleNode.nextSibling)){ oSingleNode.parentNode.removeChild(oSingleNode.nextSibling); } }else{ this.oEditingArea.execCommand(sCommand, bUserInterface, vValue); } } } this._countClickCr(sCommand); }, /** * [SMARTEDITORSUS-1658] ํ•ด๋‹น๋…ธ๋“œ์˜ ์ƒ์œ„๋กœ ๊ฒ€์ƒ‰ํ•ด single child ๋งŒ ๊ฐ–๋Š” ์ตœ์ƒ์œ„ ๋…ธ๋“œ๋ฅผ ์ฐพ๋Š”๋‹ค. * @param {Node} oNode ํ™•์ธํ•  ๋…ธ๋“œ * @return {Node} single child ๋งŒ ๊ฐ์‹ธ๊ณ  ์žˆ๋Š” ์ตœ์ƒ์œ„ ๋…ธ๋“œ๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค. ์—†์œผ๋ฉด ์ž…๋ ฅํ•œ ๋…ธ๋“œ ๋ฐ˜ํ™˜ */ _findSingleNode : function(oNode){ if(!oNode){ return null; } if(oNode.parentNode.childNodes.length === 1){ return this._findSingleNode(oNode.parentNode); }else{ return oNode; } }, $AFTER_EXECCOMMAND : function(sCommand, bUserInterface, vValue, htOptions){ if(this.elP1 && this.elP1.parentNode){ this.elP1.parentNode.removeChild(this.elP1); } if(this.elP2 && this.elP2.parentNode){ this.elP2.parentNode.removeChild(this.elP2); } if(/^insertorderedlist|insertunorderedlist$/i.test(sCommand)){ // this._fixDocumentBR(); // Chrome/Safari this._fixCorruptedBlockQuote(sCommand === "insertorderedlist" ? "OL" : "UL"); // IE } if((/^justify*/i.test(sCommand))){ this._fixAlign(sCommand === "justifyfull" ? "justify" : sCommand.substring(7)); } if(sCommand == "indent" || sCommand == "outdent"){ if(!htOptions){htOptions = {};} htOptions["bDontAddUndoHistory"] = true; } if((!htOptions || !htOptions["bDontAddUndoHistory"]) && !this._bOnlyCursorChanged){ this.oApp.exec("RECORD_UNDO_AFTER_ACTION", [sCommand, this.oUndoOption]); } this.oApp.exec("CHECK_STYLE_CHANGE", []); }, _removeSpanAlign : function(){ var oSelection = this.oApp.getSelection(), aNodes = oSelection.getNodes(), elNode = null; for(var i=0, nLen=aNodes.length; i<nLen; i++){ elNode = aNodes[i]; // [SMARTEDITORSUS-704] SPAN์—์„œ ์ ์šฉ๋œ Align์„ ์ œ๊ฑฐ if(elNode.tagName && elNode.tagName === "SPAN"){ elNode.style.textAlign = ""; elNode.removeAttribute("align"); } } }, // [SMARTEDITORSUS-851] align, text-align์„ fixํ•ด์•ผ ํ•  ๋Œ€์ƒ ๋…ธ๋“œ๋ฅผ ์ฐพ์Œ _getAlignNode : function(elNode){ if(elNode.tagName && (elNode.tagName === "P" || elNode.tagName === "DIV")){ return elNode; } elNode = elNode.parentNode; while(elNode && elNode.tagName){ if(elNode.tagName === "P" || elNode.tagName === "DIV"){ return elNode; } elNode = elNode.parentNode; } }, _fixAlign : function(sAlign){ var oSelection = this.oApp.getSelection(), aNodes = [], elNode = null, elParentNode = null; var removeTableAlign = !this.oNavigator.ie ? function(){} : function(elNode){ if(elNode.tagName && elNode.tagName === "TABLE"){ elNode.removeAttribute("align"); return true; } return false; }; if(oSelection.collapsed){ aNodes[0] = oSelection.startContainer; // collapsed์ธ ๊ฒฝ์šฐ์—๋Š” getNodes์˜ ๊ฒฐ๊ณผ๋Š” [] }else{ aNodes = oSelection.getNodes(); } for(var i=0, nLen=aNodes.length; i<nLen; i++){ elNode = aNodes[i]; if(elNode.nodeType === 3){ elNode = elNode.parentNode; } if(elParentNode && (elNode === elParentNode || jindo.$Element(elNode).isChildOf(elParentNode))){ continue; } elParentNode = this._getAlignNode(elNode); if(elParentNode && elParentNode.align !== elParentNode.style.textAlign){ // [SMARTEDITORSUS-704] align ์†์„ฑ๊ณผ text-align ์†์„ฑ์˜ ๊ฐ’์„ ๋งž์ถฐ์คŒ elParentNode.style.textAlign = sAlign; elParentNode.setAttribute("align", sAlign); } } }, _getDocumentBR : function(){ var i, nLen; // [COM-715] <Chrome/Safari> ์š”์•ฝ๊ธ€ ์‚ฝ์ž… > ๋”๋ณด๊ธฐ ์˜์—ญ์—์„œ ๊ธฐํ˜ธ๋งค๊ธฐ๊ธฐ, ๋ฒˆํ˜ธ๋งค๊ธฐ๊ธฐ ์„ค์ •ํ• ๋•Œ๋งˆ๋‹ค ์š”์•ฝ๊ธ€ ๋ฐ•์Šค๊ฐ€ ์•„๋ž˜๋กœ ์ด๋™๋จ // ExecCommand๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์ „์— ํ˜„์žฌ์˜ BR์„ ์ €์žฅ this.aBRs = this.oApp.getWYSIWYGDocument().getElementsByTagName("BR"); this.aBeforeBRs = []; for(i=0, nLen=this.aBRs.length; i<nLen; i++){ this.aBeforeBRs[i] = this.aBRs[i]; } }, _fixDocumentBR : function(){ // [COM-715] ExecCommand๊ฐ€ ์ฒ˜๋ฆฌ๋œ ํ›„์— ์—…๋ฐ์ดํŠธ๋œ BR์„ ์ฒ˜๋ฆฌ ์ „์— ์ €์žฅํ•œ BR๊ณผ ๋น„๊ตํ•˜์—ฌ ์ƒ์„ฑ๋œ BR์„ ์ œ๊ฑฐ if(this.aBeforeBRs.length === this.aBRs.length){ // this.aBRs gets updated automatically when the document is updated return; } var waBeforeBRs = jindo.$A(this.aBeforeBRs), i, iLen = this.aBRs.length; for(i=iLen-1; i>=0; i--){ if(waBeforeBRs.indexOf(this.aBRs[i])<0){ this.aBRs[i].parentNode.removeChild(this.aBRs[i]); } } }, _setBlockExecCommand : function(sCommand, bUserInterface, vValue){ var aNodes, aChildrenNode, htSelectedTDs = {}; this.oSelection = this.oApp.getSelection(); this.oApp.exec("GET_SELECTED_TD_BLOCK",['aTdCells',htSelectedTDs]); aNodes = htSelectedTDs.aTdCells; for( var j = 0; j < aNodes.length ; j++){ this.oSelection.selectNodeContents(aNodes[j]); this.oSelection.select(); if(this.oNavigator.firefox){ this.oEditingArea.execCommand("styleWithCSS", bUserInterface, false); //styleWithCSS๋Š” ff์ „์šฉ์ž„. } aChildrenNode = this.oSelection.getNodes(); for( var k = 0; k < aChildrenNode.length ; k++ ) { if(aChildrenNode[k].tagName == "UL" || aChildrenNode[k].tagName == "OL" ){ jindo.$Element(aChildrenNode[k]).css("color",vValue); } } this.oEditingArea.execCommand(sCommand, bUserInterface, vValue); } }, _indentMargin : function(elDiv){ var elTmp = elDiv, aAppend, i, nLen, elInsertTarget, elDeleteTarget, nCurMarginLeft; while(elTmp){ if(elTmp.tagName && elTmp.tagName === "LI"){ elDiv = elTmp; break; } elTmp = elTmp.parentNode; } if(elDiv.tagName === "LI"){ //<OL> // <OL> // <LI>22</LI> // </OL> // <LI>33</LI> //</OL> //์™€ ๊ฐ™์€ ํ˜•ํƒœ๋ผ๋ฉด 33์„ ๋“ค์—ฌ์“ฐ๊ธฐ ํ–ˆ์„ ๋•Œ, ์ƒ๋‹จ์˜ silbling OL๊ณผ ํ•ฉ์ณ์„œ ์•„๋ž˜์™€ ๊ฐ™์ด ๋งŒ๋“ค์–ด ์คŒ. //<OL> // <OL> // <LI>22</LI> // <LI>33</LI> // </OL> //</OL> if(elDiv.previousSibling && elDiv.previousSibling.tagName && elDiv.previousSibling.tagName === elDiv.parentNode.tagName){ // ํ•˜๋‹จ์— ๋˜๋‹ค๋ฅธ OL์ด ์žˆ์–ด ์•„๋ž˜์™€ ๊ฐ™์€ ํ˜•ํƒœ๋ผ๋ฉด, //<OL> // <OL> // <LI>22</LI> // </OL> // <LI>33</LI> // <OL> // <LI>44</LI> // </OL> //</OL> //22,33,44๋ฅผ ํ•ฉ์ณ์„œ ์•„๋ž˜์™€ ๊ฐ™์ด ๋งŒ๋“ค์–ด ์คŒ. //<OL> // <OL> // <LI>22</LI> // <LI>33</LI> // <LI>44</LI> // </OL> //</OL> if(elDiv.nextSibling && elDiv.nextSibling.tagName && elDiv.nextSibling.tagName === elDiv.parentNode.tagName){ aAppend = [elDiv]; for(i=0, nLen=elDiv.nextSibling.childNodes.length; i<nLen; i++){ aAppend.push(elDiv.nextSibling.childNodes[i]); } elInsertTarget = elDiv.previousSibling; elDeleteTarget = elDiv.nextSibling; for(i=0, nLen=aAppend.length; i<nLen; i++){ elInsertTarget.insertBefore(aAppend[i], null); } elDeleteTarget.parentNode.removeChild(elDeleteTarget); }else{ elDiv.previousSibling.insertBefore(elDiv, null); } return; } //<OL> // <LI>22</LI> // <OL> // <LI>33</LI> // </OL> //</OL> //์™€ ๊ฐ™์€ ํ˜•ํƒœ๋ผ๋ฉด 22์„ ๋“ค์—ฌ์“ฐ๊ธฐ ํ–ˆ์„ ๋•Œ, ํ•˜๋‹จ์˜ silbling OL๊ณผ ํ•ฉ์นœ๋‹ค. if(elDiv.nextSibling && elDiv.nextSibling.tagName && elDiv.nextSibling.tagName === elDiv.parentNode.tagName){ elDiv.nextSibling.insertBefore(elDiv, elDiv.nextSibling.firstChild); return; } elTmp = elDiv.parentNode.cloneNode(false); elDiv.parentNode.insertBefore(elTmp, elDiv); elTmp.appendChild(elDiv); return; } nCurMarginLeft = parseInt(elDiv.style.marginLeft, 10); if(!nCurMarginLeft){ nCurMarginLeft = 0; } nCurMarginLeft += this.nIndentSpacing; elDiv.style.marginLeft = nCurMarginLeft+"px"; }, _outdentMargin : function(elDiv){ var elTmp = elDiv, elParentNode, elInsertBefore, elNewParent, elInsertParent, oDoc, nCurMarginLeft; while(elTmp){ if(elTmp.tagName && elTmp.tagName === "LI"){ elDiv = elTmp; break; } elTmp = elTmp.parentNode; } if(elDiv.tagName === "LI"){ elParentNode = elDiv.parentNode; elInsertBefore = elDiv.parentNode; // LI๋ฅผ ์ ์ ˆ ์œ„์น˜๋กœ ์ด๋™. // ์œ„์— ๋‹ค๋ฅธ li/ol/ul๊ฐ€ ์žˆ๋Š”๊ฐ€? if(elDiv.previousSibling && elDiv.previousSibling.tagName && elDiv.previousSibling.tagName.match(/LI|UL|OL/)){ // ์œ„์•„๋ž˜๋กœ sibling li/ol/ul๊ฐ€ ์žˆ๋‹ค๋ฉด ol/ul๋ฅผ 2๊ฐœ๋กœ ๋‚˜๋ˆ„์–ด์•ผ๋จ if(elDiv.nextSibling && elDiv.nextSibling.tagName && elDiv.nextSibling.tagName.match(/LI|UL|OL/)){ elNewParent = elParentNode.cloneNode(false); while(elDiv.nextSibling){ elNewParent.insertBefore(elDiv.nextSibling, null); } elParentNode.parentNode.insertBefore(elNewParent, elParentNode.nextSibling); elInsertBefore = elNewParent; // ํ˜„์žฌ LI๊ฐ€ ๋งˆ์ง€๋ง‰ LI๋ผ๋ฉด ๋ถ€๋ชจ OL/UL ํ•˜๋‹จ์— ์‚ฝ์ž… }else{ elInsertBefore = elParentNode.nextSibling; } } elParentNode.parentNode.insertBefore(elDiv, elInsertBefore); // ๋‚ด์–ด์“ฐ๊ธฐ ํ•œ LI ์™ธ์— ๋‹ค๋ฅธ LI๊ฐ€ ์กด์žฌ ํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ ๋ถ€๋ชจ ๋…ธ๋“œ ์ง€์›Œ์คŒ if(!elParentNode.innerHTML.match(/LI/i)){ elParentNode.parentNode.removeChild(elParentNode); } // OL์ด๋‚˜ UL ์œ„๋กœ๊นŒ์ง€ ๋‚ด์–ด์“ฐ๊ธฐ๊ฐ€ ๋œ ์ƒํƒœ๋ผ๋ฉด LI๋ฅผ ๋ฒ—๊ฒจ๋ƒ„ if(!elDiv.parentNode.tagName.match(/OL|UL/)){ elInsertParent = elDiv.parentNode; elInsertBefore = elDiv; // ๋‚ด์šฉ๋ฌผ์„ P๋กœ ๊ฐ์‹ธ๊ธฐ oDoc = this.oApp.getWYSIWYGDocument(); elInsertParent = oDoc.createElement("P"); elInsertBefore = null; elDiv.parentNode.insertBefore(elInsertParent, elDiv); while(elDiv.firstChild){ elInsertParent.insertBefore(elDiv.firstChild, elInsertBefore); } elDiv.parentNode.removeChild(elDiv); } return; } nCurMarginLeft = parseInt(elDiv.style.marginLeft, 10); if(!nCurMarginLeft){ nCurMarginLeft = 0; } nCurMarginLeft -= this.nIndentSpacing; if(nCurMarginLeft < 0){ nCurMarginLeft = 0; } elDiv.style.marginLeft = nCurMarginLeft+"px"; }, // Fix IE's execcommand bug // When insertorderedlist/insertunorderedlist is executed on a blockquote, the blockquote will "suck in" directly neighboring OL, UL's if there's any. // To prevent this, insert empty P tags right before and after the blockquote and remove them after the execution. // [SMARTEDITORSUS-793] Chrome ์—์„œ ๋™์ผํ•œ ์ด์Šˆ ๋ฐœ์ƒ, Chrome ์€ ๋นˆ P ํƒœ๊ทธ๋กœ๋Š” ์ฒ˜๋ฆฌ๋˜์ง€ ์•Š์œผ &nbsp; ์ถ”๊ฐ€ _insertBlankLine : function(){ var oSelection = this.oApp.getSelection(); var elNode = oSelection.commonAncestorContainer; this.elP1 = null; this.elP2 = null; while(elNode){ if(elNode.tagName == "BLOCKQUOTE"){ this.elP1 = jindo.$("<p>&nbsp;</p>", this.oApp.getWYSIWYGDocument()); elNode.parentNode.insertBefore(this.elP1, elNode); this.elP2 = jindo.$("<p>&nbsp;</p>", this.oApp.getWYSIWYGDocument()); elNode.parentNode.insertBefore(this.elP2, elNode.nextSibling); break; } elNode = elNode.parentNode; } }, // Fix IE's execcommand bug // When insertorderedlist/insertunorderedlist is executed on a blockquote with all the child nodes selected, // eg:<blockquote>[selection starts here]blah...[selection ends here]</blockquote> // , IE will change the blockquote with the list tag and create <OL><OL><LI>blah...</LI></OL></OL>. // (two OL's or two UL's depending on which command was executed) // // It can also happen when the cursor is located at bogus positions like // * below blockquote when the blockquote is the last element in the document // // [IE] ์ธ์šฉ๊ตฌ ์•ˆ์—์„œ ๊ธ€๋จธ๋ฆฌ ๊ธฐํ˜ธ๋ฅผ ์ ์šฉํ–ˆ์„ ๋•Œ, ์ธ์šฉ๊ตฌ ๋ฐ–์— ์ ์šฉ๋œ ๋ฒˆํ˜ธ๋งค๊ธฐ๊ธฐ/๊ธ€๋จธ๋ฆฌ ๊ธฐํ˜ธ๊ฐ€ ์ธ์šฉ๊ตฌ ์•ˆ์œผ๋กœ ๋นจ๋ ค ๋“ค์–ด๊ฐ€๋Š” ๋ฌธ์ œ ์ฒ˜๋ฆฌ _fixCorruptedBlockQuote : function(sTagName){ var aNodes = this.oApp.getWYSIWYGDocument().getElementsByTagName(sTagName), elCorruptedBlockQuote, elTmpParent, elNewNode, aLists, i, nLen, nPos, el, oSelection; for(i=0, nLen=aNodes.length; i<nLen; i++){ if(aNodes[i].firstChild && aNodes[i].firstChild.tagName == sTagName){ elCorruptedBlockQuote = aNodes[i]; break; } } if(!elCorruptedBlockQuote){return;} elTmpParent = elCorruptedBlockQuote.parentNode; // (1) changing outerHTML will cause loss of the reference to the node, so remember the idx position here nPos = this._getPosIdx(elCorruptedBlockQuote); el = this.oApp.getWYSIWYGDocument().createElement("DIV"); el.innerHTML = elCorruptedBlockQuote.outerHTML.replace("<"+sTagName, "<BLOCKQUOTE"); elCorruptedBlockQuote.parentNode.insertBefore(el.firstChild, elCorruptedBlockQuote); elCorruptedBlockQuote.parentNode.removeChild(elCorruptedBlockQuote); // (2) and retrieve the new node here elNewNode = elTmpParent.childNodes[nPos]; // garbage <OL></OL> or <UL></UL> will be left over after setting the outerHTML, so remove it here. aLists = elNewNode.getElementsByTagName(sTagName); for(i=0, nLen=aLists.length; i<nLen; i++){ if(aLists[i].childNodes.length<1){ aLists[i].parentNode.removeChild(aLists[i]); } } oSelection = this.oApp.getEmptySelection(); oSelection.selectNodeContents(elNewNode); oSelection.collapseToEnd(); oSelection.select(); }, _getPosIdx : function(refNode){ var idx = 0; for(var node = refNode.previousSibling; node; node = node.previousSibling){idx++;} return idx; }, _countClickCr : function(sCommand) { if (!sCommand.match(this.rxClickCr)) { return; } this.oApp.exec('MSG_NOTIFY_CLICKCR', [sCommand.replace(/^insert/i, '')]); }, _extendBlock : function(){ // [SMARTEDITORSUS-663] [FF] block๋‹จ์œ„๋กœ ํ™•์žฅํ•˜์—ฌ Range๋ฅผ ์ƒˆ๋กœ ์ง€์ •ํ•ด์ฃผ๋Š”๊ฒƒ์ด ์›๋ž˜ ์ŠคํŽ™์ด๋ฏ€๋กœ // ํ•ด๊ฒฐ์„ ์œ„ํ•ด์„œ๋Š” ํ˜„์žฌ ์„ ํƒ๋œ ๋ถ€๋ถ„์„ Block์œผ๋กœ extendํ•˜์—ฌ execCommand API๊ฐ€ ์ฒ˜๋ฆฌ๋  ์ˆ˜ ์žˆ๋„๋ก ํ•จ var oSelection = this.oApp.getSelection(), oStartContainer = oSelection.startContainer, oEndContainer = oSelection.endContainer, aChildImg = [], aSelectedImg = [], oSelectionClone = oSelection.cloneRange(); // <p><img><br/><img><br/><img></p> ์ผ ๋•Œ ์ด๋ฏธ์ง€๊ฐ€ ์ผ๋ถ€๋งŒ ์„ ํƒ๋˜๋ฉด ๋ฐœ์ƒ // - container ๋…ธ๋“œ๋Š” P ์ด๊ณ  container ๋…ธ๋“œ์˜ ์ž์‹๋…ธ๋“œ ์ค‘ ์ด๋ฏธ์ง€๊ฐ€ ์—ฌ๋Ÿฌ๊ฐœ์ธ๋ฐ ์„ ํƒ๋œ ์ด๋ฏธ์ง€๊ฐ€ ๊ทธ ์ค‘ ์ผ๋ถ€์ธ ๊ฒฝ์šฐ if(!(oStartContainer === oEndContainer && oStartContainer.nodeType === 1 && oStartContainer.tagName === "P")){ return; } aChildImg = jindo.$A(oStartContainer.childNodes).filter(function(value, index, array){ return (value.nodeType === 1 && value.tagName === "IMG"); }).$value(); aSelectedImg = jindo.$A(oSelection.getNodes()).filter(function(value, index, array){ return (value.nodeType === 1 && value.tagName === "IMG"); }).$value(); if(aChildImg.length <= aSelectedImg.length){ return; } oSelection.selectNode(oStartContainer); oSelection.select(); return oSelectionClone; } }); //} //{ /** * @fileOverview This file contains Husky plugin that takes care of the operations related to changing the font color * @name hp_SE_FontColor.js */ nhn.husky.SE2M_FontColor = jindo.$Class({ name : "SE2M_FontColor", rxColorPattern : /^#?[0-9a-fA-F]{6}$|^rgb\(\d+, ?\d+, ?\d+\)$/i, $init : function(elAppContainer){ this._assignHTMLElements(elAppContainer); }, _assignHTMLElements : function(elAppContainer){ //@ec[ this.elLastUsed = jindo.$$.getSingle("SPAN.husky_se2m_fontColor_lastUsed", elAppContainer); this.elDropdownLayer = jindo.$$.getSingle("DIV.husky_se2m_fontcolor_layer", elAppContainer); this.elPaletteHolder = jindo.$$.getSingle("DIV.husky_se2m_fontcolor_paletteHolder", this.elDropdownLayer); //@ec] this._setLastUsedFontColor("#000000"); }, $BEFORE_MSG_APP_READY : function() { this.oApp.exec("ADD_APP_PROPERTY", ["getLastUsedFontColor", jindo.$Fn(this.getLastUsedFontColor, this).bind()]); }, $ON_MSG_APP_READY : function(){ this.oApp.exec("REGISTER_UI_EVENT", ["fontColorA", "click", "APPLY_LAST_USED_FONTCOLOR"]); this.oApp.exec("REGISTER_UI_EVENT", ["fontColorB", "click", "TOGGLE_FONTCOLOR_LAYER"]); }, //@lazyload_js APPLY_LAST_USED_FONTCOLOR,TOGGLE_FONTCOLOR_LAYER[ $ON_TOGGLE_FONTCOLOR_LAYER : function(){ this.oApp.exec("TOGGLE_TOOLBAR_ACTIVE_LAYER", [this.elDropdownLayer, null, "FONTCOLOR_LAYER_SHOWN", [], "FONTCOLOR_LAYER_HIDDEN", []]); this.oApp.exec('MSG_NOTIFY_CLICKCR', ['fontcolor']); }, $ON_FONTCOLOR_LAYER_SHOWN : function(){ this.oApp.exec("SELECT_UI", ["fontColorB"]); this.oApp.exec("SHOW_COLOR_PALETTE", ["APPLY_FONTCOLOR", this.elPaletteHolder]); }, $ON_FONTCOLOR_LAYER_HIDDEN : function(){ this.oApp.exec("DESELECT_UI", ["fontColorB"]); this.oApp.exec("RESET_COLOR_PALETTE", []); }, $ON_APPLY_LAST_USED_FONTCOLOR : function(){ this.oApp.exec("APPLY_FONTCOLOR", [this.sLastUsedColor]); this.oApp.exec('MSG_NOTIFY_CLICKCR', ['fontcolor']); }, $ON_APPLY_FONTCOLOR : function(sFontColor){ if(!this.rxColorPattern.test(sFontColor)){ alert(this.oApp.$MSG("SE_FontColor.invalidColorCode")); return; } this._setLastUsedFontColor(sFontColor); this.oApp.exec("SET_WYSIWYG_STYLE", [{"color":sFontColor}]); // [SMARTEDITORSUS-907] ๋ชจ๋“  ๋ธŒ๋ผ์šฐ์ €์—์„œ SET_WYSIWYG_STYLE๋กœ ์ƒ‰์ƒ์„ ์„ค์ •ํ•˜๋„๋ก ๋ณ€๊ฒฝ // var oAgent = jindo.$Agent().navigator(); // if( oAgent.ie || oAgent.firefox ){ // [SMARTEDITORSUS-658] Firefox ์ถ”๊ฐ€ // this.oApp.exec("SET_WYSIWYG_STYLE", [{"color":sFontColor}]); // } else { // var bDontAddUndoHistory = false; // if(this.oApp.getSelection().collapsed){ // bDontAddUndoHistory = true; // } // this.oApp.exec("EXECCOMMAND", ["ForeColor", false, sFontColor, { "bDontAddUndoHistory" : bDontAddUndoHistory }]); // if(bDontAddUndoHistory){ // this.oApp.exec("RECORD_UNDO_ACTION", ["FONT COLOR", {bMustBlockElement : true}]); // } // } this.oApp.exec("HIDE_ACTIVE_LAYER"); }, //@lazyload_js] _setLastUsedFontColor : function(sFontColor){ this.sLastUsedColor = sFontColor; this.elLastUsed.style.backgroundColor = this.sLastUsedColor; }, getLastUsedFontColor : function(){ return (!!this.sLastUsedColor) ? this.sLastUsedColor : '#000000'; } }); //} /** * @fileOverview This file contains Husky plugin that takes care of the operations related to changing the font name using Select element * @name SE2M_FontNameWithLayerUI.js * @trigger MSG_STYLE_CHANGED,SE2M_TOGGLE_FONTNAME_LAYER */ nhn.husky.SE2M_FontNameWithLayerUI = jindo.$Class({ name : "SE2M_FontNameWithLayerUI", $init : function(elAppContainer, aAdditionalFontList){ this.elLastHover = null; this._assignHTMLElements(elAppContainer); this.htBrowser = jindo.$Agent().navigator(); this.aAdditionalFontList = aAdditionalFontList || []; }, addAllFonts : function(){ var aDefaultFontList, aFontList, htMainFont, aFontInUse, i; // family name -> display name ๋งคํ•‘ (์›นํฐํŠธ๋Š” ๋‘๊ฐœ๊ฐ€ ๋‹ค๋ฆ„) this.htFamilyName2DisplayName = {}; this.htAllFonts = {}; this.aBaseFontList = []; this.aDefaultFontList = []; this.aTempSavedFontList = []; this.htOptions = this.oApp.htOptions.SE2M_FontName; if(this.htOptions){ aDefaultFontList = this.htOptions.aDefaultFontList || []; aFontList = this.htOptions.aFontList; htMainFont = this.htOptions.htMainFont; aFontInUse = this.htOptions.aFontInUse; //add Font if(this.htBrowser.ie && aFontList){ for(i=0; i<aFontList.length; i++){ this.addFont(aFontList[i].id, aFontList[i].name, aFontList[i].size, aFontList[i].url, aFontList[i].cssUrl); } } for(i=0; i<aDefaultFontList.length; i++){ this.addFont(aDefaultFontList[i][0], aDefaultFontList[i][1], 0, "", "", 1); } //set Main Font //if(mainFontSelected=='true') { if(htMainFont && htMainFont.id) { //this.setMainFont(mainFontId, mainFontName, mainFontSize, mainFontUrl, mainFontCssUrl); this.setMainFont(htMainFont.id, htMainFont.name, htMainFont.size, htMainFont.url, htMainFont.cssUrl); } // add font in use if(this.htBrowser.ie && aFontInUse){ for(i=0; i<aFontInUse.length; i++){ this.addFontInUse(aFontInUse[i].id, aFontInUse[i].name, aFontInUse[i].size, aFontInUse[i].url, aFontInUse[i].cssUrl); } } } // [SMARTEDITORSUS-245] ์„œ๋น„์Šค ์ ์šฉ ์‹œ ๊ธ€๊ผด์ •๋ณด๋ฅผ ๋„˜๊ธฐ์ง€ ์•Š์œผ๋ฉด ๊ธฐ๋ณธ ๊ธ€๊ผด ๋ชฉ๋ก์ด ๋ณด์ด์ง€ ์•Š๋Š” ์˜ค๋ฅ˜ if(!this.htOptions || !this.htOptions.aDefaultFontList || this.htOptions.aDefaultFontList.length === 0){ this.addFont("๋‹์›€,Dotum", "๋‹์›€", 0, "", "", 1, null, true); this.addFont("๋‹์›€์ฒด,DotumChe,AppleGothic", "๋‹์›€์ฒด", 0, "", "", 1); this.addFont("๊ตด๋ฆผ,Gulim", "๊ตด๋ฆผ", 0, "", "", 1, null, true); this.addFont("๊ตด๋ฆผ์ฒด,GulimChe", "๊ตด๋ฆผ์ฒด", 0, "", "", 1, null, true); this.addFont("๋ฐ”ํƒ•,Batang,AppleMyungjo", "๋ฐ”ํƒ•", 0, "", "", 1); this.addFont("๋ฐ”ํƒ•์ฒด,BatangChe", "๋ฐ”ํƒ•์ฒด", 0, "", "", 1, null, true); this.addFont("๊ถ์„œ,Gungsuh,GungSeo", "๊ถ์„œ", 0, "", "", 1); this.addFont('Arial', 'Arial', 0, "", "", 1, "abcd"); this.addFont('Tahoma', 'Tahoma', 0, "", "", 1, "abcd"); this.addFont('Times New Roman', 'Times New Roman', 0, "", "", 1, "abcd"); this.addFont('Verdana', 'Verdana', 0, "", "", 1, "abcd"); this.addFont('Courier New', 'Courier New', 0, "", "", 1, "abcd"); } // [SMARTEDITORSUS-1436] ๊ธ€๊ผด ๋ฆฌ์ŠคํŠธ์— ๊ธ€๊ผด ์ข…๋ฅ˜ ์ถ”๊ฐ€ํ•˜๊ธฐ ๊ธฐ๋Šฅ if(!!this.aAdditionalFontList && this.aAdditionalFontList.length > 0){ for(i = 0, nLen = this.aAdditionalFontList.length; i < nLen; i++){ this.addFont(this.aAdditionalFontList[i][0], this.aAdditionalFontList[i][1], 0, "", "", 1); } } }, $ON_MSG_APP_READY : function(){ this.bDoNotRecordUndo = false; this.oApp.exec("ADD_APP_PROPERTY", ["addFont", jindo.$Fn(this.addFont, this).bind()]); this.oApp.exec("ADD_APP_PROPERTY", ["addFontInUse", jindo.$Fn(this.addFontInUse, this).bind()]); // ๋ธ”๋กœ๊ทธ๋“ฑ ํŒฉํ† ๋ฆฌ ํฐํŠธ ํฌํ•จ ์šฉ this.oApp.exec("ADD_APP_PROPERTY", ["setMainFont", jindo.$Fn(this.setMainFont, this).bind()]); // ๋ฉ”์ผ๋“ฑ ๋‹จ์ˆœ ํฐํŠธ ์ง€์ • ์šฉ this.oApp.exec("ADD_APP_PROPERTY", ["setDefaultFont", jindo.$Fn(this.setDefaultFont, this).bind()]); this.oApp.exec("REGISTER_UI_EVENT", ["fontName", "click", "SE2M_TOGGLE_FONTNAME_LAYER"]); }, $AFTER_MSG_APP_READY : function(){ this._initFontName(); this._attachIEEvent(); }, _assignHTMLElements : function(elAppContainer){ //@ec[ this.oDropdownLayer = jindo.$$.getSingle("DIV.husky_se_fontName_layer", elAppContainer); this.elFontNameLabel = jindo.$$.getSingle("SPAN.husky_se2m_current_fontName", elAppContainer); this.elFontNameList = jindo.$$.getSingle("UL", this.oDropdownLayer); this.elInnerLayer = this.elFontNameList.parentNode; this.elFontItemTemplate = jindo.$$.getSingle("LI", this.oDropdownLayer); this.aLIFontNames = jindo.$A(jindo.$$("LI", this.oDropdownLayer)).filter(function(v,i,a){return (v.firstChild !== null);})._array; this.elSeparator = jindo.$$.getSingle("LI.husky_seditor_font_separator", this.oDropdownLayer); this.elNanumgothic = jindo.$$.getSingle("LI.husky_seditor_font_nanumgothic", this.oDropdownLayer); this.elNanummyeongjo = jindo.$$.getSingle("LI.husky_seditor_font_nanummyeongjo", this.oDropdownLayer); this.elNanumgothiccoding = jindo.$$.getSingle("LI.husky_seditor_font_nanumgothiccoding", this.oDropdownLayer); //@ec] this.sDefaultText = this.elFontNameLabel.innerHTML; }, //$LOCAL_BEFORE_FIRST : function(){ _initFontName : function(){ this._addNanumFont(); this.addAllFonts(); this.oApp.registerBrowserEvent(this.oDropdownLayer, "mouseover", "EVENT_FONTNAME_LAYER_MOUSEOVER", []); this.oApp.registerBrowserEvent(this.oDropdownLayer, "click", "EVENT_FONTNAME_LAYER_CLICKED", []); }, _addNanumFont : function(){ var bUseSeparator = false; var nanum_gothic = unescape("%uB098%uB214%uACE0%uB515"); var nanum_myungjo = unescape("%uB098%uB214%uBA85%uC870"); var nanum_gothic_coding = unescape("%uB098%uB214%uACE0%uB515%uCF54%uB529"); if(jindo.$Agent().os().mac){ nanum_gothic = "NanumGothic"; nanum_myungjo = "NanumMyeongjo"; nanum_gothic_coding = "NanumGothicCoding"; } if(!!this.elNanumgothic){ if(IsInstalledFont(nanum_gothic)){ bUseSeparator = true; this.elNanumgothic.style.display = "block"; }else{ this.elNanumgothic.style.display = "none"; } } if(!!this.elNanummyeongjo){ if(IsInstalledFont(nanum_myungjo)){ bUseSeparator = true; this.elNanummyeongjo.style.display = "block"; }else{ this.elNanummyeongjo.style.display = "none"; } } if(!!this.elNanumgothicCoding){ if(IsInstalledFont(nanum_gothic_coding)){ bUseSeparator = true; this.elNanumgothiccoding.style.display = "block"; }else{ this.elNanumgothiccoding.style.display = "none"; } } if(!!this.elSeparator){ this.elSeparator.style.display = bUseSeparator ? "block" : "none"; } }, _attachIEEvent : function(){ if(!this.htBrowser.ie){ return; } if(this.htBrowser.nativeVersion < 9){ // [SMARTEDITORSUS-187] [< IE9] ์ตœ์ดˆ paste ์‹œ์ ์— ์›นํฐํŠธ ํŒŒ์ผ์„ ๋กœ๋“œ this._wfOnPasteWYSIWYGBody = jindo.$Fn(this._onPasteWYSIWYGBody, this); this._wfOnPasteWYSIWYGBody.attach(this.oApp.getWYSIWYGDocument().body, "paste"); return; } if(document.documentMode < 9){ // [SMARTEDITORSUS-169] [>= IE9] ์ตœ์ดˆ ํฌ์ปค์Šค ์‹œ์ ์— ์›นํฐํŠธ ๋กœ๋“œ this._wfOnFocusWYSIWYGBody = jindo.$Fn(this._onFocusWYSIWYGBody, this); this._wfOnFocusWYSIWYGBody.attach(this.oApp.getWYSIWYGDocument().body, "focus"); return; } // documentMode === 9 // http://blogs.msdn.com/b/ie/archive/2010/08/17/ie9-opacity-and-alpha.aspx // opacity:0.0; this.welEditingAreaCover = jindo.$Element('<DIV style="width:100%; height:100%; position:absolute; top:0px; left:0px; z-index:1000;"></DIV>'); this.oApp.welEditingAreaContainer.prepend(this.welEditingAreaCover); jindo.$Fn(this._onMouseupCover, this).attach(this.welEditingAreaCover.$value(), "mouseup"); }, _onFocusWYSIWYGBody : function(e){ this._wfOnFocusWYSIWYGBody.detach(this.oApp.getWYSIWYGDocument().body, "focus"); this._loadAllBaseFont(); }, _onPasteWYSIWYGBody : function(e){ this._wfOnPasteWYSIWYGBody.detach(this.oApp.getWYSIWYGDocument().body, "paste"); this._loadAllBaseFont(); }, _onMouseupCover : function(e){ e.stop(); // [SMARTEDITORSUS-1632] ๋ฌธ์„œ ๋ชจ๋“œ๊ฐ€ 9 ์ด์ƒ์ผ ๋•Œ, ๊ฒฝ์šฐ์— ๋”ฐ๋ผ this.welEditingAreaContainer๊ฐ€ ์—†์„ ๋•Œ ์Šคํฌ๋ฆฝํŠธ ์˜ค๋ฅ˜ ๋ฐœ์ƒ if(this.welEditingAreaCover){ this.welEditingAreaCover.leave(); } //this.welEditingAreaCover.leave(); // --[SMARTEDITORSUS-1632] var oMouse = e.mouse(), elBody = this.oApp.getWYSIWYGDocument().body, welBody = jindo.$Element(elBody), oSelection = this.oApp.getEmptySelection(); // [SMARTEDITORSUS-363] ๊ฐ•์ œ๋กœ Selection ์„ ์ฃผ๋„๋ก ์ฒ˜๋ฆฌํ•จ oSelection.selectNode(elBody); oSelection.collapseToStart(); oSelection.select(); welBody.fireEvent("mousedown", {left : oMouse.left, middle : oMouse.middle, right : oMouse.right}); welBody.fireEvent("mouseup", {left : oMouse.left, middle : oMouse.middle, right : oMouse.right}); }, $ON_EVENT_TOOLBAR_MOUSEDOWN : function(){ if(this.htBrowser.nativeVersion < 9 || document.documentMode < 9){ return; } // [SMARTEDITORSUS-1632] ๋ฌธ์„œ ๋ชจ๋“œ๊ฐ€ 9 ์ด์ƒ์ผ ๋•Œ, ๊ฒฝ์šฐ์— ๋”ฐ๋ผ this.welEditingAreaContainer๊ฐ€ ์—†์„ ๋•Œ ์Šคํฌ๋ฆฝํŠธ ์˜ค๋ฅ˜ ๋ฐœ์ƒ if(this.welEditingAreaCover){ this.welEditingAreaCover.leave(); } //this.welEditingAreaCover.leave(); // --[SMARTEDITORSUS-1632] }, _loadAllBaseFont : function(){ var i, nFontLen; if(!this.htBrowser.ie){ return; } if(this.htBrowser.nativeVersion < 9){ for(i=0, nFontLen=this.aBaseFontList.length; i<nFontLen; i++){ this.aBaseFontList[i].loadCSS(this.oApp.getWYSIWYGDocument()); } }else if(document.documentMode < 9){ for(i=0, nFontLen=this.aBaseFontList.length; i<nFontLen; i++){ this.aBaseFontList[i].loadCSSToMenu(); } } this._loadAllBaseFont = function(){}; }, _addFontToMenu: function(sDisplayName, sFontFamily, sSampleText){ var elItem = document.createElement("LI"); elItem.innerHTML = this.elFontItemTemplate.innerHTML.replace("@DisplayName@", sDisplayName).replace("FontFamily", sFontFamily).replace("@SampleText@", sSampleText); this.elFontNameList.insertBefore(elItem, this.elFontItemTemplate); this.aLIFontNames[this.aLIFontNames.length] = elItem; if(this.aLIFontNames.length > 20){ this.oDropdownLayer.style.overflowX = 'hidden'; this.oDropdownLayer.style.overflowY = 'auto'; this.oDropdownLayer.style.height = '400px'; this.oDropdownLayer.style.width = '204px'; // [SMARTEDITORSUS-155] ์Šคํฌ๋กค์„ ํฌํ•จํ•˜์—ฌ 206px ์ด ๋˜๋„๋ก ์ฒ˜๋ฆฌ } }, $ON_EVENT_FONTNAME_LAYER_MOUSEOVER : function(wev){ var elTmp = this._findLI(wev.element); if(!elTmp){ return; } this._clearLastHover(); elTmp.className = "hover"; this.elLastHover = elTmp; }, $ON_EVENT_FONTNAME_LAYER_CLICKED : function(wev){ var elTmp = this._findLI(wev.element); if(!elTmp){ return; } var sFontFamily = this._getFontFamilyFromLI(elTmp); // [SMARTEDITORSUS-169] ์›นํฐํŠธ์˜ ๊ฒฝ์šฐ fontFamily ์— ' ์„ ๋ถ™์—ฌ์ฃผ๋Š” ์ฒ˜๋ฆฌ๋ฅผ ํ•จ var htFontInfo = this.htAllFonts[sFontFamily.replace(/\"/g, nhn.husky.SE2M_FontNameWithLayerUI.CUSTOM_FONT_MARKS)]; var nDefaultFontSize; if(htFontInfo){ nDefaultFontSize = htFontInfo.defaultSize+"pt"; }else{ nDefaultFontSize = 0; } this.oApp.exec("SET_FONTFAMILY", [sFontFamily, nDefaultFontSize]); }, _findLI : function(elTmp){ while(elTmp.tagName != "LI"){ if(!elTmp || elTmp === this.oDropdownLayer){ return null; } elTmp = elTmp.parentNode; } if(/husky_seditor_font_separator/.test(elTmp.className)){ return null; } return elTmp; }, _clearLastHover : function(){ if(this.elLastHover){ this.elLastHover.className = ""; } }, $ON_SE2M_TOGGLE_FONTNAME_LAYER : function(){ this.oApp.exec("TOGGLE_TOOLBAR_ACTIVE_LAYER", [this.oDropdownLayer, null, "MSG_FONTNAME_LAYER_OPENED", [], "MSG_FONTNAME_LAYER_CLOSED", []]); this.oApp.exec('MSG_NOTIFY_CLICKCR', ['font']); }, $ON_MSG_FONTNAME_LAYER_OPENED : function(){ this.oApp.exec("SELECT_UI", ["fontName"]); }, $ON_MSG_FONTNAME_LAYER_CLOSED : function(){ this._clearLastHover(); this.oApp.exec("DESELECT_UI", ["fontName"]); }, $ON_MSG_STYLE_CHANGED : function(sAttributeName, sAttributeValue){ if(sAttributeName == "fontFamily"){ sAttributeValue = sAttributeValue.replace(/["']/g, ""); var elLi = this._getMatchingLI(sAttributeValue); this._clearFontNameSelection(); if(elLi){ this.elFontNameLabel.innerHTML = this._getFontNameLabelFromLI(elLi); jindo.$Element(elLi).addClass("active"); }else{ //var sDisplayName = this.htFamilyName2DisplayName[sAttributeValue] || sAttributeValue; var sDisplayName = this.sDefaultText; this.elFontNameLabel.innerHTML = sDisplayName; } } }, $BEFORE_RECORD_UNDO_BEFORE_ACTION : function(){ return !this.bDoNotRecordUndo; }, $BEFORE_RECORD_UNDO_AFTER_ACTION : function(){ return !this.bDoNotRecordUndo; }, $BEFORE_RECORD_UNDO_ACTION : function(){ return !this.bDoNotRecordUndo; }, $ON_SET_FONTFAMILY : function(sFontFamily, sDefaultSize){ if(!sFontFamily){return;} // [SMARTEDITORSUS-169] ์›นํฐํŠธ์˜ ๊ฒฝ์šฐ fontFamily ์— ' ์„ ๋ถ™์—ฌ์ฃผ๋Š” ์ฒ˜๋ฆฌ๋ฅผ ํ•จ var oFontInfo = this.htAllFonts[sFontFamily.replace(/\"/g, nhn.husky.SE2M_FontNameWithLayerUI.CUSTOM_FONT_MARKS)]; if(!!oFontInfo){ oFontInfo.loadCSS(this.oApp.getWYSIWYGDocument()); } // fontFamily์™€ fontSize ๋‘๊ฐœ์˜ ์•ก์…˜์„ ํ•˜๋‚˜๋กœ ๋ฌถ์–ด์„œ undo history ์ €์žฅ this.oApp.exec("RECORD_UNDO_BEFORE_ACTION", ["SET FONTFAMILY", {bMustBlockElement:true}]); this.bDoNotRecordUndo = true; if(parseInt(sDefaultSize, 10) > 0){ this.oApp.exec("SET_WYSIWYG_STYLE", [{"fontSize":sDefaultSize}]); } this.oApp.exec("SET_WYSIWYG_STYLE", [{"fontFamily":sFontFamily}]); this.bDoNotRecordUndo = false; this.oApp.exec("RECORD_UNDO_AFTER_ACTION", ["SET FONTFAMILY", {bMustBlockElement:true}]); this.oApp.exec("HIDE_ACTIVE_LAYER", []); this.oApp.exec("CHECK_STYLE_CHANGE", []); }, _getMatchingLI : function(sFontName){ sFontName = sFontName.toLowerCase(); var elLi, aFontFamily; for(var i=0; i<this.aLIFontNames.length; i++){ elLi = this.aLIFontNames[i]; aFontFamily = this._getFontFamilyFromLI(elLi).toLowerCase().split(","); for(var h=0; h < aFontFamily.length;h++){ if( !!aFontFamily[h] && jindo.$S(aFontFamily[h].replace(/['"]/ig, "")).trim().$value() == sFontName){ return elLi; } } } return null; }, _getFontFamilyFromLI : function(elLi){ //return elLi.childNodes[1].innerHTML.toLowerCase(); // <li><button type="button"><span>๋‹์Œ</span>(</span><em style="font-family:'๋‹์Œ',Dotum,'๊ตด๋ฆผ',Gulim,Helvetica,Sans-serif;">๋‹์Œ</em><span>)</span></span></button></li> return (elLi.getElementsByTagName("EM")[0]).style.fontFamily; }, _getFontNameLabelFromLI : function(elLi){ return elLi.firstChild.firstChild.firstChild.nodeValue; }, _clearFontNameSelection : function(elLi){ for(var i=0; i<this.aLIFontNames.length; i++){ jindo.$Element(this.aLIFontNames[i]).removeClass("active"); } }, /** * Add the font to the list * @param fontId {String} value of font-family in style * @param fontName {String} name of font list in editor * @param defaultSize * @param fontURL * @param fontCSSURL * @param fontType fontType == null, custom font (sent from the server) * fontType == 1, default font * fontType == 2, tempSavedFont * @param sSampleText {String} sample text of font list in editor * @param bCheck {Boolean} */ addFont : function (fontId, fontName, defaultSize, fontURL, fontCSSURL, fontType, sSampleText, bCheck) { // custom font feature only available in IE if(!this.htBrowser.ie && fontCSSURL){ return null; } // OS์— ํ•ด๋‹น ํฐํŠธ๊ฐ€ ์กด์žฌํ•˜๋Š”์ง€ ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•œ๋‹ค. if(bCheck && !IsInstalledFont(fontId)){ return null; } fontId = fontId.toLowerCase(); var newFont = new fontProperty(fontId, fontName, defaultSize, fontURL, fontCSSURL); var sFontFamily; var sDisplayName; if(defaultSize>0){ sFontFamily = fontId+"_"+defaultSize; sDisplayName = fontName+"_"+defaultSize; }else{ sFontFamily = fontId; sDisplayName = fontName; } if(!fontType){ sFontFamily = nhn.husky.SE2M_FontNameWithLayerUI.CUSTOM_FONT_MARKS + sFontFamily + nhn.husky.SE2M_FontNameWithLayerUI.CUSTOM_FONT_MARKS; } if(this.htAllFonts[sFontFamily]){ return this.htAllFonts[sFontFamily]; } this.htAllFonts[sFontFamily] = newFont; /* // do not add again, if the font is already in the list for(var i=0; i<this._allFontList.length; i++){ if(newFont.fontFamily == this._allFontList[i].fontFamily){ return this._allFontList[i]; } } this._allFontList[this._allFontList.length] = newFont; */ // [SMARTEDITORSUS-169] [IE9] ์›นํฐํŠธA ์„ ํƒ>์›นํฐํŠธB ์„ ํƒ>์›นํฐํŠธ A๋ฅผ ๋‹ค์‹œ ์„ ํƒํ•˜๋ฉด ์›นํฐํŠธ A๊ฐ€ ์ ์šฉ๋˜์ง€ ์•Š๋Š” ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒ // // [์›์ธ] // - IE9์˜ ์›นํฐํŠธ ๋กœ๋“œ/์–ธ๋กœ๋“œ ์‹œ์  // ์›นํฐํŠธ ๋กœ๋“œ ์‹œ์ : StyleSheet ์˜ @font-face ๊ตฌ๋ฌธ์ด ํ•ด์„๋œ ์ดํ›„, DOM Tree ์ƒ์—์„œ ํ•ด๋‹น ์›นํฐํŠธ๊ฐ€ ์ตœ์ดˆ๋กœ ์‚ฌ์šฉ๋œ ์‹œ์  // ์›นํฐํŠธ ์–ธ๋กœ๋“œ ์‹œ์ : StyleSheet ์˜ @font-face ๊ตฌ๋ฌธ์ด ํ•ด์„๋œ ์ดํ›„, DOM Tree ์ƒ์—์„œ ํ•ด๋‹น ์›ฌํฐํŠธ๊ฐ€ ๋”์ด์ƒ ์‚ฌ์šฉ๋˜์ง€ ์•Š๋Š” ์‹œ์  // - ๋ฉ”๋‰ด ๋ฆฌ์ŠคํŠธ์— ์ ์šฉ๋˜๋Š” ์Šคํƒ€์ผ์€ @font-face ์ด์ „์— ์ฒ˜๋ฆฌ๋˜๋Š” ๊ฒƒ์ด์–ด์„œ ์–ธ๋กœ๋“œ์— ์˜ํ–ฅ์„ ๋ฏธ์น˜์ง€ ์•Š์Œ // // ์Šค๋งˆํŠธ์—๋””ํ„ฐ์˜ ๊ฒฝ์šฐ, ์›นํฐํŠธ๋ฅผ ์„ ํƒํ•  ๋•Œ๋งˆ๋‹ค SPAN ์ด ์ƒˆ๋กœ ์ถ”๊ฐ€๋˜๋Š” ๊ฒƒ์ด ์•„๋‹Œ ์„ ํƒ๋œ SPAN ์˜ fontFamily ๋ฅผ ๋ณ€๊ฒฝํ•˜์—ฌ ์ฒ˜๋ฆฌํ•˜๋ฏ€๋กœ // fontFamily ๋ณ€๊ฒฝ ํ›„ DOM Tree ์ƒ์—์„œ ๋”์ด์ƒ ์‚ฌ์šฉ๋˜์ง€ ์•Š๋Š” ๊ฒƒ์œผ๋กœ ๋ธŒ๋ผ์šฐ์ € ํŒ๋‹จํ•˜์—ฌ ์–ธ๋กœ๋“œ ํ•ด๋ฒ„๋ฆผ. // [ํ•ด๊ฒฐ] // ์–ธ๋กœ๋“œ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋„๋ก ๋ฉ”๋‰ด ๋ฆฌ์ŠคํŠธ์— ์Šคํƒ€์ผ์„ ์ ์šฉํ•˜๋Š” ๊ฒƒ์„ @font-face ์ดํ›„๋กœ ํ•˜๋„๋ก ์ฒ˜๋ฆฌํ•˜์—ฌ DOM Tree ์ƒ์— ํ•ญ์ƒ ์ ์šฉ๋  ์ˆ˜ ์žˆ๋„๋ก ํ•จ // // [SMARTEDITORSUS-969] [IE10] ์›นํฐํŠธ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ธ€์„ ๋“ฑ๋กํ•˜๊ณ , ์ˆ˜์ •๋ชจ๋“œ๋กœ ๋“ค์–ด๊ฐ”์„ ๋•Œ ์›นํฐํŠธ๊ฐ€ ์ ์šฉ๋˜์ง€ ์•Š๋Š” ๋ฌธ์ œ // - IE10์—์„œ๋„ ์›นํฐํŠธ ์–ธ๋กœ๋“œ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋„๋ก ์กฐ๊ฑด์„ ์ˆ˜์ •ํ•จ // -> ๊ธฐ์กด : nativeVersion === 9 && documentMode === 9 // -> ์ˆ˜์ • : nativeVersion >= 9 && documentMode >= 9 if(this.htBrowser.ie && this.htBrowser.nativeVersion >= 9 && document.documentMode >= 9) { newFont.loadCSSToMenu(); } this.htFamilyName2DisplayName[sFontFamily] = fontName; sSampleText = sSampleText || this.oApp.$MSG('SE2M_FontNameWithLayerUI.sSampleText'); this._addFontToMenu(sDisplayName, sFontFamily, sSampleText); if(!fontType){ this.aBaseFontList[this.aBaseFontList.length] = newFont; }else{ if(fontType == 1){ this.aDefaultFontList[this.aDefaultFontList.length] = newFont; }else{ this.aTempSavedFontList[this.aTempSavedFontList.length] = newFont; } } return newFont; }, // Add the font AND load it right away addFontInUse : function (fontId, fontName, defaultSize, fontURL, fontCSSURL, fontType) { var newFont = this.addFont(fontId, fontName, defaultSize, fontURL, fontCSSURL, fontType); if(!newFont){ return null; } newFont.loadCSS(this.oApp.getWYSIWYGDocument()); return newFont; }, // Add the font AND load it right away AND THEN set it as the default font setMainFont : function (fontId, fontName, defaultSize, fontURL, fontCSSURL, fontType) { var newFont = this.addFontInUse(fontId, fontName, defaultSize, fontURL, fontCSSURL, fontType); if(!newFont){ return null; } this.setDefaultFont(newFont.fontFamily, defaultSize); return newFont; }, setDefaultFont : function(sFontFamily, nFontSize){ var elBody = this.oApp.getWYSIWYGDocument().body; elBody.style.fontFamily = sFontFamily; if(nFontSize>0){elBody.style.fontSize = nFontSize + 'pt';} } }); nhn.husky.SE2M_FontNameWithLayerUI.CUSTOM_FONT_MARKS = "'"; // [SMARTEDITORSUS-169] ์›นํฐํŠธ์˜ ๊ฒฝ์šฐ fontFamily ์— ' ์„ ๋ถ™์—ฌ์ฃผ๋Š” ์ฒ˜๋ฆฌ๋ฅผ ํ•จ // property function for all fonts - including the default fonts and the custom fonts // non-custom fonts will have the defaultSize of 0 and empty string for fontURL/fontCSSURL function fontProperty(fontId, fontName, defaultSize, fontURL, fontCSSURL){ this.fontId = fontId; this.fontName = fontName; this.defaultSize = defaultSize; this.fontURL = fontURL; this.fontCSSURL = fontCSSURL; this.displayName = fontName; this.isLoaded = true; this.fontFamily = this.fontId; // it is custom font if(this.fontCSSURL != ""){ this.displayName += '' + defaultSize; this.fontFamily += '_' + defaultSize; // custom fonts requires css loading this.isLoaded = false; // load the css that loads the custom font this.loadCSS = function(doc){ // if the font is loaded already, return if(this.isLoaded){ return; } this._importCSS(doc); this.isLoaded = true; }; // [SMARTEDITORSUS-169] [IE9] // addImport ํ›„์— ์ฒ˜์Œ ์ ์šฉ๋œ DOM-Tree ๊ฐ€ iframe ๋‚ด๋ถ€์ธ ๊ฒฝ์šฐ (setMainFont || addFontInUse ์—์„œ ํ˜ธ์ถœ๋œ ๊ฒฝ์šฐ) // ํ•ด๋‹น ํฐํŠธ์— ๋Œ€ํ•œ ์–ธ๋กœ๋“œ ๋ฌธ์ œ๊ฐ€ ๊ณ„์† ๋ฐœ์ƒํ•˜์—ฌ IE9์—์„œ addFont ์—์„œ ํ˜ธ์ถœํ•˜๋Š” loadCSS ์˜ ๊ฒฝ์šฐ์—๋Š” isLoaded๋ฅผ true ๋กœ ๋ณ€๊ฒฝํ•˜์ง€ ์•Š์Œ. this.loadCSSToMenu = function(){ this._importCSS(document); }; this._importCSS = function(doc){ var nStyleSheet = doc.styleSheets.length; var oStyleSheet = doc.styleSheets[nStyleSheet - 1]; if(nStyleSheet === 0 || oStyleSheet.imports.length == 30){ // imports limit oStyleSheet = doc.createStyleSheet(); } oStyleSheet.addImport(this.fontCSSURL); }; }else{ this.loadCSS = function(){}; this.loadCSSToMenu = function(){}; } this.toStruct = function(){ return {fontId:this.fontId, fontName:this.fontName, defaultSize:this.defaultSize, fontURL:this.fontURL, fontCSSURL:this.fontCSSURL}; }; } //{ /** * @fileOverview This file contains Husky plugin that takes care of the operations related to changing the font size using Select element * @name SE2M_FontSizeWithLayerUI.js */ nhn.husky.SE2M_FontSizeWithLayerUI = jindo.$Class({ name : "SE2M_FontSizeWithLayerUI", $init : function(elAppContainer){ this._assignHTMLElements(elAppContainer); }, _assignHTMLElements : function(elAppContainer){ //@ec this.oDropdownLayer = jindo.$$.getSingle("DIV.husky_se_fontSize_layer", elAppContainer); //@ec[ this.elFontSizeLabel = jindo.$$.getSingle("SPAN.husky_se2m_current_fontSize", elAppContainer); this.aLIFontSizes = jindo.$A(jindo.$$("LI", this.oDropdownLayer)).filter(function(v,i,a){return (v.firstChild != null);})._array; //@ec] this.sDefaultText = this.elFontSizeLabel.innerHTML; }, $ON_MSG_APP_READY : function(){ this.oApp.exec("REGISTER_UI_EVENT", ["fontSize", "click", "SE2M_TOGGLE_FONTSIZE_LAYER"]); this.oApp.exec("SE2_ATTACH_HOVER_EVENTS", [this.aLIFontSizes]); for(var i=0; i<this.aLIFontSizes.length; i++){ this.oApp.registerBrowserEvent(this.aLIFontSizes[i], "click", "SET_FONTSIZE", [this._getFontSizeFromLI(this.aLIFontSizes[i])]); } }, $ON_SE2M_TOGGLE_FONTSIZE_LAYER : function(){ this.oApp.exec("TOGGLE_TOOLBAR_ACTIVE_LAYER", [this.oDropdownLayer, null, "SELECT_UI", ["fontSize"], "DESELECT_UI", ["fontSize"]]); this.oApp.exec('MSG_NOTIFY_CLICKCR', ['size']); }, _rxPX : /px$/i, _rxPT : /pt$/i, $ON_MSG_STYLE_CHANGED : function(sAttributeName, sAttributeValue){ if(sAttributeName == "fontSize"){ // [SMARTEDITORSUS-1600] if(this._rxPX.test(sAttributeValue)){ // as-is /* if(sAttributeValue.match(/px$/)){ var num = parseFloat(sAttributeValue.replace("px", "")).toFixed(0); if(this.mapPX2PT[num]){ sAttributeValue = this.mapPX2PT[num] + "pt"; }else{ if(sAttributeValue > 0){ sAttributeValue = num + "px"; }else{ sAttributeValue = this.sDefaultText; } }*/ /** * Chrome์˜ ๊ฒฝ์šฐ, * jindo.$Element().css()์—์„œ ๋Œ€์ƒ Element์— ๊ตฌํ•˜๊ณ ์ž ํ•˜๋Š” style ๊ฐ’์ด ๋ช…์‹œ๋˜์–ด ์žˆ์ง€ ์•Š๋‹ค๋ฉด, * ์‹ค์ œ ์ˆ˜ํ–‰๋˜๋Š” ๋ฉ”์„œ๋“œ๋Š” window.getComputedStyle()์ด๋‹ค. * * ์ด ๋ฉ”์„œ๋“œ๋ฅผ ๊ฑฐ์น˜๋ฉด px ๋‹จ์œ„๋กœ ๊ฐ’์„ ๊ฐ€์ ธ์˜ค๊ฒŒ ๋˜๋Š”๋ฐ, * WYSIWYGDocument.body์— pt ๋‹จ์œ„๋กœ ๊ฐ’์ด ์„ค์ •๋˜์–ด ์žˆ์—ˆ๋‹ค๋ฉด * px : pt = 72 : 96 ์˜ ๋น„๋ก€์— ์˜ํ•ด * ๋ณ€ํ™˜๋œ px ๊ฐ’์„ ํš๋“ํ•˜๊ฒŒ ๋˜๋ฉฐ, * * ์•„๋ž˜ parseFloat()์˜ ํŠน์„ฑ ์ƒ * ์†Œ์ˆ˜์  16์ž๋ฆฌ๋ถ€ํ„ฐ๋Š” ๋ฒ„๋ ค์งˆ ์ˆ˜ ์žˆ์œผ๋ฉฐ, * * ์ด ๊ฒฝ์šฐ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ์˜ค์ฐจ๋Š” * pt ๊ธฐ์ค€์œผ๋กœ 3.75E-16 pt์ด๋‹ค. * * 0.5pt ํฌ๊ธฐ๋กœ ๊ตฌ๊ฐ„์„ ์„ค์ •ํ•˜์˜€๊ธฐ ๋•Œ๋ฌธ์— * ์ด ์˜ค์ฐจ๋Š” ์„ค์ •์— ์ง€์žฅ์„ ์ฃผ์ง€ ์•Š๋Š”๋‹ค. * * ์œ„์˜ ๊ธฐ์กด ๋ฐฉ์‹์€ ๊ณ„์‚ฐ์„ ๊ฑฐ์น˜์ง€ ์•Š์„ ๋ฟ ์•„๋‹ˆ๋ผ, * ์†Œ์ˆ˜์  ์ฒซ์งธ ์ž๋ฆฌ๋ถ€ํ„ฐ ๋ฌด์กฐ๊ฑด ๋ฐ˜์˜ฌ๋ฆผํ•˜๊ธฐ ๋•Œ๋ฌธ์— * ๊ฒฐ๊ณผ์— ๋”ฐ๋ผ 0.375 pt์˜ ์˜ค์ฐจ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค. * */ var num = parseFloat(sAttributeValue.replace(this._rxPX, "")); if(num > 0){ // px : pt = 72 : 96 sAttributeValue = num * 72 / 96 + "pt"; }else{ sAttributeValue = this.sDefaultText; } // --[SMARTEDITORSUS-1600] } // [SMARTEDITORSUS-1600] // ์‚ฐ์ˆ  ๊ณ„์‚ฐ์„ ํ†ตํ•ด ์ผ์ฐจ์ ์œผ๋กœ pt๋กœ ๋ณ€ํ™˜๋œ ๊ฐ’์„ 0.5pt ๊ตฌ๊ฐ„์„ ์ ์šฉํ•˜์—ฌ ๋ณด์ •ํ•˜๋˜, ๋ณด๋‹ค ๊ฐ€๊นŒ์šด ์ชฝ์œผ๋กœ ์„ค์ •ํ•œ๋‹ค. if(this._rxPT.test(sAttributeValue)){ var num = parseFloat(sAttributeValue.replace(this._rxPT, "")); var integerPart = Math.floor(num); // ์ •์ˆ˜ ๋ถ€๋ถ„ var decimalPart = num - integerPart; // ์†Œ์ˆ˜ ๋ถ€๋ถ„ // ๋ณด์ • ๊ธฐ์ค€์€ ์†Œ์ˆ˜ ๋ถ€๋ถ„์ด๋ฉฐ, ๋ฐ˜์˜ฌ๋ฆผ ๋‹จ์œ„๋Š” 0.25pt if(decimalPart >= 0 && decimalPart < 0.25){ num = integerPart + 0; }else if(decimalPart >= 0.25 && decimalPart < 0.75){ num = integerPart + 0.5; }else{ num = integerPart + 1; } // ๋ณด์ •๋œ pt sAttributeValue = num + "pt"; } // --[SMARTEDITORSUS-1600] if(!sAttributeValue){ sAttributeValue = this.sDefaultText; } var elLi = this._getMatchingLI(sAttributeValue); this._clearFontSizeSelection(); if(elLi){ this.elFontSizeLabel.innerHTML = sAttributeValue; jindo.$Element(elLi).addClass("active"); }else{ this.elFontSizeLabel.innerHTML = sAttributeValue; } } }, $ON_SET_FONTSIZE : function(sFontSize){ if(!sFontSize){return;} this.oApp.exec("SET_WYSIWYG_STYLE", [{"fontSize":sFontSize}]); this.oApp.exec("HIDE_ACTIVE_LAYER", []); this.oApp.exec("CHECK_STYLE_CHANGE", []); }, _getMatchingLI : function(sFontSize){ var elLi; sFontSize = sFontSize.toLowerCase(); for(var i=0; i<this.aLIFontSizes.length; i++){ elLi = this.aLIFontSizes[i]; if(this._getFontSizeFromLI(elLi).toLowerCase() == sFontSize){return elLi;} } return null; }, _getFontSizeFromLI : function(elLi){ return elLi.firstChild.firstChild.style.fontSize; }, _clearFontSizeSelection : function(elLi){ for(var i=0; i<this.aLIFontSizes.length; i++){ jindo.$Element(this.aLIFontSizes[i]).removeClass("active"); } } }); //{ /** * @fileOverview This file contains Husky plugin that takes care of the operations related to hyperlink * @name hp_SE_Hyperlink.js */ nhn.husky.SE2M_Hyperlink = jindo.$Class({ name : "SE2M_Hyperlink", sATagMarker : "HTTP://HUSKY_TMP.MARKER/", _assignHTMLElements : function(elAppContainer){ this.oHyperlinkButton = jindo.$$.getSingle("li.husky_seditor_ui_hyperlink", elAppContainer); this.oHyperlinkLayer = jindo.$$.getSingle("div.se2_layer", this.oHyperlinkButton); this.oLinkInput = jindo.$$.getSingle("INPUT[type=text]", this.oHyperlinkLayer); this.oBtnConfirm = jindo.$$.getSingle("button.se2_apply", this.oHyperlinkLayer); this.oBtnCancel = jindo.$$.getSingle("button.se2_cancel", this.oHyperlinkLayer); //this.oCbNewWin = jindo.$$.getSingle("INPUT[type=checkbox]", this.oHyperlinkLayer) || null; }, _generateAutoLink : function(sAll, sBreaker, sURL, sWWWURL, sHTTPURL) { sBreaker = sBreaker || ""; var sResult; if (sWWWURL){ sResult = '<a href="http://'+sWWWURL+'">'+sURL+'</a>'; } else { sResult = '<a href="'+sHTTPURL+'">'+sURL+'</a>'; } return sBreaker+sResult; }, /** * [SMARTEDITORSUS-1405] ์ž๋™๋งํฌ ๋น„ํ™œ์„ฑํ™” ์˜ต์…˜์„ ์ฒดํฌํ•ด์„œ ์ฒ˜๋ฆฌํ•œ๋‹ค. * $ON_REGISTER_CONVERTERS ๋ฉ”์‹œ์ง€๊ฐ€ SE_EditingAreaManager.$ON_MSG_APP_READY ์—์„œ ์ˆ˜ํ–‰๋˜๋ฏ€๋กœ ๋จผ์ € ์ฒ˜๋ฆฌํ•œ๋‹ค. */ $BEFORE_MSG_APP_READY : function(){ var htOptions = nhn.husky.SE2M_Configuration.SE2M_Hyperlink; if(htOptions && htOptions.bAutolink === false){ // ์ž๋™๋งํฌ ์ปจ๋ฒ„ํ„ฐ ๋น„ํ™œ์„ฑํ™” this.$ON_REGISTER_CONVERTERS = null; // UI enable/disable ์ฒ˜๋ฆฌ ์ œ์™ธ this.$ON_DISABLE_MESSAGE = null; this.$ON_ENABLE_MESSAGE = null; // ๋ธŒ๋ผ์šฐ์ €์˜ ์ž๋™๋งํฌ๊ธฐ๋Šฅ ๋น„ํ™œ์„ฑํ™” try{ this.oApp.getWYSIWYGDocument().execCommand("AutoUrlDetect", false, false); } catch(e){} } }, $ON_MSG_APP_READY : function(){ this.bLayerShown = false; this.oApp.exec("REGISTER_UI_EVENT", ["hyperlink", "click", "TOGGLE_HYPERLINK_LAYER"]); this.oApp.exec("REGISTER_HOTKEY", ["ctrl+k", "TOGGLE_HYPERLINK_LAYER", []]); }, $ON_REGISTER_CONVERTERS : function(){ this.oApp.exec("ADD_CONVERTER_DOM", ["IR_TO_DB", jindo.$Fn(this.irToDb, this).bind()]); }, $LOCAL_BEFORE_FIRST : function(sMsg){ if(!!sMsg.match(/(REGISTER_CONVERTERS)/)){ this.oApp.acceptLocalBeforeFirstAgain(this, true); return true; } this._assignHTMLElements(this.oApp.htOptions.elAppContainer); this.sRXATagMarker = this.sATagMarker.replace(/\//g, "\\/").replace(/\./g, "\\."); this.oApp.registerBrowserEvent(this.oBtnConfirm, "click", "APPLY_HYPERLINK"); this.oApp.registerBrowserEvent(this.oBtnCancel, "click", "HIDE_ACTIVE_LAYER"); this.oApp.registerBrowserEvent(this.oLinkInput, "keydown", "EVENT_HYPERLINK_KEYDOWN"); }, //@lazyload_js TOGGLE_HYPERLINK_LAYER,APPLY_HYPERLINK[ $ON_TOGGLE_HYPERLINK_LAYER : function(){ if(!this.bLayerShown){ this.oApp.exec("IE_FOCUS", []); this.oSelection = this.oApp.getSelection(); } // hotkey may close the layer right away so delay here this.oApp.delayedExec("TOGGLE_TOOLBAR_ACTIVE_LAYER", [this.oHyperlinkLayer, null, "MSG_HYPERLINK_LAYER_SHOWN", [], "MSG_HYPERLINK_LAYER_HIDDEN", [""]], 0); this.oApp.exec('MSG_NOTIFY_CLICKCR', ['hyperlink']); }, $ON_MSG_HYPERLINK_LAYER_SHOWN : function(){ this.bLayerShown = true; var oAnchor = this.oSelection.findAncestorByTagName("A"); if (!oAnchor) { oAnchor = this._getSelectedNode(); } //this.oCbNewWin.checked = false; if(oAnchor && !this.oSelection.collapsed){ this.oSelection.selectNode(oAnchor); this.oSelection.select(); var sTarget = oAnchor.target; //if(sTarget && sTarget == "_blank"){this.oCbNewWin.checked = true;} // href์†์„ฑ์— ๋ฌธ์ œ๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ, ์˜ˆ: href="http://na&nbsp;&nbsp; ver.com", IE์—์„œ oAnchor.href ์ ‘๊ทผ ์‹œ์— ์•Œ์ˆ˜ ์—†๋Š” ์˜ค๋ฅ˜๋ฅผ ๋ฐœ์ƒ์‹œํ‚ด try{ var sHref = oAnchor.getAttribute("href"); this.oLinkInput.value = sHref && sHref.indexOf("#") == -1 ? sHref : "http://"; }catch(e){ this.oLinkInput.value = "http://"; } this.bModify = true; }else{ this.oLinkInput.value = "http://"; this.bModify = false; } this.oApp.delayedExec("SELECT_UI", ["hyperlink"], 0); this.oLinkInput.focus(); this.oLinkInput.value = this.oLinkInput.value; this.oLinkInput.select(); }, $ON_MSG_HYPERLINK_LAYER_HIDDEN : function(){ this.bLayerShown = false; this.oApp.exec("DESELECT_UI", ["hyperlink"]); }, _validateTarget : function() { var oNavigator = jindo.$Agent().navigator(), bReturn = true; if(oNavigator.ie) { jindo.$A(this.oSelection.getNodes(true)).forEach(function(elNode, index, array){ if(!!elNode && elNode.nodeType == 1 && elNode.tagName.toLowerCase() == "iframe" && elNode.getAttribute('s_type').toLowerCase() == "db") { bReturn = false; jindo.$A.Break(); } jindo.$A.Continue(); }, this); } return bReturn; }, $ON_APPLY_HYPERLINK : function(){ // [SMARTEDITORSUS-1451] ๊ธ€๊ฐ์— ๋งํฌ๋ฅผ ์ ์šฉํ•˜์ง€ ์•Š๋„๋ก ์ฒ˜๋ฆฌ if(!this._validateTarget()){ alert(this.oApp.$MSG("SE_Hyperlink.invalidTarget")); return; } var sURL = this.oLinkInput.value; if(!/^((http|https|ftp|mailto):(?:\/\/)?)/.test(sURL)){ sURL = "http://"+sURL; } sURL = sURL.replace(/\s+$/, ""); var oAgent = jindo.$Agent().navigator(); var sBlank = ""; this.oApp.exec("IE_FOCUS", []); if(oAgent.ie){sBlank = "<span style=\"text-decoration:none;\">&nbsp;</span>";} if(this._validateURL(sURL)){ //if(this.oCbNewWin.checked){ // if(false){ // sTarget = "_blank"; // }else{ sTarget = "_self"; //} this.oApp.exec("RECORD_UNDO_BEFORE_ACTION", ["HYPERLINK", {sSaveTarget:(this.bModify ? "A" : null)}]); var sBM; if(this.oSelection.collapsed){ var str = "<a href='" + sURL + "' target="+sTarget+">" + sURL + "</a>" + sBlank; this.oSelection.pasteHTML(str); sBM = this.oSelection.placeStringBookmark(); }else{ // ๋ธŒ๋ผ์šฐ์ €์—์„œ ์ œ๊ณตํ•˜๋Š” execcommand์— createLink๋กœ๋Š” ํƒ€๊ฒŸ์„ ์ง€์ •ํ•  ์ˆ˜๊ฐ€ ์—†๋‹ค. // ๊ทธ๋ ‡๊ธฐ ๋•Œ๋ฌธ์—, ๋”๋ฏธ URL์„ createLink์— ๋„˜๊ฒจ์„œ ๋งํฌ๋ฅผ ๋จผ์ € ๊ฑธ๊ณ , ์ดํ›„์— loop์„ ๋Œ๋ฉด์„œ ๋”๋ฏธ URL์„ ๊ฐ€์ง„ Aํƒœ๊ทธ๋ฅผ ์ฐพ์•„์„œ ์ •์ƒ URL ๋ฐ ํƒ€๊ฒŸ์„ ์„ธํŒ… ํ•ด ์ค€๋‹ค. sBM = this.oSelection.placeStringBookmark(); this.oSelection.select(); // [SMARTEDITORSUS-61] TD ์•ˆ์— ์žˆ๋Š” ํ…์ŠคํŠธ๋ฅผ ์ „์ฒด ์„ ํƒํ•˜์—ฌ URL ๋ณ€๊ฒฝํ•˜๋ฉด ์ˆ˜์ •๋˜์ง€ ์•Š์Œ (only IE8) // SE_EditingArea_WYSIWYG ์—์„œ๋Š” IE์ธ ๊ฒฝ์šฐ, beforedeactivate ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด ํ˜„์žฌ์˜ Range๋ฅผ ์ €์žฅํ•˜๊ณ , RESTORE_IE_SELECTION ๋ฉ”์‹œ์ง€๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด ์ €์žฅ๋œ Range๋ฅผ ์ ์šฉํ•œ๋‹ค. // IE8 ๋˜๋Š” IE7 ํ˜ธํ™˜๋ชจ๋“œ์ด๊ณ  TD ์•ˆ์˜ ํ…์ŠคํŠธ ์ „์ฒด๋ฅผ ์„ ํƒํ•œ ๊ฒฝ์šฐ Bookmark ์ƒ์„ฑ ํ›„์˜ select()๋ฅผ ์ฒ˜๋ฆฌํ•  ๋•Œ // HuskyRange ์—์„œ ํ˜ธ์ถœ๋˜๋Š” this._oSelection.empty(); ์—์„œ beforedeactivate ๊ฐ€ ๋ฐœ์ƒํ•˜์—ฌ empty ์ฒ˜๋ฆฌ๋œ selection ์ด ์ €์žฅ๋˜๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์–ด ๋งํฌ๊ฐ€ ์ ์šฉ๋˜์ง€ ์•Š์Œ. // ์˜ฌ๋ฐ”๋ฅธ selection ์ด ์ €์žฅ๋˜์–ด EXECCOMMAND์—์„œ ๋งํฌ๊ฐ€ ์ ์šฉ๋  ์ˆ˜ ์žˆ๋„๋ก ํ•จ if(oAgent.ie && (oAgent.version === 8 || oAgent.nativeVersion === 8)){ // nativeVersion ์œผ๋กœ IE7 ํ˜ธํ™˜๋ชจ๋“œ์ธ ๊ฒฝ์šฐ ํ™•์ธ this.oApp.exec("IE_FOCUS", []); this.oSelection.moveToBookmark(sBM); this.oSelection.select(); } // createLink ์ดํ›„์— ์ด๋ฒˆ์— ์ƒ์„ฑ๋œ A ํƒœ๊ทธ๋ฅผ ์ฐพ์„ ์ˆ˜ ์žˆ๋„๋ก nSession์„ ํฌํ•จํ•˜๋Š” ๋”๋ฏธ ๋งํฌ๋ฅผ ๋งŒ๋“ ๋‹ค. var nSession = Math.ceil(Math.random()*10000); if(sURL == ""){ // unlink this.oApp.exec("EXECCOMMAND", ["unlink"]); }else{ // createLink if(this._isExceptional()){ this.oApp.exec("EXECCOMMAND", ["unlink", false, "", {bDontAddUndoHistory: true}]); var sTempUrl = "<a href='" + sURL + "' target="+sTarget+">"; jindo.$A(this.oSelection.getNodes(true)).forEach(function(value, index, array){ var oEmptySelection = this.oApp.getEmptySelection(); if(value.nodeType === 3){ oEmptySelection.selectNode(value); oEmptySelection.pasteHTML(sTempUrl + value.nodeValue + "</a>"); }else if(value.nodeType === 1 && value.tagName === "IMG"){ oEmptySelection.selectNode(value); oEmptySelection.pasteHTML(sTempUrl + jindo.$Element(value).outerHTML() + "</a>"); } }, this); }else{ this.oApp.exec("EXECCOMMAND", ["createLink", false, this.sATagMarker+nSession+encodeURIComponent(sURL), {bDontAddUndoHistory: true}]); } } var oDoc = this.oApp.getWYSIWYGDocument(); var aATags = oDoc.body.getElementsByTagName("A"); var nLen = aATags.length; var rxMarker = new RegExp(this.sRXATagMarker+nSession, "gi"); var elATag; for(var i=0; i<nLen; i++){ elATag = aATags[i]; var sHref = ""; try{ sHref = elATag.getAttribute("href"); }catch(e){} if (sHref && sHref.match(rxMarker)) { var sNewHref = sHref.replace(rxMarker, ""); var sDecodeHref = decodeURIComponent(sNewHref); if(oAgent.ie){ jindo.$Element(elATag).attr({ "href" : sDecodeHref, "target" : sTarget }); //}else if(oAgent.firefox){ }else{ var sAContent = jindo.$Element(elATag).html(); jindo.$Element(elATag).attr({ "href" : sDecodeHref, "target" : sTarget }); if(this._validateURL(sAContent)){ jindo.$Element(elATag).html(jindo.$Element(elATag).attr("href")); } } /*else{ elATag.href = sDecodeHref; } */ } } } this.oApp.exec("HIDE_ACTIVE_LAYER"); setTimeout(jindo.$Fn(function(){ var oSelection = this.oApp.getEmptySelection(); oSelection.moveToBookmark(sBM); oSelection.collapseToEnd(); oSelection.select(); oSelection.removeStringBookmark(sBM); this.oApp.exec("FOCUS"); this.oApp.exec("RECORD_UNDO_AFTER_ACTION", ["HYPERLINK", {sSaveTarget:(this.bModify ? "A" : null)}]); }, this).bind(), 17); }else{ alert(this.oApp.$MSG("SE_Hyperlink.invalidURL")); this.oLinkInput.focus(); } }, _isExceptional : function(){ var oNavigator = jindo.$Agent().navigator(), bImg = false, bEmail = false; if(!oNavigator.ie){ return false; } // [SMARTEDITORSUS-612] ์ด๋ฏธ์ง€ ์„ ํƒ ํ›„ ๋งํฌ ์ถ”๊ฐ€ํ–ˆ์„ ๋•Œ ๋งํฌ๊ฐ€ ๊ฑธ๋ฆฌ์ง€ ์•Š๋Š” ๋ฌธ์ œ if(this.oApp.getWYSIWYGDocument().selection && this.oApp.getWYSIWYGDocument().selection.type === "None"){ bImg = jindo.$A(this.oSelection.getNodes()).some(function(value, index, array){ if(value.nodeType === 1 && value.tagName === "IMG"){ return true; } }, this); if(bImg){ return true; } } if(oNavigator.nativeVersion > 8){ // version? nativeVersion? return false; } // [SMARTEDITORSUS-579] IE8 ์ดํ•˜์—์„œ E-mail ํŒจํ„ด ๋ฌธ์ž์—ด์— URL ๋งํฌ ๋ชป๊ฑฐ๋Š” ์ด์Šˆ bEmail = jindo.$A(this.oSelection.getTextNodes()).some(function(value, index, array){ if(value.nodeValue.indexOf("@") >= 1){ return true; } }, this); if(bEmail){ return true; } return false; }, //@lazyload_js] $ON_EVENT_HYPERLINK_KEYDOWN : function(oEvent){ if (oEvent.key().enter){ this.oApp.exec("APPLY_HYPERLINK"); oEvent.stop(); } }, /** * [MUG-1265] ๋ฒ„ํŠผ์ด ์‚ฌ์šฉ๋ถˆ๊ฐ€ ์ƒํƒœ์ด๋ฉด ์ž๋™๋ณ€ํ™˜๊ธฐ๋Šฅ์„ ๋ง‰๋Š”๋‹ค. * @see http://stackoverflow.com/questions/7556007/avoid-transformation-text-to-link-ie-contenteditable-mode * IE9 ์ด์ „ ๋ฒ„์ „์€ AutoURlDetect์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†์–ด ์˜ค๋ฅ˜ ๋ฐœ์ƒ๋˜๊ธฐ ๋•Œ๋ฌธ์—, try catch๋กœ ๋ธ”๋Ÿญ ์ฒ˜๋ฆฌ(http://msdn.microsoft.com/en-us/library/aa769893%28VS.85%29.aspx) */ $ON_DISABLE_MESSAGE : function(sCmd) { if(sCmd !== "TOGGLE_HYPERLINK_LAYER"){ return; } try{ this.oApp.getWYSIWYGDocument().execCommand("AutoUrlDetect", false, false); } catch(e){} this._bDisabled = true; }, /** * [MUG-1265] ๋ฒ„ํŠผ์ด ์‚ฌ์šฉ๊ฐ€๋Šฅ ์ƒํƒœ์ด๋ฉด ์ž๋™๋ณ€ํ™˜๊ธฐ๋Šฅ์„ ๋ณต์›ํ•ด์ค€๋‹ค. */ $ON_ENABLE_MESSAGE : function(sCmd) { if(sCmd !== "TOGGLE_HYPERLINK_LAYER"){ return; } try{ this.oApp.getWYSIWYGDocument().execCommand("AutoUrlDetect", false, true); } catch(e){} this._bDisabled = false; }, irToDb : function(oTmpNode){ if(this._bDisabled){ // [MUG-1265] ๋ฒ„ํŠผ์ด ์‚ฌ์šฉ๋ถˆ๊ฐ€ ์ƒํƒœ์ด๋ฉด ์ž๋™๋ณ€ํ™˜ํ•˜์ง€ ์•Š๋Š”๋‹ค. return; } //์ €์žฅ ์‹œ์ ์— ์ž๋™ ๋งํฌ๋ฅผ ์œ„ํ•œ ํ•จ์ˆ˜. //[SMARTEDITORSUS-1207][IE][๋ฉ”์ผ] object ์‚ฝ์ž… ํ›„ ๊ธ€์„ ์ €์žฅํ•˜๋ฉด IE ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ์ฃฝ์–ด๋ฒ„๋ฆฌ๋Š” ํ˜„์ƒ //์›์ธ : ํ™•์ธ ๋ถˆ๊ฐ€. IE ์ €์ž‘๊ถŒ ๊ด€๋ จ ์ด์Šˆ๋กœ ์ถ”์ • //ํ•ด๊ฒฐ : contents๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” div ํƒœ๊ทธ๋ฅผ ์ด ํ•จ์ˆ˜ ๋‚ด๋ถ€์—์„œ ๋ณต์‚ฌํ•˜์—ฌ ์ˆ˜์ • ํ›„ call by reference๋กœ ๋„˜์–ด์˜จ ๋ณ€์ˆ˜์˜ innerHTML์„ ๋ณ€๊ฒฝ var oCopyNode = oTmpNode.cloneNode(true); try{ oCopyNode.innerHTML; }catch(e) { oCopyNode = jindo.$(oTmpNode.outerHTML); } var oTmpRange = this.oApp.getEmptySelection(); var elFirstNode = oTmpRange._getFirstRealChild(oCopyNode); var elLastNode = oTmpRange._getLastRealChild(oCopyNode); var waAllNodes = jindo.$A(oTmpRange._getNodesBetween(elFirstNode, elLastNode)); var aAllTextNodes = waAllNodes.filter(function(elNode){return (elNode && elNode.nodeType === 3);}).$value(); var a = aAllTextNodes; /* // ํ…์ŠคํŠธ ๊ฒ€์ƒ‰์ด ์šฉ์ด ํ•˜๋„๋ก ๋Š์–ด์ง„ ํ…์ŠคํŠธ ๋…ธ๋“œ๊ฐ€ ์žˆ์œผ๋ฉด ํ•ฉ์ณ์คŒ. (ํ™”๋ฉด์ƒ์œผ๋กœ ABC๋ผ๊ณ  ๋ณด์ด๋‚˜ ์ƒํ™ฉ์— ๋”ฐ๋ผ ์‹ค์ œ 2๊ฐœ์˜ ํ…์ŠคํŠธ A, BC๋กœ ์ด๋ฃจ์–ด์ ธ ์žˆ์„ ์ˆ˜ ์žˆ์Œ. ์ด๋ฅผ ABC ํ•˜๋‚˜์˜ ๋…ธ๋“œ๋กœ ๋งŒ๋“ค์–ด ์คŒ.) // ๋ฌธ์ œ ๋ฐœ์ƒ ๊ฐ€๋Šฅ์„ฑ์— ๋น„ํ•ด์„œ ํผํฌ๋จผ์Šค๋‚˜ ์‚ฌ์ด๋“œ ์ดํŽ™ํŠธ ๊ฐ€๋Šฅ์„ฑ ๋†’์•„ ์ผ๋‹จ ์ฃผ์„ var aCleanTextNodes = []; for(var i=0, nLen=aAllTextNodes.length; i<nLen; i++){ if(a[i].nextSibling && a[i].nextSibling.nodeType === 3){ a[i].nextSibling.nodeValue += a[i].nodeValue; a[i].parentNode.removeChild(a[i]); }else{ aCleanTextNodes[aCleanTextNodes.length] = a[i]; } } */ var aCleanTextNodes = aAllTextNodes; // IE์—์„œ PRE๋ฅผ ์ œ์™ธํ•œ ๋‹ค๋ฅธ ํƒœ๊ทธ ํ•˜์œ„์— ์žˆ๋Š” ํ…์ŠคํŠธ ๋…ธ๋“œ๋Š” ์ค„๋ฐ”๊ฟˆ ๋“ฑ์˜ ๊ฐ’์„ ๋ณ€์งˆ์‹œํ‚ด var elTmpDiv = this.oApp.getWYSIWYGDocument().createElement("DIV"); var elParent, bAnchorFound; var sTmpStr = "@"+(new Date()).getTime()+"@"; var rxTmpStr = new RegExp(sTmpStr, "g"); for(var i=0, nLen=aAllTextNodes.length; i<nLen; i++){ // Anchor๊ฐ€ ์ด๋ฏธ ๊ฑธ๋ ค ์žˆ๋Š” ํ…์ŠคํŠธ์ด๋ฉด ๋งํฌ๋ฅผ ๋‹ค์‹œ ๊ฑธ์ง€ ์•Š์Œ. elParent = a[i].parentNode; bAnchorFound = false; while(elParent){ if(elParent.tagName === "A" || elParent.tagName === "PRE"){ bAnchorFound = true; break; } elParent = elParent.parentNode; } if(bAnchorFound){ continue; } // www.๋˜๋Š” http://์œผ๋กœ ์‹œ์ž‘ํ•˜๋Š” ํ…์ŠคํŠธ์— ๋งํฌ ๊ฑธ์–ด ์คŒ // IE์—์„œ ํ…์ŠคํŠธ ๋…ธ๋“œ ์•ž์ชฝ์˜ ์ŠคํŽ˜์ด์Šค๋‚˜ ์ฃผ์„๋“ฑ์ด ์‚ฌ๋ผ์ง€๋Š” ํ˜„์ƒ์ด ์žˆ์–ด sTmpStr์„ ์•ž์— ๋ถ™์—ฌ์คŒ. elTmpDiv.innerHTML = ""; try { elTmpDiv.appendChild(a[i].cloneNode(true)); // IE์—์„œ innerHTML๋ฅผ ์ด์šฉ ํ•ด ์ง์ ‘ ํ…์ŠคํŠธ ๋…ธ๋“œ ๊ฐ’์„ ํ• ๋‹น ํ•  ๊ฒฝ์šฐ ์ค„๋ฐ”๊ฟˆ๋“ฑ์ด ๊นจ์งˆ ์ˆ˜ ์žˆ์–ด, ํ…์ŠคํŠธ ๋…ธ๋“œ๋กœ ๋งŒ๋“ค์–ด์„œ ์ด๋ฅผ ๋ฐ”๋กœ append ์‹œ์ผœ์คŒ elTmpDiv.innerHTML = (sTmpStr+elTmpDiv.innerHTML).replace(/(&nbsp|\s)?(((?!http:\/\/)www\.(?:(?!\&nbsp;|\s|"|').)+)|(http:\/\/(?:(?!&nbsp;|\s|"|').)+))/ig, this._generateAutoLink); // innerHTML ๋‚ด์— ํ…์ŠคํŠธ๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ insert ์‹œ์— ์ฃผ๋ณ€ ํ…์ŠคํŠธ ๋…ธ๋“œ์™€ ํ•ฉ์ณ์ง€๋Š” ํ˜„์ƒ์ด ์žˆ์–ด div๋กœ ์œ„์น˜๋ฅผ ๋จผ์ € ์žก๊ณ  ํ•˜๋‚˜์”ฉ ์‚ฝ์ž… a[i].parentNode.insertBefore(elTmpDiv, a[i]); a[i].parentNode.removeChild(a[i]); } catch(e1) { } while(elTmpDiv.firstChild){ elTmpDiv.parentNode.insertBefore(elTmpDiv.firstChild, elTmpDiv); } elTmpDiv.parentNode.removeChild(elTmpDiv); // alert(a[i].nodeValue); } elTmpDiv = oTmpRange = elFirstNode = elLastNode = waAllNodes = aAllTextNodes = a = aCleanTextNodes = elParent = null; oCopyNode.innerHTML = oCopyNode.innerHTML.replace(rxTmpStr, ""); oTmpNode.innerHTML = oCopyNode.innerHTML; oCopyNode = null; //alert(oTmpNode.innerHTML); }, _getSelectedNode : function(){ var aNodes = this.oSelection.getNodes(); for (var i = 0; i < aNodes.length; i++) { if (aNodes[i].tagName && aNodes[i].tagName == "A") { return aNodes[i]; } } }, _validateURL : function(sURL){ if(!sURL){return false;} // escape ๋ถˆ๊ฐ€๋Šฅํ•œ %๊ฐ€ ๋“ค์–ด์žˆ๋‚˜ ํ™•์ธ try{ var aURLParts = sURL.split("?"); aURLParts[0] = aURLParts[0].replace(/%[a-z0-9]{2}/gi, "U"); decodeURIComponent(aURLParts[0]); }catch(e){ return false; } return /^(http|https|ftp|mailto):(\/\/)?(([-๊ฐ€-ํžฃ]|\w)+(?:[\/\.:@]([-๊ฐ€-ํžฃ]|\w)+)+)\/?(.*)?\s*$/i.test(sURL); } }); //} //{ /** * @fileOverview This file contains Husky plugin that takes care of the operations related to changing the lineheight using layer * @name hp_SE2M_LineHeightWithLayerUI.js */ nhn.husky.SE2M_LineHeightWithLayerUI = jindo.$Class({ name : "SE2M_LineHeightWithLayerUI", MIN_LINE_HEIGHT : 50, $ON_MSG_APP_READY : function(){ this.oApp.exec("REGISTER_UI_EVENT", ["lineHeight", "click", "SE2M_TOGGLE_LINEHEIGHT_LAYER"]); }, //@lazyload_js SE2M_TOGGLE_LINEHEIGHT_LAYER[ _assignHTMLObjects : function(elAppContainer) { //this.elLineHeightSelect = jindo.$$.getSingle("SELECT.husky_seditor_ui_lineHeight_select", elAppContainer); this.oDropdownLayer = jindo.$$.getSingle("DIV.husky_se2m_lineHeight_layer", elAppContainer); this.aLIOptions = jindo.$A(jindo.$$("LI", this.oDropdownLayer)).filter(function(v,i,a){return (v.firstChild !== null);})._array; this.oInput = jindo.$$.getSingle("INPUT", this.oDropdownLayer); var tmp = jindo.$$.getSingle(".husky_se2m_lineHeight_direct_input", this.oDropdownLayer); tmp = jindo.$$("BUTTON", tmp); this.oBtn_up = tmp[0]; this.oBtn_down = tmp[1]; this.oBtn_ok = tmp[2]; this.oBtn_cancel = tmp[3]; }, $LOCAL_BEFORE_FIRST : function(){ this._assignHTMLObjects(this.oApp.htOptions.elAppContainer); this.oApp.exec("SE2_ATTACH_HOVER_EVENTS", [this.aLIOptions]); for(var i=0; i<this.aLIOptions.length; i++){ this.oApp.registerBrowserEvent(this.aLIOptions[i], "click", "SET_LINEHEIGHT_FROM_LAYER_UI", [this._getLineHeightFromLI(this.aLIOptions[i])]); } this.oApp.registerBrowserEvent(this.oBtn_up, "click", "SE2M_INC_LINEHEIGHT", []); this.oApp.registerBrowserEvent(this.oBtn_down, "click", "SE2M_DEC_LINEHEIGHT", []); this.oApp.registerBrowserEvent(this.oBtn_ok, "click", "SE2M_SET_LINEHEIGHT_FROM_DIRECT_INPUT", []); this.oApp.registerBrowserEvent(this.oBtn_cancel, "click", "SE2M_CANCEL_LINEHEIGHT", []); this.oApp.registerBrowserEvent(this.oInput, "keydown", "EVENT_SE2M_LINEHEIGHT_KEYDOWN"); }, $ON_EVENT_SE2M_LINEHEIGHT_KEYDOWN : function(oEvent){ if (oEvent.key().enter){ this.oApp.exec("SE2M_SET_LINEHEIGHT_FROM_DIRECT_INPUT"); oEvent.stop(); } }, $ON_SE2M_TOGGLE_LINEHEIGHT_LAYER : function(){ this.oApp.exec("TOGGLE_TOOLBAR_ACTIVE_LAYER", [this.oDropdownLayer, null, "LINEHEIGHT_LAYER_SHOWN", [], "LINEHEIGHT_LAYER_HIDDEN", []]); this.oApp.exec('MSG_NOTIFY_CLICKCR', ['lineheight']); }, $ON_SE2M_INC_LINEHEIGHT : function(){ this.oInput.value = parseInt(this.oInput.value, 10) || this.MIN_LINE_HEIGHT; this.oInput.value++; }, $ON_SE2M_DEC_LINEHEIGHT : function(){ this.oInput.value = parseInt(this.oInput.value, 10) || this.MIN_LINE_HEIGHT; if(this.oInput.value > this.MIN_LINE_HEIGHT){this.oInput.value--;} }, $ON_LINEHEIGHT_LAYER_SHOWN : function(){ this.oApp.exec("SELECT_UI", ["lineHeight"]); this.oInitialSelection = this.oApp.getSelection(); var nLineHeight = this.oApp.getLineStyle("lineHeight"); if(nLineHeight != null && nLineHeight !== 0){ this.oInput.value = (nLineHeight*100).toFixed(0); var elLi = this._getMatchingLI(this.oInput.value+"%"); if(elLi){jindo.$Element(elLi.firstChild).addClass("active");} }else{ this.oInput.value = ""; } }, $ON_LINEHEIGHT_LAYER_HIDDEN : function(){ this.oApp.exec("DESELECT_UI", ["lineHeight"]); this._clearOptionSelection(); }, $ON_SE2M_SET_LINEHEIGHT_FROM_DIRECT_INPUT : function(){ var nInputValue = parseInt(this.oInput.value, 10); var sValue = (nInputValue < this.MIN_LINE_HEIGHT) ? this.MIN_LINE_HEIGHT : nInputValue; this._setLineHeightAndCloseLayer(sValue); }, $ON_SET_LINEHEIGHT_FROM_LAYER_UI : function(sValue){ this._setLineHeightAndCloseLayer(sValue); }, $ON_SE2M_CANCEL_LINEHEIGHT : function(){ this.oInitialSelection.select(); this.oApp.exec("HIDE_ACTIVE_LAYER"); }, _setLineHeightAndCloseLayer : function(sValue){ var nLineHeight = parseInt(sValue, 10)/100; if(nLineHeight>0){ this.oApp.exec("SET_LINE_STYLE", ["lineHeight", nLineHeight]); }else{ alert(this.oApp.$MSG("SE_LineHeight.invalidLineHeight")); } this.oApp.exec("SE2M_TOGGLE_LINEHEIGHT_LAYER", []); var oNavigator = jindo.$Agent().navigator(); if(oNavigator.chrome || oNavigator.safari){ this.oApp.exec("FOCUS"); // [SMARTEDITORSUS-654] } }, _getMatchingLI : function(sValue){ var elLi; sValue = sValue.toLowerCase(); for(var i=0; i<this.aLIOptions.length; i++){ elLi = this.aLIOptions[i]; if(this._getLineHeightFromLI(elLi).toLowerCase() == sValue){return elLi;} } return null; }, _getLineHeightFromLI : function(elLi){ return elLi.firstChild.firstChild.innerHTML; }, _clearOptionSelection : function(elLi){ for(var i=0; i<this.aLIOptions.length; i++){ jindo.$Element(this.aLIOptions[i].firstChild).removeClass("active"); } } //@lazyload_js] }); //} //{ /** * @fileOverview This file contains Husky plugin that takes care of the operations related to setting/changing the line style * @name hp_SE_LineStyler.js */ nhn.husky.SE2M_LineStyler = jindo.$Class({ name : "SE2M_LineStyler", $BEFORE_MSG_APP_READY : function() { this.oApp.exec("ADD_APP_PROPERTY", ["getLineStyle", jindo.$Fn(this.getLineStyle, this).bind()]); }, //SMARTEDITORSUS-987 SE2M_TOGGLE_LINEHEIGHT_LAYER,SET_LINE_STYLE ๋™์  ๋กœ๋”ฉ ์ œ๊ฑฐ $ON_SE2M_TOGGLE_LINEHEIGHT_LAYER : function(){ this.oApp.exec("ADD_APP_PROPERTY", ["getLineStyle", jindo.$Fn(this.getLineStyle, this).bind()]); }, $ON_SET_LINE_STYLE : function(sStyleName, styleValue, htOptions){ this.oSelection = this.oApp.getSelection(); var nodes = this._getSelectedNodes(false); this.setLineStyle(sStyleName, styleValue, htOptions, nodes); this.oApp.exec("CHECK_STYLE_CHANGE", []); }, $ON_SET_LINE_BLOCK_STYLE : function(sStyleName, styleValue, htOptions){ this.oSelection = this.oApp.getSelection(); this.setLineBlockStyle(sStyleName, styleValue, htOptions); this.oApp.exec("CHECK_STYLE_CHANGE", []); }, getLineStyle : function(sStyle){ var nodes = this._getSelectedNodes(false); var curWrapper, prevWrapper; var sCurStyle, sStyleValue; if(nodes.length === 0){return null;} var iLength = nodes.length; if(iLength === 0){ sStyleValue = null; }else{ prevWrapper = this._getLineWrapper(nodes[0]); sStyleValue = this._getWrapperLineStyle(sStyle, prevWrapper); } var firstNode = this.oSelection.getStartNode(); if(sStyleValue != null){ for(var i=1; i<iLength; i++){ if(this._isChildOf(nodes[i], curWrapper)){continue;} if(!nodes[i]){continue;} curWrapper = this._getLineWrapper(nodes[i]); if(curWrapper == prevWrapper){continue;} sCurStyle = this._getWrapperLineStyle(sStyle, curWrapper); if(sCurStyle != sStyleValue){ sStyleValue = null; break; } prevWrapper = curWrapper; } } curWrapper = this._getLineWrapper(nodes[iLength-1]); var lastNode = this.oSelection.getEndNode(); selectText = jindo.$Fn(function(firstNode, lastNode){ this.oSelection.setEndNodes(firstNode, lastNode); this.oSelection.select(); this.oApp.exec("CHECK_STYLE_CHANGE", []); }, this).bind(firstNode, lastNode); setTimeout(selectText, 0); return sStyleValue; }, // height in percentage. For example pass 1 to set the line height to 100% and 1.5 to set it to 150% setLineStyle : function(sStyleName, styleValue, htOptions, nodes){ thisRef = this; var bWrapperCreated = false; function _setLineStyle(div, sStyleName, styleValue){ if(!div){ bWrapperCreated = true; // try to wrap with P first try{ div = thisRef.oSelection.surroundContentsWithNewNode("P"); // if the range contains a block-level tag, wrap it with a DIV }catch(e){ div = thisRef.oSelection.surroundContentsWithNewNode("DIV"); } } if(typeof styleValue == "function"){ styleValue(div); }else{ div.style[sStyleName] = styleValue; } if(div.childNodes.length === 0){ div.innerHTML = "&nbsp;"; } return div; } function isInBody(node){ while(node && node.tagName != "BODY"){ node = nhn.DOMFix.parentNode(node); } if(!node){return false;} return true; } if(nodes.length === 0){ return; } var curWrapper, prevWrapper; var iLength = nodes.length; if((!htOptions || !htOptions["bDontAddUndoHistory"])){ this.oApp.exec("RECORD_UNDO_BEFORE_ACTION", ["LINE STYLE"]); } prevWrapper = this._getLineWrapper(nodes[0]); prevWrapper = _setLineStyle(prevWrapper, sStyleName, styleValue); var startNode = prevWrapper; var endNode = prevWrapper; for(var i=1; i<iLength; i++){ // Skip the node if a copy of the node were wrapped and the actual node no longer exists within the document. try{ if(!isInBody(nhn.DOMFix.parentNode(nodes[i]))){continue;} }catch(e){continue;} if(this._isChildOf(nodes[i], curWrapper)){continue;} curWrapper = this._getLineWrapper(nodes[i]); if(curWrapper == prevWrapper){continue;} curWrapper = _setLineStyle(curWrapper, sStyleName, styleValue); prevWrapper = curWrapper; } endNode = curWrapper || startNode; if(bWrapperCreated && (!htOptions || !htOptions.bDoNotSelect)) { setTimeout(jindo.$Fn(function(startNode, endNode, htOptions){ if(startNode == endNode){ this.oSelection.selectNodeContents(startNode); if(startNode.childNodes.length==1 && startNode.firstChild.tagName == "BR"){ this.oSelection.collapseToStart(); } }else{ this.oSelection.setEndNodes(startNode, endNode); } this.oSelection.select(); if((!htOptions || !htOptions["bDontAddUndoHistory"])){ this.oApp.exec("RECORD_UNDO_AFTER_ACTION", ["LINE STYLE"]); } }, this).bind(startNode, endNode, htOptions), 0); } }, /** * Block Style ์ ์šฉ */ setLineBlockStyle : function(sStyleName, styleValue, htOptions) { var htSelectedTDs = {}; //var aTempNodes = aTextnodes = []; var aTempNodes = []; var aTextnodes = []; this.oApp.exec("GET_SELECTED_TD_BLOCK",['aTdCells',htSelectedTDs]); var aNodes = htSelectedTDs.aTdCells; for( var j = 0; j < aNodes.length ; j++){ this.oSelection.selectNode(aNodes[j]); aTempNodes = this.oSelection.getNodes(); for(var k = 0, m = 0; k < aTempNodes.length ; k++){ if(aTempNodes[k].nodeType == 3 || (aTempNodes[k].tagName == "BR" && k == 0)) { aTextnodes[m] = aTempNodes[k]; m ++; } } this.setLineStyle(sStyleName, styleValue, htOptions, aTextnodes); aTempNodes = aTextnodes = []; } }, getTextNodes : function(bSplitTextEndNodes, oSelection){ var txtFilter = function(oNode){ // ํŽธ์ง‘ ์ค‘์— ์ƒ๊ฒจ๋‚œ ๋นˆ LI/P์—๋„ ์Šคํƒ€์ผ ๋จน์ด๋„๋ก ํฌํ•จํ•จ if((oNode.nodeType == 3 && oNode.nodeValue != "\n" && oNode.nodeValue != "") || (oNode.tagName == "LI" && oNode.innerHTML == "") || (oNode.tagName == "P" && oNode.innerHTML == "")){ return true; }else{ return false; } }; return oSelection.getNodes(bSplitTextEndNodes, txtFilter); }, _getSelectedNodes : function(bDontUpdate){ if(!bDontUpdate){ this.oSelection = this.oApp.getSelection(); } // ํŽ˜์ด์ง€ ์ตœํ•˜๋‹จ์— ๋นˆ LI ์žˆ์„ ๊ฒฝ์šฐ ํ•ด๋‹น LI ํฌํ•จํ•˜๋„๋ก expand if(this.oSelection.endContainer.tagName == "LI" && this.oSelection.endOffset == 0 && this.oSelection.endContainer.innerHTML == ""){ this.oSelection.setEndAfter(this.oSelection.endContainer); } if(this.oSelection.collapsed){this.oSelection.selectNode(this.oSelection.commonAncestorContainer);} //var nodes = this.oSelection.getTextNodes(); var nodes = this.getTextNodes(false, this.oSelection); if(nodes.length === 0){ var tmp = this.oSelection.getStartNode(); if(tmp){ nodes[0] = tmp; }else{ var elTmp = this.oSelection._document.createTextNode("\u00A0"); this.oSelection.insertNode(elTmp); nodes = [elTmp]; } } return nodes; }, _getWrapperLineStyle : function(sStyle, div){ var sStyleValue = null; if(div && div.style[sStyle]){ sStyleValue = div.style[sStyle]; }else{ div = this.oSelection.commonAncesterContainer; while(div && !this.oSelection.rxLineBreaker.test(div.tagName)){ if(div && div.style[sStyle]){ sStyleValue = div.style[sStyle]; break; } div = nhn.DOMFix.parentNode(div); } } return sStyleValue; }, _isChildOf : function(node, container){ while(node && node.tagName != "BODY"){ if(node == container){return true;} node = nhn.DOMFix.parentNode(node); } return false; }, _getLineWrapper : function(node){ var oTmpSelection = this.oApp.getEmptySelection(); oTmpSelection.selectNode(node); var oLineInfo = oTmpSelection.getLineInfo(); var oStart = oLineInfo.oStart; var oEnd = oLineInfo.oEnd; var a, b; var breakerA, breakerB; var div = null; a = oStart.oNode; breakerA = oStart.oLineBreaker; b = oEnd.oNode; breakerB = oEnd.oLineBreaker; this.oSelection.setEndNodes(a, b); if(breakerA == breakerB){ if(breakerA.tagName == "P" || breakerA.tagName == "DIV" || breakerA.tagName == "LI"){ // if(breakerA.tagName == "P" || breakerA.tagName == "DIV"){ div = breakerA; }else{ this.oSelection.setEndNodes(breakerA.firstChild, breakerA.lastChild); } } return div; } }); //} //{ /** * @fileOverview This file contains Husky plugin that takes care of the operations related to detecting the style change * @name hp_SE_WYSIWYGStyleGetter.js */ nhn.husky.SE_WYSIWYGStyleGetter = jindo.$Class({ name : "SE_WYSIWYGStyleGetter", hKeyUp : null, getStyleInterval : 200, oStyleMap : { fontFamily : { type : "Value", css : "fontFamily" }, fontSize : { type : "Value", css : "fontSize" }, lineHeight : { type : "Value", css : "lineHeight", converter : function(sValue, oStyle){ if(!sValue.match(/px$/)){ return sValue; } return Math.ceil((parseInt(sValue, 10)/parseInt(oStyle.fontSize, 10))*10)/10; } }, bold : { command : "bold" }, underline : { command : "underline" }, italic : { command : "italic" }, lineThrough : { command : "strikethrough" }, superscript : { command : "superscript" }, subscript : { command : "subscript" }, justifyleft : { command : "justifyleft" }, justifycenter : { command : "justifycenter" }, justifyright : { command : "justifyright" }, justifyfull : { command : "justifyfull" }, orderedlist : { command : "insertorderedlist" }, unorderedlist : { command : "insertunorderedlist" } }, $init : function(){ this.oStyle = this._getBlankStyle(); }, $LOCAL_BEFORE_ALL : function(){ return (this.oApp.getEditingMode() == "WYSIWYG"); }, $ON_MSG_APP_READY : function(){ this.oDocument = this.oApp.getWYSIWYGDocument(); this.oApp.exec("ADD_APP_PROPERTY", ["getCurrentStyle", jindo.$Fn(this.getCurrentStyle, this).bind()]); if(jindo.$Agent().navigator().safari || jindo.$Agent().navigator().chrome || jindo.$Agent().navigator().ie){ this.oStyleMap.textAlign = { type : "Value", css : "textAlign" }; } }, $ON_EVENT_EDITING_AREA_MOUSEUP : function(oEvnet){ /* if(this.hKeyUp){ clearTimeout(this.hKeyUp); } this.oApp.delayedExec("CHECK_STYLE_CHANGE", [], 100); */ this.oApp.exec("CHECK_STYLE_CHANGE"); }, $ON_EVENT_EDITING_AREA_KEYPRESS : function(oEvent){ // ctrl+a in FF triggers keypress event with keyCode 97, other browsers don't throw keypress event for ctrl+a var oKeyInfo; if(this.oApp.oNavigator.firefox){ oKeyInfo = oEvent.key(); if(oKeyInfo.ctrl && oKeyInfo.keyCode == 97){ return; } } if(this.bAllSelected){ this.bAllSelected = false; return; } /* // queryCommandState often fails to return correct result for Korean/Enter. So just ignore them. if(this.oApp.oNavigator.firefox && (oKeyInfo.keyCode == 229 || oKeyInfo.keyCode == 13)){ return; } */ this.oApp.exec("CHECK_STYLE_CHANGE"); //this.oApp.delayedExec("CHECK_STYLE_CHANGE", [], 0); }, $ON_EVENT_EDITING_AREA_KEYDOWN : function(oEvent){ var oKeyInfo = oEvent.key(); // ctrl+a if((this.oApp.oNavigator.ie || this.oApp.oNavigator.firefox) && oKeyInfo.ctrl && oKeyInfo.keyCode == 65){ this.oApp.exec("RESET_STYLE_STATUS"); this.bAllSelected = true; return; } /* backspace 8 enter 13 page up 33 page down 34 end 35 home 36 left arrow 37 up arrow 38 right arrow 39 down arrow 40 insert 45 delete 46 */ // other key strokes are taken care by keypress event if(!(oKeyInfo.keyCode == 8 || (oKeyInfo.keyCode >= 33 && oKeyInfo.keyCode <= 40) || oKeyInfo.keyCode == 45 || oKeyInfo.keyCode == 46)) return; // take care of ctrl+a -> delete/bksp sequence if(this.bAllSelected){ // firefox will throw both keydown and keypress events for those input(keydown first), so let keypress take care of them if(this.oApp.oNavigator.firefox){ return; } this.bAllSelected = false; return; } this.oApp.exec("CHECK_STYLE_CHANGE"); }, $ON_CHECK_STYLE_CHANGE : function(){ this._getStyle(); }, $ON_RESET_STYLE_STATUS : function(){ this.oStyle = this._getBlankStyle(); var oBodyStyle = this._getStyleOf(this.oApp.getWYSIWYGDocument().body); this.oStyle.fontFamily = oBodyStyle.fontFamily; this.oStyle.fontSize = oBodyStyle.fontSize; this.oStyle["justifyleft"]="@^"; for(var sAttributeName in this.oStyle){ //this.oApp.exec("SET_STYLE_STATUS", [sAttributeName, this.oStyle[sAttributeName]]); this.oApp.exec("MSG_STYLE_CHANGED", [sAttributeName, this.oStyle[sAttributeName]]); } }, getCurrentStyle : function(){ return this.oStyle; }, _check_style_change : function(){ this.oApp.exec("CHECK_STYLE_CHANGE", []); }, _getBlankStyle : function(){ var oBlankStyle = {}; for(var attributeName in this.oStyleMap){ if(this.oStyleMap[attributeName].type == "Value"){ oBlankStyle[attributeName] = ""; }else{ oBlankStyle[attributeName] = 0; } } return oBlankStyle; }, _getStyle : function(){ var oStyle; if(nhn.CurrentSelection.isCollapsed()){ oStyle = this._getStyleOf(nhn.CurrentSelection.getCommonAncestorContainer()); }else{ var oSelection = this.oApp.getSelection(); var funcFilter = function(oNode){ if (!oNode.childNodes || oNode.childNodes.length == 0) return true; else return false; } var aBottomNodes = oSelection.getNodes(false, funcFilter); if(aBottomNodes.length == 0){ oStyle = this._getStyleOf(oSelection.commonAncestorContainer); }else{ oStyle = this._getStyleOf(aBottomNodes[0]); } } for(attributeName in oStyle){ if(this.oStyleMap[attributeName].converter){ oStyle[attributeName] = this.oStyleMap[attributeName].converter(oStyle[attributeName], oStyle); } if(this.oStyle[attributeName] != oStyle[attributeName]){ this.oApp.exec("MSG_STYLE_CHANGED", [attributeName, oStyle[attributeName]]); } } this.oStyle = oStyle; }, _getStyleOf : function(oNode){ var oStyle = this._getBlankStyle(); // this must not happen if(!oNode){ return oStyle; } if( oNode.nodeType == 3 ){ oNode = oNode.parentNode; }else if( oNode.nodeType == 9 ){ //document์—๋Š” css๋ฅผ ์ ์šฉํ•  ์ˆ˜ ์—†์Œ. oNode = oNode.body; } var welNode = jindo.$Element(oNode); var attribute, cssName; for(var styleName in this.oStyle){ attribute = this.oStyleMap[styleName]; if(attribute.type && attribute.type == "Value"){ try{ if(attribute.css){ var sValue = welNode.css(attribute.css); if(styleName == "fontFamily"){ sValue = sValue.split(/,/)[0]; } oStyle[styleName] = sValue; } else if(attribute.command){ oStyle[styleName] = this.oDocument.queryCommandState(attribute.command); } else { // todo } }catch(e){} }else{ if(attribute.command){ try{ if(this.oDocument.queryCommandState(attribute.command)){ oStyle[styleName] = "@^"; }else{ oStyle[styleName] = "@-"; } }catch(e){} }else{ // todo } } } switch(oStyle["textAlign"]){ case "left": oStyle["justifyleft"]="@^"; break; case "center": oStyle["justifycenter"]="@^"; break; case "right": oStyle["justifyright"]="@^"; break; case "justify": oStyle["justifyfull"]="@^"; break; } // IE์—์„œ๋Š” ๊ธฐ๋ณธ ์ •๋ ฌ์ด queryCommandState๋กœ ๋„˜์–ด์˜ค์ง€ ์•Š์•„์„œ ์ •๋ ฌ์ด ์—†๋‹ค๋ฉด, ์™ผ์ชฝ ์ •๋ ฌ๋กœ ๊ฐ€์ •ํ•จ if(oStyle["justifyleft"]=="@-" && oStyle["justifycenter"]=="@-" && oStyle["justifyright"]=="@-" && oStyle["justifyfull"]=="@-"){oStyle["justifyleft"]="@^";} return oStyle; } }); //} //{ /** * @fileOverview This file contains Husky plugin that takes care of the operations related to styling the font * @name hp_SE_WYSIWYGStyler.js * @required SE_EditingArea_WYSIWYG, HuskyRangeManager */ nhn.husky.SE_WYSIWYGStyler = jindo.$Class({ name : "SE_WYSIWYGStyler", _sZWSP : "\u200B", // ZWNBSP(\uFEFF) ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด IE9 ์ด์ƒ์˜ ๊ฒฝ์šฐ ๋†’์ด๊ฐ’์„ ๊ฐ–์ง€ ๋ชปํ•ด ์ปค์„œ์œ„์น˜๊ฐ€ ์ด์ƒํ•จ [SMARTEDITORSUS-178] $init : function(){ var htBrowser = jindo.$Agent().navigator(); if(!htBrowser.ie || htBrowser.nativeVersion < 9 || document.documentMode < 9){ this._addCursorHolder = function(){}; } }, _addCursorHolder : function(oSelection, oSpan){ var oBody = this.oApp.getWYSIWYGDocument().body, oAncestor, welSpan = jindo.$Element(oSpan), sHtml, tmpTextNode; sHtml = oBody.innerHTML; oAncestor = oBody; if(sHtml === welSpan.outerHTML()){ tmpTextNode = oSelection._document.createTextNode(this._sZWSP); oAncestor.appendChild(tmpTextNode); return; } oAncestor = nhn.husky.SE2M_Utils.findAncestorByTagName("P", oSpan); if(!oAncestor){ return; } sHtml = oAncestor.innerHTML; if(sHtml.indexOf("&nbsp;") > -1){ return; } tmpTextNode = oSelection._document.createTextNode(this._sZWSP); oAncestor.appendChild(tmpTextNode); }, $PRECONDITION : function(sFullCommand, aArgs){ return (this.oApp.getEditingMode() == "WYSIWYG"); }, $ON_SET_WYSIWYG_STYLE : function(oStyles){ var oSelection = this.oApp.getSelection(); var htSelectedTDs = {}; this.oApp.exec("IS_SELECTED_TD_BLOCK",['bIsSelectedTd',htSelectedTDs]); var bSelectedBlock = htSelectedTDs.bIsSelectedTd; // style cursor or !(selected block) if(oSelection.collapsed && !bSelectedBlock){ this.oApp.exec("RECORD_UNDO_ACTION", ["FONT STYLE", {bMustBlockElement : true}]); var oSpan, bNewSpan = false; var elCAC = oSelection.commonAncestorContainer; //var elCAC = nhn.CurrentSelection.getCommonAncestorContainer(); if(elCAC.nodeType == 3){ elCAC = elCAC.parentNode; } // [SMARTEDITORSUS-1648] SPAN > ๊ตต๊ฒŒ/๋ฐ‘์ค„/๊ธฐ์šธ๋ฆผ/์ทจ์†Œ์„ ์ด ์žˆ๋Š” ๊ฒฝ์šฐ, ์ƒ์œ„ SPAN์„ ์ฐพ๋Š”๋‹ค. if(elCAC && oSelection._rxCursorHolder.test(elCAC.innerHTML)){ oSpan = oSelection._findParentSingleSpan(elCAC); } // ์Šคํƒ€์ผ์„ ์ ์šฉํ•  SPAN์ด ์—†์œผ๋ฉด ์ƒˆ๋กœ ์ƒ์„ฑ if(!oSpan){ oSpan = this.oApp.getWYSIWYGDocument().createElement("SPAN"); oSpan.innerHTML = this._sZWSP; bNewSpan = true; }else if(oSpan.innerHTML == ""){ // ๋‚ด์šฉ์ด ์•„์˜ˆ ์—†์œผ๋ฉด ํฌ๋กฌ์—์„œ ์ปค์„œ๊ฐ€ ์œ„์น˜ํ•˜์ง€ ๋ชปํ•จ oSpan.innerHTML = this._sZWSP; } var sValue; for(var sName in oStyles){ sValue = oStyles[sName]; if(typeof sValue != "string"){ continue; } oSpan.style[sName] = sValue; } if(bNewSpan){ if(oSelection.startContainer.tagName == "BODY" && oSelection.startOffset === 0){ var oVeryFirstNode = oSelection._getVeryFirstRealChild(this.oApp.getWYSIWYGDocument().body); var bAppendable = true; var elTmp = oVeryFirstNode.cloneNode(false); // some browsers may throw an exception for trying to set the innerHTML of BR/IMG tags try{ elTmp.innerHTML = "test"; if(elTmp.innerHTML != "test"){ bAppendable = false; } }catch(e){ bAppendable = false; } if(bAppendable && elTmp.nodeType == 1 && elTmp.tagName == "BR"){// [SMARTEDITORSUS-311] [FF4] Cursor Holder ์ธ BR ์˜ ํ•˜์œ„๋…ธ๋“œ๋กœ SPAN ์„ ์ถ”๊ฐ€ํ•˜์—ฌ ๋ฐœ์ƒํ•˜๋Š” ๋ฌธ์ œ oSelection.selectNode(oVeryFirstNode); oSelection.collapseToStart(); oSelection.insertNode(oSpan); }else if(bAppendable && oVeryFirstNode.tagName != "IFRAME" && oVeryFirstNode.appendChild && typeof oVeryFirstNode.innerHTML == "string"){ oVeryFirstNode.appendChild(oSpan); }else{ oSelection.selectNode(oVeryFirstNode); oSelection.collapseToStart(); oSelection.insertNode(oSpan); } }else{ oSelection.collapseToStart(); oSelection.insertNode(oSpan); } }else{ oSelection = this.oApp.getEmptySelection(); } // [SMARTEDITORSUS-229] ์ƒˆ๋กœ ์ƒ์„ฑ๋˜๋Š” SPAN ์—๋„ ์ทจ์†Œ์„ /๋ฐ‘์ค„ ์ฒ˜๋ฆฌ ์ถ”๊ฐ€ if(!!oStyles.color){ oSelection._checkTextDecoration(oSpan); } // [SMARTEDITORSUS-1648] ZWSP ๋ฅผ ์‚ฝ์ž…ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•ด์„œ ๊ตณ์ด ํ•„์š”ํ•˜์ง€๋Š” ์•Š์ง€๋งŒ ๋งŒ์•ฝ์„ ์œ„ํ•ด ์ฝ”๋ฉ˜ํŠธ์ฒ˜๋ฆฌํ•จ //this._addCursorHolder(oSelection, oSpan); // [SMARTEDITORSUS-178] [IE9] ์ปค์„œ๊ฐ€ ์œ„๋กœ ์˜ฌ๋ผ๊ฐ€๋Š” ๋ฌธ์ œ // [SMARTEDITORSUS-1648] oSpan์ด ๊ตต๊ฒŒ//๋ฐ‘์ค„/๊ธฐ์šธ์ž„/์ทจ์†Œ์„ ํƒœ๊ทธ๋ณด๋‹ค ์ƒ์œ„์ธ ๊ฒฝ์šฐ, IE์—์„œ ๊ตต๊ฒŒ//๋ฐ‘์ค„/๊ธฐ์šธ์ž„/์ทจ์†Œ์„ ํƒœ๊ทธ ๋ฐ–์œผ๋กœ ๋‚˜๊ฐ€๊ฒŒ ๋œ๋‹ค. ๋•Œ๋ฌธ์— SPAN์„ ์ƒˆ๋กœ ๋งŒ๋“  ๊ฒฝ์šฐ oSpan์„, ๊ทธ๋ ‡์ง€ ์•Š์€ ๊ฒฝ์šฐ elCAC๋ฅผ ์žก๋Š”๋‹ค. oSelection.selectNodeContents(bNewSpan?oSpan:elCAC); oSelection.collapseToEnd(); // TODO: focus ๋Š” ์™œ ์žˆ๋Š” ๊ฒƒ์ผ๊นŒ? => IE์—์„œ style ์ ์šฉํ›„ ํฌ์ปค์Šค๊ฐ€ ๋‚ ์•„๊ฐ€์„œ ๊ธ€์ž‘์„ฑ์ด ์•ˆ๋จ??? oSelection._window.focus(); oSelection._window.document.body.focus(); oSelection.select(); // ์˜์—ญ์œผ๋กœ ์Šคํƒ€์ผ์ด ์žกํ˜€ ์žˆ๋Š” ๊ฒฝ์šฐ(์˜ˆ:ํ˜„์žฌ ์ปค์„œ๊ฐ€ B๋ธ”๋Ÿญ ์•ˆ์— ์กด์žฌ) ํ•ด๋‹น ์˜์—ญ์ด ์‚ฌ๋ผ์ ธ ๋ฒ„๋ฆฌ๋Š” ์˜ค๋ฅ˜ ๋ฐœ์ƒํ•ด์„œ ์ œ๊ฑฐ // http://bts.nhncorp.com/nhnbts/browse/COM-912 /* var oCursorStyle = this.oApp.getCurrentStyle(); if(oCursorStyle.bold == "@^"){ this.oApp.delayedExec("EXECCOMMAND", ["bold"], 0); } if(oCursorStyle.underline == "@^"){ this.oApp.delayedExec("EXECCOMMAND", ["underline"], 0); } if(oCursorStyle.italic == "@^"){ this.oApp.delayedExec("EXECCOMMAND", ["italic"], 0); } if(oCursorStyle.lineThrough == "@^"){ this.oApp.delayedExec("EXECCOMMAND", ["strikethrough"], 0); } */ // FF3 will actually display %uFEFF when it is followed by a number AND certain font-family is used(like Gulim), so remove the character for FF3 //if(jindo.$Agent().navigator().firefox && jindo.$Agent().navigator().version == 3){ // FF4+ may have similar problems, so ignore the version number // [SMARTEDITORSUS-416] ์ปค์„œ๊ฐ€ ์˜ฌ๋ผ๊ฐ€์ง€ ์•Š๋„๋ก BR ์„ ์‚ด๋ ค๋‘  // if(jindo.$Agent().navigator().firefox){ // oSpan.innerHTML = ""; // } return; } this.oApp.exec("RECORD_UNDO_BEFORE_ACTION", ["FONT STYLE", {bMustBlockElement:true}]); if(bSelectedBlock){ var aNodes; this.oApp.exec("GET_SELECTED_TD_BLOCK",['aTdCells',htSelectedTDs]); aNodes = htSelectedTDs.aTdCells; for( var j = 0; j < aNodes.length ; j++){ oSelection.selectNodeContents(aNodes[j]); oSelection.styleRange(oStyles); oSelection.select(); } } else { var bCheckTextDecoration = !!oStyles.color; // [SMARTEDITORSUS-26] ์ทจ์†Œ์„ /๋ฐ‘์ค„ ์ƒ‰์ƒ ์ ์šฉ ์ฒ˜๋ฆฌ var bIncludeLI = oStyles.fontSize || oStyles.fontFamily; oSelection.styleRange(oStyles, null, null, bIncludeLI, bCheckTextDecoration); // http://bts.nhncorp.com/nhnbts/browse/COM-964 // // In FF when, // 1) Some text was wrapped with a styling SPAN and a bogus BR is followed // eg: <span style="XXX">TEST</span><br> // 2) And some place outside the span is clicked. // // The text cursor will be located outside the SPAN like the following, // <span style="XXX">TEST</span>[CURSOR]<br> // // which is not what the user would expect // Desired result: <span style="XXX">TEST[CURSOR]</span><br> // // To make the cursor go inside the styling SPAN, remove the bogus BR when the styling SPAN is created. // -> Style TEST<br> as <span style="XXX">TEST</span> (remove unnecessary BR) // -> Cannot monitor clicks/cursor position real-time so make the contents error-proof instead. if(jindo.$Agent().navigator().firefox){ var aStyleParents = oSelection.aStyleParents; for(var i=0, nLen=aStyleParents.length; i<nLen; i++){ var elNode = aStyleParents[i]; if(elNode.nextSibling && elNode.nextSibling.tagName == "BR" && !elNode.nextSibling.nextSibling){ elNode.parentNode.removeChild(elNode.nextSibling); } } } oSelection._window.focus(); oSelection.select(); } this.oApp.exec("RECORD_UNDO_AFTER_ACTION", ["FONT STYLE", {bMustBlockElement:true}]); } }); //} //{ /** * @fileOverview This file contains Husky plugin that takes care of the operations related to Find/Replace * @name hp_SE2M_FindReplacePlugin.js */ nhn.husky.SE2M_FindReplacePlugin = jindo.$Class({ name : "SE2M_FindReplacePlugin", oEditingWindow : null, oFindReplace : null, bFindMode : true, bLayerShown : false, $init : function(){ this.nDefaultTop = 20; }, $ON_MSG_APP_READY : function(){ // the right document will be available only when the src is completely loaded this.oEditingWindow = this.oApp.getWYSIWYGWindow(); this.oApp.exec("REGISTER_HOTKEY", ["ctrl+f", "SHOW_FIND_LAYER", []]); this.oApp.exec("REGISTER_HOTKEY", ["ctrl+h", "SHOW_REPLACE_LAYER", []]); this.oApp.exec("REGISTER_UI_EVENT", ["findAndReplace", "click", "TOGGLE_FIND_REPLACE_LAYER"]); }, $ON_SHOW_ACTIVE_LAYER : function(){ this.oApp.exec("HIDE_DIALOG_LAYER", [this.elDropdownLayer]); }, //@lazyload_js TOGGLE_FIND_REPLACE_LAYER,SHOW_FIND_LAYER,SHOW_REPLACE_LAYER,SHOW_FIND_REPLACE_LAYER:N_FindReplace.js[ _assignHTMLElements : function(){ var oAppContainer = this.oApp.htOptions.elAppContainer; this.oApp.exec("LOAD_HTML", ["find_and_replace"]); // this.oEditingWindow = jindo.$$.getSingle("IFRAME", oAppContainer); this.elDropdownLayer = jindo.$$.getSingle("DIV.husky_se2m_findAndReplace_layer", oAppContainer); this.welDropdownLayer = jindo.$Element(this.elDropdownLayer); var oTmp = jindo.$$("LI", this.elDropdownLayer); this.oFindTab = oTmp[0]; this.oReplaceTab = oTmp[1]; oTmp = jindo.$$(".container > .bx", this.elDropdownLayer); this.oFindInputSet = jindo.$$.getSingle(".husky_se2m_find_ui", this.elDropdownLayer); this.oReplaceInputSet = jindo.$$.getSingle(".husky_se2m_replace_ui", this.elDropdownLayer); this.elTitle = jindo.$$.getSingle("H3", this.elDropdownLayer); this.oFindInput_Keyword = jindo.$$.getSingle("INPUT", this.oFindInputSet); oTmp = jindo.$$("INPUT", this.oReplaceInputSet); this.oReplaceInput_Original = oTmp[0]; this.oReplaceInput_Replacement = oTmp[1]; this.oFindNextButton = jindo.$$.getSingle("BUTTON.husky_se2m_find_next", this.elDropdownLayer); this.oReplaceFindNextButton = jindo.$$.getSingle("BUTTON.husky_se2m_replace_find_next", this.elDropdownLayer); this.oReplaceButton = jindo.$$.getSingle("BUTTON.husky_se2m_replace", this.elDropdownLayer); this.oReplaceAllButton = jindo.$$.getSingle("BUTTON.husky_se2m_replace_all", this.elDropdownLayer); this.aCloseButtons = jindo.$$("BUTTON.husky_se2m_cancel", this.elDropdownLayer); }, $LOCAL_BEFORE_FIRST : function(sMsg){ this._assignHTMLElements(); this.oFindReplace = new nhn.FindReplace(this.oEditingWindow); for(var i=0; i<this.aCloseButtons.length; i++){ // var func = jindo.$Fn(this.oApp.exec, this.oApp).bind("HIDE_DIALOG_LAYER", [this.elDropdownLayer]); var func = jindo.$Fn(this.oApp.exec, this.oApp).bind("HIDE_FIND_REPLACE_LAYER", [this.elDropdownLayer]); jindo.$Fn(func, this).attach(this.aCloseButtons[i], "click"); } jindo.$Fn(jindo.$Fn(this.oApp.exec, this.oApp).bind("SHOW_FIND", []), this).attach(this.oFindTab, "click"); jindo.$Fn(jindo.$Fn(this.oApp.exec, this.oApp).bind("SHOW_REPLACE", []), this).attach(this.oReplaceTab, "click"); jindo.$Fn(jindo.$Fn(this.oApp.exec, this.oApp).bind("FIND", []), this).attach(this.oFindNextButton, "click"); jindo.$Fn(jindo.$Fn(this.oApp.exec, this.oApp).bind("FIND", []), this).attach(this.oReplaceFindNextButton, "click"); jindo.$Fn(jindo.$Fn(this.oApp.exec, this.oApp).bind("REPLACE", []), this).attach(this.oReplaceButton, "click"); jindo.$Fn(jindo.$Fn(this.oApp.exec, this.oApp).bind("REPLACE_ALL", []), this).attach(this.oReplaceAllButton, "click"); this.oFindInput_Keyword.value = ""; this.oReplaceInput_Original.value = ""; this.oReplaceInput_Replacement.value = ""; //๋ ˆ์ด์–ด์˜ ์ด๋™ ๋ฒ”์œ„ ์„ค์ •. var elIframe = this.oApp.getWYSIWYGWindow().frameElement; this.htOffsetPos = jindo.$Element(elIframe).offset(); this.nEditorWidth = elIframe.offsetWidth; this.elDropdownLayer.style.display = "block"; this.htInitialPos = this.welDropdownLayer.offset(); var htScrollXY = this.oApp.oUtils.getScrollXY(); // this.welDropdownLayer.offset(this.htOffsetPos.top-htScrollXY.y, this.htOffsetPos.left-htScrollXY.x); this.welDropdownLayer.offset(this.htOffsetPos.top, this.htOffsetPos.left); this.htTopLeftCorner = {x:parseInt(this.elDropdownLayer.style.left, 10), y:parseInt(this.elDropdownLayer.style.top, 10)}; // offset width๊ฐ€ IE์—์„œ css lazy loading ๋•Œ๋ฌธ์— ์ œ๋Œ€๋กœ ์žกํžˆ์ง€ ์•Š์•„ ์ƒ์ˆ˜๋กœ ์„ค์ • //this.nLayerWidth = this.elDropdownLayer.offsetWidth; this.nLayerWidth = 258; this.nLayerHeight = 160; //this.nLayerWidth = Math.abs(parseInt(this.elDropdownLayer.style.marginLeft))+20; this.elDropdownLayer.style.display = "none"; }, // [SMARTEDITORSUS-728] ์ฐพ๊ธฐ/๋ฐ”๊พธ๊ธฐ ๋ ˆ์ด์–ด ์˜คํ”ˆ ํˆด๋ฐ” ๋ฒ„ํŠผ active/inactive ์ฒ˜๋ฆฌ ์ถ”๊ฐ€ $ON_TOGGLE_FIND_REPLACE_LAYER : function(){ if(!this.bLayerShown) { this.oApp.exec("SHOW_FIND_REPLACE_LAYER"); } else { this.oApp.exec("HIDE_FIND_REPLACE_LAYER"); } }, $ON_SHOW_FIND_REPLACE_LAYER : function(){ this.bLayerShown = true; this.oApp.exec("DISABLE_ALL_UI", [{aExceptions: ["findAndReplace"]}]); this.oApp.exec("SELECT_UI", ["findAndReplace"]); this.oApp.exec("HIDE_ALL_DIALOG_LAYER", []); this.elDropdownLayer.style.top = this.nDefaultTop+"px"; this.oApp.exec("SHOW_DIALOG_LAYER", [this.elDropdownLayer, { elHandle: this.elTitle, fnOnDragStart : jindo.$Fn(this.oApp.exec, this.oApp).bind("SHOW_EDITING_AREA_COVER"), fnOnDragEnd : jindo.$Fn(this.oApp.exec, this.oApp).bind("HIDE_EDITING_AREA_COVER"), nMinX : this.htTopLeftCorner.x, nMinY : this.nDefaultTop, nMaxX : this.htTopLeftCorner.x + this.oApp.getEditingAreaWidth() - this.nLayerWidth, nMaxY : this.htTopLeftCorner.y + this.oApp.getEditingAreaHeight() - this.nLayerHeight, sOnShowMsg : "FIND_REPLACE_LAYER_SHOWN" }]); this.oApp.exec('MSG_NOTIFY_CLICKCR', ['findreplace']); }, $ON_HIDE_FIND_REPLACE_LAYER : function() { this.oApp.exec("ENABLE_ALL_UI"); this.oApp.exec("DESELECT_UI", ["findAndReplace"]); this.oApp.exec("HIDE_ALL_DIALOG_LAYER", []); this.bLayerShown = false; }, $ON_FIND_REPLACE_LAYER_SHOWN : function(){ this.oApp.exec("POSITION_TOOLBAR_LAYER", [this.elDropdownLayer]); if(this.bFindMode){ this.oFindInput_Keyword.value = "_clear_"; this.oFindInput_Keyword.value = ""; this.oFindInput_Keyword.focus(); }else{ this.oReplaceInput_Original.value = "_clear_"; this.oReplaceInput_Original.value = ""; this.oReplaceInput_Replacement.value = ""; this.oReplaceInput_Original.focus(); } this.oApp.exec("HIDE_CURRENT_ACTIVE_LAYER", []); }, $ON_SHOW_FIND_LAYER : function(){ this.oApp.exec("SHOW_FIND"); this.oApp.exec("SHOW_FIND_REPLACE_LAYER"); }, $ON_SHOW_REPLACE_LAYER : function(){ this.oApp.exec("SHOW_REPLACE"); this.oApp.exec("SHOW_FIND_REPLACE_LAYER"); }, $ON_SHOW_FIND : function(){ this.bFindMode = true; this.oFindInput_Keyword.value = this.oReplaceInput_Original.value; jindo.$Element(this.oFindTab).addClass("active"); jindo.$Element(this.oReplaceTab).removeClass("active"); jindo.$Element(this.oFindNextButton).removeClass("normal"); jindo.$Element(this.oFindNextButton).addClass("strong"); this.oFindInputSet.style.display = "block"; this.oReplaceInputSet.style.display = "none"; this.oReplaceButton.style.display = "none"; this.oReplaceAllButton.style.display = "none"; jindo.$Element(this.elDropdownLayer).removeClass("replace"); jindo.$Element(this.elDropdownLayer).addClass("find"); }, $ON_SHOW_REPLACE : function(){ this.bFindMode = false; this.oReplaceInput_Original.value = this.oFindInput_Keyword.value; jindo.$Element(this.oFindTab).removeClass("active"); jindo.$Element(this.oReplaceTab).addClass("active"); jindo.$Element(this.oFindNextButton).removeClass("strong"); jindo.$Element(this.oFindNextButton).addClass("normal"); this.oFindInputSet.style.display = "none"; this.oReplaceInputSet.style.display = "block"; this.oReplaceButton.style.display = "inline"; this.oReplaceAllButton.style.display = "inline"; jindo.$Element(this.elDropdownLayer).removeClass("find"); jindo.$Element(this.elDropdownLayer).addClass("replace"); }, $ON_FIND : function(){ var sKeyword; if(this.bFindMode){ sKeyword = this.oFindInput_Keyword.value; }else{ sKeyword = this.oReplaceInput_Original.value; } var oSelection = this.oApp.getSelection(); oSelection.select(); switch(this.oFindReplace.find(sKeyword, false)){ case 1: alert(this.oApp.$MSG("SE_FindReplace.keywordNotFound")); oSelection.select(); break; case 2: alert(this.oApp.$MSG("SE_FindReplace.keywordMissing")); break; } }, $ON_REPLACE : function(){ var sOriginal = this.oReplaceInput_Original.value; var sReplacement = this.oReplaceInput_Replacement.value; var oSelection = this.oApp.getSelection(); this.oApp.exec("RECORD_UNDO_BEFORE_ACTION", ["REPLACE"]); var iReplaceResult = this.oFindReplace.replace(sOriginal, sReplacement, false); this.oApp.exec("RECORD_UNDO_AFTER_ACTION", ["REPLACE"]); switch(iReplaceResult){ case 1: case 3: alert(this.oApp.$MSG("SE_FindReplace.keywordNotFound")); oSelection.select(); break; case 4: alert(this.oApp.$MSG("SE_FindReplace.keywordMissing")); break; } }, $ON_REPLACE_ALL : function(){ var sOriginal = this.oReplaceInput_Original.value; var sReplacement = this.oReplaceInput_Replacement.value; var oSelection = this.oApp.getSelection(); this.oApp.exec("RECORD_UNDO_BEFORE_ACTION", ["REPLACE ALL", {sSaveTarget:"BODY"}]); var iReplaceAllResult = this.oFindReplace.replaceAll(sOriginal, sReplacement, false); this.oApp.exec("RECORD_UNDO_AFTER_ACTION", ["REPLACE ALL", {sSaveTarget:"BODY"}]); if(iReplaceAllResult === 0){ alert(this.oApp.$MSG("SE_FindReplace.replaceKeywordNotFound")); oSelection.select(); this.oApp.exec("FOCUS"); }else{ if(iReplaceAllResult<0){ alert(this.oApp.$MSG("SE_FindReplace.keywordMissing")); oSelection.select(); }else{ alert(this.oApp.$MSG("SE_FindReplace.replaceAllResultP1")+iReplaceAllResult+this.oApp.$MSG("SE_FindReplace.replaceAllResultP2")); oSelection = this.oApp.getEmptySelection(); oSelection.select(); this.oApp.exec("FOCUS"); } } } //@lazyload_js] }); //} /** * @fileOverview This file contains Husky plugin that takes care of the operations related to quote * @name hp_SE_Quote.js * @required SE_EditingArea_WYSIWYG */ nhn.husky.SE2M_Quote = jindo.$Class({ name : "SE2M_Quote", htQuoteStyles_view : null, $init : function(){ var htConfig = nhn.husky.SE2M_Configuration.Quote || {}; var sImageBaseURL = htConfig.sImageBaseURL; this.nMaxLevel = htConfig.nMaxLevel || 14; this.htQuoteStyles_view = {}; this.htQuoteStyles_view["se2_quote1"] = "_zoom:1;padding:0 8px; margin:0 0 30px 20px; margin-right:15px; border-left:2px solid #cccccc;color:#888888;"; this.htQuoteStyles_view["se2_quote2"] = "_zoom:1;margin:0 0 30px 13px;padding:0 8px 0 16px;background:url("+sImageBaseURL+"/bg_quote2.gif) 0 3px no-repeat;color:#888888;"; this.htQuoteStyles_view["se2_quote3"] = "_zoom:1;margin:0 0 30px 0;padding:10px;border:1px dashed #cccccc;color:#888888;"; this.htQuoteStyles_view["se2_quote4"] = "_zoom:1;margin:0 0 30px 0;padding:10px;border:1px dashed #66b246;color:#888888;"; this.htQuoteStyles_view["se2_quote5"] = "_zoom:1;margin:0 0 30px 0;padding:10px;border:1px dashed #cccccc;background:url("+sImageBaseURL+"/bg_b1.png) repeat;_background:none;_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+sImageBaseURL+"/bg_b1.png',sizingMethod='scale');color:#888888;"; this.htQuoteStyles_view["se2_quote6"] = "_zoom:1;margin:0 0 30px 0;padding:10px;border:1px solid #e5e5e5;color:#888888;"; this.htQuoteStyles_view["se2_quote7"] = "_zoom:1;margin:0 0 30px 0;padding:10px;border:1px solid #66b246;color:#888888;"; this.htQuoteStyles_view["se2_quote8"] = "_zoom:1;margin:0 0 30px 0;padding:10px;border:1px solid #e5e5e5;background:url("+sImageBaseURL+"/bg_b1.png) repeat;_background:none;_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+sImageBaseURL+"/bg_b1.png',sizingMethod='scale');color:#888888;"; this.htQuoteStyles_view["se2_quote9"] = "_zoom:1;margin:0 0 30px 0;padding:10px;border:2px solid #e5e5e5;color:#888888;"; this.htQuoteStyles_view["se2_quote10"] = "_zoom:1;margin:0 0 30px 0;padding:10px;border:2px solid #e5e5e5;background:url("+sImageBaseURL+"/bg_b1.png) repeat;_background:none;_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+sImageBaseURL+"/bg_b1.png',sizingMethod='scale');color:#888888;"; }, _assignHTMLElements : function(){ //@ec this.elDropdownLayer = jindo.$$.getSingle("DIV.husky_seditor_blockquote_layer", this.oApp.htOptions.elAppContainer); this.aLI = jindo.$$("LI", this.elDropdownLayer); }, $ON_REGISTER_CONVERTERS : function(){ this.oApp.exec("ADD_CONVERTER", ["DB_TO_IR", jindo.$Fn(function(sContents){ sContents = sContents.replace(/<(blockquote)[^>]*class=['"]?(se2_quote[0-9]+)['"]?[^>]*>/gi, "<$1 class=$2>"); return sContents; }, this).bind()]); this.oApp.exec("ADD_CONVERTER", ["IR_TO_DB", jindo.$Fn(function(sContents){ var htQuoteStyles_view = this.htQuoteStyles_view; sContents = sContents.replace(/<(blockquote)[^>]*class=['"]?(se2_quote[0-9]+)['"]?[^>]*>/gi, function(sAll, sTag, sClassName){ return '<'+sTag+' class='+sClassName+' style="'+htQuoteStyles_view[sClassName]+'">'; }); return sContents; }, this).bind()]); this.htSE1toSE2Map = { "01" : "1", "02" : "2", "03" : "6", "04" : "8", "05" : "9", "07" : "3", "08" : "5" }; // convert SE1's quotes to SE2's // -> ๋ธ”๋กœ๊ทธ ๊ฐœ๋ฐœ ์ชฝ์—์„œ ์ฒ˜๋ฆฌ ํ•˜๊ธฐ๋กœ ํ•จ. /* this.oApp.exec("ADD_CONVERTER", ["DB_TO_IR", jindo.$Fn(function(sContents){ return sContents.replace(/<blockquote[^>]* class="?vview_quote([0-9]+)"?[^>]*>((?:\s|.)*?)<\/blockquote>/ig, jindo.$Fn(function(m0,sQuoteType,sQuoteContents){ if (/<!--quote_txt-->((?:\s|.)*?)<!--\/quote_txt-->/ig.test(sQuoteContents)){ if(!this.htSE1toSE2Map[sQuoteType]){ return m0; } return '<blockquote class="se2_quote'+this.htSE1toSE2Map[sQuoteType]+'">'+RegExp.$1+'</blockquote>'; }else{ return ''; } }, this).bind()); }, this).bind()]); */ }, $LOCAL_BEFORE_FIRST : function(){ this._assignHTMLElements(); this.oApp.registerBrowserEvent(this.elDropdownLayer, "click", "EVENT_SE2_BLOCKQUOTE_LAYER_CLICK", []); this.oApp.delayedExec("SE2_ATTACH_HOVER_EVENTS", [this.aLI], 0); }, $ON_MSG_APP_READY: function(){ this.oApp.exec("REGISTER_UI_EVENT", ["quote", "click", "TOGGLE_BLOCKQUOTE_LAYER"]); }, //@lazyload_js TOGGLE_BLOCKQUOTE_LAYER[ $ON_TOGGLE_BLOCKQUOTE_LAYER : function(){ this.oApp.exec("TOGGLE_TOOLBAR_ACTIVE_LAYER", [this.elDropdownLayer, null, "SELECT_UI", ["quote"], "DESELECT_UI", ["quote"]]); this.oApp.exec('MSG_NOTIFY_CLICKCR', ['quote']); }, $ON_EVENT_SE2_BLOCKQUOTE_LAYER_CLICK : function(weEvent){ var elButton = nhn.husky.SE2M_Utils.findAncestorByTagName("BUTTON", weEvent.element); if(!elButton || elButton.tagName != "BUTTON"){return;} var sClass = elButton.className; this.oApp.exec("APPLY_BLOCKQUOTE", [sClass]); }, $ON_APPLY_BLOCKQUOTE : function(sClass){ if(sClass.match(/(se2_quote[0-9]+)/)){ this._wrapBlock("BLOCKQUOTE", RegExp.$1); }else{ this._unwrapBlock("BLOCKQUOTE"); } this.oApp.exec("HIDE_ACTIVE_LAYER", []); }, /** * ์ธ์šฉ๊ตฌ์˜ ์ค‘์ฒฉ ๊ฐ€๋Šฅํ•œ ์ตœ๋Œ€ ๊ฐœ์ˆ˜๋ฅผ ๋„˜์—ˆ๋Š”์ง€ ํ™•์ธํ•จ * ์ธ์šฉ๊ตฌ ๋‚ด๋ถ€์—์„œ ์ธ์šฉ๊ตฌ๋ฅผ ์ ์šฉํ•˜๋ฉด ์ค‘์ฒฉ๋˜์ง€ ์•Š์œผ๋ฏ€๋กœ ์ž์‹๋…ธ๋“œ์— ๋Œ€ํ•ด์„œ๋งŒ ํ™•์ธํ•จ */ _isExceedMaxDepth : function(elNode){ var countChildQuote = function(elNode){ var elChild = elNode.firstChild; var nCount = 0; var nMaxCount = 0; if(!elChild){ if(elNode.tagName && elNode.tagName === "BLOCKQUOTE"){ return 1; }else{ return 0; } } while(elChild){ if(elChild.nodeType === 1){ nCount = countChildQuote(elChild); if(elChild.tagName === "BLOCKQUOTE"){ nCount += 1; } if(nMaxCount < nCount){ nMaxCount = nCount; } if(nMaxCount >= this.nMaxLevel){ return nMaxCount; } } elChild = elChild.nextSibling; } return nMaxCount; }; return (countChildQuote(elNode) >= this.nMaxLevel); }, _unwrapBlock : function(tag){ var oSelection = this.oApp.getSelection(); var elCommonAncestor = oSelection.commonAncestorContainer; while(elCommonAncestor && elCommonAncestor.tagName != tag){elCommonAncestor = elCommonAncestor.parentNode;} if(!elCommonAncestor){return;} this.oApp.exec("RECORD_UNDO_BEFORE_ACTION", ["CANCEL BLOCK QUOTE", {sSaveTarget:"BODY"}]); while(elCommonAncestor.firstChild){elCommonAncestor.parentNode.insertBefore(elCommonAncestor.firstChild, elCommonAncestor);} elCommonAncestor.parentNode.removeChild(elCommonAncestor); this.oApp.exec("RECORD_UNDO_AFTER_ACTION", ["CANCEL BLOCK QUOTE", {sSaveTarget:"BODY"}]); }, _wrapBlock : function(tag, className){ var oSelection, oLineInfo, oStart, oEnd, rxDontUseAsWhole = /BODY|TD|LI/i, oStartNode, oEndNode, oNode, elCommonAncestor, elCommonNode, elParentQuote, elInsertBefore, oFormattingNode, elNextNode, elParentNode, aQuoteChild, aQuoteCloneChild, i, nLen, oP, sBookmarkID; this.oApp.exec("RECORD_UNDO_BEFORE_ACTION", ["BLOCK QUOTE", {sSaveTarget:"BODY"}]); oSelection = this.oApp.getSelection(); // var sBookmarkID = oSelection.placeStringBookmark(); // [SMARTEDITORSUS-430] ๋ฌธ์ž๋ฅผ ์ž…๋ ฅํ•˜๊ณ  Enter ํ›„ ์ธ์šฉ๊ตฌ๋ฅผ ์ ์šฉํ•  ๋•Œ ์œ„์˜ ๋ฌธ์ž๋“ค์ด ์ธ์šฉ๊ตฌ ์•ˆ์— ๋“ค์–ด๊ฐ€๋Š” ๋ฌธ์ œ // [SMARTEDITORSUS-1323] ์‚ฌ์ง„ ์ฒจ๋ถ€ ํ›„ ์ธ์šฉ๊ตฌ ์ ์šฉ ์‹œ ์ฒจ๋ถ€ํ•œ ์‚ฌ์ง„์ด ์‚ญ์ œ๋˜๋Š” ํ˜„์ƒ // [SMARTEDITORSUS-1567] ์—”ํ„ฐํ‚ค๋ฅผ ํ•œ ๋ฒˆ๋„ ๋ˆ„๋ฅด์ง€ ์•Š๊ณ  ์ธ์šฉ๊ตฌ๋ฅผ ์‚ฝ์ž…ํ•˜๋Š” ๊ฒฝ์šฐ์— ๋Œ€์‘ /*if(oSelection.startContainer === oSelection.endContainer && oSelection.startContainer.nodeType === 1 && oSelection.startContainer.tagName === "P"){ if(nhn.husky.SE2M_Utils.isBlankNode(oSelection.startContainer) || nhn.husky.SE2M_Utils.isFirstChildOfNode("IMG", oSelection.startContainer.tagName, oSelection.startContainer) || nhn.husky.SE2M_Utils.isFirstChildOfNode("IFRAME", oSelection.startContainer.tagName, oSelection.startContainer)){ oLineInfo = oSelection.getLineInfo(true); }else{ oLineInfo = oSelection.getLineInfo(false); } }else{ oLineInfo = oSelection.getLineInfo(false); }*/ if(oSelection.startContainer === oSelection.endContainer){ if(oSelection.startContainer.nodeType === 1 && oSelection.startContainer.tagName === "P"){ if(nhn.husky.SE2M_Utils.isBlankNode(oSelection.startContainer) || nhn.husky.SE2M_Utils.isFirstChildOfNode("IMG", oSelection.startContainer.tagName, oSelection.startContainer) || nhn.husky.SE2M_Utils.isFirstChildOfNode("IFRAME", oSelection.startContainer.tagName, oSelection.startContainer)){ oLineInfo = oSelection.getLineInfo(true); }else{ oLineInfo = oSelection.getLineInfo(false); } }else{ // ์‹œ์ž‘ ์ปจํ…Œ์ด๋„ˆ์™€ ๋ ์ปจํ…Œ์ด๋„ˆ๋Š” ๊ฐ™๋˜ P ํƒœ๊ทธ๊ฐ€ ์•„๋‹Œ ๊ฒฝ์šฐ๋กœ, // ์—”ํ„ฐ๋ฅผ ํ•œ ๋ฒˆ๋„ ์ž…๋ ฅํ•˜์ง€ ์•Š์€ ์ƒํ™ฉ์ด๋‹ค. // TD ํƒœ๊ทธ๋‚˜ BODY ํƒœ๊ทธ ๋‚ด๋ถ€์— ์†ํ•ด ์žˆ์„ ๊ฒƒ์ด๋ผ๊ณ  ๊ฐ€์ •ํ•˜๊ณ  ์ง„ํ–‰ํ•˜๋Š”๋ฐ, // ์˜ฌ๋ฐ”๋ฅธ ์ •๋ ฌ ์ ์šฉ์„ ์œ„ํ•ด ํ˜„์žฌ ์œ„์น˜์— ์†ํ•œ ์ปจํ…์ธ ๋ฅผ P ํƒœ๊ทธ๋กœ ๊ฐ์‹ธ ์ฃผ๊ฒŒ ๋œ๋‹ค. var _startContainer = oSelection.startContainer; var _startOffset = oSelection.startOffset; var _endContainer = oSelection.endContainer; var _endOffset = oSelection.endOffset; var _sBM = oSelection.placeStringBookmark(); var _elBookmark = oSelection.getStringBookmark(_sBM); var _elParent = _elBookmark.parentNode; var _elAncestor = nhn.husky.SE2M_Utils.findAncestorByTagName("P", _elParent); // ์›๋ž˜ P ํƒœ๊ทธ๋ฅผ ํฌํ•จํ•  ์ˆ˜ ์žˆ๋Š” ๋ถ€๋ชจ ๋ชฉ๋ก var _aParagraphContainer = ["TD", "BODY"]; // ํƒ์ƒ‰ ์ˆœ์„œ๋Š” TD, BODY ์ˆœ if(!_elAncestor){ for(var i = 0, len = _aParagraphContainer.length; i < len; i++){ _elAncestor = nhn.husky.SE2M_Utils.findAncestorByTagName(_aParagraphContainer[i], _elParent); if(_elAncestor){ break; } } var _elParagraph = document.createElement("P"); var _aAncestorChildren = _elAncestor.childNodes; for(var i = 0, len = _aAncestorChildren.length; i < len; i++){ _elParagraph.appendChild(_aAncestorChildren[0]); } _elAncestor.appendChild(_elParagraph); } oSelection.removeStringBookmark(_sBM); oSelection = this.oApp.getSelection(); oSelection.setStart(_startContainer, _startOffset); oSelection.setEnd(_endContainer, _endOffset); oLineInfo = oSelection.getLineInfo(true); } }else{ oLineInfo = oSelection.getLineInfo(false); } // --[SMARTEDITORSUS-1567] oStart = oLineInfo.oStart; oEnd = oLineInfo.oEnd; if(oStart.bParentBreak && !rxDontUseAsWhole.test(oStart.oLineBreaker.tagName)){ oStartNode = oStart.oNode.parentNode; }else{ oStartNode = oStart.oNode; } if(oEnd.bParentBreak && !rxDontUseAsWhole.test(oEnd.oLineBreaker.tagName)){ oEndNode = oEnd.oNode.parentNode; }else{ oEndNode = oEnd.oNode; } oSelection.setStartBefore(oStartNode); oSelection.setEndAfter(oEndNode); oNode = this._expandToTableStart(oSelection, oEndNode); if(oNode){ oEndNode = oNode; oSelection.setEndAfter(oNode); } oNode = this._expandToTableStart(oSelection, oStartNode); if(oNode){ oStartNode = oNode; oSelection.setStartBefore(oNode); } oNode = oStartNode; // IE์—์„œ๋Š” commonAncestorContainer ์ž์ฒด๋Š” select ๊ฐ€๋Šฅํ•˜์ง€ ์•Š๊ณ , ํ•˜์œ„์— commonAncestorContainer๋ฅผ ๋Œ€์ฒด ํ•˜๋”๋ผ๋„ ๋˜‘๊ฐ™์€ ์˜์—ญ์ด ์…€๋ ‰ํŠธ ๋˜์–ด ๋ณด์ด๋Š” // ๋…ธ๋“œ๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ ํ•˜์œ„ ๋…ธ๋“œ๊ฐ€ commonAncestorContainer๋กœ ๋ฐ˜ํ™˜๋จ. // ๊ทธ๋ž˜์„œ, ์Šคํฌ๋ฆฝํŠธ๋กœ commonAncestorContainer ๊ณ„์‚ฐ ํ•˜๋„๋ก ํ•จ. // ์˜ˆ) // <P><SPAN>TEST</SPAN></p>๋ฅผ ์„ ํƒ ํ•  ๊ฒฝ์šฐ, <SPAN>TEST</SPAN>๊ฐ€ commonAncestorContainer๋กœ ์žกํž˜ oSelection.fixCommonAncestorContainer(); elCommonAncestor = oSelection.commonAncestorContainer; if(oSelection.startContainer == oSelection.endContainer && oSelection.endOffset-oSelection.startOffset == 1){ elCommonNode = oSelection.startContainer.childNodes[oSelection.startOffset]; }else{ elCommonNode = oSelection.commonAncestorContainer; } elParentQuote = this._findParentQuote(elCommonNode); if(elParentQuote){ elParentQuote.className = className; return; } while(!elCommonAncestor.tagName || (elCommonAncestor.tagName && elCommonAncestor.tagName.match(/UL|OL|LI|IMG|IFRAME/))){ elCommonAncestor = elCommonAncestor.parentNode; } // find the insertion position for the formatting tag right beneath the common ancestor container while(oNode && oNode != elCommonAncestor && oNode.parentNode != elCommonAncestor){oNode = oNode.parentNode;} if(oNode == elCommonAncestor){ elInsertBefore = elCommonAncestor.firstChild; }else{ elInsertBefore = oNode; } oFormattingNode = oSelection._document.createElement(tag); if(className){ oFormattingNode.className = className; // SMARTEDITORSUS-1239 blockquate style ์ ์šฉ this._setStyle(oFormattingNode, this.htQuoteStyles_view[className]); } elCommonAncestor.insertBefore(oFormattingNode, elInsertBefore); oSelection.setStartAfter(oFormattingNode); oSelection.setEndAfter(oEndNode); oSelection.surroundContents(oFormattingNode); if(this._isExceedMaxDepth(oFormattingNode)){ alert(this.oApp.$MSG("SE2M_Quote.exceedMaxCount").replace("#MaxCount#", (this.nMaxLevel + 1))); this.oApp.exec("HIDE_ACTIVE_LAYER", []); elNextNode = oFormattingNode.nextSibling; elParentNode = oFormattingNode.parentNode; aQuoteChild = oFormattingNode.childNodes; aQuoteCloneChild = []; jindo.$Element(oFormattingNode).leave(); for(i = 0, nLen = aQuoteChild.length; i < nLen; i++){ aQuoteCloneChild[i] = aQuoteChild[i]; } for(i = 0, nLen = aQuoteCloneChild.length; i < nLen; i++){ if(!!elNextNode){ jindo.$Element(elNextNode).before(aQuoteCloneChild[i]); }else{ jindo.$Element(elParentNode).append(aQuoteCloneChild[i]); } } return; } oSelection.selectNodeContents(oFormattingNode); // insert an empty line below, so the text cursor can move there if(oFormattingNode && oFormattingNode.parentNode && oFormattingNode.parentNode.tagName == "BODY" && !oFormattingNode.nextSibling){ oP = oSelection._document.createElement("P"); //oP.innerHTML = unescape("<br/>"); oP.innerHTML = "&nbsp;"; oFormattingNode.parentNode.insertBefore(oP, oFormattingNode.nextSibling); } // oSelection.removeStringBookmark(sBookmarkID); // Insert an empty line inside the blockquote if it's empty. // This is done to position the cursor correctly when the contents of the blockquote is empty in Chrome. if(nhn.husky.SE2M_Utils.isBlankNode(oFormattingNode)){ // oFormattingNode.innerHTML = ""; // oP = oSelection._document.createElement("P"); // oP.innerHTML = "&nbsp;"; // oFormattingNode.insertBefore(oP, null); // oSelection = this.oApp.getEmptySelection(); // oSelection.selectNode(oP); // [SMARTEDITORSUS-645] ํŽธ์ง‘์˜์—ญ ํฌ์ปค์Šค ์—†์ด ์ธ์šฉ๊ตฌ ์ถ”๊ฐ€ํ–ˆ์„ ๋•Œ IE7์—์„œ ๋ฐ•์Šค๊ฐ€ ๋Š˜์–ด๋‚˜๋Š” ๋ฌธ์ œ // [SMARTEDITORSUS-1567] [Chrome] ์ธ์šฉ๊ตฌ ์‚ฝ์ž… ์ง์ „ ๋‚ด์šฉ์ด ์•„๋ฌด๊ฒƒ๋„ ์—†๋Š” ๊ฒฝ์šฐ์— ๋Œ€์‘ //oFormattingNode.innerHTML = "&nbsp;"; var htBrowser = jindo.$Agent().navigator(); if(htBrowser.chrome){ // P ํƒœ๊ทธ๋กœ ๊ฐ์‹ธ์ฃผ์ง€ ์•Š์œผ๋ฉด blockquote ํƒœ๊ทธ์— ์ •๋ ฌ์ด ์ ์šฉ๋˜๋Š”๋ฐ, DB๋กœ ๋„˜์–ด๊ฐˆ ๋•Œ ์Šคํƒ€์ผ์ด ์ ์šฉ๋˜์ง€ ์•Š๋Š” ๋ฌธ์ œ ๋ฐœ๊ฒฌ oFormattingNode.innerHTML = "<p>&nbsp;</p>"; }else{ oFormattingNode.innerHTML = "&nbsp;"; } // --[SMARTEDITORSUS-1567] oSelection.selectNodeContents(oFormattingNode); oSelection.collapseToStart(); oSelection.select(); } //oSelection.select(); this.oApp.exec("REFRESH_WYSIWYG"); setTimeout(jindo.$Fn(function(oSelection){ sBookmarkID = oSelection.placeStringBookmark(); oSelection.select(); oSelection.removeStringBookmark(sBookmarkID); this.oApp.exec("FOCUS"); // [SMARTEDITORSUS-469] [SMARTEDITORSUS-434] ์—๋””ํ„ฐ ๋กœ๋“œ ํ›„ ์ตœ์ดˆ ์‚ฝ์ž…ํ•œ ์ธ์šฉ๊ตฌ ์•ˆ์— ํฌ์ปค์Šค๊ฐ€ ๊ฐ€์ง€ ์•Š๋Š” ๋ฌธ์ œ },this).bind(oSelection), 0); this.oApp.exec("RECORD_UNDO_AFTER_ACTION", ["BLOCK QUOTE", {sSaveTarget:"BODY"}]); return oFormattingNode; }, _expandToTableStart : function(oSelection, oNode){ var elCommonAncestor = oSelection.commonAncestorContainer; var oResultNode = null; var bLastIteration = false; while(oNode && !bLastIteration){ if(oNode == elCommonAncestor){bLastIteration = true;} if(/TBODY|TFOOT|THEAD|TR/i.test(oNode.tagName)){ oResultNode = this._getTableRoot(oNode); break; } oNode = oNode.parentNode; } return oResultNode; }, _getTableRoot : function(oNode){ while(oNode && oNode.tagName != "TABLE"){oNode = oNode.parentNode;} return oNode; }, _setStyle : function(el, sStyle) { el.setAttribute("style", sStyle); el.style.cssText = sStyle; }, //@lazyload_js] // [SMARTEDITORSUS-209] ์ธ์šฉ๊ตฌ ๋‚ด์— ๋‚ด์šฉ์ด ์—†์„ ๋•Œ Backspace ๋กœ ์ธ์šฉ๊ตฌ๊ฐ€ ์‚ญ์ œ๋˜๋„๋ก ์ฒ˜๋ฆฌ $ON_EVENT_EDITING_AREA_KEYDOWN : function(weEvent) { var oSelection, elParentQuote; if ('WYSIWYG' !== this.oApp.getEditingMode()){ return; } if(8 !== weEvent.key().keyCode){ return; } oSelection = this.oApp.getSelection(); oSelection.fixCommonAncestorContainer(); elParentQuote = this._findParentQuote(oSelection.commonAncestorContainer); if(!elParentQuote){ return; } if(this._isBlankQuote(elParentQuote)){ weEvent.stop(jindo.$Event.CANCEL_DEFAULT); oSelection.selectNode(elParentQuote); oSelection.collapseToStart(); jindo.$Element(elParentQuote).leave(); oSelection.select(); } }, // [SMARTEDITORSUS-215] Delete ๋กœ ์ธ์šฉ๊ตฌ ๋’ค์˜ P ๊ฐ€ ์ œ๊ฑฐ๋˜์ง€ ์•Š๋„๋ก ์ฒ˜๋ฆฌ $ON_EVENT_EDITING_AREA_KEYUP : function(weEvent) { var oSelection, elParentQuote, oP; if ('WYSIWYG' !== this.oApp.getEditingMode()){ return; } if(46 !== weEvent.key().keyCode){ return; } oSelection = this.oApp.getSelection(); oSelection.fixCommonAncestorContainer(); elParentQuote = this._findParentQuote(oSelection.commonAncestorContainer); if(!elParentQuote){ return false; } if(!elParentQuote.nextSibling){ weEvent.stop(jindo.$Event.CANCEL_DEFAULT); oP = oSelection._document.createElement("P"); oP.innerHTML = "&nbsp;"; jindo.$Element(elParentQuote).after(oP); setTimeout(jindo.$Fn(function(oSelection){ var sBookmarkID = oSelection.placeStringBookmark(); oSelection.select(); oSelection.removeStringBookmark(sBookmarkID); },this).bind(oSelection), 0); } }, _isBlankQuote : function(elParentQuote){ var elChild, aChildNodes, i, nLen, bChrome = this.oApp.oNavigator.chrome, bSafari = this.oApp.oNavigator.safari, isBlankText = function(sText){ sText = sText.replace(/[\r\n]/ig, '').replace(unescape("%uFEFF"), ''); if(sText === ""){ return true; } if(sText === "&nbsp;" || sText === " "){ // [SMARTEDITORSUS-479] return true; } return false; }, isBlank = function(oNode){ if(oNode.nodeType === 3 && isBlankText(oNode.nodeValue)){ return true; } if((oNode.tagName === "P" || oNode.tagName === "SPAN") && (isBlankText(oNode.innerHTML) || oNode.innerHTML === "<br>")){ return true; } return false; }, isBlankTable = function(oNode){ if((jindo.$$("tr", oNode)).length === 0){ return true; } return false; }; if(isBlankText(elParentQuote.innerHTML) || elParentQuote.innerHTML === "<br>"){ return true; } if(bChrome || bSafari){ // [SMARTEDITORSUS-352], [SMARTEDITORSUS-502] var aTable = jindo.$$("TABLE", elParentQuote), nTable = aTable.length, elTable; for(i=0; i<nTable; i++){ elTable = aTable[i]; if(isBlankTable(elTable)){ jindo.$Element(elTable).leave(); } } } aChildNodes = elParentQuote.childNodes; for(i=0, nLen=aChildNodes.length; i<nLen; i++){ elChild = aChildNodes[i]; if(!isBlank(elChild)){ return false; } } return true; }, _findParentQuote : function(el){ return this._findAncestor(jindo.$Fn(function(elNode){ if(!elNode){return false;} if(elNode.tagName !== "BLOCKQUOTE"){return false;} if(!elNode.className){return false;} var sClassName = elNode.className; if(!this.htQuoteStyles_view[sClassName]){return false;} return true; }, this).bind(), el); }, _findAncestor : function(fnCondition, elNode){ while(elNode && !fnCondition(elNode)){elNode = elNode.parentNode;} return elNode; } }); //{ /** * @fileOverview This file contains Husky plugin that takes care of the operations related to inserting special characters * @name hp_SE2M_SCharacter.js * @required HuskyRangeManager */ nhn.husky.SE2M_SCharacter = jindo.$Class({ name : "SE2M_SCharacter", $ON_MSG_APP_READY : function(){ this.oApp.exec("REGISTER_UI_EVENT", ["sCharacter", "click", "TOGGLE_SCHARACTER_LAYER"]); }, //@lazyload_js TOGGLE_SCHARACTER_LAYER[ _assignHTMLObjects : function(oAppContainer){ oAppContainer = jindo.$(oAppContainer) || document; this.elDropdownLayer = jindo.$$.getSingle("DIV.husky_seditor_sCharacter_layer", oAppContainer); this.oTextField = jindo.$$.getSingle("INPUT", this.elDropdownLayer); this.oInsertButton = jindo.$$.getSingle("BUTTON.se2_confirm", this.elDropdownLayer); this.aCloseButton = jindo.$$("BUTTON.husky_se2m_sCharacter_close", this.elDropdownLayer); this.aSCharList = jindo.$$("UL.husky_se2m_sCharacter_list", this.elDropdownLayer); var oLabelUL = jindo.$$.getSingle("UL.se2_char_tab", this.elDropdownLayer); this.aLabel = jindo.$$(">LI", oLabelUL); }, $LOCAL_BEFORE_FIRST : function(sFullMsg){ this.bIE = jindo.$Agent().navigator().ie; this._assignHTMLObjects(this.oApp.htOptions.elAppContainer); this.charSet = []; this.charSet[0] = unescape('FF5B FF5D 3014 3015 3008 3009 300A 300B 300C 300D 300E 300F 3010 3011 2018 2019 201C 201D 3001 3002 %B7 2025 2026 %A7 203B 2606 2605 25CB 25CF 25CE 25C7 25C6 25A1 25A0 25B3 25B2 25BD 25BC 25C1 25C0 25B7 25B6 2664 2660 2661 2665 2667 2663 2299 25C8 25A3 25D0 25D1 2592 25A4 25A5 25A8 25A7 25A6 25A9 %B1 %D7 %F7 2260 2264 2265 221E 2234 %B0 2032 2033 2220 22A5 2312 2202 2261 2252 226A 226B 221A 223D 221D 2235 222B 222C 2208 220B 2286 2287 2282 2283 222A 2229 2227 2228 FFE2 21D2 21D4 2200 2203 %B4 FF5E 02C7 02D8 02DD 02DA 02D9 %B8 02DB %A1 %BF 02D0 222E 2211 220F 266D 2669 266A 266C 327F 2192 2190 2191 2193 2194 2195 2197 2199 2196 2198 321C 2116 33C7 2122 33C2 33D8 2121 2668 260F 260E 261C 261E %B6 2020 2021 %AE %AA %BA 2642 2640').replace(/(\S{4})/g, function(a){return "%u"+a;}).split(' '); this.charSet[1] = unescape('%BD 2153 2154 %BC %BE 215B 215C 215D 215E %B9 %B2 %B3 2074 207F 2081 2082 2083 2084 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 FFE6 %24 FFE5 FFE1 20AC 2103 212B 2109 FFE0 %A4 2030 3395 3396 3397 2113 3398 33C4 33A3 33A4 33A5 33A6 3399 339A 339B 339C 339D 339E 339F 33A0 33A1 33A2 33CA 338D 338E 338F 33CF 3388 3389 33C8 33A7 33A8 33B0 33B1 33B2 33B3 33B4 33B5 33B6 33B7 33B8 33B9 3380 3381 3382 3383 3384 33BA 33BB 33BC 33BD 33BE 33BF 3390 3391 3392 3393 3394 2126 33C0 33C1 338A 338B 338C 33D6 33C5 33AD 33AE 33AF 33DB 33A9 33AA 33AB 33AC 33DD 33D0 33D3 33C3 33C9 33DC 33C6').replace(/(\S{4})/g, function(a){return "%u"+a;}).split(' '); this.charSet[2] = unescape('3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 326A 326B 326C 326D 326E 326F 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 327A 327B 24D0 24D1 24D2 24D3 24D4 24D5 24D6 24D7 24D8 24D9 24DA 24DB 24DC 24DD 24DE 24DF 24E0 24E1 24E2 24E3 24E4 24E5 24E6 24E7 24E8 24E9 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 246A 246B 246C 246D 246E 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 320A 320B 320C 320D 320E 320F 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 321A 321B 249C 249D 249E 249F 24A0 24A1 24A2 24A3 24A4 24A5 24A6 24A7 24A8 24A9 24AA 24AB 24AC 24AD 24AE 24AF 24B0 24B1 24B2 24B3 24B4 24B5 2474 2475 2476 2477 2478 2479 247A 247B 247C 247D 247E 247F 2480 2481 2482').replace(/(\S{4})/g, function(a){return "%u"+a;}).split(' '); this.charSet[3] = unescape('3131 3132 3133 3134 3135 3136 3137 3138 3139 313A 313B 313C 313D 313E 313F 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 314A 314B 314C 314D 314E 314F 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 315A 315B 315C 315D 315E 315F 3160 3161 3162 3163 3165 3166 3167 3168 3169 316A 316B 316C 316D 316E 316F 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 317A 317B 317C 317D 317E 317F 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 318A 318B 318C 318D 318E').replace(/(\S{4})/g, function(a){return "%u"+a;}).split(' '); this.charSet[4] = unescape('0391 0392 0393 0394 0395 0396 0397 0398 0399 039A 039B 039C 039D 039E 039F 03A0 03A1 03A3 03A4 03A5 03A6 03A7 03A8 03A9 03B1 03B2 03B3 03B4 03B5 03B6 03B7 03B8 03B9 03BA 03BB 03BC 03BD 03BE 03BF 03C0 03C1 03C3 03C4 03C5 03C6 03C7 03C8 03C9 %C6 %D0 0126 0132 013F 0141 %D8 0152 %DE 0166 014A %E6 0111 %F0 0127 I 0133 0138 0140 0142 0142 0153 %DF %FE 0167 014B 0149 0411 0413 0414 0401 0416 0417 0418 0419 041B 041F 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F 0431 0432 0433 0434 0451 0436 0437 0438 0439 043B 043F 0444 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F').replace(/(\S{4})/g, function(a){return "%u"+a;}).split(' '); this.charSet[5] = unescape('3041 3042 3043 3044 3045 3046 3047 3048 3049 304A 304B 304C 304D 304E 304F 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 305A 305B 305C 305D 305E 305F 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 306A 306B 306C 306D 306E 306F 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 307A 307B 307C 307D 307E 307F 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 308A 308B 308C 308D 308E 308F 3090 3091 3092 3093 30A1 30A2 30A3 30A4 30A5 30A6 30A7 30A8 30A9 30AA 30AB 30AC 30AD 30AE 30AF 30B0 30B1 30B2 30B3 30B4 30B5 30B6 30B7 30B8 30B9 30BA 30BB 30BC 30BD 30BE 30BF 30C0 30C1 30C2 30C3 30C4 30C5 30C6 30C7 30C8 30C9 30CA 30CB 30CC 30CD 30CE 30CF 30D0 30D1 30D2 30D3 30D4 30D5 30D6 30D7 30D8 30D9 30DA 30DB 30DC 30DD 30DE 30DF 30E0 30E1 30E2 30E3 30E4 30E5 30E6 30E7 30E8 30E9 30EA 30EB 30EC 30ED 30EE 30EF 30F0 30F1 30F2 30F3 30F4 30F5 30F6').replace(/(\S{4})/g, function(a){return "%u"+a;}).split(' '); var funcInsert = jindo.$Fn(this.oApp.exec, this.oApp).bind("INSERT_SCHARACTERS", [this.oTextField.value]); jindo.$Fn(funcInsert, this).attach(this.oInsertButton, "click"); this.oApp.exec("SET_SCHARACTER_LIST", [this.charSet]); for(var i=0; i<this.aLabel.length; i++){ var func = jindo.$Fn(this.oApp.exec, this.oApp).bind("CHANGE_SCHARACTER_SET", [i]); jindo.$Fn(func, this).attach(this.aLabel[i].firstChild, "mousedown"); } for(var i=0; i<this.aCloseButton.length; i++){ this.oApp.registerBrowserEvent(this.aCloseButton[i], "click", "HIDE_ACTIVE_LAYER", []); } this.oApp.registerBrowserEvent(this.elDropdownLayer, "click", "EVENT_SCHARACTER_CLICKED", []); }, $ON_TOGGLE_SCHARACTER_LAYER : function(){ this.oTextField.value = ""; this.oSelection = this.oApp.getSelection(); this.oApp.exec("TOGGLE_TOOLBAR_ACTIVE_LAYER", [this.elDropdownLayer, null, "MSG_SCHARACTER_LAYER_SHOWN", [], "MSG_SCHARACTER_LAYER_HIDDEN", [""]]); this.oApp.exec('MSG_NOTIFY_CLICKCR', ['symbol']); }, $ON_MSG_SCHARACTER_LAYER_SHOWN : function(){ this.oTextField.focus(); this.oApp.exec("SELECT_UI", ["sCharacter"]); }, $ON_MSG_SCHARACTER_LAYER_HIDDEN : function(){ this.oApp.exec("DESELECT_UI", ["sCharacter"]); }, $ON_EVENT_SCHARACTER_CLICKED : function(weEvent){ var elButton = nhn.husky.SE2M_Utils.findAncestorByTagName("BUTTON", weEvent.element); if(!elButton || elButton.tagName != "BUTTON"){return;} if(elButton.parentNode.tagName != "LI"){return;} var sChar = elButton.firstChild.innerHTML; if(sChar.length > 1){return;} this.oApp.exec("SELECT_SCHARACTER", [sChar]); weEvent.stop(); }, $ON_SELECT_SCHARACTER : function(schar){ this.oTextField.value += schar; if(this.oTextField.createTextRange){ var oTextRange = this.oTextField.createTextRange(); oTextRange.collapse(false); oTextRange.select(); }else{ if(this.oTextField.selectionEnd){ this.oTextField.selectionEnd = this.oTextField.value.length; this.oTextField.focus(); } } }, $ON_INSERT_SCHARACTERS : function(){ this.oApp.exec("RECORD_UNDO_BEFORE_ACTION", ["INSERT SCHARACTER"]); this.oApp.exec("PASTE_HTML", [this.oTextField.value]); this.oApp.exec("FOCUS"); this.oApp.exec("RECORD_UNDO_AFTER_ACTION", ["INSERT SCHARACTER"]); this.oApp.exec("HIDE_ACTIVE_LAYER", []); }, $ON_CHANGE_SCHARACTER_SET : function(nSCharSet){ for(var i=0; i<this.aSCharList.length; i++){ if(jindo.$Element(this.aLabel[i]).hasClass("active")){ if(i == nSCharSet){return;} jindo.$Element(this.aLabel[i]).removeClass("active"); } } this._drawSCharList(nSCharSet); jindo.$Element(this.aLabel[nSCharSet]).addClass("active"); }, $ON_SET_SCHARACTER_LIST : function(charSet){ this.charSet = charSet; this.bSCharSetDrawn = new Array(this.charSet.length); this._drawSCharList(0); }, _drawSCharList : function(i){ if(this.bSCharSetDrawn[i]){return;} this.bSCharSetDrawn[i] = true; var len = this.charSet[i].length; var aLI = new Array(len); this.aSCharList[i].innerHTML = ''; var button, span; for(var ii=0; ii<len; ii++){ aLI[ii] = jindo.$("<LI>"); if(this.bIE){ button = jindo.$("<BUTTON>"); button.setAttribute('type', 'button'); }else{ button = jindo.$("<BUTTON>"); button.type = "button"; } span = jindo.$("<SPAN>"); span.innerHTML = unescape(this.charSet[i][ii]); button.appendChild(span); aLI[ii].appendChild(button); aLI[ii].onmouseover = function(){this.className='hover'}; aLI[ii].onmouseout = function(){this.className=''}; this.aSCharList[i].appendChild(aLI[ii]); } //this.oApp.delayedExec("SE2_ATTACH_HOVER_EVENTS", [jindo.$$(">LI", this.aSCharList[i]), 0]); } //@lazyload_js] }); //} /** * @fileOverview This file contains Husky plugin that takes care of the operations related to changing the font style in the table. * @requires SE2M_TableEditor.js * @name SE2M_TableBlockManager */ nhn.husky.SE2M_TableBlockStyler = jindo.$Class({ name : "SE2M_TableBlockStyler", nSelectedTD : 0, htSelectedTD : {}, aTdRange : [], $init : function(){ }, $LOCAL_BEFORE_ALL : function(){ return (this.oApp.getEditingMode() == "WYSIWYG"); }, $ON_MSG_APP_READY : function(){ this.oDocument = this.oApp.getWYSIWYGDocument(); }, $ON_EVENT_EDITING_AREA_MOUSEUP : function(wevE){ if(this.oApp.getEditingMode() != "WYSIWYG") return; this.setTdBlock(); }, /** * selected Area๊ฐ€ td block์ธ์ง€ ์ฒดํฌํ•˜๋Š” ํ•จ์ˆ˜. */ $ON_IS_SELECTED_TD_BLOCK : function(sAttr,oReturn) { if( this.nSelectedTD > 0){ oReturn[sAttr] = true; return oReturn[sAttr]; }else{ oReturn[sAttr] = false; return oReturn[sAttr]; } }, /** * */ $ON_GET_SELECTED_TD_BLOCK : function(sAttr,oReturn){ //use : this.oApp.exec("GET_SELECTED_TD_BLOCK",['aCells',this.htSelectedTD]); oReturn[sAttr] = this.htSelectedTD.aTdCells; }, setTdBlock : function() { this.oApp.exec("GET_SELECTED_CELLS",['aTdCells',this.htSelectedTD]); //tableEditor๋กœ ๋ถ€ํ„ฐ ์–ป์–ด์˜จ๋‹ค. var aNodes = this.htSelectedTD.aTdCells; if(aNodes){ this.nSelectedTD = aNodes.length; } }, $ON_DELETE_BLOCK_CONTENTS : function(){ var self = this, welParent, oBlockNode, oChildNode; this.setTdBlock(); for (var j = 0; j < this.nSelectedTD ; j++){ jindo.$Element(this.htSelectedTD.aTdCells[j]).child( function(elChild){ welParent = jindo.$Element(elChild._element.parentNode); welParent.remove(elChild); oBlockNode = self.oDocument.createElement('P'); if (jindo.$Agent().navigator().firefox) { oChildNode = self.oDocument.createElement('BR'); } else { oChildNode = self.oDocument.createTextNode('\u00A0'); } oBlockNode.appendChild(oChildNode); welParent.append(oBlockNode); }, 1); } } }); //{ /** * @fileOverview This file contains Husky plugin that takes care of the operations related to table creation * @name hp_SE_Table.js */ nhn.husky.SE2M_TableCreator = jindo.$Class({ name : "SE2M_TableCreator", _sSETblClass : "__se_tbl", nRows : 3, nColumns : 4, nBorderSize : 1, sBorderColor : "#000000", sBGColor: "#000000", nBorderStyleIdx : 3, nTableStyleIdx : 1, nMinRows : 1, nMaxRows : 20, nMinColumns : 1, nMaxColumns : 20, nMinBorderWidth : 1, nMaxBorderWidth : 10, rxLastDigits : null, sReEditGuideMsg_table : null, // ํ…Œ๋‘๋ฆฌ ์Šคํƒ€์ผ ๋ชฉ๋ก // ํ‘œ ์Šคํƒ€์ผ ์Šคํƒ€์ผ ๋ชฉ๋ก oSelection : null, $ON_MSG_APP_READY : function(){ this.sReEditGuideMsg_table = this.oApp.$MSG(nhn.husky.SE2M_Configuration.SE2M_ReEditAction.aReEditGuideMsg[3]); this.oApp.exec("REGISTER_UI_EVENT", ["table", "click", "TOGGLE_TABLE_LAYER"]); }, // [SMARTEDITORSUS-365] ํ…Œ์ด๋ธ”ํ€ต์—๋””ํ„ฐ > ์†์„ฑ ์ง์ ‘์ž…๋ ฅ > ํ…Œ๋‘๋ฆฌ ์Šคํƒ€์ผ // - ํ…Œ๋‘๋ฆฌ ์—†์Œ์„ ์„ ํƒํ•˜๋Š” ๊ฒฝ์šฐ ๋ณธ๋ฌธ์— ์‚ฝ์ž…ํ•˜๋Š” ํ‘œ์— ๊ฐ€์ด๋“œ ๋ผ์ธ์„ ํ‘œ์‹œํ•ด ์ค๋‹ˆ๋‹ค. ๋ณด๊ธฐ ์‹œ์—๋Š” ํ…Œ๋‘๋ฆฌ๊ฐ€ ๋ณด์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค. $ON_REGISTER_CONVERTERS : function(){ this.oApp.exec("ADD_CONVERTER_DOM", ["IR_TO_DB", jindo.$Fn(this.irToDbDOM, this).bind()]); this.oApp.exec("ADD_CONVERTER_DOM", ["DB_TO_IR", jindo.$Fn(this.dbToIrDOM, this).bind()]); }, irToDbDOM : function(oTmpNode){ /** * ์ €์žฅ์„ ์œ„ํ•œ Table Tag ๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ๋ณ€๊ฒฝ๋ฉ๋‹ˆ๋‹ค. * (1) <TABLE> * <table border="1" cellpadding="0" cellspacing="0" style="border:1px dashed #c7c7c7; border-left:0; border-bottom:0;" attr_no_border_tbl="1" class="__se_tbl"> * --> <table border="0" cellpadding="1" cellspacing="0" attr_no_border_tbl="1" class="__se_tbl"> * (2) <TD> * <td style="border:1px dashed #c7c7c7; border-top:0; border-right:0; background-color:#ffef00" width="245"><p>&nbsp;</p></td> * --> <td style="background-color:#ffef00" width="245">&nbsp;</td> */ var aNoBorderTable = []; var aTables = jindo.$$('table[class=__se_tbl]', oTmpNode, {oneTimeOffCache:true}); // ํ…Œ๋‘๋ฆฌ๊ฐ€ ์—†์Œ ์†์„ฑ์˜ table (์ž„์˜๋กœ ์ถ”๊ฐ€ํ•œ attr_no_border_tbl ์†์„ฑ์ด ์žˆ๋Š” table ์„ ์ฐพ์Œ) jindo.$A(aTables).forEach(function(oValue, nIdx, oArray) { if(jindo.$Element(oValue).attr("attr_no_border_tbl")){ aNoBorderTable.push(oValue); } }, this); if(aNoBorderTable.length < 1){ return; } // [SMARTEDITORSUS-410] ๊ธ€ ์ €์žฅ ์‹œ, ํ…Œ๋‘๋ฆฌ ์—†์Œ ์†์„ฑ์„ ์„ ํƒํ•  ๋•Œ ์ž„์˜๋กœ ํ‘œ์‹œํ•œ ๊ฐ€์ด๋“œ ๋ผ์ธ property ๋งŒ style ์—์„œ ์ œ๊ฑฐํ•ด ์ค€๋‹ค. // <TABLE> ๊ณผ <TD> ์˜ ์†์„ฑ๊ฐ’์„ ๋ณ€๊ฒฝ ๋ฐ ์ œ๊ฑฐ var aTDs = [], oTable; for(var i = 0, nCount = aNoBorderTable.length; i < nCount; i++){ oTable = aNoBorderTable[i]; // <TABLE> ์—์„œ border, cellpadding ์†์„ฑ๊ฐ’ ๋ณ€๊ฒฝ, style property ์ œ๊ฑฐ jindo.$Element(oTable).css({"border": "", "borderLeft": "", "borderBottom": ""}); jindo.$Element(oTable).attr({"border": 0, "cellpadding": 1}); // <TD> ์—์„œ๋Š” background-color ๋ฅผ ์ œ์™ธํ•œ style ์„ ๋ชจ๋‘ ์ œ๊ฑฐ aTDs = jindo.$$('tbody>tr>td', oTable); jindo.$A(aTDs).forEach(function(oTD, nIdx, oTDArray) { jindo.$Element(oTD).css({"border": "", "borderTop": "", "borderRight": ""}); }); } }, dbToIrDOM : function(oTmpNode){ /** * ์ˆ˜์ •์„ ์œ„ํ•œ Table Tag ๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ๋ณ€๊ฒฝ๋ฉ๋‹ˆ๋‹ค. * (1) <TABLE> * <table border="0" cellpadding="1" cellspacing="0" attr_no_border_tbl="1" class="__se_tbl"> * --> <table border="1" cellpadding="0" cellspacing="0" style="border:1px dashed #c7c7c7; border-left:0; border-bottom:0;" attr_no_border_tbl="1" class="__se_tbl"> * (2) <TD> * <td style="background-color:#ffef00" width="245">&nbsp;</td> * --> <td style="border:1px dashed #c7c7c7; border-top:0; border-right:0; background-color:#ffef00" width="245"><p>&nbsp;</p></td> */ var aNoBorderTable = []; var aTables = jindo.$$('table[class=__se_tbl]', oTmpNode, {oneTimeOffCache:true}); // ํ…Œ๋‘๋ฆฌ๊ฐ€ ์—†์Œ ์†์„ฑ์˜ table (์ž„์˜๋กœ ์ถ”๊ฐ€ํ•œ attr_no_border_tbl ์†์„ฑ์ด ์žˆ๋Š” table ์„ ์ฐพ์Œ) jindo.$A(aTables).forEach(function(oValue, nIdx, oArray) { if(jindo.$Element(oValue).attr("attr_no_border_tbl")){ aNoBorderTable.push(oValue); } }, this); if(aNoBorderTable.length < 1){ return; } // <TABLE> ๊ณผ <TD> ์˜ ์†์„ฑ๊ฐ’์„ ๋ณ€๊ฒฝ/์ถ”๊ฐ€ var aTDs = [], oTable; for(var i = 0, nCount = aNoBorderTable.length; i < nCount; i++){ oTable = aNoBorderTable[i]; // <TABLE> ์—์„œ border, cellpadding ์†์„ฑ๊ฐ’ ๋ณ€๊ฒฝ/ style ์†์„ฑ ์ถ”๊ฐ€ jindo.$Element(oTable).css({"border": "1px dashed #c7c7c7", "borderLeft": 0, "borderBottom": 0}); jindo.$Element(oTable).attr({"border": 1, "cellpadding": 0}); // <TD> ์—์„œ style ์†์„ฑ๊ฐ’ ์ถ”๊ฐ€ aTDs = jindo.$$('tbody>tr>td', oTable); jindo.$A(aTDs).forEach(function(oTD, nIdx, oTDArray) { jindo.$Element(oTD).css({"border": "1px dashed #c7c7c7", "borderTop": 0, "borderRight": 0}); }); } }, //@lazyload_js TOGGLE_TABLE_LAYER[ _assignHTMLObjects : function(oAppContainer){ this.oApp.exec("LOAD_HTML", ["create_table"]); var tmp = null; this.elDropdownLayer = jindo.$$.getSingle("DIV.husky_se2m_table_layer", oAppContainer); this.welDropdownLayer = jindo.$Element(this.elDropdownLayer); tmp = jindo.$$("INPUT", this.elDropdownLayer); this.elText_row = tmp[0]; this.elText_col = tmp[1]; this.elRadio_manualStyle = tmp[2]; this.elText_borderSize = tmp[3]; this.elText_borderColor = tmp[4]; this.elText_BGColor = tmp[5]; this.elRadio_templateStyle = tmp[6]; tmp = jindo.$$("BUTTON", this.elDropdownLayer); this.elBtn_rowInc = tmp[0]; this.elBtn_rowDec = tmp[1]; this.elBtn_colInc = tmp[2]; this.elBtn_colDec = tmp[3]; this.elBtn_borderStyle = tmp[4]; this.elBtn_incBorderSize = jindo.$$.getSingle("BUTTON.se2m_incBorder", this.elDropdownLayer); this.elBtn_decBorderSize = jindo.$$.getSingle("BUTTON.se2m_decBorder", this.elDropdownLayer); this.elLayer_Dim1 = jindo.$$.getSingle("DIV.se2_t_dim0", this.elDropdownLayer); this.elLayer_Dim2 = jindo.$$.getSingle("DIV.se2_t_dim3", this.elDropdownLayer); // border style layer contains btn elm's tmp = jindo.$$("SPAN.se2_pre_color>BUTTON", this.elDropdownLayer); this.elBtn_borderColor = tmp[0]; this.elBtn_BGColor = tmp[1]; this.elBtn_tableStyle = jindo.$$.getSingle("DIV.se2_select_ty2>BUTTON", this.elDropdownLayer); tmp = jindo.$$("P.se2_btn_area>BUTTON", this.elDropdownLayer); this.elBtn_apply = tmp[0]; this.elBtn_cancel = tmp[1]; this.elTable_preview = jindo.$$.getSingle("TABLE.husky_se2m_table_preview", this.elDropdownLayer); this.elLayer_borderStyle = jindo.$$.getSingle("DIV.husky_se2m_table_border_style_layer", this.elDropdownLayer); this.elPanel_borderStylePreview = jindo.$$.getSingle("SPAN.husky_se2m_table_border_style_preview", this.elDropdownLayer); this.elPanel_borderColorPallet = jindo.$$.getSingle("DIV.husky_se2m_table_border_color_pallet", this.elDropdownLayer); this.elPanel_bgColorPallet = jindo.$$.getSingle("DIV.husky_se2m_table_bgcolor_pallet", this.elDropdownLayer); this.elLayer_tableStyle = jindo.$$.getSingle("DIV.husky_se2m_table_style_layer", this.elDropdownLayer); this.elPanel_tableStylePreview = jindo.$$.getSingle("SPAN.husky_se2m_table_style_preview", this.elDropdownLayer); this.aElBtn_borderStyle = jindo.$$("BUTTON", this.elLayer_borderStyle); this.aElBtn_tableStyle = jindo.$$("BUTTON", this.elLayer_tableStyle); this.sNoBorderText = jindo.$$.getSingle("SPAN.se2m_no_border", this.elDropdownLayer).innerHTML; this.rxLastDigits = RegExp("([0-9]+)$"); }, $LOCAL_BEFORE_FIRST : function(){ this._assignHTMLObjects(this.oApp.htOptions.elAppContainer); this.oApp.registerBrowserEvent(this.elText_row, "change", "TABLE_SET_ROW_NUM", [null, 0]); this.oApp.registerBrowserEvent(this.elText_col, "change", "TABLE_SET_COLUMN_NUM", [null, 0]); this.oApp.registerBrowserEvent(this.elText_borderSize, "change", "TABLE_SET_BORDER_SIZE", [null, 0]); this.oApp.registerBrowserEvent(this.elBtn_rowInc, "click", "TABLE_INC_ROW"); this.oApp.registerBrowserEvent(this.elBtn_rowDec, "click", "TABLE_DEC_ROW"); jindo.$Fn(this._numRowKeydown, this).attach(this.elText_row.parentNode, "keydown"); this.oApp.registerBrowserEvent(this.elBtn_colInc, "click", "TABLE_INC_COLUMN"); this.oApp.registerBrowserEvent(this.elBtn_colDec, "click", "TABLE_DEC_COLUMN"); jindo.$Fn(this._numColKeydown, this).attach(this.elText_col.parentNode, "keydown"); this.oApp.registerBrowserEvent(this.elBtn_incBorderSize, "click", "TABLE_INC_BORDER_SIZE"); this.oApp.registerBrowserEvent(this.elBtn_decBorderSize, "click", "TABLE_DEC_BORDER_SIZE"); jindo.$Fn(this._borderSizeKeydown, this).attach(this.elText_borderSize.parentNode, "keydown"); this.oApp.registerBrowserEvent(this.elBtn_borderStyle, "click", "TABLE_TOGGLE_BORDER_STYLE_LAYER"); this.oApp.registerBrowserEvent(this.elBtn_tableStyle, "click", "TABLE_TOGGLE_STYLE_LAYER"); this.oApp.registerBrowserEvent(this.elBtn_borderColor, "click", "TABLE_TOGGLE_BORDER_COLOR_PALLET"); this.oApp.registerBrowserEvent(this.elBtn_BGColor, "click", "TABLE_TOGGLE_BGCOLOR_PALLET"); this.oApp.registerBrowserEvent(this.elRadio_manualStyle, "click", "TABLE_ENABLE_MANUAL_STYLE"); this.oApp.registerBrowserEvent(this.elRadio_templateStyle, "click", "TABLE_ENABLE_TEMPLATE_STYLE"); //this.oApp.registerBrowserEvent(this.elDropdownLayer, "click", "TABLE_LAYER_CLICKED"); //this.oApp.registerBrowserEvent(this.elLayer_borderStyle, "click", "TABLE_BORDER_STYLE_LAYER_CLICKED"); //this.oApp.registerBrowserEvent(this.elLayer_tableStyle, "click", "TABLE_STYLE_LAYER_CLICKED"); this.oApp.exec("SE2_ATTACH_HOVER_EVENTS", [this.aElBtn_borderStyle]); this.oApp.exec("SE2_ATTACH_HOVER_EVENTS", [this.aElBtn_tableStyle]); var i; for(i=0; i<this.aElBtn_borderStyle.length; i++){ this.oApp.registerBrowserEvent(this.aElBtn_borderStyle[i], "click", "TABLE_SELECT_BORDER_STYLE"); } for(i=0; i<this.aElBtn_tableStyle.length; i++){ this.oApp.registerBrowserEvent(this.aElBtn_tableStyle[i], "click", "TABLE_SELECT_STYLE"); } this.oApp.registerBrowserEvent(this.elBtn_apply, "click", "TABLE_INSERT"); this.oApp.registerBrowserEvent(this.elBtn_cancel, "click", "HIDE_ACTIVE_LAYER"); this.oApp.exec("TABLE_SET_BORDER_COLOR", [/#[0-9A-Fa-f]{6}/.test(this.elText_borderColor.value) ? this.elText_borderColor.value : "#cccccc"]); this.oApp.exec("TABLE_SET_BGCOLOR", [/#[0-9A-Fa-f]{6}/.test(this.elText_BGColor.value) ? this.elText_BGColor.value : "#ffffff"]); // 1: manual style // 2: template style this.nStyleMode = 1; // add #BorderSize+x# if needed //--- // [SMARTEDITORSUS-365] ํ…Œ์ด๋ธ”ํ€ต์—๋””ํ„ฐ > ์†์„ฑ ์ง์ ‘์ž…๋ ฅ > ํ…Œ๋‘๋ฆฌ ์Šคํƒ€์ผ // - ํ…Œ๋‘๋ฆฌ ์—†์Œ์„ ์„ ํƒํ•˜๋Š” ๊ฒฝ์šฐ ๋ณธ๋ฌธ์— ์‚ฝ์ž…ํ•˜๋Š” ํ‘œ์— ๊ฐ€์ด๋“œ ๋ผ์ธ์„ ํ‘œ์‹œํ•ด ์ค๋‹ˆ๋‹ค. ๋ณด๊ธฐ ์‹œ์—๋Š” ํ…Œ๋‘๋ฆฌ๊ฐ€ ๋ณด์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค. this.aTableStyleByBorder = [ '', 'border="1" cellpadding="0" cellspacing="0" style="border:1px dashed #c7c7c7; border-left:0; border-bottom:0;"', 'border="1" cellpadding="0" cellspacing="0" style="border:#BorderSize#px dashed #BorderColor#; border-left:0; border-bottom:0;"', 'border="0" cellpadding="0" cellspacing="0" style="border:#BorderSize#px solid #BorderColor#; border-left:0; border-bottom:0;"', 'border="0" cellpadding="0" cellspacing="1" style="border:#BorderSize#px solid #BorderColor#;"', 'border="0" cellpadding="0" cellspacing="1" style="border:#BorderSize#px double #BorderColor#;"', 'border="0" cellpadding="0" cellspacing="1" style="border-width:#BorderSize*2#px #BorderSize#px #BorderSize#px #BorderSize*2#px; border-style:solid;border-color:#BorderColor#;"', 'border="0" cellpadding="0" cellspacing="1" style="border-width:#BorderSize#px #BorderSize*2#px #BorderSize*2#px #BorderSize#px; border-style:solid;border-color:#BorderColor#;"' ]; this.aTDStyleByBorder = [ '', 'style="border:1px dashed #c7c7c7; border-top:0; border-right:0; background-color:#BGColor#"', 'style="border:#BorderSize#px dashed #BorderColor#; border-top:0; border-right:0; background-color:#BGColor#"', 'style="border:#BorderSize#px solid #BorderColor#; border-top:0; border-right:0; background-color:#BGColor#"', 'style="border:#BorderSize#px solid #BorderColor#; background-color:#BGColor#"', 'style="border:#BorderSize+2#px double #BorderColor#; background-color:#BGColor#"', 'style="border-width:#BorderSize#px #BorderSize*2#px #BorderSize*2#px #BorderSize#px; border-style:solid;border-color:#BorderColor#; background-color:#BGColor#"', 'style="border-width:#BorderSize*2#px #BorderSize#px #BorderSize#px #BorderSize*2#px; border-style:solid;border-color:#BorderColor#; background-color:#BGColor#"' ]; this.oApp.registerBrowserEvent(this.elDropdownLayer, "keydown", "EVENT_TABLE_CREATE_KEYDOWN"); this._drawTableDropdownLayer(); }, $ON_TABLE_SELECT_BORDER_STYLE : function(weEvent){ var elButton = weEvent.currentElement; // var aMatch = this.rxLastDigits.exec(weEvent.element.className); var aMatch = this.rxLastDigits.exec(elButton.className); this._selectBorderStyle(aMatch[1]); }, $ON_TABLE_SELECT_STYLE : function(weEvent){ var aMatch = this.rxLastDigits.exec(weEvent.element.className); this._selectTableStyle(aMatch[1]); }, $ON_TOGGLE_TABLE_LAYER : function(){ // this.oSelection = this.oApp.getSelection(); this._showNewTable(); this.oApp.exec("TOGGLE_TOOLBAR_ACTIVE_LAYER", [this.elDropdownLayer, null, "SELECT_UI", ["table"], "TABLE_CLOSE", []]); this.oApp.exec('MSG_NOTIFY_CLICKCR', ['table']); }, // $ON_TABLE_BORDER_STYLE_LAYER_CLICKED : function(weEvent){ // top.document.title = weEvent.element.tagName; // }, $ON_TABLE_CLOSE_ALL : function(){ this.oApp.exec("TABLE_HIDE_BORDER_COLOR_PALLET", []); this.oApp.exec("TABLE_HIDE_BGCOLOR_PALLET", []); this.oApp.exec("TABLE_HIDE_BORDER_STYLE_LAYER", []); this.oApp.exec("TABLE_HIDE_STYLE_LAYER", []); }, $ON_TABLE_INC_ROW : function(){ this.oApp.exec("TABLE_SET_ROW_NUM", [null, 1]); }, $ON_TABLE_DEC_ROW : function(){ this.oApp.exec("TABLE_SET_ROW_NUM", [null, -1]); }, $ON_TABLE_INC_COLUMN : function(){ this.oApp.exec("TABLE_SET_COLUMN_NUM", [null, 1]); }, $ON_TABLE_DEC_COLUMN : function(){ this.oApp.exec("TABLE_SET_COLUMN_NUM", [null, -1]); }, $ON_TABLE_SET_ROW_NUM : function(nRows, nRowDiff){ nRows = nRows || parseInt(this.elText_row.value, 10) || 0; nRowDiff = nRowDiff || 0; nRows += nRowDiff; if(nRows < this.nMinRows){nRows = this.nMinRows;} if(nRows > this.nMaxRows){nRows = this.nMaxRows;} this.elText_row.value = nRows; this._showNewTable(); }, $ON_TABLE_SET_COLUMN_NUM : function(nColumns, nColumnDiff){ nColumns = nColumns || parseInt(this.elText_col.value, 10) || 0; nColumnDiff = nColumnDiff || 0; nColumns += nColumnDiff; if(nColumns < this.nMinColumns){nColumns = this.nMinColumns;} if(nColumns > this.nMaxColumns){nColumns = this.nMaxColumns;} this.elText_col.value = nColumns; this._showNewTable(); }, _getTableString : function(){ var sTable; if(this.nStyleMode == 1){ sTable = this._doGetTableString(this.nColumns, this.nRows, this.nBorderSize, this.sBorderColor, this.sBGColor, this.nBorderStyleIdx); }else{ sTable = this._doGetTableString(this.nColumns, this.nRows, this.nBorderSize, this.sBorderColor, this.sBGColor, 0); } return sTable; }, $ON_TABLE_INSERT : function(){ this.oApp.exec("IE_FOCUS", []); // [SMARTEDITORSUS-500] IE์ธ ๊ฒฝ์šฐ ๋ช…์‹œ์ ์ธ focus ์ถ”๊ฐ€ //[SMARTEDITORSUS-596]์ด๋ฒคํŠธ ๋ฐœ์ƒ์ด ์•ˆ๋˜๋Š” ๊ฒฝ์šฐ, //max ์ œํ•œ์ด ์ ์šฉ์ด ์•ˆ๋˜๊ธฐ ๋•Œ๋ฌธ์— ํ…Œ์ด๋ธ” ์‚ฌ์ž… ์‹œ์ ์— ๋‹ค์‹œํ•œ๋ฒˆ Max ๊ฐ’์„ ๊ฒ€์‚ฌํ•œ๋‹ค. this.oApp.exec("TABLE_SET_COLUMN_NUM"); this.oApp.exec("TABLE_SET_ROW_NUM"); this._loadValuesFromHTML(); var sTable, elLinebreak, elBody, welBody, elTmpDiv, elTable, elFirstTD, oSelection, elTableHolder, htBrowser; elBody = this.oApp.getWYSIWYGDocument().body; welBody = jindo.$Element(elBody); htBrowser = jindo.$Agent().navigator(); this.nTableWidth = elBody.offsetWidth; sTable = this._getTableString(); elTmpDiv = this.oApp.getWYSIWYGDocument().createElement("DIV"); elTmpDiv.innerHTML = sTable; elTable = elTmpDiv.firstChild; elTable.className = this._sSETblClass; oSelection = this.oApp.getSelection(); oSelection = this._divideParagraph(oSelection); // [SMARTEDITORSUS-306] this.oApp.exec("RECORD_UNDO_BEFORE_ACTION", ["INSERT TABLE", {sSaveTarget:"BODY"}]); // If the table were inserted within a styled(strikethough & etc) paragraph, the table may inherit the style in IE. elTableHolder = this.oApp.getWYSIWYGDocument().createElement("DIV"); // ์˜์—ญ์„ ์žก์•˜์„ ๊ฒฝ์šฐ, ์˜์—ญ ์ง€์šฐ๊ณ  ํ…Œ์ด๋ธ” ์‚ฝ์ž… oSelection.deleteContents(); oSelection.insertNode(elTableHolder); oSelection.selectNode(elTableHolder); this.oApp.exec("REMOVE_STYLE", [oSelection]); if(htBrowser.ie && this.oApp.getWYSIWYGDocument().body.childNodes.length === 1 && this.oApp.getWYSIWYGDocument().body.firstChild === elTableHolder){ // IE์—์„œ table์ด body์— ๋ฐ”๋กœ ๋ถ™์–ด ์žˆ์„ ๊ฒฝ์šฐ, ์ •๋ ฌ๋“ฑ์—์„œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒ ํ•จ์œผ๋กœ elTableHolder(DIV)๋ฅผ ๋‚จ๊ฒจ๋‘  elTableHolder.insertBefore(elTable, null); }else{ elTableHolder.parentNode.insertBefore(elTable, elTableHolder); elTableHolder.parentNode.removeChild(elTableHolder); } // FF : ํ…Œ์ด๋ธ” ํ•˜๋‹จ์— BR์ด ์—†์„ ๊ฒฝ์šฐ, ์ปค์„œ๊ฐ€ ํ…Œ์ด๋ธ” ๋ฐ‘์œผ๋กœ ์ด๋™ํ•  ์ˆ˜ ์—†์–ด BR์„ ์‚ฝ์ž… ํ•ด ์คŒ. //[SMARTEDITORSUS-181][IE9] ํ‘œ๋‚˜ ์š”์•ฝ๊ธ€ ๋“ฑ์˜ ํ…Œ์ด๋ธ”์—์„œ > ํ…Œ์ด๋ธ” ์™ธ๋ถ€๋กœ ์ปค์„œ ์ด๋™ ๋ถˆ๊ฐ€ if(htBrowser.firefox){ elLinebreak = this.oApp.getWYSIWYGDocument().createElement("BR"); elTable.parentNode.insertBefore(elLinebreak, elTable.nextSibling); }else if(htBrowser.ie ){ elLinebreak = this.oApp.getWYSIWYGDocument().createElement("p"); elTable.parentNode.insertBefore(elLinebreak, elTable.nextSibling); } if(this.nStyleMode == 2){ this.oApp.exec("STYLE_TABLE", [elTable, this.nTableStyleIdx]); } elFirstTD = elTable.getElementsByTagName("TD")[0]; oSelection.selectNodeContents(elFirstTD.firstChild || elFirstTD); oSelection.collapseToEnd(); oSelection.select(); this.oApp.exec("FOCUS"); this.oApp.exec("RECORD_UNDO_AFTER_ACTION", ["INSERT TABLE", {sSaveTarget:"BODY"}]); this.oApp.exec("HIDE_ACTIVE_LAYER", []); this.oApp.exec('MSG_DISPLAY_REEDIT_MESSAGE_SHOW', [this.name, this.sReEditGuideMsg_table]); }, /** * P ์•ˆ์— Table ์ด ์ถ”๊ฐ€๋˜์ง€ ์•Š๋„๋ก P ํƒœ๊ทธ๋ฅผ ๋ถ„๋ฆฌํ•จ * * [SMARTEDITORSUS-306] * P ์— Table ์„ ์ถ”๊ฐ€ํ•œ ๊ฒฝ์šฐ, DOM ์—์„œ ๋น„์ •์ƒ์ ์ธ P ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ๊นจ์ง€๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋ฐœ์ƒํ•จ * ํ…Œ์ด๋ธ”์ด ์ถ”๊ฐ€๋˜๋Š” ๋ถ€๋ถ„์— P ๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ, P ๋ฅผ ๋ถ„๋ฆฌ์‹œ์ผœ์ฃผ๋Š” ์ฒ˜๋ฆฌ */ _divideParagraph : function(oSelection){ var oParentP, welParentP, sNodeVaule, sBM, oSWrapper, oEWrapper; oSelection.fixCommonAncestorContainer(); // [SMARTEDITORSUS-423] ์—”ํ„ฐ์— ์˜ํ•ด ์ƒ์„ฑ๋œ P ๊ฐ€ ์•„๋‹Œ ์ด์ „ P ๊ฐ€ ์„ ํƒ๋˜์ง€ ์•Š๋„๋ก fix ํ•˜๋„๋ก ์ฒ˜๋ฆฌ oParentP = oSelection.findAncestorByTagName("P"); if(!oParentP){ return oSelection; } if(!oParentP.firstChild || nhn.husky.SE2M_Utils.isBlankNode(oParentP)){ oSelection.selectNode(oParentP); // [SMARTEDITORSUS-423] ๋ถˆํ•„์š”ํ•œ ๊ฐœํ–‰์ด ์ผ์–ด๋‚˜์ง€ ์•Š๋„๋ก ๋นˆ P ๋ฅผ ์„ ํƒํ•˜์—ฌ TABLE ๋กœ ๋Œ€์ฒดํ•˜๋„๋ก ์ฒ˜๋ฆฌ oSelection.select(); return oSelection; } sBM = oSelection.placeStringBookmark(); oSelection.moveToBookmark(sBM); oSWrapper = this.oApp.getWYSIWYGDocument().createElement("P"); oSelection.setStartBefore(oParentP.firstChild); oSelection.surroundContents(oSWrapper); oSelection.collapseToEnd(); oEWrapper = this.oApp.getWYSIWYGDocument().createElement("P"); oSelection.setEndAfter(oParentP.lastChild); oSelection.surroundContents(oEWrapper); oSelection.collapseToStart(); oSelection.removeStringBookmark(sBM); welParentP = jindo.$Element(oParentP); welParentP.after(oEWrapper); welParentP.after(oSWrapper); welParentP.leave(); oSelection = this.oApp.getEmptySelection(); oSelection.setEndAfter(oSWrapper); oSelection.setStartBefore(oEWrapper); oSelection.select(); return oSelection; }, $ON_TABLE_CLOSE : function(){ this.oApp.exec("TABLE_CLOSE_ALL", []); this.oApp.exec("DESELECT_UI", ["table"]); }, $ON_TABLE_SET_BORDER_SIZE : function(nBorderWidth, nBorderWidthDiff){ nBorderWidth = nBorderWidth || parseInt(this.elText_borderSize.value, 10) || 0; nBorderWidthDiff = nBorderWidthDiff || 0; nBorderWidth += nBorderWidthDiff; if(nBorderWidth < this.nMinBorderWidth){nBorderWidth = this.nMinBorderWidth;} if(nBorderWidth > this.nMaxBorderWidth){nBorderWidth = this.nMaxBorderWidth;} this.elText_borderSize.value = nBorderWidth; }, $ON_TABLE_INC_BORDER_SIZE : function(){ this.oApp.exec("TABLE_SET_BORDER_SIZE", [null, 1]); }, $ON_TABLE_DEC_BORDER_SIZE : function(){ this.oApp.exec("TABLE_SET_BORDER_SIZE", [null, -1]); }, $ON_TABLE_TOGGLE_BORDER_STYLE_LAYER : function(){ if(this.elLayer_borderStyle.style.display == "block"){ this.oApp.exec("TABLE_HIDE_BORDER_STYLE_LAYER", []); }else{ this.oApp.exec("TABLE_SHOW_BORDER_STYLE_LAYER", []); } }, $ON_TABLE_SHOW_BORDER_STYLE_LAYER : function(){ this.oApp.exec("TABLE_CLOSE_ALL", []); this.elBtn_borderStyle.className = "se2_view_more2"; this.elLayer_borderStyle.style.display = "block"; this._refresh(); }, $ON_TABLE_HIDE_BORDER_STYLE_LAYER : function(){ this.elBtn_borderStyle.className = "se2_view_more"; this.elLayer_borderStyle.style.display = "none"; this._refresh(); }, $ON_TABLE_TOGGLE_STYLE_LAYER : function(){ if(this.elLayer_tableStyle.style.display == "block"){ this.oApp.exec("TABLE_HIDE_STYLE_LAYER", []); }else{ this.oApp.exec("TABLE_SHOW_STYLE_LAYER", []); } }, $ON_TABLE_SHOW_STYLE_LAYER : function(){ this.oApp.exec("TABLE_CLOSE_ALL", []); this.elBtn_tableStyle.className = "se2_view_more2"; this.elLayer_tableStyle.style.display = "block"; this._refresh(); }, $ON_TABLE_HIDE_STYLE_LAYER : function(){ this.elBtn_tableStyle.className = "se2_view_more"; this.elLayer_tableStyle.style.display = "none"; this._refresh(); }, $ON_TABLE_TOGGLE_BORDER_COLOR_PALLET : function(){ if(this.welDropdownLayer.hasClass("p1")){ this.oApp.exec("TABLE_HIDE_BORDER_COLOR_PALLET", []); }else{ this.oApp.exec("TABLE_SHOW_BORDER_COLOR_PALLET", []); } }, $ON_TABLE_SHOW_BORDER_COLOR_PALLET : function(){ this.oApp.exec("TABLE_CLOSE_ALL", []); this.welDropdownLayer.addClass("p1"); this.welDropdownLayer.removeClass("p2"); this.oApp.exec("SHOW_COLOR_PALETTE", ["TABLE_SET_BORDER_COLOR_FROM_PALETTE", this.elPanel_borderColorPallet]); this.elPanel_borderColorPallet.parentNode.style.display = "block"; }, $ON_TABLE_HIDE_BORDER_COLOR_PALLET : function(){ this.welDropdownLayer.removeClass("p1"); this.oApp.exec("HIDE_COLOR_PALETTE", []); this.elPanel_borderColorPallet.parentNode.style.display = "none"; }, $ON_TABLE_TOGGLE_BGCOLOR_PALLET : function(){ if(this.welDropdownLayer.hasClass("p2")){ this.oApp.exec("TABLE_HIDE_BGCOLOR_PALLET", []); }else{ this.oApp.exec("TABLE_SHOW_BGCOLOR_PALLET", []); } }, $ON_TABLE_SHOW_BGCOLOR_PALLET : function(){ this.oApp.exec("TABLE_CLOSE_ALL", []); this.welDropdownLayer.removeClass("p1"); this.welDropdownLayer.addClass("p2"); this.oApp.exec("SHOW_COLOR_PALETTE", ["TABLE_SET_BGCOLOR_FROM_PALETTE", this.elPanel_bgColorPallet]); this.elPanel_bgColorPallet.parentNode.style.display = "block"; }, $ON_TABLE_HIDE_BGCOLOR_PALLET : function(){ this.welDropdownLayer.removeClass("p2"); this.oApp.exec("HIDE_COLOR_PALETTE", []); this.elPanel_bgColorPallet.parentNode.style.display = "none"; }, $ON_TABLE_SET_BORDER_COLOR_FROM_PALETTE : function(sColorCode){ this.oApp.exec("TABLE_SET_BORDER_COLOR", [sColorCode]); this.oApp.exec("TABLE_HIDE_BORDER_COLOR_PALLET", []); }, $ON_TABLE_SET_BORDER_COLOR : function(sColorCode){ this.elText_borderColor.value = sColorCode; this.elBtn_borderColor.style.backgroundColor = sColorCode; }, $ON_TABLE_SET_BGCOLOR_FROM_PALETTE : function(sColorCode){ this.oApp.exec("TABLE_SET_BGCOLOR", [sColorCode]); this.oApp.exec("TABLE_HIDE_BGCOLOR_PALLET", []); }, $ON_TABLE_SET_BGCOLOR : function(sColorCode){ this.elText_BGColor.value = sColorCode; this.elBtn_BGColor.style.backgroundColor = sColorCode; }, $ON_TABLE_ENABLE_MANUAL_STYLE : function(){ this.nStyleMode = 1; this._drawTableDropdownLayer(); }, $ON_TABLE_ENABLE_TEMPLATE_STYLE : function(){ this.nStyleMode = 2; this._drawTableDropdownLayer(); }, $ON_EVENT_TABLE_CREATE_KEYDOWN : function(oEvent){ if (oEvent.key().enter){ this.elBtn_apply.focus(); this.oApp.exec("TABLE_INSERT"); oEvent.stop(); } }, _drawTableDropdownLayer : function(){ if(this.nBorderStyleIdx == 1){ this.elPanel_borderStylePreview.innerHTML = this.sNoBorderText; this.elLayer_Dim1.className = "se2_t_dim2"; }else{ this.elPanel_borderStylePreview.innerHTML = ""; this.elLayer_Dim1.className = "se2_t_dim0"; } if(this.nStyleMode == 1){ this.elRadio_manualStyle.checked = true; this.elLayer_Dim2.className = "se2_t_dim3"; this.elText_borderSize.disabled = false; this.elText_borderColor.disabled = false; this.elText_BGColor.disabled = false; }else{ this.elRadio_templateStyle.checked = true; this.elLayer_Dim2.className = "se2_t_dim1"; this.elText_borderSize.disabled = true; this.elText_borderColor.disabled = true; this.elText_BGColor.disabled = true; } this.oApp.exec("TABLE_CLOSE_ALL", []); }, _selectBorderStyle : function(nStyleNum){ this.elPanel_borderStylePreview.className = "se2_b_style"+nStyleNum; this.nBorderStyleIdx = nStyleNum; this._drawTableDropdownLayer(); }, _selectTableStyle : function(nStyleNum){ this.elPanel_tableStylePreview.className = "se2_t_style"+nStyleNum; this.nTableStyleIdx = nStyleNum; this._drawTableDropdownLayer(); }, _showNewTable : function(){ var oTmp = document.createElement("DIV"); this._loadValuesFromHTML(); oTmp.innerHTML = this._getPreviewTableString(this.nColumns, this.nRows); //this.nTableWidth = 0; //oTmp.innerHTML = this._getTableString(); var oNewTable = oTmp.firstChild; this.elTable_preview.parentNode.insertBefore(oNewTable, this.elTable_preview); this.elTable_preview.parentNode.removeChild(this.elTable_preview); this.elTable_preview = oNewTable; this._refresh(); }, _getPreviewTableString : function(nColumns, nRows){ var sTable = '<table border="0" cellspacing="1" class="se2_pre_table husky_se2m_table_preview">'; var sRow = '<tr>'; for(var i=0; i<nColumns; i++){ sRow += "<td><p>&nbsp;</p></td>\n"; } sRow += "</tr>\n"; sTable += "<tbody>"; for(var i=0; i<nRows; i++){ sTable += sRow; } sTable += "</tbody>\n"; sTable += "</table>\n"; return sTable; }, _loadValuesFromHTML : function(){ this.nColumns = parseInt(this.elText_col.value, 10) || 1; this.nRows = parseInt(this.elText_row.value, 10) || 1; this.nBorderSize = parseInt(this.elText_borderSize.value, 10) || 1; this.sBorderColor = this.elText_borderColor.value; this.sBGColor = this.elText_BGColor.value; }, _doGetTableString : function(nColumns, nRows, nBorderSize, sBorderColor, sBGColor, nBorderStyleIdx){ var nTDWidth = parseInt(this.nTableWidth/nColumns, 10); var nBorderSize = this.nBorderSize; var sTableStyle = this.aTableStyleByBorder[nBorderStyleIdx].replace(/#BorderSize#/g, this.nBorderSize).replace(/#BorderSize\*([0-9]+)#/g, function(sAll, s1){return nBorderSize*parseInt(s1, 10);}).replace(/#BorderSize\+([0-9]+)#/g, function(sAll, s1){return nBorderSize+parseInt(s1, 10);}).replace("#BorderColor#", this.sBorderColor).replace("#BGColor#", this.sBGColor); var sTDStyle = this.aTDStyleByBorder[nBorderStyleIdx].replace(/#BorderSize#/g, this.nBorderSize).replace(/#BorderSize\*([0-9]+)#/g, function(sAll, s1){return nBorderSize*parseInt(s1, 10);}).replace(/#BorderSize\+([0-9]+)#/g, function(sAll, s1){return nBorderSize+parseInt(s1, 10);}).replace("#BorderColor#", this.sBorderColor).replace("#BGColor#", this.sBGColor); if(nTDWidth){ sTDStyle += " width="+nTDWidth; }else{ //sTableStyle += " width=100%"; sTableStyle += "class=se2_pre_table"; } // [SMARTEDITORSUS-365] ํ…Œ์ด๋ธ”ํ€ต์—๋””ํ„ฐ > ์†์„ฑ ์ง์ ‘์ž…๋ ฅ > ํ…Œ๋‘๋ฆฌ ์Šคํƒ€์ผ // - ํ…Œ๋‘๋ฆฌ ์—†์Œ์„ ์„ ํƒํ•˜๋Š” ๊ฒฝ์šฐ ๋ณธ๋ฌธ์— ์‚ฝ์ž…ํ•˜๋Š” ํ‘œ์— ๊ฐ€์ด๋“œ ๋ผ์ธ์„ ํ‘œ์‹œํ•ด ์ค๋‹ˆ๋‹ค. ๋ณด๊ธฐ ์‹œ์—๋Š” ํ…Œ๋‘๋ฆฌ๊ฐ€ ๋ณด์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค. // - ๊ธ€ ์ €์žฅ ์‹œ์—๋Š” ๊ธ€ ์ž‘์„ฑ ์‹œ์— ์ ์šฉํ•˜์˜€๋˜ style ์„ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฅผ ์œ„ํ•ด์„œ ์ž„์˜์˜ ์†์„ฑ(attr_no_border_tbl)์„ ์ถ”๊ฐ€ํ•˜์˜€๋‹ค๊ฐ€ ์ €์žฅ ์‹œ์ ์—์„œ ์ œ๊ฑฐํ•ด ์ฃผ๋„๋ก ํ•ฉ๋‹ˆ๋‹ค. var sTempNoBorderClass = (nBorderStyleIdx == 1) ? 'attr_no_border_tbl="1"' : ''; var sTable = "<table "+sTableStyle+" "+sTempNoBorderClass+">"; var sRow = "<tr>"; for(var i=0; i<nColumns; i++){ sRow += "<td "+sTDStyle+"><p>&nbsp;</p></td>\n"; } sRow += "</tr>\n"; sTable += "<tbody>\n"; for(var i=0; i<nRows; i++){ sTable += sRow; } sTable += "</tbody>\n"; sTable += "</table>\n<br>"; return sTable; }, _numRowKeydown : function(weEvent){ var oKeyInfo = weEvent.key(); // up if(oKeyInfo.keyCode == 38){ this.oApp.exec("TABLE_INC_ROW", []); } // down if(oKeyInfo.keyCode == 40){ this.oApp.exec("TABLE_DEC_ROW", []); } }, _numColKeydown : function(weEvent){ var oKeyInfo = weEvent.key(); // up if(oKeyInfo.keyCode == 38){ this.oApp.exec("TABLE_INC_COLUMN", []); } // down if(oKeyInfo.keyCode == 40){ this.oApp.exec("TABLE_DEC_COLUMN", []); } }, _borderSizeKeydown : function(weEvent){ var oKeyInfo = weEvent.key(); // up if(oKeyInfo.keyCode == 38){ this.oApp.exec("TABLE_INC_BORDER_SIZE", []); } // down if(oKeyInfo.keyCode == 40){ this.oApp.exec("TABLE_DEC_BORDER_SIZE", []); } }, _refresh : function(){ // the dropdown layer breaks without this line in IE 6 when modifying the preview table this.elDropdownLayer.style.zoom=0; this.elDropdownLayer.style.zoom=""; } //@lazyload_js] }); //} nhn.husky.SE2M_TableEditor = jindo.$Class({ name : "SE2M_TableEditor", _sSETblClass : "__se_tbl", _sSEReviewTblClass : "__se_tbl_review", STATUS : { S_0 : 1, // neither cell selection nor cell resizing is active MOUSEDOWN_CELL : 2, // mouse down on a table cell CELL_SELECTING : 3, // cell selection is in progress CELL_SELECTED : 4, // cell selection was (completely) made MOUSEOVER_BORDER : 5, // mouse is over a table/cell border and the cell resizing grip is shown MOUSEDOWN_BORDER : 6 // mouse down on the cell resizing grip (cell resizing is in progress) }, CELL_SELECTION_CLASS : "se2_te_selection", MIN_CELL_WIDTH : 5, MIN_CELL_HEIGHT : 5, TMP_BGC_ATTR : "_se2_tmp_te_bgc", TMP_BGIMG_ATTR : "_se2_tmp_te_bg_img", ATTR_TBL_TEMPLATE : "_se2_tbl_template", nStatus : 1, nMouseEventsStatus : 0, aSelectedCells : [], $ON_REGISTER_CONVERTERS : function(){ // remove the cell selection class this.oApp.exec("ADD_CONVERTER_DOM", ["WYSIWYG_TO_IR", jindo.$Fn(function(elTmpNode){ if(this.aSelectedCells.length < 1){ //return sContents; return; } var aCells; var aCellType = ["TD", "TH"]; for(var n = 0; n < aCellType.length; n++){ aCells = elTmpNode.getElementsByTagName(aCellType[n]); for(var i = 0, nLen = aCells.length; i < nLen; i++){ if(aCells[i].className){ aCells[i].className = aCells[i].className.replace(this.CELL_SELECTION_CLASS, ""); if(aCells[i].getAttribute(this.TMP_BGC_ATTR)){ aCells[i].style.backgroundColor = aCells[i].getAttribute(this.TMP_BGC_ATTR); aCells[i].removeAttribute(this.TMP_BGC_ATTR); }else if(aCells[i].getAttribute(this.TMP_BGIMG_ATTR)){ jindo.$Element(this.aCells[i]).css("backgroundImage",aCells[i].getAttribute(this.TMP_BGIMG_ATTR)); aCells[i].removeAttribute(this.TMP_BGIMG_ATTR); } } } } // this.wfnMouseDown.attach(this.elResizeCover, "mousedown"); // return elTmpNode.innerHTML; // var rxSelectionColor = new RegExp("<(TH|TD)[^>]*)("+this.TMP_BGC_ATTR+"=[^> ]*)([^>]*>)", "gi"); }, this).bind()]); }, //@lazyload_js EVENT_EDITING_AREA_MOUSEMOVE:SE2M_TableTemplate.js[ _assignHTMLObjects : function(){ this.oApp.exec("LOAD_HTML", ["qe_table"]); this.elQELayer = jindo.$$.getSingle("DIV.q_table_wrap", this.oApp.htOptions.elAppContainer); this.elQELayer.style.zIndex = 150; this.elBtnAddRowBelow = jindo.$$.getSingle("BUTTON.se2_addrow", this.elQELayer); this.elBtnAddColumnRight = jindo.$$.getSingle("BUTTON.se2_addcol", this.elQELayer); this.elBtnSplitRow = jindo.$$.getSingle("BUTTON.se2_seprow", this.elQELayer); this.elBtnSplitColumn = jindo.$$.getSingle("BUTTON.se2_sepcol", this.elQELayer); this.elBtnDeleteRow = jindo.$$.getSingle("BUTTON.se2_delrow", this.elQELayer); this.elBtnDeleteColumn = jindo.$$.getSingle("BUTTON.se2_delcol", this.elQELayer); this.elBtnMergeCell = jindo.$$.getSingle("BUTTON.se2_merrow", this.elQELayer); this.elBtnBGPalette = jindo.$$.getSingle("BUTTON.husky_se2m_table_qe_bgcolor_btn", this.elQELayer); this.elBtnBGIMGPalette = jindo.$$.getSingle("BUTTON.husky_se2m_table_qe_bgimage_btn", this.elQELayer); this.elPanelBGPaletteHolder = jindo.$$.getSingle("DIV.husky_se2m_tbl_qe_bg_paletteHolder", this.elQELayer); this.elPanelBGIMGPaletteHolder = jindo.$$.getSingle("DIV.husky_se2m_tbl_qe_bg_img_paletteHolder", this.elQELayer); this.elPanelTableBGArea = jindo.$$.getSingle("DIV.se2_qe2", this.elQELayer); this.elPanelTableTemplateArea = jindo.$$.getSingle("DL.se2_qe3", this.elQELayer); this.elPanelReviewBGArea = jindo.$$.getSingle("DL.husky_se2m_tbl_qe_review_bg", this.elQELayer); this.elPanelBGImg = jindo.$$.getSingle("DD", this.elPanelReviewBGArea); this.welPanelTableBGArea = jindo.$Element(this.elPanelTableBGArea); this.welPanelTableTemplateArea = jindo.$Element(this.elPanelTableTemplateArea); this.welPanelReviewBGArea = jindo.$Element(this.elPanelReviewBGArea); // this.elPanelReviewBtnArea = jindo.$$.getSingle("DIV.se2_btn_area", this.elQELayer); //My๋ฆฌ๋ทฐ ๋ฒ„ํŠผ ๋ ˆ์ด์–ด this.elPanelDim1 = jindo.$$.getSingle("DIV.husky_se2m_tbl_qe_dim1", this.elQELayer); this.elPanelDim2 = jindo.$$.getSingle("DIV.husky_se2m_tbl_qe_dim2", this.elQELayer); this.elPanelDimDelCol = jindo.$$.getSingle("DIV.husky_se2m_tbl_qe_dim_del_col", this.elQELayer); this.elPanelDimDelRow = jindo.$$.getSingle("DIV.husky_se2m_tbl_qe_dim_del_row", this.elQELayer); this.elInputRadioBGColor = jindo.$$.getSingle("INPUT.husky_se2m_radio_bgc", this.elQELayer); this.elInputRadioBGImg = jindo.$$.getSingle("INPUT.husky_se2m_radio_bgimg", this.elQELayer); this.elSelectBoxTemplate = jindo.$$.getSingle("DIV.se2_select_ty2", this.elQELayer); this.elInputRadioTemplate = jindo.$$.getSingle("INPUT.husky_se2m_radio_template", this.elQELayer); this.elPanelQETemplate = jindo.$$.getSingle("DIV.se2_layer_t_style", this.elQELayer); this.elBtnQETemplate = jindo.$$.getSingle("BUTTON.husky_se2m_template_more", this.elQELayer); this.elPanelQETemplatePreview = jindo.$$.getSingle("SPAN.se2_t_style1", this.elQELayer); this.aElBtn_tableStyle = jindo.$$("BUTTON", this.elPanelQETemplate); for(i = 0; i < this.aElBtn_tableStyle.length; i++){ this.oApp.registerBrowserEvent(this.aElBtn_tableStyle[i], "click", "TABLE_QE_SELECT_TEMPLATE"); } }, $LOCAL_BEFORE_FIRST : function(sMsg){ if(!!sMsg.match(/(REGISTER_CONVERTERS)/)){ this.oApp.acceptLocalBeforeFirstAgain(this, true); return true; }else{ if(!sMsg.match(/(EVENT_EDITING_AREA_MOUSEMOVE)/)){ this.oApp.acceptLocalBeforeFirstAgain(this, true); return false; } } this.htResizing = {}; this.nDraggableCellEdge = 2; var elBody = jindo.$Element(document.body); this.nPageLeftRightMargin = parseInt(elBody.css("marginLeft"), 10) + parseInt(elBody.css("marginRight"), 10); this.nPageTopBottomMargin = parseInt(elBody.css("marginTop"), 10) + parseInt(elBody.css("marginBottom"), 10); //this.nPageLeftRightMargin = parseInt(elBody.css("marginLeft"), 10)+parseInt(elBody.css("marginRight"), 10) + parseInt(elBody.css("paddingLeft"), 10)+parseInt(elBody.css("paddingRight"), 10); //this.nPageTopBottomMargin = parseInt(elBody.css("marginTop"), 10)+parseInt(elBody.css("marginBottom"), 10) + parseInt(elBody.css("paddingTop"), 10)+parseInt(elBody.css("paddingBottom"), 10); this.QE_DIM_MERGE_BTN = 1; this.QE_DIM_BG_COLOR = 2; this.QE_DIM_REVIEW_BG_IMG = 3; this.QE_DIM_TABLE_TEMPLATE = 4; this.rxLastDigits = RegExp("([0-9]+)$"); this._assignHTMLObjects(); this.oApp.exec("SE2_ATTACH_HOVER_EVENTS", [this.aElBtn_tableStyle]); this.addCSSClass(this.CELL_SELECTION_CLASS, "background-color:#B4C9E9;"); this._createCellResizeGrip(); this.elIFrame = this.oApp.getWYSIWYGWindow().frameElement; this.htFrameOffset = jindo.$Element(this.elIFrame).offset(); var elTarget; this.sEmptyTDSrc = ""; if(this.oApp.oNavigator.firefox){ this.sEmptyTDSrc = "<p><br/></p>"; }else{ this.sEmptyTDSrc = "<p>&nbsp;</p>"; } elTarget = this.oApp.getWYSIWYGDocument(); /* jindo.$Fn(this._mousedown_WYSIWYGDoc, this).attach(elTarget, "mousedown"); jindo.$Fn(this._mousemove_WYSIWYGDoc, this).attach(elTarget, "mousemove"); jindo.$Fn(this._mouseup_WYSIWYGDoc, this).attach(elTarget, "mouseup"); */ elTarget = this.elResizeCover; this.wfnMousedown_ResizeCover = jindo.$Fn(this._mousedown_ResizeCover, this); this.wfnMousemove_ResizeCover = jindo.$Fn(this._mousemove_ResizeCover, this); this.wfnMouseup_ResizeCover = jindo.$Fn(this._mouseup_ResizeCover, this); this.wfnMousedown_ResizeCover.attach(elTarget, "mousedown"); this._changeTableEditorStatus(this.STATUS.S_0); // this.oApp.registerBrowserEvent(doc, "click", "EVENT_EDITING_AREA_CLICK"); this.oApp.registerBrowserEvent(this.elBtnMergeCell, "click", "TE_MERGE_CELLS"); this.oApp.registerBrowserEvent(this.elBtnSplitColumn, "click", "TE_SPLIT_COLUMN"); this.oApp.registerBrowserEvent(this.elBtnSplitRow, "click", "TE_SPLIT_ROW"); // this.oApp.registerBrowserEvent(this.elBtnAddColumnLeft, "click", "TE_INSERT_COLUMN_LEFT"); this.oApp.registerBrowserEvent(this.elBtnAddColumnRight, "click", "TE_INSERT_COLUMN_RIGHT"); this.oApp.registerBrowserEvent(this.elBtnAddRowBelow, "click", "TE_INSERT_ROW_BELOW"); // this.oApp.registerBrowserEvent(this.elBtnAddRowAbove, "click", "TE_INSERT_ROW_ABOVE"); this.oApp.registerBrowserEvent(this.elBtnDeleteColumn, "click", "TE_DELETE_COLUMN"); this.oApp.registerBrowserEvent(this.elBtnDeleteRow, "click", "TE_DELETE_ROW"); this.oApp.registerBrowserEvent(this.elInputRadioBGColor, "click", "DRAW_QE_RADIO_OPTION", [2]); this.oApp.registerBrowserEvent(this.elInputRadioBGImg, "click", "DRAW_QE_RADIO_OPTION", [3]); this.oApp.registerBrowserEvent(this.elInputRadioTemplate, "click", "DRAW_QE_RADIO_OPTION", [4]); this.oApp.registerBrowserEvent(this.elBtnBGPalette, "click", "TABLE_QE_TOGGLE_BGC_PALETTE"); // this.oApp.registerBrowserEvent(this.elPanelReviewBtnArea, "click", "SAVE_QE_MY_REVIEW_ITEM"); //My๋ฆฌ๋ทฐ ๋ฒ„ํŠผ ๋ ˆ์ด์–ด this.oApp.registerBrowserEvent(this.elBtnBGIMGPalette, "click", "TABLE_QE_TOGGLE_IMG_PALETTE"); this.oApp.registerBrowserEvent(this.elPanelBGIMGPaletteHolder, "click", "TABLE_QE_SET_IMG_FROM_PALETTE"); //this.elPanelQETemplate //this.elBtnQETemplate this.oApp.registerBrowserEvent(this.elBtnQETemplate, "click", "TABLE_QE_TOGGLE_TEMPLATE"); this.oApp.registerBrowserEvent(document.body, "mouseup", "EVENT_OUTER_DOC_MOUSEUP"); this.oApp.registerBrowserEvent(document.body, "mousemove", "EVENT_OUTER_DOC_MOUSEMOVE"); }, $ON_EVENT_EDITING_AREA_KEYUP : function(oEvent){ // for undo/redo and other hotkey functions var oKeyInfo = oEvent.key(); // 229: Korean/Eng, 33, 34: page up/down, 35,36: end/home, 37,38,39,40: left, up, right, down, 16: shift if(oKeyInfo.keyCode == 229 || oKeyInfo.alt || oKeyInfo.ctrl || oKeyInfo.keyCode == 16){ return; }else if(oKeyInfo.keyCode == 8 || oKeyInfo.keyCode == 46){ this.oApp.exec("DELETE_BLOCK_CONTENTS"); oEvent.stop(); } switch(this.nStatus){ case this.STATUS.CELL_SELECTED: this._changeTableEditorStatus(this.STATUS.S_0); break; } }, $ON_TABLE_QE_SELECT_TEMPLATE : function(weEvent){ var aMatch = this.rxLastDigits.exec(weEvent.element.className); var elCurrentTable = this.elSelectionStartTable; this._changeTableEditorStatus(this.STATUS.S_0); this.oApp.exec("STYLE_TABLE", [elCurrentTable, aMatch[1]]); //this._selectTableStyle(aMatch[1]); var elSaveTarget = !!elCurrentTable && elCurrentTable.parentNode ? elCurrentTable.parentNode : null; var sSaveTarget = !elCurrentTable ? "BODY" : null; this.oApp.exec("RECORD_UNDO_ACTION", ["CHANGE_TABLE_STYLE", {elSaveTarget:elSaveTarget, sSaveTarget : sSaveTarget, bDontSaveSelection:true}]); }, $BEFORE_CHANGE_EDITING_MODE : function(sMode, bNoFocus){ if(sMode !== "WYSIWYG" && this.nStatus !== this.STATUS.S_0){ this._changeTableEditorStatus(this.STATUS.S_0); } }, // [Undo/Redo] Table Selection ์ฒ˜๋ฆฌ์™€ ๊ด€๋ จ๋œ ๋ถ€๋ถ„ ์ฃผ์„ ์ฒ˜๋ฆฌ // $AFTER_DO_RECORD_UNDO_HISTORY : function(){ // if(this.nStatus != this.STATUS.CELL_SELECTED){ // return; // } // // if(this.aSelectedCells.length < 1){ // return; // } // // var aTables = this.oApp.getWYSIWYGDocument().getElementsByTagName("TABLE"); // for(var nTableIdx = 0, nLen = aTables.length; nTableIdx < nLen; nTableIdx++){ // if(aTables[nTableIdx] === this.elSelectionStartTable){ // break; // } // } // // var aUndoHistory = this.oApp.getUndoHistory(); // var oUndoStateIdx = this.oApp.getUndoStateIdx(); // if(!aUndoHistory[oUndoStateIdx.nIdx].htTableSelection){ // aUndoHistory[oUndoStateIdx.nIdx].htTableSelection = []; // } // aUndoHistory[oUndoStateIdx.nIdx].htTableSelection[oUndoStateIdx.nStep] = { // nTableIdx : nTableIdx, // nSX : this.htSelectionSPos.x, // nSY : this.htSelectionSPos.y, // nEX : this.htSelectionEPos.x, // nEY : this.htSelectionEPos.y // }; // }, // // $BEFORE_RESTORE_UNDO_HISTORY : function(){ // if(this.nStatus == this.STATUS.CELL_SELECTED){ // var oSelection = this.oApp.getEmptySelection(); // oSelection.selectNode(this.elSelectionStartTable); // oSelection.collapseToEnd(); // oSelection.select(); // } // }, // // $AFTER_RESTORE_UNDO_HISTORY : function(){ // var aUndoHistory = this.oApp.getUndoHistory(); // var oUndoStateIdx = this.oApp.getUndoStateIdx(); // // if(aUndoHistory[oUndoStateIdx.nIdx].htTableSelection && aUndoHistory[oUndoStateIdx.nIdx].htTableSelection[oUndoStateIdx.nStep]){ // var htTableSelection = aUndoHistory[oUndoStateIdx.nIdx].htTableSelection[oUndoStateIdx.nStep]; // this.elSelectionStartTable = this.oApp.getWYSIWYGDocument().getElementsByTagName("TABLE")[htTableSelection.nTableIdx]; // this.htMap = this._getCellMapping(this.elSelectionStartTable); // // this.htSelectionSPos.x = htTableSelection.nSX; // this.htSelectionSPos.y = htTableSelection.nSY; // this.htSelectionEPos.x = htTableSelection.nEX; // this.htSelectionEPos.y = htTableSelection.nEY; // this._selectCells(this.htSelectionSPos, this.htSelectionEPos); // // this._startCellSelection(); // this._changeTableEditorStatus(this.STATUS.CELL_SELECTED); // }else{ // this._changeTableEditorStatus(this.STATUS.S_0); // } // }, /** * ํ…Œ์ด๋ธ” ์…€ ๋ฐฐ๊ฒฝ์ƒ‰ ์…‹ํŒ… */ $ON_TABLE_QE_TOGGLE_BGC_PALETTE : function(){ if(this.elPanelBGPaletteHolder.parentNode.style.display == "block"){ this.oApp.exec("HIDE_TABLE_QE_BGC_PALETTE", []); }else{ this.oApp.exec("SHOW_TABLE_QE_BGC_PALETTE", []); } }, $ON_SHOW_TABLE_QE_BGC_PALETTE : function(){ this.elPanelBGPaletteHolder.parentNode.style.display = "block"; this.oApp.exec("SHOW_COLOR_PALETTE", ["TABLE_QE_SET_BGC_FROM_PALETTE", this.elPanelBGPaletteHolder]); }, $ON_HIDE_TABLE_QE_BGC_PALETTE : function(){ this.elPanelBGPaletteHolder.parentNode.style.display = "none"; this.oApp.exec("HIDE_COLOR_PALETTE", []); }, $ON_TABLE_QE_SET_BGC_FROM_PALETTE : function(sColorCode){ this.oApp.exec("TABLE_QE_SET_BGC", [sColorCode]); if(this.oSelection){ this.oSelection.select(); } this._changeTableEditorStatus(this.STATUS.S_0); }, $ON_TABLE_QE_SET_BGC : function(sColorCode){ this.elBtnBGPalette.style.backgroundColor = sColorCode; for(var i = 0, nLen = this.aSelectedCells.length; i < nLen; i++){ this.aSelectedCells[i].setAttribute(this.TMP_BGC_ATTR, sColorCode); this.aSelectedCells[i].removeAttribute(this.TMP_BGIMG_ATTR); } this.sQEAction = "TABLE_SET_BGCOLOR"; }, /** * ํ…Œ์ด๋ธ” ๋ฆฌ๋ทฐ ํ…Œ์ด๋ธ” ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€ ์…‹ํŒ… */ $ON_TABLE_QE_TOGGLE_IMG_PALETTE : function(){ if(this.elPanelBGIMGPaletteHolder.parentNode.style.display == "block"){ this.oApp.exec("HIDE_TABLE_QE_IMG_PALETTE", []); }else{ this.oApp.exec("SHOW_TABLE_QE_IMG_PALETTE", []); } }, $ON_SHOW_TABLE_QE_IMG_PALETTE : function(){ this.elPanelBGIMGPaletteHolder.parentNode.style.display = "block"; }, $ON_HIDE_TABLE_QE_IMG_PALETTE : function(){ this.elPanelBGIMGPaletteHolder.parentNode.style.display = "none"; }, $ON_TABLE_QE_SET_IMG_FROM_PALETTE : function(elEvt){ this.oApp.exec("TABLE_QE_SET_IMG", [elEvt.element]); if(this.oSelection){ this.oSelection.select(); } this._changeTableEditorStatus(this.STATUS.S_0); }, $ON_TABLE_QE_SET_IMG : function(elSelected){ var sClassName = jindo.$Element(elSelected).className(); var welBtnBGIMGPalette = jindo.$Element(this.elBtnBGIMGPalette); var aBtnClassNames = welBtnBGIMGPalette.className().split(" "); for(var i = 0, nLen = aBtnClassNames.length; i < nLen; i++){ if(aBtnClassNames[i].indexOf("cellimg") > 0){ welBtnBGIMGPalette.removeClass(aBtnClassNames[i]); } } jindo.$Element(this.elBtnBGIMGPalette).addClass(sClassName); var n = sClassName.substring(11, sClassName.length); //se2_cellimg11 var sImageName = "pattern_"; if(n === "0"){ for(var i = 0, nLen = this.aSelectedCells.length; i < nLen; i++){ jindo.$Element(this.aSelectedCells[i]).css("backgroundImage", ""); this.aSelectedCells[i].removeAttribute(this.TMP_BGC_ATTR); this.aSelectedCells[i].removeAttribute(this.TMP_BGIMG_ATTR); } }else{ if(n == 19 || n == 20 || n == 21 || n == 22 || n == 25 || n == 26){ //ํŒŒ์ผ ์‚ฌ์ด์ฆˆ๋•Œ๋ฌธ์— jpg sImageName = sImageName + n + ".jpg"; }else{ sImageName = sImageName + n + ".gif"; } for(var j = 0, nLen = this.aSelectedCells.length; j < nLen ; j++){ jindo.$Element(this.aSelectedCells[j]).css("backgroundImage", "url("+"http://static.se2.naver.com/static/img/"+sImageName+")"); this.aSelectedCells[j].removeAttribute(this.TMP_BGC_ATTR); this.aSelectedCells[j].setAttribute(this.TMP_BGIMG_ATTR, "url("+"http://static.se2.naver.com/static/img/"+sImageName+")"); } } this.sQEAction = "TABLE_SET_BGIMAGE"; }, $ON_SAVE_QE_MY_REVIEW_ITEM : function(){ this.oApp.exec("SAVE_MY_REVIEW_ITEM"); this.oApp.exec("CLOSE_QE_LAYER"); }, /** * ํ…Œ์ด๋ธ” ํ€ต ์—๋””ํ„ฐ Show */ $ON_SHOW_COMMON_QE : function(){ if(jindo.$Element(this.elSelectionStartTable).hasClass(this._sSETblClass)){ this.oApp.exec("SHOW_TABLE_QE"); }else{ if(jindo.$Element(this.elSelectionStartTable).hasClass(this._sSEReviewTblClass)){ this.oApp.exec("SHOW_REVIEW_QE"); } } }, $ON_SHOW_TABLE_QE : function(){ this.oApp.exec("HIDE_TABLE_QE_BGC_PALETTE", []); this.oApp.exec("TABLE_QE_HIDE_TEMPLATE", []); this.oApp.exec("SETUP_TABLE_QE_MODE", [0]); this.oApp.exec("OPEN_QE_LAYER", [this.htMap[this.htSelectionEPos.x][this.htSelectionEPos.y], this.elQELayer, "table"]); //this.oApp.exec("FOCUS"); }, $ON_SHOW_REVIEW_QE : function(){ this.oApp.exec("SETUP_TABLE_QE_MODE", [1]); this.oApp.exec("OPEN_QE_LAYER", [this.htMap[this.htSelectionEPos.x][this.htSelectionEPos.y], this.elQELayer, "review"]); }, $ON_CLOSE_SUB_LAYER_QE : function(){ if(typeof this.elPanelBGPaletteHolder != 'undefined'){ this.elPanelBGPaletteHolder.parentNode.style.display = "none"; } if(typeof this.elPanelBGIMGPaletteHolder != 'undefined'){ this.elPanelBGIMGPaletteHolder.parentNode.style.display = "none"; } }, // 0: table // 1: review $ON_SETUP_TABLE_QE_MODE : function(nMode){ var bEnableMerge = true; if(typeof nMode == "number"){ this.nQEMode = nMode; } if(this.aSelectedCells.length < 2){ bEnableMerge = false; } this.oApp.exec("TABLE_QE_DIM", [this.QE_DIM_MERGE_BTN, bEnableMerge]); //null์ธ๊ฒฝ์šฐ๋ฅผ ๋Œ€๋น„ํ•ด์„œ default๊ฐ’์„ ์ง€์ •ํ•ด์ค€๋‹ค. var sBackgroundColor = this.aSelectedCells[0].getAttribute(this.TMP_BGC_ATTR) || "rgb(255,255,255)"; var bAllMatched = true; for(var i = 1, nLen = this.aSelectedCells.length; i < nLen; i++){ // [SMARTEDITORSUS-1552] ๋“œ๋ž˜๊ทธ๋กœ ์…€์„ ์„ ํƒํ•˜๋Š” ์ค‘ elCell์ด ์—†๋Š” ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ๋ฐœ์ƒ if(this.aSelectedCells[i]){ if(sBackgroundColor != this.aSelectedCells[i].getAttribute(this.TMP_BGC_ATTR)){ bAllMatched = false; break; } } // --[SMARTEDITORSUS-1552] } if(bAllMatched){ this.elBtnBGPalette.style.backgroundColor = sBackgroundColor; }else{ this.elBtnBGPalette.style.backgroundColor = "#FFFFFF"; } var sBackgroundImage = this.aSelectedCells[0].getAttribute(this.TMP_BGIMG_ATTR) || ""; var bAllMatchedImage = true; var sPatternInfo, nPatternImage = 0; var welBtnBGIMGPalette = jindo.$Element(this.elBtnBGIMGPalette); if(!!sBackgroundImage){ var aPattern = sBackgroundImage.match(/\_[0-9]*/); sPatternInfo = (!!aPattern)?aPattern[0] : "_0"; nPatternImage = sPatternInfo.substring(1, sPatternInfo.length); for(var i = 1, nLen = this.aSelectedCells.length; i < nLen; i++){ if(sBackgroundImage != this.aSelectedCells[i].getAttribute(this.TMP_BGIMG_ATTR)){ bAllMatchedImage = false; break; } } } var aBtnClassNames = welBtnBGIMGPalette.className().split(/\s/); for(var j = 0, nLen = aBtnClassNames.length; j < nLen; j++){ if(aBtnClassNames[j].indexOf("cellimg") > 0){ welBtnBGIMGPalette.removeClass(aBtnClassNames[j]); } } if(bAllMatchedImage && nPatternImage > 0){ welBtnBGIMGPalette.addClass("se2_cellimg" + nPatternImage); }else{ welBtnBGIMGPalette.addClass("se2_cellimg0"); } if(this.nQEMode === 0){ //table this.elPanelTableTemplateArea.style.display = "block"; // this.elSelectBoxTemplate.style.display = "block"; this.elPanelReviewBGArea.style.display = "none"; // this.elSelectBoxTemplate.style.position = ""; //this.elPanelReviewBtnArea.style.display = "none"; //My๋ฆฌ๋ทฐ ๋ฒ„ํŠผ ๋ ˆ์ด์–ด // ๋ฐฐ๊ฒฝArea์—์„œ css๋ฅผ ์ œ๊ฑฐํ•ด์•ผํ•จ jindo.$Element(this.elPanelTableBGArea).className("se2_qe2"); var nTpl = this.parseIntOr0(this.elSelectionStartTable.getAttribute(this.ATTR_TBL_TEMPLATE)); if(nTpl){ //this.elInputRadioTemplate.checked = "true"; }else{ this.elInputRadioBGColor.checked = "true"; nTpl = 1; } this.elPanelQETemplatePreview.className = "se2_t_style" + nTpl; this.elPanelBGImg.style.position = ""; }else if(this.nQEMode == 1){ //review this.elPanelTableTemplateArea.style.display = "none"; // this.elSelectBoxTemplate.style.display = "none"; this.elPanelReviewBGArea.style.display = "block"; // this.elSelectBoxTemplate.style.position = "static"; // this.elPanelReviewBtnArea.style.display = "block"; //My๋ฆฌ๋ทฐ ๋ฒ„ํŠผ ๋ ˆ์ด์–ด var nTpl = this.parseIntOr0(this.elSelectionStartTable.getAttribute(this.ATTR_REVIEW_TEMPLATE)); this.elPanelBGImg.style.position = "relative"; }else{ this.elPanelTableTemplateArea.style.display = "none"; this.elPanelReviewBGArea.style.display = "none"; // this.elPanelReviewBtnArea.style.display = "none"; //My๋ฆฌ๋ทฐ ๋ฒ„ํŠผ ๋ ˆ์ด์–ด } this.oApp.exec("DRAW_QE_RADIO_OPTION", [0]); }, // nClickedIdx // 0: none // 2: bg color // 3: bg img // 4: template $ON_DRAW_QE_RADIO_OPTION : function(nClickedIdx){ if(nClickedIdx !== 0 && nClickedIdx != 2){ this.oApp.exec("HIDE_TABLE_QE_BGC_PALETTE", []); } if(nClickedIdx !== 0 && nClickedIdx != 3){ this.oApp.exec("HIDE_TABLE_QE_IMG_PALETTE", []); } if(nClickedIdx !== 0 && nClickedIdx != 4){ this.oApp.exec("TABLE_QE_HIDE_TEMPLATE", []); } if(this.nQEMode === 0){ // bg image option does not exist in table mode. so select the bgcolor option if(this.elInputRadioBGImg.checked){ this.elInputRadioBGColor.checked = "true"; } if(this.elInputRadioBGColor.checked){ // one dimming layer is being shared so only need to dim once and the rest will be undimmed automatically //this.oApp.exec("TABLE_QE_DIM", [this.QE_DIM_BG_COLOR, true]); this.oApp.exec("TABLE_QE_DIM", [this.QE_DIM_TABLE_TEMPLATE, false]); }else{ this.oApp.exec("TABLE_QE_DIM", [this.QE_DIM_BG_COLOR, false]); //this.oApp.exec("TABLE_QE_DIM", [this.QE_DIM_TABLE_TEMPLATE, true]); } }else{ // template option does not exist in review mode. so select the bgcolor optio if(this.elInputRadioTemplate.checked){ this.elInputRadioBGColor.checked = "true"; } if(this.elInputRadioBGColor.checked){ //this.oApp.exec("TABLE_QE_DIM", [this.QE_DIM_BG_COLOR, true]); this.oApp.exec("TABLE_QE_DIM", [this.QE_DIM_REVIEW_BG_IMG, false]); }else{ this.oApp.exec("TABLE_QE_DIM", [this.QE_DIM_BG_COLOR, false]); //this.oApp.exec("TABLE_QE_DIM", [this.QE_DIM_REVIEW_BG_IMG, true]); } } }, // nPart // 1: Merge cell btn // 2: Cell bg color // 3: Review - bg image // 4: Table - Template // // bUndim // true: Undim // false(default): Dim $ON_TABLE_QE_DIM : function(nPart, bUndim){ var elPanelDim; var sDimClassPrefix = "se2_qdim"; if(nPart == 1){ elPanelDim = this.elPanelDim1; }else{ elPanelDim = this.elPanelDim2; } if(bUndim){ nPart = 0; } elPanelDim.className = sDimClassPrefix + nPart; }, $ON_TE_SELECT_TABLE : function(elTable){ this.elSelectionStartTable = elTable; this.htMap = this._getCellMapping(this.elSelectionStartTable); }, $ON_TE_SELECT_CELLS : function(htSPos, htEPos){ this._selectCells(htSPos, htEPos); }, $ON_TE_MERGE_CELLS : function(){ if(this.aSelectedCells.length === 0 || this.aSelectedCells.length == 1){ return; } this._removeClassFromSelection(); var i, elFirstTD, elTD; elFirstTD = this.aSelectedCells[0]; var elTable = nhn.husky.SE2M_Utils.findAncestorByTagName("TABLE", elFirstTD); var nHeight, nWidth; var elCurTD, elLastTD = this.aSelectedCells[0]; nHeight = parseInt(elLastTD.style.height || elLastTD.getAttribute("height"), 10); nWidth = parseInt(elLastTD.style.width || elLastTD.getAttribute("width"), 10); //nHeight = elLastTD.offsetHeight; //nWidth = elLastTD.offsetWidth; for(i = this.htSelectionSPos.x + 1; i < this.htSelectionEPos.x + 1; i++){ curTD = this.htMap[i][this.htSelectionSPos.y]; if(curTD == elLastTD){ continue; } elLastTD = curTD; nWidth += parseInt(curTD.style.width || curTD.getAttribute("width"), 10); //nWidth += curTD.offsetWidth; } elLastTD = this.aSelectedCells[0]; for(i = this.htSelectionSPos.y + 1; i < this.htSelectionEPos.y + 1; i++){ curTD = this.htMap[this.htSelectionSPos.x][i]; if(curTD == elLastTD){ continue; } elLastTD = curTD; nHeight += parseInt(curTD.style.height || curTD.getAttribute("height"), 10); //nHeight += curTD.offsetHeight; } if(nWidth){ elFirstTD.style.width = nWidth + "px"; } if(nHeight){ elFirstTD.style.height = nHeight + "px"; } elFirstTD.setAttribute("colSpan", this.htSelectionEPos.x - this.htSelectionSPos.x + 1); elFirstTD.setAttribute("rowSpan", this.htSelectionEPos.y - this.htSelectionSPos.y + 1); for(i = 1; i < this.aSelectedCells.length; i++){ elTD = this.aSelectedCells[i]; if(elTD.parentNode){ if(!nhn.husky.SE2M_Utils.isBlankNode(elTD)){ elFirstTD.innerHTML += elTD.innerHTML; } elTD.parentNode.removeChild(elTD); } } // this._updateSelection(); this.htMap = this._getCellMapping(this.elSelectionStartTable); this._selectCells(this.htSelectionSPos, this.htSelectionEPos); this._showTableTemplate(this.elSelectionStartTable); this._addClassToSelection(); this.sQEAction = "TABLE_CELL_MERGE"; this.oApp.exec("SHOW_COMMON_QE"); }, $ON_TABLE_QE_TOGGLE_TEMPLATE : function(){ if(this.elPanelQETemplate.style.display == "block"){ this.oApp.exec("TABLE_QE_HIDE_TEMPLATE"); }else{ this.oApp.exec("TABLE_QE_SHOW_TEMPLATE"); } }, $ON_TABLE_QE_SHOW_TEMPLATE : function(){ this.elPanelQETemplate.style.display = "block"; this.oApp.exec("POSITION_TOOLBAR_LAYER", [this.elPanelQETemplate]); }, $ON_TABLE_QE_HIDE_TEMPLATE : function(){ this.elPanelQETemplate.style.display = "none"; }, $ON_STYLE_TABLE : function(elTable, nTableStyleIdx){ if(!elTable){ if(!this._t){ this._t = 1; } elTable = this.elSelectionStartTable; nTableStyleIdx = (this._t++) % 20 + 1; } if(this.oSelection){ this.oSelection.select(); } this._applyTableTemplate(elTable, nTableStyleIdx); }, $ON_TE_DELETE_COLUMN : function(){ if(this.aSelectedCells.length === 0 || this.aSelectedCells.length == 1) { return; } this._selectAll_Column(); this._deleteSelectedCells(); this.sQEAction = "DELETE_TABLE_COLUMN"; this._changeTableEditorStatus(this.STATUS.S_0); }, $ON_TE_DELETE_ROW : function(){ if(this.aSelectedCells.length === 0 || this.aSelectedCells.length == 1) { return; } this._selectAll_Row(); this._deleteSelectedCells(); this.sQEAction = "DELETE_TABLE_ROW"; this._changeTableEditorStatus(this.STATUS.S_0); }, $ON_TE_INSERT_COLUMN_RIGHT : function(){ if(this.aSelectedCells.length === 0) { return; } this._selectAll_Column(); this._insertColumnAfter(this.htSelectionEPos.x); }, $ON_TE_INSERT_COLUMN_LEFT : function(){ this._selectAll_Column(); this._insertColumnAfter(this.htSelectionSPos.x - 1); }, $ON_TE_INSERT_ROW_BELOW : function(){ if(this.aSelectedCells.length === 0) { return; } this._insertRowBelow(this.htSelectionEPos.y); }, $ON_TE_INSERT_ROW_ABOVE : function(){ this._insertRowBelow(this.htSelectionSPos.y - 1); }, $ON_TE_SPLIT_COLUMN : function(){ var nSpan, nNewSpan, nWidth, nNewWidth; var elCurCell, elNewTD; if(this.aSelectedCells.length === 0) { return; } this._removeClassFromSelection(); var elLastCell = this.aSelectedCells[0]; // Assign colSpan>1 to all selected cells. // If current colSpan == 1 then increase the colSpan of the cell and all the vertically adjacent cells. for(var i = 0, nLen = this.aSelectedCells.length; i < nLen; i++){ elCurCell = this.aSelectedCells[i]; nSpan = parseInt(elCurCell.getAttribute("colSpan"), 10) || 1; if(nSpan > 1){ continue; } var htPos = this._getBasisCellPosition(elCurCell); for(var y = 0; y < this.htMap[0].length;){ elCurCell = this.htMap[htPos.x][y]; nSpan = parseInt(elCurCell.getAttribute("colSpan"), 10) || 1; elCurCell.setAttribute("colSpan", nSpan+1); y += parseInt(elCurCell.getAttribute("rowSpan"), 10) || 1; } } for(var i = 0, nLen = this.aSelectedCells.length; i < nLen; i++){ elCurCell = this.aSelectedCells[i]; nSpan = parseInt(elCurCell.getAttribute("colSpan"), 10) || 1; nNewSpan = (nSpan/2).toFixed(0); elCurCell.setAttribute("colSpan", nNewSpan); elNewTD = this._shallowCloneTD(elCurCell); elNewTD.setAttribute("colSpan", nSpan-nNewSpan); elLastCell = elNewTD; nSpan = parseInt(elCurCell.getAttribute("rowSpan"), 10) || 1; elNewTD.setAttribute("rowSpan", nSpan); elNewTD.innerHTML = "&nbsp;"; nWidth = elCurCell.width || elCurCell.style.width; if(nWidth){ nWidth = this.parseIntOr0(nWidth); elCurCell.removeAttribute("width"); nNewWidth = (nWidth/2).toFixed(); elCurCell.style.width = nNewWidth + "px"; elNewTD.style.width = (nWidth - nNewWidth) + "px"; } elCurCell.parentNode.insertBefore(elNewTD, elCurCell.nextSibling); } this._reassignCellSizes(this.elSelectionStartTable); this.htMap = this._getCellMapping(this.elSelectionStartTable); var htPos = this._getBasisCellPosition(elLastCell); this.htSelectionEPos.x = htPos.x; this._selectCells(this.htSelectionSPos, this.htSelectionEPos); this.sQEAction = "SPLIT_TABLE_COLUMN"; this.oApp.exec("SHOW_COMMON_QE"); }, $ON_TE_SPLIT_ROW : function(){ var nSpan, nNewSpan, nHeight, nHeight; var elCurCell, elNewTD, htPos, elNewTR; if(this.aSelectedCells.length === 0) { return; } var aTR = jindo.$$(">TBODY>TR", this.elSelectionStartTable, {oneTimeOffCache:true}); this._removeClassFromSelection(); //top.document.title = this.htSelectionSPos.x+","+this.htSelectionSPos.y+"::"+this.htSelectionEPos.x+","+this.htSelectionEPos.y; var nNewRows = 0; // Assign rowSpan>1 to all selected cells. // If current rowSpan == 1 then increase the rowSpan of the cell and all the horizontally adjacent cells. var elNextTRInsertionPoint; for(var i = 0, nLen = this.aSelectedCells.length; i < nLen; i++){ elCurCell = this.aSelectedCells[i]; nSpan = parseInt(elCurCell.getAttribute("rowSpan"), 10) || 1; if(nSpan > 1){ continue; } htPos = this._getBasisCellPosition(elCurCell); elNextTRInsertionPoint = aTR[htPos.y]; // a new TR has to be inserted when there's an increase in rowSpan elNewTR = this.oApp.getWYSIWYGDocument().createElement("TR"); elNextTRInsertionPoint.parentNode.insertBefore(elNewTR, elNextTRInsertionPoint.nextSibling); nNewRows++; // loop through horizontally adjacent cells and increase their rowSpan for(var x = 0; x < this.htMap.length;){ elCurCell = this.htMap[x][htPos.y]; nSpan = parseInt(elCurCell.getAttribute("rowSpan"), 10) || 1; elCurCell.setAttribute("rowSpan", nSpan + 1); x += parseInt(elCurCell.getAttribute("colSpan"), 10) || 1; } } aTR = jindo.$$(">TBODY>TR", this.elSelectionStartTable, {oneTimeOffCache:true}); var htPos1, htPos2; for(var i = 0, nLen = this.aSelectedCells.length; i < nLen; i++){ elCurCell = this.aSelectedCells[i]; nSpan = parseInt(elCurCell.getAttribute("rowSpan"), 10) || 1; nNewSpan = (nSpan/2).toFixed(0); elCurCell.setAttribute("rowSpan", nNewSpan); elNewTD = this._shallowCloneTD(elCurCell); elNewTD.setAttribute("rowSpan", nSpan - nNewSpan); nSpan = parseInt(elCurCell.getAttribute("colSpan"), 10) || 1; elNewTD.setAttribute("colSpan", nSpan); elNewTD.innerHTML = "&nbsp;"; nHeight = elCurCell.height || elCurCell.style.height; if(nHeight){ nHeight = this.parseIntOr0(nHeight); elCurCell.removeAttribute("height"); nNewHeight = (nHeight/2).toFixed(); elCurCell.style.height = nNewHeight + "px"; elNewTD.style.height = (nHeight - nNewHeight) + "px"; } //var elTRInsertTo = elCurCell.parentNode; //for(var ii=0; ii<nNewSpan; ii++) elTRInsertTo = elTRInsertTo.nextSibling; var nTRIdx = jindo.$A(aTR).indexOf(elCurCell.parentNode); var nNextTRIdx = parseInt(nTRIdx, 10)+parseInt(nNewSpan, 10); var elTRInsertTo = aTR[nNextTRIdx]; var oSiblingTDs = elTRInsertTo.childNodes; var elInsertionPt = null; var tmp; htPos1 = this._getBasisCellPosition(elCurCell); for(var ii = 0, nNumTDs = oSiblingTDs.length; ii < nNumTDs; ii++){ tmp = oSiblingTDs[ii]; if(!tmp.tagName || tmp.tagName != "TD"){ continue; } htPos2 = this._getBasisCellPosition(tmp); if(htPos1.x < htPos2.x){ elInsertionPt = tmp; break; } } elTRInsertTo.insertBefore(elNewTD, elInsertionPt); } this._reassignCellSizes(this.elSelectionStartTable); this.htMap = this._getCellMapping(this.elSelectionStartTable); this.htSelectionEPos.y += nNewRows; this._selectCells(this.htSelectionSPos, this.htSelectionEPos); this.sQEAction = "SPLIT_TABLE_ROW"; this.oApp.exec("SHOW_COMMON_QE"); }, $ON_MSG_CELL_SELECTED : function(){ // disable row/col delete btn this.elPanelDimDelCol.className = "se2_qdim6r"; this.elPanelDimDelRow.className = "se2_qdim6c"; if(this.htSelectionSPos.x === 0 && this.htSelectionEPos.x === this.htMap.length - 1){ this.oApp.exec("MSG_ROW_SELECTED"); } if(this.htSelectionSPos.y === 0 && this.htSelectionEPos.y === this.htMap[0].length - 1){ this.oApp.exec("MSG_COL_SELECTED"); } this.oApp.exec("SHOW_COMMON_QE"); }, $ON_MSG_ROW_SELECTED : function(){ this.elPanelDimDelRow.className = ""; }, $ON_MSG_COL_SELECTED : function(){ this.elPanelDimDelCol.className = ""; }, $ON_EVENT_EDITING_AREA_MOUSEDOWN : function(wevE){ if(!this.oApp.isWYSIWYGEnabled()){ return; } switch(this.nStatus){ case this.STATUS.S_0: // the user may just want to resize the image if(!wevE.element){return;} if(wevE.element.tagName == "IMG"){return;} if(this.oApp.getEditingMode() !== "WYSIWYG"){return;} // change the status to MOUSEDOWN_CELL if the mouse is over a table cell var elTD = nhn.husky.SE2M_Utils.findAncestorByTagName("TD", wevE.element); if(elTD && elTD.tagName == "TD"){ var elTBL = nhn.husky.SE2M_Utils.findAncestorByTagName("TABLE", elTD); if(!jindo.$Element(elTBL).hasClass(this._sSETblClass) && !jindo.$Element(elTBL).hasClass(this._sSEReviewTblClass)){return;} if(!this._isValidTable(elTBL)){ jindo.$Element(elTBL).removeClass(this._sSETblClass); jindo.$Element(elTBL).removeClass(this._sSEReviewTblClass); return; } if(elTBL){ this.elSelectionStartTD = elTD; this.elSelectionStartTable = elTBL; this._changeTableEditorStatus(this.STATUS.MOUSEDOWN_CELL); } } break; case this.STATUS.MOUSEDOWN_CELL: break; case this.STATUS.CELL_SELECTING: break; case this.STATUS.CELL_SELECTED: this._changeTableEditorStatus(this.STATUS.S_0); break; } }, $ON_EVENT_EDITING_AREA_MOUSEMOVE : function(wevE){ if(this.oApp.getEditingMode() != "WYSIWYG"){return;} switch(this.nStatus){ case this.STATUS.S_0: // if(this._isOnBorder(wevE)){ //this._changeTableEditorStatus(this.MOUSEOVER_BORDER); this._showCellResizeGrip(wevE); }else{ this._hideResizer(); } break; case this.STATUS.MOUSEDOWN_CELL: // change the status to CELL_SELECTING if the mouse moved out of the inital TD var elTD = nhn.husky.SE2M_Utils.findAncestorByTagName("TD", wevE.element); if((elTD && elTD !== this.elSelectionStartTD) || !elTD){ if(!elTD){elTD = this.elSelectionStartTD;} this._reassignCellSizes(this.elSelectionStartTable); this._startCellSelection(); this._selectBetweenCells(this.elSelectionStartTD, elTD); } break; case this.STATUS.CELL_SELECTING: // show selection var elTD = nhn.husky.SE2M_Utils.findAncestorByTagName("TD", wevE.element); if(!elTD || elTD === this.elLastSelectedTD){return;} var elTBL = nhn.husky.SE2M_Utils.findAncestorByTagName("TABLE", elTD); if(elTBL !== this.elSelectionStartTable){return;} this.elLastSelectedTD = elTD; this._selectBetweenCells(this.elSelectionStartTD, elTD); break; case this.STATUS.CELL_SELECTED: break; } }, // ์…€ ์„ ํƒ ์ƒํƒœ์—์„œ ๋ฌธ์„œ์˜์—ญ์„ ์ƒ/ํ•˜๋กœ ๋ฒ—์–ด๋‚  ๊ฒฝ์šฐ, ๋ฒ—์–ด๋‚œ ๋ฐฉํ–ฅ์œผ๋กœ ์„ ํƒ ์…€์„ ๋Š˜๋ ค๊ฐ€๋ฉฐ ๋ฌธ์„œ์˜ ์Šคํฌ๋กค์„ ํ•ด์คŒ $ON_EVENT_OUTER_DOC_MOUSEMOVE : function(wevE){ switch(this.nStatus){ case this.STATUS.CELL_SELECTING: var htPos = wevE.pos(); var nYPos = htPos.pageY; var nXPos = htPos.pageX; if(nYPos < this.htEditingAreaPos.top){ var y = this.htSelectionSPos.y; if(y > 0){ this.htSelectionSPos.y--; this._selectCells(this.htSelectionSPos, this.htSelectionEPos); var oSelection = this.oApp.getSelection(); oSelection.selectNodeContents(this.aSelectedCells[0]); oSelection.select(); oSelection.oBrowserSelection.selectNone(); } }else{ if(nYPos > this.htEditingAreaPos.bottom){ var y = this.htSelectionEPos.y; if(y < this.htMap[0].length - 1){ this.htSelectionEPos.y++; this._selectCells(this.htSelectionSPos, this.htSelectionEPos); var oSelection = this.oApp.getSelection(); oSelection.selectNodeContents(this.htMap[this.htSelectionEPos.x][this.htSelectionEPos.y]); oSelection.select(); oSelection.oBrowserSelection.selectNone(); } } } if(nXPos < this.htEditingAreaPos.left){ var x = this.htSelectionSPos.x; if(x > 0){ this.htSelectionSPos.x--; this._selectCells(this.htSelectionSPos, this.htSelectionEPos); var oSelection = this.oApp.getSelection(); oSelection.selectNodeContents(this.aSelectedCells[0]); oSelection.select(); oSelection.oBrowserSelection.selectNone(); } }else{ if(nXPos > this.htEditingAreaPos.right){ var x = this.htSelectionEPos.x; if(x < this.htMap.length - 1){ this.htSelectionEPos.x++; this._selectCells(this.htSelectionSPos, this.htSelectionEPos); var oSelection = this.oApp.getSelection(); oSelection.selectNodeContents(this.htMap[this.htSelectionEPos.x][this.htSelectionEPos.y]); oSelection.select(); oSelection.oBrowserSelection.selectNone(); } } } break; } }, $ON_EVENT_OUTER_DOC_MOUSEUP : function(wevE){ this._eventEditingAreaMouseup(wevE); }, $ON_EVENT_EDITING_AREA_MOUSEUP : function(wevE){ this._eventEditingAreaMouseup(wevE); }, _eventEditingAreaMouseup : function(wevE){ if(this.oApp.getEditingMode() != "WYSIWYG"){return;} switch(this.nStatus){ case this.STATUS.S_0: break; case this.STATUS.MOUSEDOWN_CELL: this._changeTableEditorStatus(this.STATUS.S_0); break; case this.STATUS.CELL_SELECTING: this._changeTableEditorStatus(this.STATUS.CELL_SELECTED); break; case this.STATUS.CELL_SELECTED: break; } }, /** * Table์˜ block์œผ๋กœ ์žกํžŒ ์˜์—ญ์„ ๋„˜๊ฒจ์ค€๋‹ค. * @see hp_SE2M_TableBlockStyler.js */ $ON_GET_SELECTED_CELLS : function(sAttr,oReturn){ if(!!this.aSelectedCells){ oReturn[sAttr] = this.aSelectedCells; } }, _coverResizeLayer : function(){ // [SMARTEDITORSUS-1504] ์—๋””ํ„ฐ ์ „์ฒด ํฌ๊ธฐ๋ณด๋‹ค ์ฐฝ์ด ์ž‘์•„์กŒ์„ ๋•Œ elResizeGrid๊ฐ€ ์ตœ๋Œ€ํ™”๋œ elResizeCover์œผ๋กœ๋ถ€ํ„ฐ ๋ฒ—์–ด๋‚˜๋Š” ์ด์Šˆ๊ฐ€ ์žˆ์Œ //this.elResizeCover.style.position = "absolute"; this.elResizeCover.style.position = "fixed"; // --[SMARTEDITORSUS-1504] var size = jindo.$Document().clientSize(); this.elResizeCover.style.width = size.width - this.nPageLeftRightMargin + "px"; this.elResizeCover.style.height = size.height - this.nPageTopBottomMargin + "px"; //this.elResizeCover.style.width = size.width + "px"; //this.elResizeCover.style.height = size.height + "px"; //document.body.insertBefore(this.elResizeCover, document.body.firstChild); document.body.appendChild(this.elResizeCover); }, _uncoverResizeLayer : function(){ this.elResizeGrid.appendChild(this.elResizeCover); this.elResizeCover.style.position = ""; this.elResizeCover.style.width = "100%"; this.elResizeCover.style.height = "100%"; }, _reassignCellSizes : function(elTable){ var allCells = new Array(2); allCells[0] = jindo.$$(">TBODY>TR>TD", elTable, {oneTimeOffCache:true}); allCells[1] = jindo.$$(">TBODY>TR>TH", elTable, {oneTimeOffCache:true}); var aAllCellsWithSizeInfo = new Array(allCells[0].length + allCells[1].length); var numCells = 0; var nTblBorderPadding = this.parseIntOr0(elTable.border); var nTblCellPadding = this.parseIntOr0(elTable.cellPadding); // remember all the dimensions first and then assign later. // this is done this way because if the table/cell size were set in %, setting one cell size would change size of other cells, which are still yet in %. // 1 for TD and 1 for TH for(var n = 0; n < 2; n++){ for(var i = 0; i < allCells[n].length; i++){ var elCell = allCells[n][i]; var welCell = jindo.$Element(elCell); var htBrowser = jindo.$Agent().navigator(); // [SMARTEDITORSUS-1427][SMARTEDITORSUS-1431][SMARTEDITORSUS-1491][SMARTEDITORSUS-1504] IE9, 10์—์„œ Jindo.$Element#css ๊ฐ€ ๋นˆ ์†์„ฑ๊ฐ’์„ 1px๋กœ ๊ฐ€์ ธ์˜ค๋Š” ๋ฌธ์ œ์ ์ด ์žˆ์–ด ๋Œ€์ฒด /*var nPaddingLeft = this.parseIntOr0(welCell.css("paddingLeft")); var nPaddingRight = this.parseIntOr0(welCell.css("paddingRight")); var nPaddingTop = this.parseIntOr0(welCell.css("paddingTop")); var nPaddingBottom = this.parseIntOr0(welCell.css("paddingBottom")); var nBorderLeft = this.parseBorder(welCell.css("borderLeftWidth"), welCell.css("borderLeftStyle")); var nBorderRight = this.parseBorder(welCell.css("borderRightWidth"), welCell.css("borderRightStyle")); var nBorderTop = this.parseBorder(welCell.css("borderTopWidth"), welCell.css("borderTopStyle")); var nBorderBottom = this.parseBorder(welCell.css("borderBottomWidth"), welCell.css("borderBottomStyle"));*/ var nPaddingLeft, nPaddingRight, nPaddingTop, nPaddingBottom; var nBorderLeft, nBorderRight, nBorderTop, nBorderBottom; // --[SMARTEDITORSUS-1427][SMARTEDITORSUS-1431][SMARTEDITORSUS-1491][SMARTEDITORSUS-1504] var nOffsetWidth, nOffsetHeight; // [SMARTEDITORSUS-1571] IE 10 ์ด์ƒ์ž„์—๋„ ๋ถˆ๊ตฌํ•˜๊ณ , ๋ฌธ์„œ ๋ชจ๋“œ๊ฐ€ 8 ์ดํ•˜๋กœ ์„ค์ •๋˜์–ด ์žˆ๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ์–ด ๋ฉ”์„œ๋“œ ๊ธฐ๋ฐ˜ ๋ถ„๊ธฐ๋กœ ๋ณ€๊ฒฝ if(elCell.getComputedStyle){ // --[SMARTEDITORSUS-1571] // getComputedStyle()๋กœ inherit๋œ ์Šคํƒ€์ผ์„ ํš๋“. IE 8 ์ดํ•˜์—์„œ๋Š” ์ง€์›๋˜์ง€ ์•Š๋Š”๋‹ค. nPaddingLeft = parseFloat(getComputedStyle(elCell).paddingLeft, 10); nPaddingRight = parseFloat(getComputedStyle(elCell).paddingRight, 10); nPaddingTop = parseFloat(getComputedStyle(elCell).paddingTop, 10); nPaddingBottom = parseFloat(getComputedStyle(elCell).paddingBottom, 10); // ์ตœ์ดˆ ๋ฆฌ์‚ฌ์ด์ง• ์ง์ „ width attribute์—์„œ style์˜ width๋กœ ์ดํ–‰ํ•˜๋Š” ๊ณผ์ •์—์„œ ๋ฏธ์„ธ๋ณด์ •์ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ํฌ๊ธฐ๊ฐ€ ์กฐ๊ธˆ ๋ณ€ํ•œ๋‹ค. nBorderLeft = parseFloat(getComputedStyle(elCell).borderLeftWidth, 10); nBorderRight = parseFloat(getComputedStyle(elCell).borderRightWidth, 10); nBorderTop = parseFloat(getComputedStyle(elCell).borderTopWidth, 10); nBorderBottom = parseFloat(getComputedStyle(elCell).borderBottomWidth, 10); }else{ // ์ด ๋ฐฉ์‹์€ inherit๋œ ์Šคํƒ€์ผ์„ ๊ฐ€์ ธ์˜ค์ง€ ๋ชปํ•˜๋Š” ๋ฌธ์ œ์™€ ํ•จ๊ป˜, ์ผ๋ถ€ ๋ธŒ๋ผ์šฐ์ €์˜ ์†Œ์ˆ˜์  ๊ฐ’์„ ๋ฒ„๋ฆผํ•˜๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ๋‹ค. // [SMARTEDITORSUS-1427][SMARTEDITORSUS-1431][SMARTEDITORSUS-1491] nPaddingLeft = this.parseIntOr0(elCell.style.paddingLeft); nPaddingRight = this.parseIntOr0(elCell.style.paddingRight); nPaddingTop = this.parseIntOr0(elCell.style.paddingTop); nPaddingBottom = this.parseIntOr0(elCell.style.paddingBottom); // --[SMARTEDITORSUS-1427][SMARTEDITORSUS-1431][SMARTEDITORSUS-1491] // ๊ธฐ์กด ๋กœ์ง์„ ์‚ฌ์šฉ. IE์˜ ๊ฒฝ์šฐ bug๋กœ ๋ถ„๋ฅ˜ํ•˜์—ฌ 1px๋ฅผ ํš๋“ํ•˜๋„๋ก ์„ค์ •๋˜์–ด ์žˆ๋‹ค. nBorderLeft = this.parseBorder(welCell.css("borderLeftWidth"), welCell.css("borderLeftStyle")); nBorderRight = this.parseBorder(welCell.css("borderRightWidth"), welCell.css("borderRightStyle")); nBorderTop = this.parseBorder(welCell.css("borderTopWidth"), welCell.css("borderTopStyle")); nBorderBottom = this.parseBorder(welCell.css("borderBottomWidth"), welCell.css("borderBottomStyle")); } /** * ๋งค๋ฒˆ ๋ฐœ์ƒํ•˜๋Š” ๋ฆฌ์‚ฌ์ด์ง• ์˜ค์ฐจ๋ฅผ ์ตœ์†Œํ•˜๊ธฐ ์œ„ํ•˜์—ฌ, 2ํšŒ์ฐจ๋ถ€ํ„ฐ๋Š” 1ํšŒ์ฐจ์— ์ ์šฉ๋˜๋Š” style ๊ฐ’์„ ๊ฐ€์ ธ์˜จ๋‹ค. * * width์™€ height attribute๋Š” ์ตœ์ดˆ 1ํšŒ์— ์ œ๊ฑฐ๋œ๋‹ค. * ์ฆ‰ 2ํšŒ์ฐจ๋ถ€ํ„ฐ๋Š”, ๋™์ ์œผ๋กœ ๋ณ€ํ•˜๋Š” style์˜ width, height ๊ฐ’์„ ๊ทธ๋Œ€๋กœ ์‚ฌ์šฉํ•œ๋‹ค. * */ /*nOffsetWidth = elCell.offsetWidth - (nPaddingLeft + nPaddingRight + nBorderLeft + nBorderRight) + "px"; nOffsetHeight = elCell.offsetHeight - (nPaddingTop + nPaddingBottom + nBorderTop + nBorderBottom) + "px";*/ var nWidth = jindo.$Element(elCell).attr("width"); var nHeight = jindo.$Element(elCell).attr("height"); if(!nWidth && !nHeight){ nOffsetWidth = elCell.style.width; nOffsetHeight = elCell.style.height; }else{ nOffsetWidth = elCell.offsetWidth - (nPaddingLeft + nPaddingRight + nBorderLeft + nBorderRight) + "px"; nOffsetHeight = elCell.offsetHeight - (nPaddingTop + nPaddingBottom + nBorderTop + nBorderBottom) + "px"; } /*if(htBrowser.ie && (htBrowser.nativeVersion >= 9 && htBrowser.nativeVersion <= 10)){ // IE9, IE10 // [SMARTEDITORSUS-1427][SMARTEDITORSUS-1431][SMARTEDITORSUS-1491] IE9, 10์—์„œ Jindo.$Element#css ๊ด€๋ จ ๋ฌธ์ œ์— ๋Œ€์‘ํ•˜๋ฉด ๋‹ค๋ฅธ ๋ธŒ๋ผ์šฐ์ €์™€ ๋™์ผํ•œ ์ˆ˜์‹ ์ ์šฉ ๊ฐ€๋Šฅ //nOffsetWidth = elCell.offsetWidth + "px"; //nOffsetHeight = elCell.offsetHeight - (nPaddingTop + nPaddingBottom + nBorderTop + nBorderBottom) + "px"; nOffsetWidth = elCell.offsetWidth - (nPaddingLeft + nPaddingRight + nBorderLeft + nBorderRight) + "px"; nOffsetHeight = elCell.offsetHeight - (nPaddingTop + nPaddingBottom + nBorderTop + nBorderBottom) + "px"; // --[SMARTEDITORSUS-1427][SMARTEDITORSUS-1431][SMARTEDITORSUS-1491] }else{ // Firefox, Chrome, IE7, IE8 nOffsetWidth = elCell.offsetWidth - (nPaddingLeft + nPaddingRight + nBorderLeft + nBorderRight) + "px"; nOffsetHeight = elCell.offsetHeight - (nPaddingTop + nPaddingBottom + nBorderTop + nBorderBottom) + "px"; }*/ // --[SMARTEDITORSUS-1504] aAllCellsWithSizeInfo[numCells++] = [elCell, nOffsetWidth, nOffsetHeight]; } } for(var i = 0; i < numCells; i++){ var aCellInfo = aAllCellsWithSizeInfo[i]; aCellInfo[0].removeAttribute("width"); aCellInfo[0].removeAttribute("height"); aCellInfo[0].style.width = aCellInfo[1]; aCellInfo[0].style.height = aCellInfo[2]; // jindo.$Element(aCellInfo[0]).css("width", aCellInfo[1]); // jindo.$Element(aCellInfo[0]).css("height", aCellInfo[2]); } elTable.removeAttribute("width"); elTable.removeAttribute("height"); elTable.style.width = ""; elTable.style.height = ""; }, _mousedown_ResizeCover : function(oEvent){ this.bResizing = true; this.nStartHeight = oEvent.pos().clientY; // [SMARTEDITORSUS-1504] ํ‘œ ํ…Œ๋‘๋ฆฌ๋ฅผ ๋ˆ„๋ฅผ ๋•Œ๋งˆ๋‹ค ๊ธ€์–‘์‹์ด 2px์”ฉ ์„ธ๋กœ๋กœ ๊ธธ์–ด์ง€๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š”๋ฐ, ์ด๋ฅผ ์œ„ํ•œ flag this.bResizingCover = true; // --[SMARTEDITORSUS-1504] this.wfnMousemove_ResizeCover.attach(this.elResizeCover, "mousemove"); this.wfnMouseup_ResizeCover.attach(document, "mouseup"); this._coverResizeLayer(); this.elResizeGrid.style.border = "1px dotted black"; this.nStartHeight = oEvent.pos().clientY; this.nStartWidth = oEvent.pos().clientX; // [SMARTEDITORSUS-1504] ํ‘œ ๋ฆฌ์‚ฌ์ด์ฆˆ์šฉ gripper์˜ ๋ฐฐ์น˜๋ฅผ WYSIWYG ํŽธ์ง‘ ์˜์—ญ ์œ„์น˜ ๊ธฐ๋ฐ˜์œผ๋กœ ๊ฐœ์„  this.nClientXDiff = this.nStartWidth - this.htResizing.htEPos.clientX; this.nClientYDiff = this.nStartHeight - this.htResizing.htEPos.clientY; // --[SMARTEDITORSUS-1504] this._reassignCellSizes(this.htResizing.elTable); this.htMap = this._getCellMapping(this.htResizing.elTable); var htPosition = this._getBasisCellPosition(this.htResizing.elCell); var nOffsetX = (parseInt(this.htResizing.elCell.getAttribute("colspan")) || 1) - 1; var nOffsetY = (parseInt(this.htResizing.elCell.getAttribute("rowspan")) || 1) - 1; var x = htPosition.x + nOffsetX + this.htResizing.nHA; var y = htPosition.y + nOffsetY + this.htResizing.nVA; if(x < 0 || y < 0){return;} this.htAllAffectedCells = this._getAllAffectedCells(x, y, this.htResizing.nResizeMode, this.htResizing.elTable); }, _mousemove_ResizeCover : function(oEvent){ // [SMARTEDITORSUS-1504] ํ‘œ ๋ชจ์„œ๋ฆฌ Drag ์‚ฌ์šฉ์„ฑ ๊ฐœ์„  // - ์ตœ์ดˆ ๋ฆฌ์‚ฌ์ด์ง• ํ›„ ํ•ด๋‹น ์œ„์น˜์—์„œ ๋ฐ”๋กœ ๋งˆ์šฐ์Šค๋ฅผ ๋ˆŒ๋Ÿฌ Drag ๊ฐ€๋Šฅ if(jindo.$Agent().navigator().chrome || jindo.$Agent().navigator().safari){ if(this.htResizing.nPreviousResizeMode != undefined && this.htResizing.nPreviousResizeMode != 0){ if(this.htResizing.nResizeMode != this.htResizing.nPreviousResizeMode){ this.htResizing.nResizeMode = this.htResizing.nPreviousResizeMode; this._showResizer(); } } } // --[SMARTEDITORSUS-1504] var nHeightChange = oEvent.pos().clientY - this.nStartHeight; var nWidthChange = oEvent.pos().clientX - this.nStartWidth; var oEventPos = oEvent.pos(); // [SMARTEDITORSUS-1504] ํ‘œ ๋ฆฌ์‚ฌ์ด์ฆˆ์šฉ gripper์˜ ๋ฐฐ์น˜๋ฅผ WYSIWYG ํŽธ์ง‘ ์˜์—ญ ์œ„์น˜ ๊ธฐ๋ฐ˜์œผ๋กœ ๊ฐœ์„  /*if(this.htResizing.nResizeMode == 1){ this.elResizeGrid.style.left = oEventPos.pageX - this.parseIntOr0(this.elResizeGrid.style.width)/2 + "px"; }else{ this.elResizeGrid.style.top = oEventPos.pageY - this.parseIntOr0(this.elResizeGrid.style.height)/2 + "px"; }*/ if(this.htResizing.nResizeMode == 1){ this.elResizeGrid.style.left = oEvent.pos().clientX - this.nClientXDiff - this.parseIntOr0(this.elResizeGrid.style.width)/2 + "px"; }else{ this.elResizeGrid.style.top = oEvent.pos().clientY - this.nClientYDiff - this.parseIntOr0(this.elResizeGrid.style.height)/2 + "px"; } // --[SMARTEDITORSUS-1504] }, _mouseup_ResizeCover : function(oEvent){ this.bResizing = false; this._hideResizer(); this._uncoverResizeLayer(); this.elResizeGrid.style.border = ""; this.wfnMousemove_ResizeCover.detach(this.elResizeCover, "mousemove"); this.wfnMouseup_ResizeCover.detach(document, "mouseup"); var nHeightChange = 0; var nWidthChange = 0; if(this.htResizing.nResizeMode == 2){ nHeightChange = oEvent.pos().clientY - this.nStartHeight; } if(this.htResizing.nResizeMode == 1){ nWidthChange = oEvent.pos().clientX - this.nStartWidth; if(this.htAllAffectedCells.nMinBefore != -1 && nWidthChange < -1*this.htAllAffectedCells.nMinBefore){ nWidthChange = -1 * this.htAllAffectedCells.nMinBefore + this.MIN_CELL_WIDTH; } if(this.htAllAffectedCells.nMinAfter != -1 && nWidthChange > this.htAllAffectedCells.nMinAfter){ nWidthChange = this.htAllAffectedCells.nMinAfter - this.MIN_CELL_WIDTH; } } // [SMARTEDITORSUS-1504] FireFox๋Š” ์†Œ์ˆ˜์ ์œผ๋กœ size๊ฐ€ ๋‚˜์˜ค๋Š”๋ฐ, parseInt๋Š” ์†Œ์ˆ˜์  ์ดํ•˜๋ฅผ ๋ฒ„๋ฆผ // [SMARTEDITORSUS-1655] ๋ฉ”์„œ๋“œ, ํ”„๋กœํผํ‹ฐ ๊ธฐ๋ฐ˜ ๋ฆฌํŒฉํ† ๋ง var width, height; // --[SMARTEDITORSUS-1655] var aCellsBefore = this.htAllAffectedCells.aCellsBefore; for(var i = 0; i < aCellsBefore.length; i++){ var elCell = aCellsBefore[i]; // [SMARTEDITORSUS-1655] width = 0, height = 0; width = elCell.style.width; if(isNaN(parseFloat(width, 10))){ // ๊ฐ’์ด ์—†๊ฑฐ๋‚˜ "auto"์ธ ๊ฒฝ์šฐ width = 0; }else{ width = parseFloat(width, 10); } width += nWidthChange; height = elCell.style.height; if(isNaN(parseFloat(height, 10))){ // ๊ฐ’์ด ์—†๊ฑฐ๋‚˜ "auto"์ธ ๊ฒฝ์šฐ height = 0; }else{ height = parseFloat(height, 10); } height += nHeightChange; // --[SMARTEDITORSUS-1655] //var width = this.parseIntOr0(elCell.style.width) + nWidthChange; elCell.style.width = Math.max(width, this.MIN_CELL_WIDTH) + "px"; //var height = this.parseIntOr0(elCell.style.height) + nHeightChange; elCell.style.height = Math.max(height, this.MIN_CELL_HEIGHT) + "px"; } var aCellsAfter = this.htAllAffectedCells.aCellsAfter; for(var i = 0; i < aCellsAfter.length; i++){ var elCell = aCellsAfter[i]; // [SMARTEDITORSUS-1655] width = 0, height = 0; width = elCell.style.width; if(isNaN(parseFloat(width, 10))){ // ๊ฐ’์ด ์—†๊ฑฐ๋‚˜ "auto"์ธ ๊ฒฝ์šฐ width = 0; }else{ width = parseFloat(width, 10); } width -= nWidthChange; height = elCell.style.height; if(isNaN(parseFloat(height, 10))){ // ๊ฐ’์ด ์—†๊ฑฐ๋‚˜ "auto"์ธ ๊ฒฝ์šฐ height = 0; }else{ height = parseFloat(height, 10); } height -= nHeightChange; // --[SMARTEDITORSUS-1655] //var width = this.parseIntOr0(elCell.style.width) - nWidthChange; elCell.style.width = Math.max(width, this.MIN_CELL_WIDTH) + "px"; //var height = this.parseIntOr0(elCell.style.height) - nHeightChange; elCell.style.height = Math.max(height, this.MIN_CELL_HEIGHT) + "px"; } // --[SMARTEDITORSUS-1504] // [SMARTEDITORSUS-1504] ํ‘œ ํ…Œ๋‘๋ฆฌ๋ฅผ ๋ˆ„๋ฅผ ๋•Œ๋งˆ๋‹ค ๊ธ€์–‘์‹์ด 2px์”ฉ ์„ธ๋กœ๋กœ ๊ธธ์–ด์ง€๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š”๋ฐ, ์ด๋ฅผ ์œ„ํ•œ flag this.bResizingCover = false; // --[SMARTEDITORSUS-1504] }, $ON_CLOSE_QE_LAYER : function(){ this._changeTableEditorStatus(this.STATUS.S_0); }, _changeTableEditorStatus : function(nNewStatus){ if(this.nStatus == nNewStatus){return;} this.nStatus = nNewStatus; switch(nNewStatus){ case this.STATUS.S_0: if(this.nStatus == this.STATUS.MOUSEDOWN_CELL){ break; } this._deselectCells(); // ํžˆ์Šคํ† ๋ฆฌ ์ €์žฅ (์„ ํƒ ์œ„์น˜๋Š” ์ €์žฅํ•˜์ง€ ์•Š์Œ) if(!!this.sQEAction){ this.oApp.exec("RECORD_UNDO_ACTION", [this.sQEAction, {elSaveTarget:this.elSelectionStartTable, bDontSaveSelection:true}]); this.sQEAction = ""; } if(this.oApp.oNavigator["safari"] || this.oApp.oNavigator["chrome"]){ this.oApp.getWYSIWYGDocument().onselectstart = null; } this.oApp.exec("ENABLE_WYSIWYG", []); this.oApp.exec("CLOSE_QE_LAYER"); this.elSelectionStartTable = null; break; case this.STATUS.CELL_SELECTING: if(this.oApp.oNavigator.ie){ document.body.setCapture(false); } break; case this.STATUS.CELL_SELECTED: this.oApp.delayedExec("MSG_CELL_SELECTED", [], 0); if(this.oApp.oNavigator.ie){ document.body.releaseCapture(); } break; } this.oApp.exec("TABLE_EDITOR_STATUS_CHANGED", [this.nStatus]); }, _isOnBorder : function(wevE){ // ===========================[Start: Set/init global resizing info]=========================== // 0: not resizing // 1: horizontal resizing // 2: vertical resizing this.htResizing.nResizeMode = 0; this.htResizing.elCell = wevE.element; if(wevE.element.tagName != "TD" && wevE.element.tagName != "TH"){return false;} this.htResizing.elTable = nhn.husky.SE2M_Utils.findAncestorByTagName("TABLE", this.htResizing.elCell); if(!this.htResizing.elTable){return;} if(!jindo.$Element(this.htResizing.elTable).hasClass(this._sSETblClass) && !jindo.$Element(this.htResizing.elTable).hasClass(this._sSEReviewTblClass)){return;} // Adjustment variables: to be used to map the x, y position of the resizing point relative to elCell // eg) When left border of a cell at 2,2 is selected, the actual cell that has to be resized is the one at 1,2. So, set the horizontal adjustment to -1. // Vertical Adjustment this.htResizing.nVA = 0; // Horizontal Adjustment this.htResizing.nHA = 0; this.htResizing.nBorderLeftPos = 0; this.htResizing.nBorderTopPos = -1; this.htResizing.htEPos = wevE.pos(true); this.htResizing.nBorderSize = this.parseIntOr0(this.htResizing.elTable.border); // ===========================[E N D: Set/init global resizing info]=========================== // Separate info is required as the offsetX/Y are different in IE and FF // For IE, (0, 0) is top left corner of the cell including the border. // For FF, (0, 0) is top left corner of the cell excluding the border. var nAdjustedDraggableCellEdge1; var nAdjustedDraggableCellEdge2; if(jindo.$Agent().navigator().ie || jindo.$Agent().navigator().safari){ nAdjustedDraggableCellEdge1 = this.htResizing.nBorderSize + this.nDraggableCellEdge; nAdjustedDraggableCellEdge2 = this.nDraggableCellEdge; }else{ nAdjustedDraggableCellEdge1 = this.nDraggableCellEdge; nAdjustedDraggableCellEdge2 = this.htResizing.nBorderSize + this.nDraggableCellEdge; } // [SMARTEDITORSUS-1504] ๊ฒฝ๊ณ„์„  ํŒ๋ณ„์— ์‚ฌ์šฉ var elCellWidth = this.htResizing.elCell.clientWidth, elCellHeight = this.htResizing.elCell.clientHeight; nRightBorderCriteria = elCellWidth - this.htResizing.htEPos.offsetX, nBottomBorderCriteria = elCellHeight - this.htResizing.htEPos.offsetY; // --[SMARTEDITORSUS-1504] // top border of the cell is selected if(this.htResizing.htEPos.offsetY <= nAdjustedDraggableCellEdge1){ // top border of the first cell can't be dragged if(this.htResizing.elCell.parentNode.previousSibling){ this.htResizing.nVA = -1; // [SMARTEDITORSUS-1504] ํ‘œ ๋ฆฌ์‚ฌ์ด์ฆˆ์šฉ gripper ๋ฐฐ์น˜ ๊ฐœ์„  //this.htResizing.nResizeMode = 2; this.htResizing.nResizeMode = 4; // --[SMARTEDITORSUS-1504] } } // bottom border of the cell is selected // [SMARTEDITORSUS-1504] ํ‘œ ๋ชจ์„œ๋ฆฌ Drag ์‚ฌ์šฉ์„ฑ ๊ฐœ์„  //if(this.htResizing.elCell.offsetHeight-nAdjustedDraggableCellEdge2 <= this.htResizing.htEPos.offsetY){ if(nBottomBorderCriteria <= nAdjustedDraggableCellEdge2){ this.htResizing.nBorderTopPos = this.htResizing.elCell.offsetHeight + nAdjustedDraggableCellEdge1 - 1; this.htResizing.nResizeMode = 2; } // --[SMARTEDITORSUS-1504] // left border of the cell is selected if(this.htResizing.htEPos.offsetX <= nAdjustedDraggableCellEdge1){ // left border of the first cell can't be dragged // [SMARTEDITORSUS-1504] ํ‘œ ๋ฆฌ์‚ฌ์ด์ฆˆ์šฉ gripper ๋ฐฐ์น˜ ๊ฐœ์„  // ์ผ๋ฐ˜ ํ‘œ๋Š” ์•„๋ž˜ if๋ฌธ์„ ๊ฑฐ์น˜์ง€ ์•Š์ง€๋งŒ, ๊ธ€์–‘์‹์˜ ๊ฒฝ์šฐ ๊ฐ€์žฅ ์ขŒ์ธก cell์˜ previousSibling์ด textNode์ด๊ธฐ ๋•Œ๋ฌธ์— if๋ฌธ์— ๋ถ€ํ•ฉํ•˜๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ๋‹ค. /*if(this.htResizing.elCell.previousSibling){ this.htResizing.nHA = -1; this.htResizing.nResizeMode = 0; }*/ // ๊ฐ€์žฅ ์ขŒ์ธก์˜ cell์€ ๊ทธ offsetLeft๊ฐ€ table์˜ scrollLeft์™€ ๊ฐ™๋‹ค. if(this.htResizing.elTable.scrollLeft != this.htResizing.elCell.offsetLeft){ this.htResizing.nHA = -1; this.htResizing.nResizeMode = 3; } // --[SMARTEDITORSUS-1504] } // right border of the cell is selected // [SMARTEDITORSUS-1504] ํ‘œ ๋ชจ์„œ๋ฆฌ Drag ์‚ฌ์šฉ์„ฑ ๊ฐœ์„  //if(this.htResizing.elCell.offsetWidth - nAdjustedDraggableCellEdge2 <= this.htResizing.htEPos.offsetX){ if(nRightBorderCriteria <= nAdjustedDraggableCellEdge1){ this.htResizing.nBorderLeftPos = this.htResizing.elCell.offsetWidth + nAdjustedDraggableCellEdge1 - 1; this.htResizing.nResizeMode = 1; } // --[SMARTEDITORSUS-1504] // [SMARTEDITORSUS-1504] ํ‘œ ๋ชจ์„œ๋ฆฌ Drag ์‚ฌ์šฉ์„ฑ ๊ฐœ์„  if(jindo.$Agent().navigator().chrome || jindo.$Agent().navigator().safari){ if(!this.htResizing.elPreviousCell){ this.htResizing.elPreviousCell = this.htResizing.elCell; }else{ if(this.htResizing.elCell != this.htResizing.elPreviousCell){ this.htResizing.elPreviousCell = this.htResizing.elCell; } } } // --[SMARTEDITORSUS-1504] if(this.htResizing.nResizeMode === 0){return false;} return true; }, _showCellResizeGrip : function(){ // [SMARTEDITORSUS-1504] gripper๊ฐ€ WYSIWYG ํŽธ์ง‘์˜์—ญ ์œ„์น˜์ •๋ณด์— ๊ธฐ๋ฐ˜ํ•˜์—ฌ ๋ฐฐ์น˜๋˜๋„๋ก ๋ณ€๊ฒฝ /*if(this.htResizing.nResizeMode == 1){ this.elResizeCover.style.cursor = "col-resize"; }else{ this.elResizeCover.style.cursor = "row-resize"; } this._showResizer();*/ // ๋งŒ์•ฝ iframe ๋‚ด๋ถ€์— gripper๋ฅผ ์ƒ์„ฑํ•œ๋‹ค๋ฉด, ์ปค์„œ ์œ„์น˜๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ์ƒ์„ฑํ•ด ์ฃผ๋ฉด ๋จ /*if(this.htResizing.nResizeMode == 1){ this._setResizerSize((this.htResizing.nBorderSize + this.nDraggableCellEdge) * 2, this.parseIntOr0(jindo.$Element(this.elIFrame).css("height"))); jindo.$Element(this.elResizeGrid).offset(this.htFrameOffset.top, this.htFrameOffset.left + this.htResizing.htEPos.clientX - this.parseIntOr0(this.elResizeGrid.style.width)/2 - this.htResizing.htEPos.offsetX + this.htResizing.nBorderLeftPos); }else{ //๊ฐ€๋ณ€ํญ์„ ์ง€์›ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋งค๋ฒˆ ํ˜„์žฌ Container์˜ ํฌ๊ธฐ๋ฅผ ๊ตฌํ•ด์™€์„œ Grip์„ ์ƒ์„ฑํ•ด์•ผ ํ•œ๋‹ค. var elIFrameWidth = this.oApp.elEditingAreaContainer.offsetWidth + "px"; this._setResizerSize(this.parseIntOr0(elIFrameWidth), (this.htResizing.nBorderSize + this.nDraggableCellEdge) * 2); jindo.$Element(this.elResizeGrid).offset(this.htFrameOffset.top + this.htResizing.htEPos.clientY - this.parseIntOr0(this.elResizeGrid.style.height)/2 - this.htResizing.htEPos.offsetY + this.htResizing.nBorderTopPos, this.htFrameOffset.left); }*/ if(this.htResizing.nResizeMode == 1 || this.htResizing.nResizeMode == 3){ this.elResizeCover.style.cursor = "col-resize"; }else if(this.htResizing.nResizeMode == 2 || this.htResizing.nResizeMode == 4){ this.elResizeCover.style.cursor = "row-resize"; } this._showResizer(); // gripper๋Š” ๋Œ€์ƒ ์…€์—์„œ ์–ด๋А ๊ฒฝ๊ณ„ ์œ„์— ์ปค์„œ๊ฐ€ ์œ„์น˜ํ–ˆ๋А๋ƒ์— ๊ธฐ๋ฐ˜ํ•˜์—ฌ ๋ฐฐ์น˜ if(this.htResizing.nResizeMode == 1){ // ์˜ค๋ฅธ์ชฝ ๊ฒฝ๊ณ„ this._setResizerSize((this.htResizing.nBorderSize + this.nDraggableCellEdge) * 2, this.parseIntOr0(jindo.$Element(this.elIFrame).css("height"))); this.elResizeGrid.style.top = "0px"; this.elResizeGrid.style.left = this.htResizing.elCell.clientWidth + this.htResizing.htEPos.clientX - this.htResizing.htEPos.offsetX - this.parseIntOr0(this.elResizeGrid.style.width)/2 + "px"; }else if(this.htResizing.nResizeMode == 2){ // ์•„๋ž˜์ชฝ ๊ฒฝ๊ณ„ //๊ฐ€๋ณ€ํญ์„ ์ง€์›ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋งค๋ฒˆ ํ˜„์žฌ Container์˜ ํฌ๊ธฐ๋ฅผ ๊ตฌํ•ด์™€์„œ Grip์„ ์ƒ์„ฑํ•ด์•ผ ํ•œ๋‹ค. var elIFrameWidth = this.oApp.elEditingAreaContainer.offsetWidth + "px"; this._setResizerSize(this.parseIntOr0(elIFrameWidth), (this.htResizing.nBorderSize + this.nDraggableCellEdge) * 2); this.elResizeGrid.style.top = this.htResizing.elCell.clientHeight + this.htResizing.htEPos.clientY - this.htResizing.htEPos.offsetY - this.parseIntOr0(this.elResizeGrid.style.height)/2 + "px"; this.elResizeGrid.style.left = "0px"; }else if(this.htResizing.nResizeMode == 3){ // ์™ผ์ชฝ ๊ฒฝ๊ณ„ this._setResizerSize((this.htResizing.nBorderSize + this.nDraggableCellEdge) * 2, this.parseIntOr0(jindo.$Element(this.elIFrame).css("height"))); this.elResizeGrid.style.top = "0px"; this.elResizeGrid.style.left = + this.htResizing.htEPos.clientX - this.htResizing.htEPos.offsetX - this.parseIntOr0(this.elResizeGrid.style.width)/2 + "px"; // ์ดํ›„ ์ž‘์—…๋“ค์€ ์˜ค๋ฅธ์ชฝ ๊ฒฝ๊ณ„๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์ผ๊ด„์ฒ˜๋ฆฌ this.htResizing.nResizeMode = 1; }else if(this.htResizing.nResizeMode == 4){ //์œ„์ชฝ ๊ฒฝ๊ณ„ //๊ฐ€๋ณ€ํญ์„ ์ง€์›ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋งค๋ฒˆ ํ˜„์žฌ Container์˜ ํฌ๊ธฐ๋ฅผ ๊ตฌํ•ด์™€์„œ Grip์„ ์ƒ์„ฑํ•ด์•ผ ํ•œ๋‹ค. var elIFrameWidth = this.oApp.elEditingAreaContainer.offsetWidth + "px"; this._setResizerSize(this.parseIntOr0(elIFrameWidth), (this.htResizing.nBorderSize + this.nDraggableCellEdge) * 2); this.elResizeGrid.style.top = this.htResizing.htEPos.clientY - this.htResizing.htEPos.offsetY - this.parseIntOr0(this.elResizeGrid.style.height)/2 + "px"; this.elResizeGrid.style.left = "0px"; // ์ดํ›„ ์ž‘์—…๋“ค์€ ์•„๋ž˜์ชฝ ๊ฒฝ๊ณ„๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์ผ๊ด„์ฒ˜๋ฆฌ this.htResizing.nResizeMode = 2; } // --[SMARTEDITORSUS-1504] }, _getAllAffectedCells : function(basis_x, basis_y, iResizeMode, oTable){ if(!oTable){return [];} var oTbl = this._getCellMapping(oTable); var iTblX = oTbl.length; var iTblY = oTbl[0].length; // ์„ ํƒ ํ…Œ๋‘๋ฆฌ์˜ ์•ž์ชฝ ์…€ var aCellsBefore = []; // ์„ ํƒ ํ…Œ๋‘๋ฆฌ์˜ ๋’ค์ชฝ ์…€ var aCellsAfter = []; var htResult; var nMinBefore = -1, nMinAfter = -1; // horizontal resizing -> need to get vertical rows if(iResizeMode == 1){ for(var y = 0; y < iTblY; y++){ if(aCellsBefore.length>0 && aCellsBefore[aCellsBefore.length-1] == oTbl[basis_x][y]){continue;} aCellsBefore[aCellsBefore.length] = oTbl[basis_x][y]; var nWidth = parseInt(oTbl[basis_x][y].style.width); if(nMinBefore == -1 || nMinBefore > nWidth){ nMinBefore = nWidth; } } if(oTbl.length > basis_x+1){ for(var y = 0; y < iTblY; y++){ if(aCellsAfter.length>0 && aCellsAfter[aCellsAfter.length-1] == oTbl[basis_x+1][y]){continue;} aCellsAfter[aCellsAfter.length] = oTbl[basis_x+1][y]; var nWidth = parseInt(oTbl[basis_x + 1][y].style.width); if(nMinAfter == -1 || nMinAfter > nWidth){ nMinAfter = nWidth; } } } htResult = {aCellsBefore: aCellsBefore, aCellsAfter: aCellsAfter, nMinBefore: nMinBefore, nMinAfter: nMinAfter}; }else{ for(var x = 0; x < iTblX; x++){ if(aCellsBefore.length>0 && aCellsBefore[aCellsBefore.length - 1] == oTbl[x][basis_y]){continue;} aCellsBefore[aCellsBefore.length] = oTbl[x][basis_y]; if(nMinBefore == -1 || nMinBefore > oTbl[x][basis_y].style.height){ nMinBefore = oTbl[x][basis_y].style.height; } } // ๋†’์ด ๋ฆฌ์‚ฌ์ด์ง• ์‹œ์—๋Š” ์„ ํƒ ํ…Œ๋‘๋ฆฌ ์•ž์ชฝ ์…€๋งŒ ์กฐ์ ˆ ํ•จ์œผ๋กœ ์•„๋ž˜์ชฝ ์…€์€ ์ƒ์„ฑ ํ•  ํ•„์š” ์—†์Œ htResult = {aCellsBefore: aCellsBefore, aCellsAfter: aCellsAfter, nMinBefore: nMinBefore, nMinAfter: nMinAfter}; } return htResult; }, _createCellResizeGrip : function(){ this.elTmp = document.createElement("DIV"); try{ this.elTmp.innerHTML = '<div style="position:absolute; overflow:hidden; z-index: 99; "><div onmousedown="return false" style="background-color:#000000;filter:alpha(opacity=0);opacity:0.0;-moz-opacity:0.0;-khtml-opacity:0.0;cursor: col-resize; left: 0px; top: 0px; width: 100%; height: 100%;font-size:1px;z-index: 999; "></div></div>'; this.elResizeGrid = this.elTmp.firstChild; this.elResizeCover = this.elResizeGrid.firstChild; }catch(e){} // [SMARTEDITORSUS-1504] gripper๋ฅผ WYSIWYG ํŽธ์ง‘ ์˜์—ญ ์œ„์น˜ ์ •๋ณด์— ๊ธฐ๋ฐ˜ํ•˜์—ฌ ๋ฐฐ์น˜ํ•˜๋„๋ก ๊ฐœ์„  //document.body.appendChild(this.elResizeGrid); // document.body ๋Œ€์‹  WYSIWYG ํŽธ์ง‘ ์˜์—ญ์„ ๋‘˜๋Ÿฌ์‹ผ container div์— ์ถ”๊ฐ€ var oContainer = jindo.$$.getSingle(".husky_seditor_editing_area_container"); oContainer.appendChild(this.elResizeGrid); // --[SMARTEDITORSUS-1504] }, _selectAll_Row : function(){ this.htSelectionSPos.x = 0; this.htSelectionEPos.x = this.htMap.length - 1; this._selectCells(this.htSelectionSPos, this.htSelectionEPos); }, _selectAll_Column : function(){ this.htSelectionSPos.y = 0; this.htSelectionEPos.y = this.htMap[0].length - 1; this._selectCells(this.htSelectionSPos, this.htSelectionEPos); }, _deleteSelectedCells : function(){ var elTmp; for(var i = 0, nLen = this.aSelectedCells.length; i < nLen; i++){ elTmp = this.aSelectedCells[i]; elTmp.parentNode.removeChild(elTmp); } var aTR = jindo.$$(">TBODY>TR", this.elSelectionStartTable, {oneTimeOffCache:true}); var nSelectionWidth = this.htSelectionEPos.x - this.htSelectionSPos.x + 1; var nWidth = this.htMap.length; if(nSelectionWidth == nWidth){ for(var i = 0, nLen = aTR.length; i < nLen; i++){ elTmp = aTR[i]; // There can be empty but necessary TR's because of Rowspan if(!this.htMap[0][i] || !this.htMap[0][i].parentNode || this.htMap[0][i].parentNode.tagName !== "TR"){ elTmp.parentNode.removeChild(elTmp); } } aTR = jindo.$$(">TBODY>TR", this.elSelectionStartTable, {oneTimeOffCache:true}); } if(aTR.length < 1){ this.elSelectionStartTable.parentNode.removeChild(this.elSelectionStartTable); } this._updateSelection(); }, _insertColumnAfter : function(){ this._removeClassFromSelection(); this._hideTableTemplate(this.elSelectionStartTable); var aTR = jindo.$$(">TBODY>TR", this.elSelectionStartTable, {oneTimeOffCache:true}); var sInserted; var sTmpAttr_Inserted = "_tmp_inserted"; var elCell, elCellClone, elCurTR, elInsertionPt; // copy each cells in the following order: top->down, right->left // +---+---+---+---+ // |...|.2.|.1.|...| // |---+---+.1.|...| // |...|.3.|.1.|...| // |...|.3.+---+...| // |...|.3.|.4.+...| // |...+---+---+...| // |...|.6.|.5.|...| // +---+---+---+---+ // [SMARTEDITORSUS-991] IE๋Š” insertionPt์˜ previousSibling์—๋„ ๋ฐฐ๊ฒฝ์ƒ‰์„ ์ ์šฉํ•ด์ค˜์•ผ ํ•  ํ•„์š”๊ฐ€ ์žˆ์Œ. var htBrowser = jindo.$Agent().navigator(); // --[SMARTEDITORSUS-991] for(var y = 0, nYLen = this.htMap[0].length; y < nYLen; y++){ elCurTR = aTR[y]; for(var x = this.htSelectionEPos.x; x >= this.htSelectionSPos.x; x--){ elCell = this.htMap[x][y]; //sInserted = elCell.getAttribute(sTmpAttr_Inserted); //if(sInserted){continue;} //elCell.setAttribute(sTmpAttr_Inserted, "o"); elCellClone = this._shallowCloneTD(elCell); // elCellClone์˜ outerHTML์— ์ •์ƒ์ ์ธ rowSpan์ด ์žˆ๋”๋ผ๋„ IE์—์„œ๋Š” ์ด ์œ„์น˜์—์„œ ํ•ญ์ƒ 1์„ ๋ฐ˜ํ™˜. (elCellClone.rowSpan & elCellClone.getAttribute("rowSpan")). //var nSpan = parseInt(elCellClone.getAttribute("rowSpan")); var nSpan = parseInt(elCell.getAttribute("rowSpan")); if(nSpan > 1){ elCellClone.setAttribute("rowSpan", 1); elCellClone.style.height = ""; } nSpan = parseInt(elCell.getAttribute("colSpan")); if(nSpan > 1){ elCellClone.setAttribute("colSpan", 1); elCellClone.style.width = ""; } // ํ˜„์žฌ ์ค„(TR)์— ์†ํ•œ ์…€(TD)์„ ์ฐพ์•„์„œ ๊ทธ ์•ž์— append ํ•œ๋‹ค. elInsertionPt = null; for(var xx = this.htSelectionEPos.x; xx >= this.htSelectionSPos.x; xx--){ if(this.htMap[xx][y].parentNode == elCurTR){ elInsertionPt = this.htMap[xx][y].nextSibling; break; } } elCurTR.insertBefore(elCellClone, elInsertionPt); // [SMARTEDITORSUS-991] IE๋Š” insertionPt์˜ previousSibling์—๋„ style์„ ์ ์šฉํ•ด์ค˜์•ผ ํ•  ํ•„์š”๊ฐ€ ์žˆ์Œ. // [SMARTEDITORSUS-1639] IE์—์„œ JS์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒ๋˜์–ด ๋ฐฉ์–ด์ฒ˜๋ฆฌ (์ƒํ•˜์…€์ด ๋ณ‘ํ•ฉ๋œ ์ƒํƒœ์—์„œ ์—ด์‚ฝ์ž…ํ•˜๋Š” ๊ฒฝ์šฐ ๋ฐœ์ƒ) if(htBrowser.ie && htBrowser.nativeVersion >= 9 && elInsertionPt){ elInsertionPt.previousSibling.style.backgroundColor = elCellClone.style.backgroundColor; } // --[SMARTEDITORSUS-991] } } // remove the insertion marker from the original cells for(var i = 0, nLen = this.aSelectedCells.length; i < nLen; i++){ this.aSelectedCells[i].removeAttribute(sTmpAttr_Inserted); } var nSelectionWidth = this.htSelectionEPos.x - this.htSelectionSPos.x + 1; var nSelectionHeight = this.htSelectionEPos.y - this.htSelectionSPos.y + 1; this.htSelectionSPos.x += nSelectionWidth; this.htSelectionEPos.x += nSelectionWidth; this.htMap = this._getCellMapping(this.elSelectionStartTable); this._selectCells(this.htSelectionSPos, this.htSelectionEPos); this._showTableTemplate(this.elSelectionStartTable); this._addClassToSelection(); this.sQEAction = "INSERT_TABLE_COLUMN"; this.oApp.exec("SHOW_COMMON_QE"); }, _insertRowBelow : function(){ this._selectAll_Row(); this._removeClassFromSelection(); this._hideTableTemplate(this.elSelectionStartTable); var elRowClone; var elTBody = this.htMap[0][0].parentNode.parentNode; var aTRs = jindo.$$(">TR", elTBody, {oneTimeOffCache:true}); var elInsertionPt = aTRs[this.htSelectionEPos.y + 1] || null; // [SMARTEDITORSUS-991] IE๋Š” insertionPt์˜ previousSibling์—๋„ ๋ฐฐ๊ฒฝ์ƒ‰์„ ์ ์šฉํ•ด์ค˜์•ผ ํ•  ํ•„์š”๊ฐ€ ์žˆ์Œ. var htBrowser = jindo.$Agent().navigator(); // --[SMARTEDITORSUS-991] for(var y = this.htSelectionSPos.y; y <= this.htSelectionEPos.y; y++){ elRowClone = this._getTRCloneWithAllTD(y); elTBody.insertBefore(elRowClone, elInsertionPt); // [SMARTEDITORSUS-991] IE๋Š” insertionPt์˜ previousSibling์—๋„ ์ถ”๊ฐ€๋กœ ๋ฐฐ๊ฒฝ์ƒ‰์„ ์ ์šฉํ•ด์ค˜์•ผ ํ•  ํ•„์š”๊ฐ€ ์žˆ์Œ. if(htBrowser.ie && htBrowser.nativeVersion >= 9){ // IE์˜ ๊ฒฝ์šฐ tr ์‚ฌ์ด์—๋„ ๋นˆ ํ…์ŠคํŠธ ๋…ธ๋“œ๋ฅผ ํ•˜๋‚˜ ์ถ”๊ฐ€ํ•ด ์ค˜์•ผ ํ•œ๋‹ค. var elEmptyTextNode = aTRs[this.htSelectionEPos.y].nextSibling.cloneNode(); elTBody.insertBefore(elEmptyTextNode, elInsertionPt); // ์Šคํƒ€์ผ์„ ์ ์šฉ์‹œ์ผœ ์ค„ ๋Œ€์ƒ tr var elPreviousSiblingParent = this.htMap[0][y].parentNode; var aOriginalPreviousSibling = elPreviousSiblingParent.childNodes; var aPreviousSibling = []; for(var i = 0, len = aOriginalPreviousSibling.length; i < len; i++){ aPreviousSibling.push(aOriginalPreviousSibling[i]); } // ๋ฐฐ๊ฒฝ์ƒ‰์„ ๋ณต์‚ฌํ•˜๊ธฐ ์œ„ํ•ด ์ค€๋น„ var aRowClone = elRowClone.childNodes; for(var i = 0, len = aRowClone.length; i < len; i++){ var elCloneTD = aRowClone[i]; var elPreviousTD = aPreviousSibling[i]; // [SMARTEDITORSUS-1639] ๋ณ‘ํ•ฉ ํ›„ ์ถ”๊ฐ€์‹œ JS ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์–ด nodeName ํ™•์ธ if(elCloneTD.nodeName == "TD" && elPreviousTD && elPreviousTD.nodeName == "TD"){ elPreviousTD.style.backgroundColor = elCloneTD.style.backgroundColor; } } } // --[SMARTEDITORSUS-991] } var nSelectionWidth = this.htSelectionEPos.x - this.htSelectionSPos.x + 1; var nSelectionHeight = this.htSelectionEPos.y - this.htSelectionSPos.y + 1; this.htSelectionSPos.y += nSelectionHeight; this.htSelectionEPos.y += nSelectionHeight; this.htMap = this._getCellMapping(this.elSelectionStartTable); this._selectCells(this.htSelectionSPos, this.htSelectionEPos); this._showTableTemplate(this.elSelectionStartTable); this._addClassToSelection(); this.sQEAction = "INSERT_TABLE_ROW"; this.oApp.exec("SHOW_COMMON_QE"); }, _updateSelection : function(){ this.aSelectedCells = jindo.$A(this.aSelectedCells).filter(function(v){return (v.parentNode!==null && v.parentNode.parentNode!==null);}).$value(); }, _startCellSelection : function(){ this.htMap = this._getCellMapping(this.elSelectionStartTable); // De-select the default selection this.oApp.getEmptySelection().oBrowserSelection.selectNone(); if(this.oApp.oNavigator["safari"] || this.oApp.oNavigator["chrome"]){ this.oApp.getWYSIWYGDocument().onselectstart = function(){return false;}; } var elIFrame = this.oApp.getWYSIWYGWindow().frameElement; this.htEditingAreaPos = jindo.$Element(elIFrame).offset(); this.htEditingAreaPos.height = elIFrame.offsetHeight; this.htEditingAreaPos.bottom = this.htEditingAreaPos.top + this.htEditingAreaPos.height; this.htEditingAreaPos.width = elIFrame.offsetWidth; this.htEditingAreaPos.right = this.htEditingAreaPos.left + this.htEditingAreaPos.width; /* if(!this.oNavigatorInfo["firefox"]){ this.oApp.exec("DISABLE_WYSIWYG", []); } */ this._changeTableEditorStatus(this.STATUS.CELL_SELECTING); }, _selectBetweenCells : function(elCell1, elCell2){ this._deselectCells(); var oP1 = this._getBasisCellPosition(elCell1); var oP2 = this._getBasisCellPosition(elCell2); this._setEndPos(oP1); this._setEndPos(oP2); var oStartPos = {}, oEndPos = {}; oStartPos.x = Math.min(oP1.x, oP1.ex, oP2.x, oP2.ex); oStartPos.y = Math.min(oP1.y, oP1.ey, oP2.y, oP2.ey); oEndPos.x = Math.max(oP1.x, oP1.ex, oP2.x, oP2.ex); oEndPos.y = Math.max(oP1.y, oP1.ey, oP2.y, oP2.ey); this._selectCells(oStartPos, oEndPos); }, _getNextCell : function(elCell){ while(elCell){ elCell = elCell.nextSibling; if(elCell && elCell.tagName && elCell.tagName.match(/^TD|TH$/)){return elCell;} } return null; }, _getCellMapping : function(elTable){ var aTR = jindo.$$(">TBODY>TR", elTable, {oneTimeOffCache:true}); var nTD = 0; var aTD_FirstRow = aTR[0].childNodes; /* // remove empty TR's from the bottom of the table for(var i=aTR.length-1; i>0; i--){ if(!aTR[i].childNodes || aTR[i].childNodes.length === 0){ aTR[i].parentNode.removeChild(aTR[i]); aTR = aTR.slice(0, i); if(this.htSelectionSPos.y>=i) this.htSelectionSPos.y--; if(this.htSelectionEPos.y>=i) this.htSelectionEPos.y--; }else{ break; } } */ // count the number of columns for(var i = 0; i < aTD_FirstRow.length; i++){ var elTmp = aTD_FirstRow[i]; if(!elTmp.tagName || !elTmp.tagName.match(/^TD|TH$/)){continue;} if(elTmp.getAttribute("colSpan")){ nTD += this.parseIntOr0(elTmp.getAttribute("colSpan")); }else{ nTD ++; } } var nTblX = nTD; var nTblY = aTR.length; var aCellMapping = new Array(nTblX); for(var x = 0; x < nTblX; x++){ aCellMapping[x] = new Array(nTblY); } for(var y = 0; y < nTblY; y++){ var elCell = aTR[y].childNodes[0]; if(!elCell){continue;} if(!elCell.tagName || !elCell.tagName.match(/^TD|TH$/)){elCell = this._getNextCell(elCell);} var x = -1; while(elCell){ x++; if(!aCellMapping[x]){aCellMapping[x] = [];} if(aCellMapping[x][y]){continue;} var colSpan = parseInt(elCell.getAttribute("colSpan"), 10) || 1; var rowSpan = parseInt(elCell.getAttribute("rowSpan"), 10) || 1; /* if(y+rowSpan >= nTblY){ rowSpan = nTblY-y; elCell.setAttribute("rowSpan", rowSpan); } */ for(var yy = 0; yy < rowSpan; yy++){ for(var xx = 0; xx < colSpan; xx++){ if(!aCellMapping[x+xx]){ aCellMapping[x+xx] = []; } aCellMapping[x+xx][y+yy] = elCell; } } elCell = this._getNextCell(elCell); } } // remove empty TR's // (์ƒ๋‹จ TD์˜ rowspan๋งŒ์œผ๋กœ ์ง€ํƒฑ๋˜๋Š”) ๋นˆ TR์ด ์žˆ์„ ๊ฒฝ์šฐ IE7 ์ดํ•˜์—์„œ ๋žœ๋”๋ง ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒ ํ•  ์ˆ˜ ์žˆ์–ด ๋นˆ TR์„ ์ง€์›Œ ์คŒ var bRowRemoved = false; var elLastCell = null; for(var y = 0, nRealY = 0, nYLen = aCellMapping[0].length; y < nYLen; y++, nRealY++){ elLastCell = null; if(!aTR[y].innerHTML.match(/TD|TH/i)){ for(var x = 0, nXLen = aCellMapping.length; x < nXLen; x++){ elCell = aCellMapping[x][y]; if(!elCell || elCell === elLastCell){ continue; } elLastCell = elCell; var rowSpan = parseInt(elCell.getAttribute("rowSpan"), 10) || 1; if(rowSpan > 1){ elCell.setAttribute("rowSpan", rowSpan - 1); } } aTR[y].parentNode.removeChild(aTR[y]); if(this.htSelectionEPos.y >= nRealY){ nRealY--; this.htSelectionEPos.y--; } bRowRemoved = true; } } if(bRowRemoved){ return this._getCellMapping(elTable); } return aCellMapping; }, _selectCells : function(htSPos, htEPos){ this.aSelectedCells = this._getSelectedCells(htSPos, htEPos); this._addClassToSelection(); }, _deselectCells : function(){ this._removeClassFromSelection(); this.aSelectedCells = []; this.htSelectionSPos = {x:-1, y:-1}; this.htSelectionEPos = {x:-1, y:-1}; }, _addClassToSelection : function(){ var welCell, elCell; for(var i = 0; i < this.aSelectedCells.length; i++){ elCell = this.aSelectedCells[i]; // [SMARTEDITORSUS-1552] ๋“œ๋ž˜๊ทธ๋กœ ์…€์„ ์„ ํƒํ•˜๋Š” ์ค‘ elCell์ด ์—†๋Š” ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ๋ฐœ์ƒ if(elCell){ // [SMARTEDITORSUS-1498][SMARTEDITORSUS-1549] ์„ ํƒ๋œ ๋ชจ๋“  ์…€์—์„œ ๋“œ๋ž˜๊ทธ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ๋ชปํ•˜๊ฒŒ ๋ฐฉ์ง€(FF, Chrome) if(elCell.ondragstart == null){ elCell.ondragstart = function(){ return false; }; } // --[SMARTEDITORSUS-1498][SMARTEDITORSUS-1549] welCell = jindo.$Element(elCell); welCell.addClass(this.CELL_SELECTION_CLASS); // [SMARTEDITORSUS-1498][SMARTEDITORSUS-1549] ์„ ํƒ๋œ ๋ชจ๋“  ์…€์—์„œ ๋“œ๋ž˜๊ทธ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ๋ชปํ•˜๊ฒŒ ๋ฐฉ์ง€(FF, Chrome) welCell.addClass("undraggable"); // --[SMARTEDITORSUS-1498][SMARTEDITORSUS-1549] if(elCell.style.backgroundColor){ elCell.setAttribute(this.TMP_BGC_ATTR, elCell.style.backgroundColor); welCell.css("backgroundColor", ""); } if(elCell.style.backgroundImage) { elCell.setAttribute(this.TMP_BGIMG_ATTR, elCell.style.backgroundImage); welCell.css("backgroundImage", ""); } } // --[SMARTEDITORSUS-1552] } }, _removeClassFromSelection : function(){ var welCell, elCell; for(var i = 0; i < this.aSelectedCells.length; i++){ elCell = this.aSelectedCells[i]; // [SMARTEDITORSUS-1552] ๋“œ๋ž˜๊ทธ๋กœ ์…€์„ ์„ ํƒํ•˜๋Š” ์ค‘ elCell์ด ์—†๋Š” ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ๋ฐœ์ƒ if(elCell){ welCell = jindo.$Element(elCell); welCell.removeClass(this.CELL_SELECTION_CLASS); // [SMARTEDITORSUS-1498][SMARTEDITORSUS-1549] ์„ ํƒ๋œ ๋ชจ๋“  ์…€์—์„œ ๋“œ๋ž˜๊ทธ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ๋ชปํ•˜๊ฒŒ ๋ฐฉ์ง€(FF, Chrome) welCell.removeClass("undraggable"); // --[SMARTEDITORSUS-1498][SMARTEDITORSUS-1549] //๋ฐฐ๊ฒฝ์ƒ‰ if(elCell.getAttribute(this.TMP_BGC_ATTR)){ elCell.style.backgroundColor = elCell.getAttribute(this.TMP_BGC_ATTR); elCell.removeAttribute(this.TMP_BGC_ATTR); } //๋ฐฐ๊ฒฝ์ด๋ฏธ์ง€ if(elCell.getAttribute(this.TMP_BGIMG_ATTR)) { welCell.css("backgroundImage",elCell.getAttribute(this.TMP_BGIMG_ATTR)); elCell.removeAttribute(this.TMP_BGIMG_ATTR); } } // --[SMARTEDITORSUS-1552] } }, _expandAndSelect : function(htPos1, htPos2){ var x, y, elTD, nTmp, i; // expand top if(htPos1.y > 0){ for(x = htPos1.x; x <= htPos2.x; x++){ elTD = this.htMap[x][htPos1.y]; if(this.htMap[x][htPos1.y - 1] == elTD){ nTmp = htPos1.y - 2; while(nTmp >= 0 && this.htMap[x][nTmp] == elTD){ nTmp--; } htPos1.y = nTmp + 1; this._expandAndSelect(htPos1, htPos2); return; } } } // expand left if(htPos1.x > 0){ for(y = htPos1.y; y <= htPos2.y; y++){ elTD = this.htMap[htPos1.x][y]; if(this.htMap[htPos1.x - 1][y] == elTD){ nTmp = htPos1.x - 2; while(nTmp >= 0 && this.htMap[nTmp][y] == elTD){ nTmp--; } htPos1.x = nTmp + 1; this._expandAndSelect(htPos1, htPos2); return; } } } // expand bottom if(htPos2.y < this.htMap[0].length - 1){ for(x = htPos1.x; x <= htPos2.x; x++){ elTD = this.htMap[x][htPos2.y]; if(this.htMap[x][htPos2.y + 1] == elTD){ nTmp = htPos2.y + 2; while(nTmp < this.htMap[0].length && this.htMap[x][nTmp] == elTD){ nTmp++; } htPos2.y = nTmp - 1; this._expandAndSelect(htPos1, htPos2); return; } } } // expand right if(htPos2.x < this.htMap.length - 1){ for(y = htPos1.y; y <= htPos2.y; y++){ elTD = this.htMap[htPos2.x][y]; if(this.htMap[htPos2.x + 1][y] == elTD){ nTmp = htPos2.x + 2; while(nTmp < this.htMap.length && this.htMap[nTmp][y] == elTD){ nTmp++; } htPos2.x = nTmp - 1; this._expandAndSelect(htPos1, htPos2); return; } } } }, _getSelectedCells : function(htPos1, htPos2){ this._expandAndSelect(htPos1, htPos2); var x1 = htPos1.x; var y1 = htPos1.y; var x2 = htPos2.x; var y2 = htPos2.y; this.htSelectionSPos = htPos1; this.htSelectionEPos = htPos2; var aResult = []; for(var y = y1; y <= y2; y++){ for(var x = x1; x <= x2; x++){ if(jindo.$A(aResult).has(this.htMap[x][y])){ continue; } aResult[aResult.length] = this.htMap[x][y]; } } return aResult; }, _setEndPos : function(htPos){ var nColspan, nRowspan; nColspan = parseInt(htPos.elCell.getAttribute("colSpan"), 10) || 1; nRowspan = parseInt(htPos.elCell.getAttribute("rowSpan"), 10) || 1; htPos.ex = htPos.x + nColspan - 1; htPos.ey = htPos.y + nRowspan - 1; }, _getBasisCellPosition : function(elCell){ var x = 0, y = 0; for(x = 0; x < this.htMap.length; x++){ for(y = 0; y < this.htMap[x].length; y++){ if(this.htMap[x][y] == elCell){ return {'x': x, 'y': y, elCell: elCell}; } } } return {'x': 0, 'y': 0, elCell: elCell}; }, _applyTableTemplate : function(elTable, nTemplateIdx){ // clear style first if already exists /* if(elTable.getAttribute(this.ATTR_TBL_TEMPLATE)){ this._doApplyTableTemplate(elTable, nhn.husky.SE2M_TableTemplate[this.parseIntOr0(elTable.getAttribute(this.ATTR_TBL_TEMPLATE))], true); }else{ this._clearAllTableStyles(elTable); } */ if (!elTable) { return; } // ์‚ฌ์šฉ์ž๊ฐ€ ์ง€์ •ํ•œ ์Šคํƒ€์ผ ๋ฌด์‹œํ•˜๊ณ  ์ƒˆ ํ…œํ”Œ๋ฆฟ ์ ์šฉ // http://bts.nhncorp.com/nhnbts/browse/COM-871 this._clearAllTableStyles(elTable); this._doApplyTableTemplate(elTable, nhn.husky.SE2M_TableTemplate[nTemplateIdx], false); elTable.setAttribute(this.ATTR_TBL_TEMPLATE, nTemplateIdx); }, _clearAllTableStyles : function(elTable){ elTable.removeAttribute("border"); elTable.removeAttribute("cellPadding"); elTable.removeAttribute("cellSpacing"); elTable.style.padding = ""; elTable.style.border = ""; elTable.style.backgroundColor = ""; elTable.style.color = ""; var aTD = jindo.$$(">TBODY>TR>TD", elTable, {oneTimeOffCache:true}); for(var i = 0, nLen = aTD.length; i < nLen; i++){ aTD[i].style.padding = ""; aTD[i].style.border = ""; aTD[i].style.backgroundColor = ""; aTD[i].style.color = ""; } }, _hideTableTemplate : function(elTable){ if(elTable.getAttribute(this.ATTR_TBL_TEMPLATE)){ this._doApplyTableTemplate(elTable, nhn.husky.SE2M_TableTemplate[this.parseIntOr0(elTable.getAttribute(this.ATTR_TBL_TEMPLATE))], true); } }, _showTableTemplate : function(elTable){ if(elTable.getAttribute(this.ATTR_TBL_TEMPLATE)){ this._doApplyTableTemplate(elTable, nhn.husky.SE2M_TableTemplate[this.parseIntOr0(elTable.getAttribute(this.ATTR_TBL_TEMPLATE))], false); } }, _doApplyTableTemplate : function(elTable, htTableTemplate, bClearStyle){ var htTableProperty = htTableTemplate.htTableProperty; var htTableStyle = htTableTemplate.htTableStyle; var ht1stRowStyle = htTableTemplate.ht1stRowStyle; var ht1stColumnStyle = htTableTemplate.ht1stColumnStyle; var aRowStyle = htTableTemplate.aRowStyle; var elTmp; // replace all TH's with TD's if(htTableProperty){ this._copyAttributesTo(elTable, htTableProperty, bClearStyle); } if(htTableStyle){ this._copyStylesTo(elTable, htTableStyle, bClearStyle); } var aTR = jindo.$$(">TBODY>TR", elTable, {oneTimeOffCache:true}); var nStartRowNum = 0; if(ht1stRowStyle){ var nStartRowNum = 1; for(var ii = 0, nNumCells = aTR[0].childNodes.length; ii < nNumCells; ii++){ elTmp = aTR[0].childNodes[ii]; if(!elTmp.tagName || !elTmp.tagName.match(/^TD|TH$/)){continue;} this._copyStylesTo(elTmp, ht1stRowStyle, bClearStyle); } } var nRowSpan; var elFirstEl; if(ht1stColumnStyle){ // if the style's got a row heading, skip the 1st row. (it was taken care above) var nRowStart = ht1stRowStyle ? 1 : 0; for(var i = nRowStart, nLen = aTR.length; i < nLen;){ elFirstEl = aTR[i].firstChild; nRowSpan = 1; if(elFirstEl && elFirstEl.tagName.match(/^TD|TH$/)){ nRowSpan = parseInt(elFirstEl.getAttribute("rowSpan"), 10) || 1; this._copyStylesTo(elFirstEl, ht1stColumnStyle, bClearStyle); } i += nRowSpan; } } if(aRowStyle){ var nNumStyles = aRowStyle.length; for(var i = nStartRowNum, nLen = aTR.length; i < nLen; i++){ for(var ii = 0, nNumCells = aTR[i].childNodes.length; ii < nNumCells; ii++){ var elTmp = aTR[i].childNodes[ii]; if(!elTmp.tagName || !elTmp.tagName.match(/^TD|TH$/)){continue;} this._copyStylesTo(elTmp, aRowStyle[(i+nStartRowNum)%nNumStyles], bClearStyle); } } } }, _copyAttributesTo : function(oTarget, htProperties, bClearStyle){ var elTmp; for(var x in htProperties){ if(htProperties.hasOwnProperty(x)){ if(bClearStyle){ if(oTarget[x]){ elTmp = document.createElement(oTarget.tagName); elTmp[x] = htProperties[x]; if(elTmp[x] == oTarget[x]){ oTarget.removeAttribute(x); } } }else{ elTmp = document.createElement(oTarget.tagName); elTmp.style[x] = ""; if(!oTarget[x] || oTarget.style[x] == elTmp.style[x]){oTarget.setAttribute(x, htProperties[x]);} } } } }, _copyStylesTo : function(oTarget, htProperties, bClearStyle){ var elTmp; for(var x in htProperties){ if(htProperties.hasOwnProperty(x)){ if(bClearStyle){ if(oTarget.style[x]){ elTmp = document.createElement(oTarget.tagName); elTmp.style[x] = htProperties[x]; if(elTmp.style[x] == oTarget.style[x]){ oTarget.style[x] = ""; } } }else{ elTmp = document.createElement(oTarget.tagName); elTmp.style[x] = ""; if(!oTarget.style[x] || oTarget.style[x] == elTmp.style[x] || x.match(/^border/)){oTarget.style[x] = htProperties[x];} } } } }, _hideResizer : function(){ this.elResizeGrid.style.display = "none"; }, _showResizer : function(){ this.elResizeGrid.style.display = "block"; }, _setResizerSize : function(width, height){ this.elResizeGrid.style.width = width + "px"; this.elResizeGrid.style.height = height + "px"; }, parseBorder : function(vBorder, sBorderStyle){ if(sBorderStyle == "none"){return 0;} var num = parseInt(vBorder, 10); if(isNaN(num)){ if(typeof(vBorder) == "string"){ // IE Bug return 1; /* switch(vBorder){ case "thin": return 1; case "medium": return 3; case "thick": return 5; } */ } } return num; }, parseIntOr0 : function(num){ num = parseInt(num, 10); if(isNaN(num)){return 0;} return num; }, _getTRCloneWithAllTD : function(nRow){ var elResult = this.htMap[0][nRow].parentNode.cloneNode(false); var elCurTD, elCurTDClone; for(var i = 0, nLen = this.htMap.length; i < nLen; i++){ elCurTD = this.htMap[i][nRow]; if(elCurTD.tagName == "TD"){ elCurTDClone = this._shallowCloneTD(elCurTD); elCurTDClone.setAttribute("rowSpan", 1); elCurTDClone.setAttribute("colSpan", 1); elCurTDClone.style.width = ""; elCurTDClone.style.height = ""; elResult.insertBefore(elCurTDClone, null); } } return elResult; }, _shallowCloneTD : function(elTD){ var elResult = elTD.cloneNode(false); elResult.innerHTML = this.sEmptyTDSrc; return elResult; }, // elTbl์ด ๊ฝ‰ ์ฐฌ ์ง์‚ฌ๊ฐํ˜• ํ˜•ํƒœ์˜ ํ…Œ์ด๋ธ”์ธ์ง€ ํ™•์ธ _isValidTable : function(elTbl){ if(!elTbl || !elTbl.tagName || elTbl.tagName != "TABLE"){ return false; } this.htMap = this._getCellMapping(elTbl); var nXSize = this.htMap.length; if(nXSize < 1){return false;} var nYSize = this.htMap[0].length; if(nYSize < 1){return false;} for(var i = 1; i < nXSize; i++){ // ์ฒซ๋ฒˆ์งธ ์—ด๊ณผ ๊ธธ์ด๊ฐ€ ๋‹ค๋ฅธ ์—ด์ด ํ•˜๋‚˜๋ผ๋„ ์žˆ๋‹ค๋ฉด ์ง์‚ฌ๊ฐํ˜•์ด ์•„๋‹˜ if(this.htMap[i].length != nYSize || !this.htMap[i][nYSize - 1]){ return false; } // ๋นˆ์นธ์ด ํ•˜๋‚˜๋ผ๋„ ์žˆ๋‹ค๋ฉด ๊ฝ‰ ์ฐฌ ์ง์‚ฌ๊ฐํ˜•์ด ์•„๋‹˜ for(var j = 0; j < nYSize; j++){ if(!this.htMap[i] || !this.htMap[i][j]){ return false; } } } return true; }, addCSSClass : function(sClassName, sClassRule){ var oDoc = this.oApp.getWYSIWYGDocument(); if(oDoc.styleSheets[0] && oDoc.styleSheets[0].addRule){ // IE oDoc.styleSheets[0].addRule("." + sClassName, sClassRule); }else{ // FF var elHead = oDoc.getElementsByTagName("HEAD")[0]; var elStyle = oDoc.createElement ("STYLE"); //styleElement.type = "text / css"; elHead.appendChild (elStyle); elStyle.sheet.insertRule("." + sClassName + " { "+sClassRule+" }", 0); } } //@lazyload_js] }); /** * @name SE2M_QuickEditor_Common * @class * @description Quick Editor Common function Class * @author NHN AjaxUI Lab - mixed * @version 1.0 * @since 2009.09.29 * */ nhn.husky.SE2M_QuickEditor_Common = jindo.$Class({ /** * class ์ด๋ฆ„ * @type {String} */ name : "SE2M_QuickEditor_Common", /** * ํ™˜๊ฒฝ ์ •๋ณด. * @type {Object} */ _environmentData : "", /** * ํ˜„์žฌ ํƒ€์ž… (table|img) * @type {String} */ _currentType :"", /** * ์ด๋ฒคํŠธ๊ฐ€ ๋ ˆ์ด์–ด ์•ˆ์—์„œ ํ˜ธ์ถœ๋˜์—ˆ๋Š”์ง€ ์•Œ๊ธฐ ์œ„ํ•œ ๋ณ€์ˆ˜ * @type {Boolean} */ _in_event : false, /** * Ajax์ฒ˜๋ฆฌ๋ฅผ ํ•˜์ง€ ์•Š์Œ * @type {Boolean} */ _bUseConfig : true, /** * ๊ณตํ†ต ์„œ๋ฒ„์—์„œ ๊ฐœ์ธ ์„ค์ • ๋ฐ›์•„์˜ค๋Š” AjaxUrl * @See SE2M_Configuration.js */ _sBaseAjaxUrl : "", _sAddTextAjaxUrl : "", /** * ์ดˆ๊ธฐ ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ ์‹คํ–‰๋˜๋Š” ํ•จ์ˆ˜. */ $init : function() { this.waHotkeys = new jindo.$A([]); this.waHotkeyLayers = new jindo.$A([]); }, $ON_MSG_APP_READY : function() { var htConfiguration = nhn.husky.SE2M_Configuration.QuickEditor; if(htConfiguration){ this._bUseConfig = (!!htConfiguration.common && typeof htConfiguration.common.bUseConfig !== "undefined") ? htConfiguration.common.bUseConfig : true; } if(!this._bUseConfig){ this.setData("{table:'full',img:'full',review:'full'}"); } else { this._sBaseAjaxUrl = htConfiguration.common.sBaseAjaxUrl; this._sAddTextAjaxUrl = htConfiguration.common.sAddTextAjaxUrl; this.getData(); } }, //์‚ญ์ œ ์‹œ์— qe layer close $ON_EVENT_EDITING_AREA_KEYDOWN : function(oEvent){ var oKeyInfo = oEvent.key(); //Backspace : 8, Delete :46 if (oKeyInfo.keyCode == 8 || oKeyInfo.keyCode == 46 ) { // [SMARTEDITORSUS-1213][IE9, 10] ์‚ฌ์ง„ ์‚ญ์ œ ํ›„ zindex 1000์ธ div๊ฐ€ ์ž”์กดํ•˜๋Š”๋ฐ, ๊ทธ ์œ„๋กœ ์ธ๋„ค์ผ drag๋ฅผ ์‹œ๋„ํ•˜๋‹ค ๋ณด๋‹ˆ drop์ด ๋ถˆ๊ฐ€๋Šฅ. var htBrowser = jindo.$Agent().navigator(); if(htBrowser.ie && htBrowser.nativeVersion > 8){ var elFirstChild = jindo.$$.getSingle("DIV.husky_seditor_editing_area_container").childNodes[0]; if((elFirstChild.tagName == "DIV") && (elFirstChild.style.zIndex == 1000)){ elFirstChild.parentNode.removeChild(elFirstChild); } } // --[SMARTEDITORSUS-1213] this.oApp.exec("CLOSE_QE_LAYER", [oEvent]); } }, getData : function() { var self = this; jindo.$Ajax(self._sBaseAjaxUrl, { type : "jsonp", timeout : 1, onload: function(rp) { var result = rp.json().result; // [SMARTEDITORSUS-1028][SMARTEDITORSUS-1517] QuickEditor ์„ค์ • API ๊ฐœ์„  //if (!!result && !!result.length) { if (!!result && !!result.text_data) { //self.setData(result[result.length - 1]); self.setData(result.text_data); } else { self.setData("{table:'full',img:'full',review:'full'}"); } // --[SMARTEDITORSUS-1028][SMARTEDITORSUS-1517] }, onerror : function() { self.setData("{table:'full',img:'full',review:'full'}"); }, ontimeout : function() { self.setData("{table:'full',img:'full',review:'full'}"); } }).request({ text_key : "qeditor_fold" }); }, setData : function(sResult){ var oResult = { table : "full", img : "full", review : "full" }; if(sResult){ oResult = eval("("+sResult+")"); } this._environmentData = { table : { isOpen : false, type : oResult["table"],//full,fold, isFixed : false, position : [] }, img : { isOpen : false, type : oResult["img"],//full,fold isFixed : false }, review : { isOpen : false, type : oResult["review"],//full,fold isFixed : false, position : [] } }; this.waTableTagNames =jindo.$A(["table","tbody","td","tfoot","th","thead","tr"]); }, /** * ์œ„์ง€์œ… ์˜์—ญ์— ๋‹จ์ถ•ํ‚ค๊ฐ€ ๋“ฑ๋ก๋  ๋•Œ, * tab ๊ณผ shift+tab (๋“ค์—ฌ์“ฐ๊ธฐ / ๋‚ด์–ด์“ฐ๊ธฐ ) ๋ฅผ ์ œ์™ธํ•œ ๋‹จ์ถ•ํ‚ค ๋ฆฌ์ŠคํŠธ๋ฅผ ์ €์žฅํ•œ๋‹ค. */ $ON_REGISTER_HOTKEY : function(sHotkey, sCMD, aArgs){ if(sHotkey != "tab" && sHotkey != "shift+tab"){ this.waHotkeys.push([sHotkey, sCMD, aArgs]); } }, //@lazyload_js OPEN_QE_LAYER[ $ON_MSG_BEFOREUNLOAD_FIRED : function(){ // [SMARTEDITORSUS-1028][SMARTEDITORSUS-1517] QuickEditor ์„ค์ • API ๊ฐœ์„ ์œผ๋กœ, submit ์ดํ›„ ๋ฐœ์ƒํ•˜๊ฒŒ ๋˜๋Š” beforeunload ์ด๋ฒคํŠธ ํ•ธ๋“ค๋ง ์ œ๊ฑฐ /*if (!this._environmentData || !this._bUseConfig) { return; } jindo.$Ajax(this._sAddTextAjaxUrl,{ type : "jsonp", onload: function(){} }).request({ text_key :"qeditor_fold", text_data : "{table:'"+this._environmentData["table"]["type"]+"',img:'"+this._environmentData["img"]["type"]+"',review:'"+this._environmentData["review"]["type"]+"'}" });*/ // --[SMARTEDITORSUS-1028][SMARTEDITORSUS-1517] }, /** * openType์„ ์ €์žฅํ•˜๋Š” ํ•จ์ˆ˜. * @param {String} sType * @param {Boolean} bBol */ setOpenType : function(sType,bBol){ // [SMARTEDITORSUS-1213] ์ž‘์„ฑ๋œ ์ปจํ…์ธ  ์ˆ˜์ • ํ™”๋ฉด์—์„œ ์‚ฌ์ง„์ด ๋กœ๋“œ๋˜์ž๋งˆ์ž ๋ฐ”๋กœ ์‚ฌ์ง„์„ ํด๋ฆญํ•˜๋ฉด QuickEditor๋ฅผ ๋„์šฐ๋Š” ๋ฐ ๋ฌธ์ œ๊ฐ€ ์žˆ์Œ if(typeof(this._environmentData) == "undefined" || this._environmentData == null){ this._environmentData = {}; } if(typeof(this._environmentData[sType]) == "undefined" || this._environmentData[sType] == null){ this._environmentData[sType] = {}; } if(typeof(this._environmentData[sType].isOpen) == "undefined" || this._environmentData[sType].isOpen == null){ this._environmentData[sType].isOpen = true; } // --[SMARTEDITORSUS-1213] this._environmentData[sType].isOpen = bBol; }, /** * ๋ ˆ์ด์–ด๊ฐ€ ์˜คํ”ˆ ํ•  ๋•Œ ์‹คํ–‰๋˜๋Š” ์ด๋ฒคํŠธ. * ๋ ˆ์ด์–ด๊ฐ€ ์ฒ˜์Œ ๋œฐ ๋•Œ, * ์ €์žฅ๋œ ๋‹จ์ถ•ํ‚ค ๋ฆฌ์ŠคํŠธ๋ฅผ ๋ ˆ์ด์–ด์— ๋“ฑ๋กํ•˜๊ณ  (๋ ˆ์ด์–ด๊ฐ€ ๋–  ์žˆ์„๋•Œ๋„ ๋‹จ์ถ•ํ‚ค๊ฐ€ ๋จน๋„๋ก ํ•˜๊ธฐ ์œ„ํ•ด) * ๋ ˆ์ด์–ด์— ๋Œ€ํ•œ ํ‚ค๋ณด๋“œ/๋งˆ์šฐ์Šค ์ด๋ฒคํŠธ๋ฅผ ๋“ฑ๋กํ•œ๋‹ค. * @param {Element} oEle * @param {Element} oLayer * @param {String} sType(img|table|review) */ $ON_OPEN_QE_LAYER : function(oEle,oLayer,sType){ if(this.waHotkeys.length() > 0 && !this.waHotkeyLayers.has(oLayer)){ this.waHotkeyLayers.push(oLayer); var aParam; for(var i=0, nLen=this.waHotkeys.length(); i<nLen; i++){ aParam = this.waHotkeys.get(i); this.oApp.exec("ADD_HOTKEY", [aParam[0], aParam[1], aParam[2], oLayer]); } } var type = sType;//?sType:"table";//this.get_type(oEle); if(type){ this.targetEle = oEle; this.currentEle = oLayer; this.layer_show(type,oEle); } }, /** * ๋ ˆ์ด์–ด๊ฐ€ ๋‹ซํ˜”์„๋•Œ ์‹คํ–‰๋˜๋Š” ์ด๋ฒคํŠธ. * @param {jindo.$Event} weEvent */ $ON_CLOSE_QE_LAYER : function(weEvent){ if(!this.currentEle){return;} // this.oApp.exec("HIDE_EDITING_AREA_COVER"); // this.oApp.exec("ENABLE_ALL_UI"); this.oApp.exec("CLOSE_SUB_LAYER_QE"); this.layer_hide(weEvent); }, /** * ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์ค€๋น„๋‹จ๊ณ„์ผ๋•Œ ์‹คํ–‰๋˜๋Š” ์ด๋ฒคํŠธ */ $LOCAL_BEFORE_FIRST : function(sMsg) { if (!sMsg.match(/OPEN_QE_LAYER/)) { // (sMsg == "$ON_CLOSE_QE_LAYER" && !this.currentEle) this.oApp.acceptLocalBeforeFirstAgain(this, true); if(sMsg.match(/REGISTER_HOTKEY/)){ return true; } return false; } this.woEditor = jindo.$Element(this.oApp.elEditingAreaContainer); this.woStandard = jindo.$Element(this.oApp.htOptions.elAppContainer).offset(); this._qe_wrap = jindo.$$.getSingle("DIV.quick_wrap", this.oApp.htOptions.elAppContainer); var that = this; new jindo.DragArea(this._qe_wrap, { sClassName : 'q_dragable', bFlowOut : false, nThreshold : 1 }).attach({ beforeDrag : function(oCustomEvent) { oCustomEvent.elFlowOut = oCustomEvent.elArea.parentNode; }, dragStart: function(oCustomEvent){ if(!jindo.$Element(oCustomEvent.elDrag).hasClass('se2_qmax')){ oCustomEvent.elDrag = oCustomEvent.elDrag.parentNode; } that.oApp.exec("SHOW_EDITING_AREA_COVER"); }, dragEnd : function(oCustomEvent){ that.changeFixedMode(); that._in_event = false; //if(that._currentType=="review"||that._currentType=="table"){ // [SMARTEDITORSUS-153] ์ด๋ฏธ์ง€ ํ€ต ์—๋””ํ„ฐ๋„ ๊ฐ™์€ ๋กœ์ง์œผ๋กœ ์ฒ˜๋ฆฌํ•˜๋„๋ก ์ˆ˜์ • var richEle = jindo.$Element(oCustomEvent.elDrag); that._environmentData[that._currentType].position = [richEle.css("top"),richEle.css("left")]; //} that.oApp.exec("HIDE_EDITING_AREA_COVER"); } }); var imgFn = jindo.$Fn(this.toggle,this).bind("img"); var tableFn = jindo.$Fn(this.toggle,this).bind("table"); jindo.$Fn(imgFn,this).attach(jindo.$$.getSingle(".q_open_img_fold", this.oApp.htOptions.elAppContainer),"click"); jindo.$Fn(imgFn,this).attach(jindo.$$.getSingle(".q_open_img_full", this.oApp.htOptions.elAppContainer),"click"); jindo.$Fn(tableFn,this).attach(jindo.$$.getSingle(".q_open_table_fold", this.oApp.htOptions.elAppContainer),"click"); jindo.$Fn(tableFn,this).attach(jindo.$$.getSingle(".q_open_table_full", this.oApp.htOptions.elAppContainer),"click"); }, /** * ๋ ˆ์ด์–ด์˜ ์ตœ๋Œ€ํ™”/์ตœ์†Œํ™”๋ฅผ ํ† ๊ธ€๋ง ํ•˜๋Š” ํ•จ์ˆ˜. * @param {String} sType(table|img) * @param {jindo.$Event} weEvent */ toggle : function(sType,weEvent){ sType = this._currentType; // var oBefore = jindo.$Element(jindo.$$.getSingle("._"+this._environmentData[sType].type,this.currentEle)); // var beforeX = oBefore.css("left"); // var beforeY = oBefore.css("top"); this.oApp.exec("CLOSE_QE_LAYER", [weEvent]); if(this._environmentData[sType].type=="full"){ this._environmentData[sType].type = "fold"; }else{ this._environmentData[sType].type = "full"; } // [SMARTEDITORSUS-1028][SMARTEDITORSUS-1517] QuickEditor ์„ค์ • API ๊ฐœ์„ ์œผ๋กœ, submit ์ดํ›„ ๋ฐœ์ƒํ•˜๊ฒŒ ๋˜๋Š” beforeunload ์ด๋ฒคํŠธ ๋Œ€์‹  ํ˜ธ์ถœ ์‹œ์  ๋ณ€๊ฒฝ // QuickEditor๋ฅผ ์ ‘๊ณ  ํŽผ์น  ๋•Œ๋งˆ๋‹ค API ํ†ต์‹ ์„ ๊ฑฐ์น˜๊ธฐ ๋•Œ๋ฌธ์— submit์ด๋‚˜ beforeunload์— ๊ตฌ์• ๋ฐ›์ง€ ์•Š๊ณ  ์•ˆ์ •์ ์ธ ๋ฐ์ดํ„ฐ ์ €์žฅ ๊ฐ€๋Šฅ if (!this._environmentData || !this._bUseConfig) { return; } jindo.$Ajax(this._sAddTextAjaxUrl,{ type : "jsonp", onload: function(){} }).request({ text_key :"qeditor_fold", text_data : "{table:'"+this._environmentData["table"]["type"]+"',img:'"+this._environmentData["img"]["type"]+"',review:'"+this._environmentData["review"]["type"]+"'}" }); // --[SMARTEDITORSUS-1028][SMARTEDITORSUS-1517] // this.positionCopy(beforeX,beforeY,this._environmentData[sType].type); this.oApp.exec("OPEN_QE_LAYER", [this.targetEle,this.currentEle,sType]); this._in_event = false; weEvent.stop(jindo.$Event.CANCEL_DEFAULT); }, /** * ํ† ๊ธ€๋ง์‹œ ์ „์— ์—˜๋ฆฌ๋จผํŠธ์— ์œ„์น˜๋ฅผ ์นดํ”ผํ•˜๋Š” ํ•จ์ˆ˜. * @param {Number} beforeX * @param {Number} beforeY * @param {Element} sAfterEle */ positionCopy:function(beforeX, beforeY, sAfterEle){ jindo.$Element(jindo.$$.getSingle("._"+sAfterEle,this.currentEle)).css({ top : beforeY, left : beforeX }); }, /** * ๋ ˆ์ด์–ด๋ฅผ ๊ณ ์ •์œผ๋กœ ํ• ๋•Œ ์‹คํ–‰๋˜๋Š” ํ•จ์ˆ˜. */ changeFixedMode : function(){ this._environmentData[this._currentType].isFixed = true; }, /** * ์—๋””ํŒ… ์˜์—ญ์—์„œ keyupํ• ๋•Œ ์‹คํ–‰๋˜๋Š” ํ•จ์ˆ˜. * @param {jindo.$Event} weEvent */ /* $ON_EVENT_EDITING_AREA_KEYUP:function(weEvent){ if(this._currentType&&(!this._in_event)&&this._environmentData[this._currentType].isOpen){ this.oApp.exec("CLOSE_QE_LAYER", [weEvent]); } this._in_event = false; }, */ $ON_HIDE_ACTIVE_LAYER : function(){ this.oApp.exec("CLOSE_QE_LAYER"); }, /** * ์—๋””ํŒ… ์˜์—ญ์—์„œ mousedownํ• ๋•Œ ์‹คํ–‰๋˜๋Š” ํ•จ์ˆ˜. * @param {jindo.$Event} weEvent */ $ON_EVENT_EDITING_AREA_MOUSEDOWN:function(weEvent){ if(this._currentType&&(!this._in_event)&&this._environmentData[this._currentType].isOpen){ this.oApp.exec("CLOSE_QE_LAYER", [weEvent]); } this._in_event = false; }, /** * ์—๋””ํŒ… ์˜์—ญ์—์„œ mousewheelํ• ๋•Œ ์‹คํ–‰๋˜๋Š” ํ•จ์ˆ˜. * @param {jindo.$Event} weEvent */ $ON_EVENT_EDITING_AREA_MOUSEWHEEL:function(weEvent){ if(this._currentType&&(!this._in_event)&&this._environmentData[this._currentType].isOpen){ this.oApp.exec("CLOSE_QE_LAYER", [weEvent]); } this._in_event = false; }, /** * ๋ ˆ์ด์–ด๋ฅผ ๋„์šฐ๋Š”๋ฐ ๋ ˆ์ด์–ด๊ฐ€ table(ํ…œํ”Œ๋ฆฟ),img์ธ์ง€๋ฅผ ํ™•์ธํ•˜์—ฌ id๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜. * @param {Element} oEle * @return {String} layer id */ get_type : function(oEle){ var tagName = oEle.tagName.toLowerCase(); if(this.waTableTagNames.has(tagName)){ return "table"; }else if(tagName=="img"){ return "img"; } }, /** * ํ€ต์—๋””ํ„ฐ์—์„œ keyup์‹œ ์‹คํ–‰๋˜๋Š” ์ด๋ฒคํŠธ */ $ON_QE_IN_KEYUP : function(){ this._in_event = true; }, /** * ํ€ต์—๋””ํ„ฐ์—์„œ mousedown์‹œ ์‹คํ–‰๋˜๋Š” ์ด๋ฒคํŠธ */ $ON_QE_IN_MOUSEDOWN : function(){ this._in_event = true; }, /** * ํ€ต์—๋””ํ„ฐ์—์„œ mousewheel์‹œ ์‹คํ–‰๋˜๋Š” ์ด๋ฒคํŠธ */ $ON_QE_IN_MOUSEWHEEL : function(){ this._in_event = true; }, /** * ๋ ˆ์ด์–ด๋ฅผ ์ˆจ๊ธฐ๋Š” ํ•จ์ˆ˜. * @param {jindo.$Event} weEvent */ layer_hide : function(weEvent){ this.setOpenType(this._currentType,false); jindo.$Element(jindo.$$.getSingle("._"+this._environmentData[this._currentType].type,this.currentEle)).hide(); }, /** * ๋Šฆ๊ฒŒ ์ด๋ฒคํŠธ ๋ฐ”์ธ๋”ฉ ํ•˜๋Š” ํ•จ์ˆ˜. * ๋ ˆ์ด์–ด๊ฐ€ ์ฒ˜์Œ ๋œฐ ๋•Œ ์ด๋ฒคํŠธ๋ฅผ ๋“ฑ๋กํ•œ๋‹ค. */ lazy_common : function(){ this.oApp.registerBrowserEvent(jindo.$(this._qe_wrap), "keyup", "QE_IN_KEYUP"); this.oApp.registerBrowserEvent(jindo.$(this._qe_wrap), "mousedown", "QE_IN_MOUSEDOWN"); this.oApp.registerBrowserEvent(jindo.$(this._qe_wrap), "mousewheel", "QE_IN_MOUSEWHEEL"); this.lazy_common = function(){}; }, /** * ๋ ˆ์ด์–ด๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” ํ•จ์ˆ˜. * @param {String} sType * @param {Element} oEle */ layer_show : function(sType,oEle){ this._currentType = sType; this.setOpenType(this._currentType,true); var layer = jindo.$$.getSingle("._"+this._environmentData[this._currentType].type,this.currentEle); jindo.$Element(layer) .show() .css( this.get_position_layer(oEle , layer) ); this.lazy_common(); }, /** * ๋ ˆ์ด์–ด์˜ ์œ„์น˜๋ฅผ ๋ฐ˜ํ™˜ ํ•˜๋Š” ํ•จ์ˆ˜ * ๊ณ ์ • ์ƒํƒœ๊ฐ€ ์•„๋‹ˆ๊ฑฐ๋‚˜ ์ตœ์†Œํ™” ์ƒํƒœ์ด๋ฉด ์—˜๋ฆฌ๋จผํŠธ ์œ„์น˜์— ํ€ต์—๋””ํ„ฐ๋ฅผ ๋„์šฐ๊ณ  * ๊ณ ์ • ์ƒํƒœ์ด๊ณ  ์ตœ๋Œ€ํ™” ์ƒํƒœ์ด๋ฉด ํ‘œ๋‚˜ ๊ธ€ ์–‘์‹์€ ์ €์žฅ๋œ ์œ„์น˜์— ๋„์›Œ์ฃผ๊ณ , ์ด๋ฏธ์ง€๋Š”...? * @param {Element} oEle * @param {Element} oLayer */ get_position_layer : function(oEle , oLayer){ if(!this.isCurrentFixed() || this._environmentData[this._currentType].type == "fold"){ return this.calculateLayer(oEle , oLayer); } //if(this._currentType == "review" || this._currentType == "table"){ // [SMARTEDITORSUS-153] ์ด๋ฏธ์ง€ ํ€ต ์—๋””ํ„ฐ๋„ ๊ฐ™์€ ๋กœ์ง์œผ๋กœ ์ฒ˜๋ฆฌํ•˜๋„๋ก ์ˆ˜์ • var position = this._environmentData[this._currentType].position; var nTop = parseInt(position[0], 10); var nAppHeight = this.getAppPosition().h; var nLayerHeight = jindo.$Element(oLayer).height(); // [SMARTEDITORSUS-129] ํŽธ์ง‘ ์˜์—ญ ๋†’์ด๋ฅผ ์ค„์˜€์„ ๋•Œ ํ€ต์—๋””ํ„ฐ๊ฐ€ ์˜์—ญ์„ ๋ฒ—์–ด๋‚˜์ง€ ์•Š๋„๋ก ์ฒ˜๋ฆฌ if((nTop + nLayerHeight + this.nYGap) > nAppHeight){ nTop = nAppHeight - nLayerHeight; this._environmentData[this._currentType].position[0] = nTop; } return { top : nTop + "px", left :position[1] }; //} //return this.calculateLayer(null , oLayer); }, /** * ํ˜„์žฌ ๋ ˆ์ด์–ด๊ฐ€ ๊ณ ์ •ํ˜•ํƒœ์ธ์ง€ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜. */ isCurrentFixed : function(){ return this._environmentData[this._currentType].isFixed; }, /** * ๋ ˆ์ด์–ด๋ฅผ ๋„์šธ ์œ„์น˜๋ฅผ ๊ณ„์‚ฐํ•˜๋Š” ํ•จ์ˆ˜. * @param {Element} oEle * @param {Element} oLayer */ calculateLayer : function(oEle, oLayer){ /* * ๊ธฐ์ค€์„ ํ•œ๊ตฐ๋ฐ๋กœ ๋งŒ๋“ค์–ด์•ผ ํ•จ. * 1. ์—๋””ํ„ฐ๋Š” ํŽ˜์ด์ง€ * 2. ์—˜๋ฆฌ๋จผํŠธ๋Š” ์•ˆ์— ์—๋””ํŒ… ์˜์—ญ * 3. ๋ ˆ์ด์–ด๋Š” ์—๋””ํŒ… ์˜์—ญ * * ๊ธฐ์ค€์€ ํŽ˜์ด์ง€๋กœ ํ•จ. */ var positionInfo = this.getPositionInfo(oEle, oLayer); return { top : positionInfo.y + "px", left : positionInfo.x + "px" }; }, /** * ์œ„์น˜๋ฅผ ๋ฐ˜ํ™˜ ํ•˜๋Š” ํ•จ์ˆ˜. * @param {Element} oEle * @param {Element} oLayer */ getPositionInfo : function(oEle, oLayer){ this.nYGap = jindo.$Agent().navigator().ie? -16 : -18; this.nXGap = 1; var oRevisePosition = {}; var eleInfo = this.getElementPosition(oEle, oLayer); var appInfo = this.getAppPosition(); var layerInfo = { w : jindo.$Element(oLayer).width(), h : jindo.$Element(oLayer).height() }; if((eleInfo.x + layerInfo.w + this.nXGap) > appInfo.w){ oRevisePosition.x = appInfo.w - layerInfo.w ; }else{ oRevisePosition.x = eleInfo.x + this.nXGap; } if((eleInfo.y + layerInfo.h + this.nYGap) > appInfo.h){ oRevisePosition.y = appInfo.h - layerInfo.h - 2; }else{ oRevisePosition.y = eleInfo.y + this.nYGap; } return { x : oRevisePosition.x , y : oRevisePosition.y }; }, /** * ๊ธฐ์ค€ ์—˜๋ฆฌ๋จผํŠธ์˜ ์œ„์น˜๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜ * ์—˜๋ฆฌ๋จผํŠธ๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ * @param {Element} eEle */ getElementPosition : function(eEle, oLayer){ var wEle, oOffset, nEleWidth, nEleHeight, nScrollX, nScrollY; if(eEle){ wEle = jindo.$Element(eEle); oOffset = wEle.offset(); nEleWidth = wEle.width(); nEleHeight = wEle.height(); }else{ oOffset = { top : parseInt(oLayer.style.top, 10) - this.nYGap, left : parseInt(oLayer.style.left, 10) - this.nXGap }; nEleWidth = 0; nEleHeight = 0; } var oAppWindow = this.oApp.getWYSIWYGWindow(); if(typeof oAppWindow.scrollX == "undefined"){ nScrollX = oAppWindow.document.documentElement.scrollLeft; nScrollY = oAppWindow.document.documentElement.scrollTop; }else{ nScrollX = oAppWindow.scrollX; nScrollY = oAppWindow.scrollY; } var oEditotOffset = this.woEditor.offset(); return { x : oOffset.left - nScrollX + nEleWidth, y : oOffset.top - nScrollY + nEleHeight }; }, /** * ์—๋””ํ„ฐ์˜ ํฌ๊ธฐ ๊ณ„์‚ฐํ•˜๋Š” ํ•จ์ˆ˜. */ getAppPosition : function(){ return { w : this.woEditor.width(), h : this.woEditor.height() }; } //@lazyload_js] }); //{ /** * @fileOverview This file contains Husky plugin that takes care of the hotkey feature * @name hp_Hotkey.js */ nhn.husky.Hotkey = jindo.$Class({ name : "Hotkey", $init : function(){ this.oShortcut = shortcut; }, $ON_ADD_HOTKEY : function(sHotkey, sCMD, aArgs, elTarget){ if(!aArgs){aArgs = [];} var func = jindo.$Fn(this.oApp.exec, this.oApp).bind(sCMD, aArgs); this.oShortcut(sHotkey, elTarget).addEvent(func); } }); //} /** * @classDescription shortcut * @author AjaxUI Lab - mixed */ function Shortcut(sKey,sId){ var sKey = sKey.replace(/\s+/g,""); var store = Shortcut.Store; var action = Shortcut.Action; if(typeof sId === "undefined"&&sKey.constructor == String){ store.set("document",sKey,document); return action.init(store.get("document"),sKey); }else if(sId.constructor == String&&sKey.constructor == String){ store.set(sId,sKey,jindo.$(sId)); return action.init(store.get(sId),sKey); }else if(sId.constructor != String&&sKey.constructor == String){ var fakeId = "nonID"+new Date().getTime(); fakeId = Shortcut.Store.searchId(fakeId,sId); store.set(fakeId,sKey,sId); return action.init(store.get(fakeId),sKey); } alert(sId+"๋Š” ๋ฐ˜๋“œ์‹œ string์ด๊ฑฐ๋‚˜ ์—†์–ด์•ผ ๋ฉ๋‹ˆ๋‹ค."); }; Shortcut.Store = { anthorKeyHash:{}, datas:{}, currentId:"", currentKey:"", searchId:function(sId,oElement){ jindo.$H(this.datas).forEach(function(oValue,sKey){ if(oElement == oValue.element){ sId = sKey; jindo.$H.Break(); } }); return sId; }, set:function(sId,sKey,oElement){ this.currentId = sId; this.currentKey = sKey; var idData = this.get(sId); this.datas[sId] = idData?idData.createKey(sKey):new Shortcut.Data(sId,sKey,oElement); }, get:function(sId,sKey){ if(sKey){ return this.datas[sId].keys[sKey]; }else{ return this.datas[sId]; } }, reset:function(sId){ var data = this.datas[sId]; Shortcut.Helper.bind(data.func,data.element,"detach"); delete this.datas[sId]; }, allReset: function(){ jindo.$H(this.datas).forEach(jindo.$Fn(function(value,key) { this.reset(key); },this).bind()); } }; Shortcut.Data = jindo.$Class({ $init:function(sId,sKey,oElement){ this.id = sId; this.element = oElement; this.func = jindo.$Fn(this.fire,this).bind(); Shortcut.Helper.bind(this.func,oElement,"attach"); this.keys = {}; this.keyStemp = {}; this.createKey(sKey); }, createKey:function(sKey){ this.keyStemp[Shortcut.Helper.keyInterpretor(sKey)] = sKey; this.keys[sKey] = {}; var data = this.keys[sKey]; data.key = sKey; data.events = []; data.commonExceptions = []; // data.keyAnalysis = Shortcut.Helper.keyInterpretor(sKey); data.stopDefalutBehavior = true; return this; }, getKeyStamp : function(eEvent){ var sKey = eEvent.keyCode || eEvent.charCode; var returnVal = ""; returnVal += eEvent.altKey?"1":"0"; returnVal += eEvent.ctrlKey?"1":"0"; returnVal += eEvent.metaKey?"1":"0"; returnVal += eEvent.shiftKey?"1":"0"; returnVal += sKey; return returnVal; }, fire:function(eEvent){ eEvent = eEvent||window.eEvent; var oMatchKeyData = this.keyStemp[this.getKeyStamp(eEvent)]; if(oMatchKeyData){ this.excute(new jindo.$Event(eEvent),oMatchKeyData); } }, excute:function(weEvent,sRawKey){ var isExcute = true; var staticFun = Shortcut.Helper; var data = this.keys[sRawKey]; if(staticFun.notCommonException(weEvent,data.commonExceptions)){ jindo.$A(data.events).forEach(function(v){ if(data.stopDefalutBehavior){ var leng = v.exceptions.length; if(leng){ for(var i=0;i<leng;i++){ if(!v.exception[i](weEvent)){ isExcute = false; break; } } if(isExcute){ v.event(weEvent); if(jindo.$Agent().navigator().ie){ var e = weEvent._event; e.keyCode = ""; e.charCode = ""; } weEvent.stop(); }else{ jindo.$A.Break(); } }else{ v.event(weEvent); if(jindo.$Agent().navigator().ie){ var e = weEvent._event; e.keyCode = ""; e.charCode = ""; } weEvent.stop(); } } }); } }, addEvent:function(fpEvent,sRawKey){ var events = this.keys[sRawKey].events; if(!Shortcut.Helper.hasEvent(fpEvent,events)){ events.push({ event:fpEvent, exceptions:[] }); }; }, addException:function(fpException,sRawKey){ var commonExceptions = this.keys[sRawKey].commonExceptions; if(!Shortcut.Helper.hasException(fpException,commonExceptions)){ commonExceptions.push(fpException); }; }, removeException:function(fpException,sRawKey){ var commonExceptions = this.keys[sRawKey].commonExceptions; commonExceptions = jindo.$A(commonExceptions).filter(function(exception){ return exception!=fpException; }).$value(); }, removeEvent:function(fpEvent,sRawKey){ var events = this.keys[sRawKey].events; events = jindo.$A(events).filter(function(event) { return event!=fpEvent; }).$value(); this.unRegister(sRawKey); }, unRegister:function(sRawKey){ var aEvents = this.keys[sRawKey].events; if(aEvents.length) delete this.keys[sRawKey]; var hasNotKey = true; for(var i in this.keys){ hasNotKey =false; break; } if(hasNotKey){ Shortcut.Helper.bind(this.func,this.element,"detach"); delete Shortcut.Store.datas[this.id]; } }, startDefalutBehavior: function(sRawKey){ this._setDefalutBehavior(sRawKey,false); }, stopDefalutBehavior: function(sRawKey){ this._setDefalutBehavior(sRawKey,true); }, _setDefalutBehavior: function(sRawKey,bType){ this.keys[sRawKey].stopDefalutBehavior = bType; } }); Shortcut.Helper = { keyInterpretor:function(sKey){ var keyArray = sKey.split("+"); var wKeyArray = jindo.$A(keyArray); var returnVal = ""; returnVal += wKeyArray.has("alt")?"1":"0"; returnVal += wKeyArray.has("ctrl")?"1":"0"; returnVal += wKeyArray.has("meta")?"1":"0"; returnVal += wKeyArray.has("shift")?"1":"0"; var wKeyArray = wKeyArray.filter(function(v){ return !(v=="alt"||v=="ctrl"||v=="meta"||v=="shift") }); var key = wKeyArray.$value()[0]; if(key){ var sKey = Shortcut.Store.anthorKeyHash[key.toUpperCase()]||key.toUpperCase().charCodeAt(0); returnVal += sKey; } return returnVal; }, notCommonException:function(e,exceptions){ var leng = exceptions.length; for(var i=0;i<leng ;i++){ if(!exceptions[i](e)) return false; } return true; }, hasEvent:function(fpEvent,aEvents){ var nLength = aEvents.length; for(var i=0; i<nLength; ++i){ if(aEvents.event==fpEvent){ return true; } }; return false; }, hasException:function(fpException,commonExceptions){ var nLength = commonExceptions.length; for(var i=0; i<nLength; ++i){ if(commonExceptions[i]==fpException){ return true; } }; return false; }, bind:function(wfFunc,oElement,sType){ if(sType=="attach"){ domAttach(oElement,"keydown",wfFunc); }else{ domDetach(oElement,"keydown",wfFunc); } } }; (function domAttach (){ if(document.addEventListener){ window.domAttach = function(dom,ev,fn){ dom.addEventListener(ev, fn, false); } }else{ window.domAttach = function(dom,ev,fn){ dom.attachEvent("on"+ev, fn); } } })(); (function domDetach (){ if(document.removeEventListener){ window.domDetach = function(dom,ev,fn){ dom.removeEventListener(ev, fn, false); } }else{ window.domDetach = function(dom,ev,fn){ dom.detachEvent("on"+ev, fn); } } })(); Shortcut.Action ={ init:function(oData,sRawKey){ this.dataInstance = oData; this.rawKey = sRawKey; return this; }, addEvent:function(fpEvent){ this.dataInstance.addEvent(fpEvent,this.rawKey); return this; }, removeEvent:function(fpEvent){ this.dataInstance.removeEvent(fpEvent,this.rawKey); return this; }, addException : function(fpException){ this.dataInstance.addException(fpException,this.rawKey); return this; }, removeException : function(fpException){ this.dataInstance.removeException(fpException,this.rawKey); return this; }, // addCommonException : function(fpException){ // return this; // }, // removeCommonEexception : function(fpException){ // return this; // }, startDefalutBehavior: function(){ this.dataInstance.startDefalutBehavior(this.rawKey); return this; }, stopDefalutBehavior: function(){ this.dataInstance.stopDefalutBehavior(this.rawKey); return this; }, resetElement: function(){ Shortcut.Store.reset(this.dataInstance.id); return this; }, resetAll: function(){ Shortcut.Store.allReset(); return this; } }; (function (){ Shortcut.Store.anthorKeyHash = { BACKSPACE : 8, TAB : 9, ENTER : 13, ESC : 27, SPACE : 32, PAGEUP : 33, PAGEDOWN : 34, END : 35, HOME : 36, LEFT : 37, UP : 38, RIGHT : 39, DOWN : 40, DEL : 46, COMMA : 188,//(,) PERIOD : 190,//(.) SLASH : 191//(/), }; var hash = Shortcut.Store.anthorKeyHash; for(var i=1 ; i < 13 ; i++){ Shortcut.Store.anthorKeyHash["F"+i] = i+111; } var agent = jindo.$Agent().navigator(); if(agent.ie||agent.safari||agent.chrome){ hash.HYPHEN = 189;//(-) hash.EQUAL = 187;//(=) }else{ hash.HYPHEN = 109; hash.EQUAL = 61; } })(); var shortcut = Shortcut; if(typeof window.nhn=='undefined') window.nhn = {}; /** * @fileOverview This file contains a function that takes care of the draggable layers * @name N_DraggableLayer.js */ nhn.DraggableLayer = jindo.$Class({ $init : function(elLayer, oOptions){ this.elLayer = elLayer; this.setOptions(oOptions); this.elHandle = this.oOptions.elHandle; elLayer.style.display = "block"; elLayer.style.position = "absolute"; elLayer.style.zIndex = "9999"; this.aBasePosition = this.getBaseOffset(elLayer); // "number-ize" the position and set it as inline style. (the position could've been set as "auto" or set by css, not inline style) var nTop = (this.toInt(jindo.$Element(elLayer).offset().top) - this.aBasePosition.top); var nLeft = (this.toInt(jindo.$Element(elLayer).offset().left) - this.aBasePosition.left); var htXY = this._correctXY({x:nLeft, y:nTop}); elLayer.style.top = htXY.y+"px"; elLayer.style.left = htXY.x+"px"; this.$FnMouseDown = jindo.$Fn(jindo.$Fn(this._mousedown, this).bind(elLayer), this); this.$FnMouseMove = jindo.$Fn(jindo.$Fn(this._mousemove, this).bind(elLayer), this); this.$FnMouseUp = jindo.$Fn(jindo.$Fn(this._mouseup, this).bind(elLayer), this); this.$FnMouseDown.attach(this.elHandle, "mousedown"); this.elHandle.ondragstart = new Function('return false'); this.elHandle.onselectstart = new Function('return false'); }, _mousedown : function(elLayer, oEvent){ if(oEvent.element.tagName == "INPUT") return; this.oOptions.fnOnDragStart(); this.MouseOffsetY = (oEvent.pos().clientY-this.toInt(elLayer.style.top)-this.aBasePosition['top']); this.MouseOffsetX = (oEvent.pos().clientX-this.toInt(elLayer.style.left)-this.aBasePosition['left']); this.$FnMouseMove.attach(elLayer.ownerDocument, "mousemove"); this.$FnMouseUp.attach(elLayer.ownerDocument, "mouseup"); this.elHandle.style.cursor = "move"; }, _mousemove : function(elLayer, oEvent){ var nTop = (oEvent.pos().clientY-this.MouseOffsetY-this.aBasePosition['top']); var nLeft = (oEvent.pos().clientX-this.MouseOffsetX-this.aBasePosition['left']); var htXY = this._correctXY({x:nLeft, y:nTop}); elLayer.style.top = htXY.y + "px"; elLayer.style.left = htXY.x + "px"; }, _mouseup : function(elLayer, oEvent){ this.oOptions.fnOnDragEnd(); this.$FnMouseMove.detach(elLayer.ownerDocument, "mousemove"); this.$FnMouseUp.detach(elLayer.ownerDocument, "mouseup"); this.elHandle.style.cursor = ""; }, _correctXY : function(htXY){ var nLeft = htXY.x; var nTop = htXY.y; if(nTop<this.oOptions.nMinY) nTop = this.oOptions.nMinY; if(nTop>this.oOptions.nMaxY) nTop = this.oOptions.nMaxY; if(nLeft<this.oOptions.nMinX) nLeft = this.oOptions.nMinX; if(nLeft>this.oOptions.nMaxX) nLeft = this.oOptions.nMaxX; return {x:nLeft, y:nTop}; }, toInt : function(num){ var result = parseInt(num); return result || 0; }, findNonStatic : function(oEl){ if(!oEl) return null; if(oEl.tagName == "BODY") return oEl; if(jindo.$Element(oEl).css("position").match(/absolute|relative/i)) return oEl; return this.findNonStatic(oEl.offsetParent); }, getBaseOffset : function(oEl){ var oBase = this.findNonStatic(oEl.offsetParent) || oEl.ownerDocument.body; var tmp = jindo.$Element(oBase).offset(); return {top: tmp.top, left: tmp.left}; }, setOptions : function(htOptions){ this.oOptions = htOptions || {}; this.oOptions.bModal = this.oOptions.bModal || false; this.oOptions.elHandle = this.oOptions.elHandle || this.elLayer; this.oOptions.nMinX = this.oOptions.nMinX || -999999; this.oOptions.nMinY = this.oOptions.nMinY || -999999; this.oOptions.nMaxX = this.oOptions.nMaxX || 999999; this.oOptions.nMaxY = this.oOptions.nMaxY || 999999; this.oOptions.fnOnDragStart = this.oOptions.fnOnDragStart || function(){}; this.oOptions.fnOnDragEnd = this.oOptions.fnOnDragEnd || function(){}; } }); /*[ * TOGGLE_ACTIVE_LAYER * * ์•กํ‹ฐ๋ธŒ ๋ ˆ์ด์–ด๊ฐ€ ํ™”๋ฉด์— ๋ณด์ด๋Š” ์—ฌ๋ถ€๋ฅผ ํ† ๊ธ€ ํ•œ๋‹ค. * * oLayer HTMLElement ๋ ˆ์ด์–ด๋กœ ์‚ฌ์šฉํ•  HTML Element * sOnOpenCmd string ํ™”๋ฉด์— ๋ณด์ด๋Š” ๊ฒฝ์šฐ ๋ฐœ์ƒ ํ•  ๋ฉ”์‹œ์ง€(์˜ต์…˜) * aOnOpenParam array sOnOpenCmd์™€ ํ•จ๊ป˜ ๋„˜๊ฒจ์ค„ ํŒŒ๋ผ๋ฏธํ„ฐ(์˜ต์…˜) * sOnCloseCmd string ํ•ด๋‹น ๋ ˆ์ด์–ด๊ฐ€ ํ™”๋ฉด์—์„œ ์ˆจ๊ฒจ์งˆ ๋•Œ ๋ฐœ์ƒ ํ•  ๋ฉ”์‹œ์ง€(์˜ต์…˜) * aOnCloseParam array sOnCloseCmd์™€ ํ•จ๊ป˜ ๋„˜๊ฒจ์ค„ ํŒŒ๋ผ๋ฏธํ„ฐ(์˜ต์…˜) * ---------------------------------------------------------------------------]*/ /*[ * SHOW_ACTIVE_LAYER * * ์•กํ‹ฐ๋ธŒ ๋ ˆ์ด์–ด๊ฐ€ ํ™”๋ฉด์— ๋ณด์ด๋Š” ์—ฌ๋ถ€๋ฅผ ํ† ๊ธ€ ํ•œ๋‹ค. * * oLayer HTMLElement ๋ ˆ์ด์–ด๋กœ ์‚ฌ์šฉํ•  HTML Element * sOnCloseCmd string ํ•ด๋‹น ๋ ˆ์ด์–ด๊ฐ€ ํ™”๋ฉด์—์„œ ์ˆจ๊ฒจ์งˆ ๋•Œ ๋ฐœ์ƒ ํ•  ๋ฉ”์‹œ์ง€(์˜ต์…˜) * aOnCloseParam array sOnCloseCmd์™€ ํ•จ๊ป˜ ๋„˜๊ฒจ์ค„ ํŒŒ๋ผ๋ฏธํ„ฐ(์˜ต์…˜) * ---------------------------------------------------------------------------]*/ /*[ * HIDE_ACTIVE_LAYER * * ํ˜„์žฌ ํ™”๋ฉด์— ๋ณด์ด๋Š” ์•กํ‹ฐ๋ธŒ ๋ ˆ์ด์–ด๋ฅผ ํ™”๋ฉด์—์„œ ์ˆจ๊ธด๋‹ค. * * none * ---------------------------------------------------------------------------]*/ /** * @pluginDesc ํ•œ๋ฒˆ์— ํ•œ๊ฐœ๋งŒ ํ™”๋ฉด์— ๋ณด์—ฌ์•ผ ํ•˜๋Š” ๋ ˆ์ด์–ด๋ฅผ ๊ด€๋ฆฌํ•˜๋Š” ํ”Œ๋Ÿฌ๊ทธ์ธ */ nhn.husky.ActiveLayerManager = jindo.$Class({ name : "ActiveLayerManager", oCurrentLayer : null, $BEFORE_MSG_APP_READY : function() { this.oNavigator = jindo.$Agent().navigator(); }, $ON_TOGGLE_ACTIVE_LAYER : function(oLayer, sOnOpenCmd, aOnOpenParam, sOnCloseCmd, aOnCloseParam){ if(oLayer == this.oCurrentLayer){ this.oApp.exec("HIDE_ACTIVE_LAYER", []); }else{ this.oApp.exec("SHOW_ACTIVE_LAYER", [oLayer, sOnCloseCmd, aOnCloseParam]); if(sOnOpenCmd){this.oApp.exec(sOnOpenCmd, aOnOpenParam);} } }, $ON_SHOW_ACTIVE_LAYER : function(oLayer, sOnCloseCmd, aOnCloseParam){ oLayer = jindo.$(oLayer); var oPrevLayer = this.oCurrentLayer; if(oLayer == oPrevLayer){return;} this.oApp.exec("HIDE_ACTIVE_LAYER", []); this.sOnCloseCmd = sOnCloseCmd; this.aOnCloseParam = aOnCloseParam; oLayer.style.display = "block"; this.oCurrentLayer = oLayer; this.oApp.exec("ADD_APP_PROPERTY", ["oToolBarLayer", this.oCurrentLayer]); }, $ON_HIDE_ACTIVE_LAYER : function(){ var oLayer = this.oCurrentLayer; if(!oLayer){return;} oLayer.style.display = "none"; this.oCurrentLayer = null; if(this.sOnCloseCmd){ this.oApp.exec(this.sOnCloseCmd, this.aOnCloseParam); } if(!!this.oNavigator.msafari){ this.oApp.getWYSIWYGWindow().focus(); } }, $ON_HIDE_ACTIVE_LAYER_IF_NOT_CHILD : function(el){ var elTmp = el; while(elTmp){ if(elTmp == this.oCurrentLayer){ return; } elTmp = elTmp.parentNode; } this.oApp.exec("HIDE_ACTIVE_LAYER"); }, // for backward compatibility only. // use HIDE_ACTIVE_LAYER instead! $ON_HIDE_CURRENT_ACTIVE_LAYER : function(){ this.oApp.exec("HIDE_ACTIVE_LAYER", []); } }); /*[ * SHOW_DIALOG_LAYER * * ๋‹ค์ด์–ผ๋กœ๊ทธ ๋ ˆ์ด์–ด๋ฅผ ํ™”๋ฉด์— ๋ณด์—ฌ์ค€๋‹ค. * * oLayer HTMLElement ๋‹ค์ด์–ผ๋กœ๊ทธ ๋ ˆ์ด์–ด๋กœ ์‚ฌ์šฉ ํ•  HTML ์—˜๋ฆฌ๋จผํŠธ * ---------------------------------------------------------------------------]*/ /*[ * HIDE_DIALOG_LAYER * * ๋‹ค์ด์–ผ๋กœ๊ทธ ๋ ˆ์ด์–ด๋ฅผ ํ™”๋ฉด์— ์ˆจ๊ธด๋‹ค. * * oLayer HTMLElement ์ˆจ๊ธธ ๋‹ค์ด์–ผ๋กœ๊ทธ ๋ ˆ์ด์–ด์— ํ•ด๋‹น ํ•˜๋Š” HTML ์—˜๋ฆฌ๋จผํŠธ * ---------------------------------------------------------------------------]*/ /*[ * HIDE_LAST_DIALOG_LAYER * * ๋งˆ์ง€๋ง‰์œผ๋กœ ํ™”๋ฉด์— ํ‘œ์‹œํ•œ ๋‹ค์ด์–ผ๋กœ๊ทธ ๋ ˆ์ด์–ด๋ฅผ ์ˆจ๊ธด๋‹ค. * * none * ---------------------------------------------------------------------------]*/ /*[ * HIDE_ALL_DIALOG_LAYER * * ํ‘œ์‹œ ์ค‘์ธ ๋ชจ๋“  ๋‹ค์ด์–ผ๋กœ๊ทธ ๋ ˆ์ด์–ด๋ฅผ ์ˆจ๊ธด๋‹ค. * * none * ---------------------------------------------------------------------------]*/ /** * @pluginDesc ๋“œ๋ž˜๊ทธ๊ฐ€ ๊ฐ€๋Šฅํ•œ ๋ ˆ์ด์–ด๋ฅผ ์ปจํŠธ๋กค ํ•˜๋Š” ํ”Œ๋Ÿฌ๊ทธ์ธ */ nhn.husky.DialogLayerManager = jindo.$Class({ name : "DialogLayerManager", aMadeDraggable : null, aOpenedLayers : null, $init : function(){ this.aMadeDraggable = []; this.aDraggableLayer = []; this.aOpenedLayers = []; }, $BEFORE_MSG_APP_READY : function() { this.oNavigator = jindo.$Agent().navigator(); }, //@lazyload_js SHOW_DIALOG_LAYER,TOGGLE_DIALOG_LAYER:N_DraggableLayer.js[ $ON_SHOW_DIALOG_LAYER : function(elLayer, htOptions){ elLayer = jindo.$(elLayer); htOptions = htOptions || {}; if(!elLayer){return;} if(jindo.$A(this.aOpenedLayers).has(elLayer)){return;} this.oApp.exec("POSITION_DIALOG_LAYER", [elLayer]); this.aOpenedLayers[this.aOpenedLayers.length] = elLayer; var oDraggableLayer; var nIdx = jindo.$A(this.aMadeDraggable).indexOf(elLayer); if(nIdx == -1){ oDraggableLayer = new nhn.DraggableLayer(elLayer, htOptions); this.aMadeDraggable[this.aMadeDraggable.length] = elLayer; this.aDraggableLayer[this.aDraggableLayer.length] = oDraggableLayer; }else{ if(htOptions){ oDraggableLayer = this.aDraggableLayer[nIdx]; oDraggableLayer.setOptions(htOptions); } elLayer.style.display = "block"; } if(htOptions.sOnShowMsg){ this.oApp.exec(htOptions.sOnShowMsg, htOptions.sOnShowParam); } }, $ON_HIDE_LAST_DIALOG_LAYER : function(){ this.oApp.exec("HIDE_DIALOG_LAYER", [this.aOpenedLayers[this.aOpenedLayers.length-1]]); }, $ON_HIDE_ALL_DIALOG_LAYER : function(){ for(var i=this.aOpenedLayers.length-1; i>=0; i--){ this.oApp.exec("HIDE_DIALOG_LAYER", [this.aOpenedLayers[i]]); } }, $ON_HIDE_DIALOG_LAYER : function(elLayer){ elLayer = jindo.$(elLayer); if(elLayer){elLayer.style.display = "none";} this.aOpenedLayers = jindo.$A(this.aOpenedLayers).refuse(elLayer).$value(); if(!!this.oNavigator.msafari){ this.oApp.getWYSIWYGWindow().focus(); } }, $ON_TOGGLE_DIALOG_LAYER : function(elLayer, htOptions){ if(jindo.$A(this.aOpenedLayers).indexOf(elLayer)){ this.oApp.exec("SHOW_DIALOG_LAYER", [elLayer, htOptions]); }else{ this.oApp.exec("HIDE_DIALOG_LAYER", [elLayer]); } }, $ON_SET_DIALOG_LAYER_POSITION : function(elLayer, nTop, nLeft){ elLayer.style.top = nTop; elLayer.style.left = nLeft; } //@lazyload_js] }); //{ /** * @fileOverview This file contains * @name hp_LazyLoader.js */ nhn.husky.LazyLoader = jindo.$Class({ name : "LazyLoader", // sMsg : KEY // contains htLoadingInfo : {} htMsgInfo : null, // contains objects // sURL : HTML to be loaded // elTarget : where to append the HTML // sSuccessCallback : message name // sFailureCallback : message name // nLoadingStatus : // 0 : loading not started // 1 : loading started // 2 : loading ended aLoadingInfo : null, // aToDo : [{aMsgs: ["EXECCOMMAND"], sURL: "http://127.0.0.1/html_snippet.txt", elTarget: elPlaceHolder}, ...] $init : function(aToDo){ this.htMsgInfo = {}; this.aLoadingInfo = []; this.aToDo = aToDo; }, $ON_MSG_APP_READY : function(){ for(var i=0; i<this.aToDo.length; i++){ var htToDoDetail = this.aToDo[i]; this._createBeforeHandlersAndSaveURLInfo(htToDoDetail.oMsgs, htToDoDetail.sURL, htToDoDetail.elTarget, htToDoDetail.htOptions); } }, $LOCAL_BEFORE_ALL : function(sMsgHandler, aParams){ var sMsg = sMsgHandler.replace("$BEFORE_", ""); var htCurMsgInfo = this.htMsgInfo[sMsg]; // ignore current message if(htCurMsgInfo.nLoadingStatus == 1){return true;} // the HTML was loaded before(probably by another message), remove the loading handler and re-send the message if(htCurMsgInfo.nLoadingStatus == 2){ this[sMsgHandler] = function(){ this._removeHandler(sMsgHandler); this.oApp.delayedExec(sMsg, aParams, 0); return false; }; return true; } htCurMsgInfo.bLoadingStatus = 1; (new jindo.$Ajax(htCurMsgInfo.sURL, { onload : jindo.$Fn(this._onload, this).bind(sMsg, aParams) })).request(); return true; }, _onload : function(sMsg, aParams, oResponse){ if(oResponse._response.readyState == 4) { this.htMsgInfo[sMsg].elTarget.innerHTML = oResponse.text(); this.htMsgInfo[sMsg].nLoadingStatus = 2; this._removeHandler("$BEFORE_"+sMsg); this.oApp.exec("sMsg", aParams); }else{ this.oApp.exec(this.htMsgInfo[sMsg].sFailureCallback, []); } }, _removeHandler : function(sMsgHandler){ delete this[sMsgHandler]; this.oApp.createMessageMap(sMsgHandler); }, _createBeforeHandlersAndSaveURLInfo : function(oMsgs, sURL, elTarget, htOptions){ htOptions = htOptions || {}; var htNewInfo = { sURL : sURL, elTarget : elTarget, sSuccessCallback : htOptions.sSuccessCallback, sFailureCallback : htOptions.sFailureCallback, nLoadingStatus : 0 }; this.aLoadingInfo[this.aLoadingInfo.legnth] = htNewInfo; // extract msgs if plugin is given if(!(oMsgs instanceof Array)){ var oPlugin = oMsgs; oMsgs = []; var htMsgAdded = {}; for(var sFunctionName in oPlugin){ if(sFunctionName.match(/^\$(BEFORE|ON|AFTER)_(.+)$/)){ var sMsg = RegExp.$2; if(sMsg == "MSG_APP_READY"){continue;} if(!htMsgAdded[sMsg]){ oMsgs[oMsgs.length] = RegExp.$2; htMsgAdded[sMsg] = true; } } } } for(var i=0; i<oMsgs.length; i++){ // create HTML loading handler var sTmpMsg = "$BEFORE_"+oMsgs[i]; this[sTmpMsg] = function(){return false;}; this.oApp.createMessageMap(sTmpMsg); // add loading info this.htMsgInfo[oMsgs[i]] = htNewInfo; } } }); //} //{ /** * @fileOverview This file contains Husky plugin that maps a message code to the actual message * @name hp_MessageManager.js */ nhn.husky.MessageManager = jindo.$Class({ name : "MessageManager", oMessageMap : null, sLocale : "ko_KR", $init : function(oMessageMap, sLocale){ switch(sLocale) { case "ja_JP" : this.oMessageMap = oMessageMap_ja_JP; break; case "en_US" : this.oMessageMap = oMessageMap_en_US; break; case "zh_CN" : this.oMessageMap = oMessageMap_zh_CN; break; default : // Korean this.oMessageMap = oMessageMap; break; } }, $BEFORE_MSG_APP_READY : function(){ this.oApp.exec("ADD_APP_PROPERTY", ["$MSG", jindo.$Fn(this.getMessage, this).bind()]); }, getMessage : function(sMsg){ if(this.oMessageMap[sMsg]){return unescape(this.oMessageMap[sMsg]);} return sMsg; } }); //} /** * @name nhn.husky.PopUpManager * @namespace * @description ํŒ์—… ๋งค๋‹ˆ์ € ํด๋ž˜์Šค. * <dt><strong>Spec Code</strong></dt> * <dd><a href="http://ajaxui.nhndesign.com/svnview/SmartEditor2_Official/tags/SE2M_popupManager/0.1/test/spec/hp_popupManager_spec.html" target="_new">Spec</a></dd> * <dt><strong>wiki</strong></dt> * <dd><a href="http://wikin.nhncorp.com/pages/viewpage.action?pageId=63501152" target="_new">wiki</a></dd> * @author NHN AjaxUI Lab - sung jong min * @version 0.1 * @since 2009.07.06 */ nhn.husky.PopUpManager = {}; /** * @ignore */ nhn.husky.PopUpManager._instance = null; /** * @ignore */ nhn.husky.PopUpManager._pluginKeyCnt = 0; /** * @description ํŒ์—… ๋งค๋‹ˆ์ € ์ธ์Šคํ„ด์Šค ํ˜ธ์ถœ ๋ฉ”์†Œ๋“œ, nhn.husky js framework ๊ธฐ๋ฐ˜ ์ฝ”๋“œ * @public * @param {Object} oApp ํ—ˆ์Šคํ‚ค ์ฝ”์–ด ๊ฐ์ฒด๋ฅผ ๋„˜๊ฒจ์ค€๋‹ค.(this.oApp) * @return {Object} nhn.husky.PopUpManager Instance * @example ํŒ์—…๊ด€๋ จ ํ”Œ๋Ÿฌ๊ทธ์ธ ์ œ์ž‘ ์˜ˆ์ œ * nhn.husky.NewPlugin = function(){ * this.$ON_APP_READY = function(){ * // ํŒ์—… ๋งค๋‹ˆ์ € getInstance ๋ฉ”์†Œ๋“œ๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค. * // ํ—ˆ์Šคํ‚ค ์ฝ”์–ด์˜ ์ฐธ์กฐ๊ฐ’์„ ๋„˜๊ฒจ์ค€๋‹ค(this.oApp) * this.oPopupMgr = nhn.husky.PopUpMaganer.getInstance(this.oApp); * }; * * // ํŒ์—…์„ ์š”์ฒญํ•˜๋Š” ๋ฉ”์‹œ์ง€ ๋ฉ”์†Œ๋“œ๋Š” ์•„๋ž˜์™€ ๊ฐ™์Œ * this.$ON_NEWPLUGIN_OPEN_WINDOW = function(){ * var oWinOp = { * oApp : this.oApp, // oApp this.oApp ํ—ˆ์Šคํ‚ค ์ฐธ์กฐ๊ฐ’ * sUrl : "", // sUrl : ํŽ˜์ด์ง€ URL * sName : "", // sName : ํŽ˜์ด์ง€ name * nWidth : 400, * nHeight : 400, * bScroll : true * } * this.oPopUpMgr.openWindow(oWinOp); * }; * * // ํŒ์—…ํŽ˜์ด์ง€ ์‘๋‹ต๋ฐ์ดํƒ€ ๋ฐ˜ํ™˜ ๋ฉ”์‹œ์ง€ ๋ฉ”์†Œ๋“œ๋ฅผ ์ •์˜ํ•จ. * // ๊ฐ ํ”Œ๋Ÿฌ๊ทธ์ธ ํŒ์—…ํŽ˜์ด์ง€์—์„œ ํ•ด๋‹น ๋ฉ”์‹œ์ง€์™€ ๋ฐ์ดํƒ€๋ฅผ ๋„˜๊ธฐ๊ฒŒ ๋จ. * this.@ON_NEWPLUGIN_WINDOW_CALLBACK = function(){ * // ํŒ์—…ํŽ˜์ด์ง€๋ณ„๋กœ ์ •์˜๋œ ํ˜•ํƒœ์˜ ์•„๊ทœ๋จผํŠธ ๋ฐ์ดํƒ€๊ฐ€ ๋„˜์–ด์˜ค๋ฉด ์ฒ˜๋ฆฌํ•œ๋‹ค. * } * } * @example ํŒ์—… ํŽ˜์ด์ง€์™€ opener ํ˜ธ์ถœ ์ธํ„ฐํŽ˜์ด์Šค ์˜ˆ์ œ * onclick์‹œ * "nhn.husky.PopUpManager.setCallback(window, "NEWPLUGIN_WINDOW_CALLBACK", oData);" * ํ˜•ํƒœ๋กœ ํ˜ธ์ถœํ•จ. * * */ nhn.husky.PopUpManager.getInstance = function(oApp) { if (this._instance==null) { this._instance = new (function(){ this._whtPluginWin = new jindo.$H(); this._whtPlugin = new jindo.$H(); this.addPlugin = function(sKey, vValue){ this._whtPlugin.add(sKey, vValue); }; this.getPlugin = function() { return this._whtPlugin; }; this.getPluginWin = function() { return this._whtPluginWin; }; this.openWindow = function(oWinOpt) { var op= { oApp : null, sUrl : "", sName : "popup", sLeft : null, sTop : null, nWidth : 400, nHeight : 400, sProperties : null, bScroll : true }; for(var i in oWinOpt) op[i] = oWinOpt[i]; if(op.oApp == null) { alert("ํŒ์—… ์š”์ฒญ์‹œ ์˜ต์…˜์œผ๋กœ oApp(ํ—ˆ์Šคํ‚ค reference) ๊ฐ’์„ ์„ค์ •ํ•˜์…”์•ผ ํ•ฉ๋‹ˆ๋‹ค."); } var left = op.sLeft || (screen.availWidth-op.nWidth)/2; var top = op.sTop ||(screen.availHeight-op.nHeight)/2; var sProperties = op.sProperties != null ? op.sProperties : "top="+ top +",left="+ left +",width="+op.nWidth+",height="+op.nHeight+",scrollbars="+(op.bScroll?"yes":"no")+",status=yes"; var win = window.open(op.sUrl, op.sName,sProperties); if (!!win) { setTimeout( function(){ try{win.focus();}catch(e){} }, 100); } this.removePluginWin(win); this._whtPluginWin.add(this.getCorrectKey(this._whtPlugin, op.oApp), win); return win; }; this.getCorrectKey = function(whtData, oCompare) { var key = null; whtData.forEach(function(v,k){ if (v == oCompare) { key = k; return; } }); return key; }; this.removePluginWin = function(vValue) { var list = this._whtPluginWin.search(vValue); if (list) { this._whtPluginWin.remove(list); this.removePluginWin(vValue); } } })(); } this._instance.addPlugin("plugin_" + (this._pluginKeyCnt++), oApp); return nhn.husky.PopUpManager._instance; }; /** * @description opener ์—ฐ๋™ interface * @public * @param {Object} oOpenWin ํŒ์—… ํŽ˜์ด์ง€์˜ window ๊ฐ์ฒด * @param {Object} sMsg ํ”Œ๋Ÿฌ๊ทธ์ธ ๋ฉ”์‹œ์ง€๋ช… * @param {Object} oData ์‘๋‹ต ๋ฐ์ดํƒ€ */ nhn.husky.PopUpManager.setCallback = function(oOpenWin, sMsg, oData) { if (this._instance.getPluginWin().hasValue(oOpenWin)) { var key = this._instance.getCorrectKey(this._instance.getPluginWin(), oOpenWin); if (key) { this._instance.getPlugin().$(key).exec(sMsg, oData); } } }; /** * @description opener์— ํ—ˆ์Šคํ‚ค ํ•จ์ˆ˜๋ฅผ ์‹คํ–‰์‹œํ‚ค๊ณ  ๋ฐ์ดํ„ฐ ๊ฐ’์„ ๋ฆฌํ„ด ๋ฐ›์Œ. * @param */ nhn.husky.PopUpManager.getFunc = function(oOpenWin, sFunc) { if (this._instance.getPluginWin().hasValue(oOpenWin)) { var key = this._instance.getCorrectKey(this._instance.getPluginWin(), oOpenWin); if (key) { return this._instance.getPlugin().$(key)[sFunc](); } } }; nhn.husky.SE2M_ImgSizeRatioKeeper = jindo.$Class({ name : "SE2M_ImgSizeRatioKeeper", $init : function(elAppContainer){ this.elAppContainer = elAppContainer; }, $LOCAL_BEFORE_FIRST : function(){ this.wfnResizeEnd = jindo.$Fn(this._onResizeEnd, this); this.bIE = jindo.$Agent().navigator().ie; this.elCheckImgAutoAdjust = jindo.$$.getSingle(".se2_srate", this.elAppContainer); if(!this.bIE){ this.$ON_EVENT_EDITING_AREA_KEYDOWN = undefined; this.$ON_EVENT_EDITING_AREA_MOUSEUP = undefined; } }, $ON_EVENT_EDITING_AREA_KEYDOWN : function(){ this._detachResizeEnd(); }, $ON_EVENT_EDITING_AREA_MOUSEUP : function(wev){ this._detachResizeEnd(); if(!wev.element || wev.element.tagName != "IMG"){return;} this.oApp.exec("SET_RESIZE_TARGET_IMG", [wev.element]); }, $ON_SET_RESIZE_TARGET_IMG : function(elImg){ if(elImg == this.elImg){return;} this._detachResizeEnd(); this._attachResizeEnd(elImg); }, _attachResizeEnd : function(elImg){ this.elImg = elImg; this.wfnResizeEnd.attach(this.elImg, "resizeend"); this.elBorderSize = (elImg.border || 0); this.nWidth = this.elImg.clientWidth ; this.nHeight = this.elImg.clientHeight ; }, _detachResizeEnd : function(){ if(!this.elImg){return;} this.wfnResizeEnd.detach(this.elImg, "resizeend"); this.elImg = null; }, _onResizeEnd : function(wev){ if(wev.element != this.elImg){return;} var nRatio, nAfterWidth, nAfterheight, nWidthDiff, nHeightDiff, nborder; nborder = this.elImg.border || 0; nAfterWidth = this.elImg.clientWidth - (nborder*2); nAfterheight = this.elImg.clientHeight - (nborder*2); if(this.elCheckImgAutoAdjust.checked){ nWidthDiff = nAfterWidth - this.nWidth; //๋ฏธ์„ธํ•œ ์ฐจ์ด์— ํฌ๊ธฐ ๋ณ€ํ™”๋Š” ๋ฌด์‹œ. if( -1 <= nWidthDiff && nWidthDiff <= 1){ nRatio = this.nWidth/this.nHeight; nAfterWidth = nRatio * nAfterheight; }else{ nRatio = this.nHeight/this.nWidth; nAfterheight = nRatio * nAfterWidth; } } this.elImg.style.width = nAfterWidth + "px"; this.elImg.style.height = nAfterheight + "px"; this.elImg.setAttribute("width", nAfterWidth ); this.elImg.setAttribute("height", nAfterheight); // [SMARTEDITORSUS-299] ๋งˆ์šฐ์Šค Drag๋กœ ์ด๋ฏธ์ง€ ํฌ๊ธฐ ๋ฆฌ์‚ฌ์ด์ฆˆ ์‹œ, ์‚ฝ์ž…ํ•  ๋•Œ์˜ ์ €์žฅ ์‚ฌ์ด์ฆˆ(rwidth/rheight)๋„ ๋ณ€๊ฒฝํ•ด ์คŒ this.elImg.style.rwidth = this.elImg.style.width; this.elImg.style.rheight = this.elImg.style.height; this.elImg.setAttribute("rwidth", this.elImg.getAttribute("width")); this.elImg.setAttribute("rheight", this.elImg.getAttribute("height")); // ์•„๋ž˜์˜ ๋ถ€๋ถ„์€ ์ถ”ํ›„ hp_SE2M_ImgSizeAdjustUtil.js ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ๋ถ„๋ฆฌํ•œ๋‹ค. var bAdjustpossible = this._isAdjustPossible(this.elImg.offsetWidth); if(!bAdjustpossible){ this.elImg.style.width = this.nWidth; this.elImg.style.height = this.nHeight; this.elImg.style.rwidth = this.elImg.style.width; this.elImg.style.rheight = this.elImg.style.height; this.elImg.setAttribute("width", this.nWidth); this.elImg.setAttribute("height", this.nHeight); this.elImg.setAttribute("rwidth", this.elImg.getAttribute("width")); this.elImg.setAttribute("rheight", this.elImg.getAttribute("height")); } this.oApp.delayedExec("SET_RESIZE_TARGET_IMG", [this.elImg], 0); }, _isAdjustPossible : function(width){ var bPossible = true; // ๊ฐ€๋กœํญ ์ ์šฉํ•˜๋Š” ๊ฒฝ์šฐ์—๋งŒ ์—๋””ํ„ฐ ๋ณธ๋ฌธ ์•ˆ์— ๋ณด์ด๋Š” ์ด๋ฏธ์ง€ ์‚ฌ์ด์ฆˆ๋ฅผ ์กฐ์ ˆํ•จ var bRulerUse = (this.oApp.htOptions['SE2M_EditingAreaRuler']) ? this.oApp.htOptions['SE2M_EditingAreaRuler'].bUse : false; if(bRulerUse){ var welWysiwygBody = jindo.$Element(this.oApp.getWYSIWYGDocument().body); if(welWysiwygBody){ var nEditorWidth = welWysiwygBody.width(); if(width > nEditorWidth){ bPossible = false; alert(this.oApp.$MSG("SE2M_ImgSizeRatioKeeper.exceedMaxWidth").replace("#EditorWidth#", nEditorWidth)); } } } return bPossible; } }); if(typeof window.nhn == 'undefined') { window.nhn = {}; } if(!nhn.husky) { nhn.husky = {}; } nhn.husky.SE2M_UtilPlugin = jindo.$Class({ name : "SE2M_UtilPlugin", $BEFORE_MSG_APP_READY : function(){ this.oApp.exec("ADD_APP_PROPERTY", ["oAgent", jindo.$Agent()]); this.oApp.exec("ADD_APP_PROPERTY", ["oNavigator", jindo.$Agent().navigator()]); this.oApp.exec("ADD_APP_PROPERTY", ["oUtils", this]); }, $ON_REGISTER_HOTKEY : function(sHotkey, sCMD, aArgs, elTarget) { this.oApp.exec("ADD_HOTKEY", [sHotkey, sCMD, aArgs, (elTarget || this.oApp.getWYSIWYGDocument())]); }, $ON_SE2_ATTACH_HOVER_EVENTS : function(aElms){ this.oApp.exec("ATTACH_HOVER_EVENTS", [aElms, {fnElmToSrc: this._elm2Src, fnElmToTarget: this._elm2Target}]); }, _elm2Src : function(el){ if(el.tagName == "LI" && el.firstChild && el.firstChild.tagName == "BUTTON"){ return el.firstChild; }else{ return el; } }, _elm2Target : function(el){ if(el.tagName == "BUTTON" && el.parentNode.tagName == "LI"){ return el.parentNode; }else{ return el; } }, getScrollXY : function(){ var scrollX,scrollY; var oAppWindow = this.oApp.getWYSIWYGWindow(); if(typeof oAppWindow.scrollX == "undefined"){ scrollX = oAppWindow.document.documentElement.scrollLeft; scrollY = oAppWindow.document.documentElement.scrollTop; }else{ scrollX = oAppWindow.scrollX; scrollY = oAppWindow.scrollY; } return {x:scrollX, y:scrollY}; } }); nhn.husky.SE2M_Utils = { sURLPattern : '(http|https|ftp|mailto):(?:\\/\\/)?((:?\\w|-)+(:?\\.(:?\\w|-)+)+)([^ <>]+)?', /** * ์‚ฌ์šฉ์ž ํด๋ž˜์Šค ์ •๋ณด๋ฅผ ์ถ”์ถœํ•œ๋‹ค. * @param {String} sStr ์ถ”์ถœ String * @param {rx} rxValue rx type ํ˜•์‹์˜ ๊ฐ’ * @param {String} sDivision value์˜ split ํ˜•์‹ * @return {Array} */ getCustomCSS : function(sStr, rxValue, sDivision) { var ret = []; if('undefined' == typeof(sStr) || 'undefined' == typeof(rxValue) || !sStr || !rxValue) { return ret; } var aMatch = sStr.match(rxValue); if(aMatch && aMatch[0]&&aMatch[1]) { if(sDivision) { ret = aMatch[1].split(sDivision); } else { ret[0] = aMatch[1]; } } return ret; }, /** * HashTable๋กœ ๊ตฌ์„ฑ๋œ Array์˜ ๊ฐ™์€ ํ”„๋กœํผํ‹ฐ๋ฅผ sSeperator ๋กœ ๊ตฌ๋ถ„๋œ String ๊ฐ’์œผ๋กœ ๋ณ€ํ™˜ * @param {Object} v * @param {Object} sKey * @author senxation * @example a = [{ b : "1" }, { b : "2" }] toStringSamePropertiesOfArray(a, "b", ", "); ==> "1, 2" */ toStringSamePropertiesOfArray : function(v, sKey, sSeperator) { if (v instanceof Array) { var a = []; for (var i = 0; i < v.length; i++) { a.push(v[i][sKey]); } return a.join(",").replace(/,/g, sSeperator); } else { if (typeof v[sKey] == "undefined") { return ""; } if (typeof v[sKey] == "string") { return v[sKey]; } } }, /** * ๋‹จ์ผ ๊ฐ์ฒด๋ฅผ ๋ฐฐ์—ด๋กœ ๋งŒ๋“ค์–ด์คŒ * @param {Object} v * @return {Array} * @author senxation * @example makeArray("test"); ==> ["test"] */ makeArray : function(v) { if (v === null || typeof v === "undefined"){ return []; } if (v instanceof Array) { return v; } var a = []; a.push(v); return a; }, /** * ๋ง์ค„์ž„์„ ํ• ๋•Œ ์ค„์ผ ๋‚ด์šฉ๊ณผ ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ๋‹ค๋ฅผ ๊ฒฝ์šฐ ์ฒ˜๋ฆฌ * ์ปจํ…Œ์ด๋„ˆ์˜ css white-space๊ฐ’์ด "normal"์ด์–ด์•ผํ•œ๋‹ค. (์ปจํ…Œ์ด๋„ˆ๋ณด๋‹ค ํ…์ŠคํŠธ๊ฐ€ ๊ธธ๋ฉด ์—ฌ๋Ÿฌํ–‰์œผ๋กœ ํ‘œํ˜„๋˜๋Š” ์ƒํƒœ) * @param {HTMLElement} elText ๋ง์ค„์ž„ํ•  ์—˜๋ฆฌ๋จผํŠธ * @param {HTMLElement} elContainer ๋ง์ค„์ž„ํ•  ์—˜๋ฆฌ๋จผํŠธ๋ฅผ ๊ฐ์‹ธ๋Š” ์ปจํ…Œ์ด๋„ˆ * @param {String} sStringTail ๋ง์ค„์ž„์„ ํ‘œํ˜„ํ•  ๋ฌธ์ž์—ด (๋ฏธ์ง€์ •์‹œ ...) * @param {Number} nLine ์ตœ๋Œ€ ๋ผ์ธ์ˆ˜ (๋ฏธ์ง€์ •์‹œ 1) * @author senxation * @example //div๊ฐ€ 2์ค„ ์ดํ•˜๊ฐ€ ๋˜๋„๋ก strong ๋‚ด๋ถ€์˜ ๋‚ด์šฉ์„ ์ค„์ž„ <div> <strong id="a">๋ง์ค„์ž„์„์ ์šฉํ• ๋‚ด์šฉ๋ง์ค„์ž„์„์ ์šฉํ• ๋‚ด์šฉ๋ง์ค„์ž„์„์ ์šฉํ• ๋‚ด์šฉ</strong><span>์ƒ์„ธ๋ณด๊ธฐ</span> <div> ellipsis(jindo.$("a"), jindo.$("a").parentNode, "...", 2); */ ellipsis : function(elText, elContainer, sStringTail, nLine) { sStringTail = sStringTail || "..."; if (typeof nLine == "undefined") { nLine = 1; } var welText = jindo.$Element(elText); var welContainer = jindo.$Element(elContainer); var sText = welText.html(); var nLength = sText.length; var nCurrentHeight = welContainer.height(); var nIndex = 0; welText.html('A'); var nHeight = welContainer.height(); if (nCurrentHeight < nHeight * (nLine + 0.5)) { return welText.html(sText); } /** * ์ง€์ •๋œ ๋ผ์ธ๋ณด๋‹ค ์ปค์งˆ๋•Œ๊นŒ์ง€ ์ „์ฒด ๋‚จ์€ ๋ฌธ์ž์—ด์˜ ์ ˆ๋ฐ˜์„ ๋”ํ•ด๋‚˜๊ฐ */ nCurrentHeight = nHeight; while(nCurrentHeight < nHeight * (nLine + 0.5)) { nIndex += Math.max(Math.ceil((nLength - nIndex)/2), 1); welText.html(sText.substring(0, nIndex) + sStringTail); nCurrentHeight = welContainer.height(); } /** * ์ง€์ •๋œ ๋ผ์ธ์ด ๋ ๋•Œ๊นŒ์ง€ ํ•œ๊ธ€์ž์”ฉ ์ž˜๋ผ๋ƒ„ */ while(nCurrentHeight > nHeight * (nLine + 0.5)) { nIndex--; welText.html(sText.substring(0, nIndex) + sStringTail); nCurrentHeight = welContainer.height(); } }, /** * ์ตœ๋Œ€ ๊ฐ€๋กœ์‚ฌ์ด์ฆˆ๋ฅผ ์ง€์ •ํ•˜์—ฌ ๋ง์ค„์ž„ํ•œ๋‹ค. * elText์˜ css white-space๊ฐ’์ด "nowrap"์ด์–ด์•ผํ•œ๋‹ค. (์ปจํ…Œ์ด๋„ˆ๋ณด๋‹ค ํ…์ŠคํŠธ๊ฐ€ ๊ธธ๋ฉด ํ–‰๋ณ€ํ™˜๋˜์ง€์•Š๊ณ  ๊ฐ€๋กœ๋กœ ๊ธธ๊ฒŒ ํ‘œํ˜„๋˜๋Š” ์ƒํƒœ) * @param {HTMLElement} elText ๋ง์ค„์ž„ํ•  ์—˜๋ฆฌ๋จผํŠธ * @param {String} sStringTail ๋ง์ค„์ž„์„ ํ‘œํ˜„ํ•  ๋ฌธ์ž์—ด (๋ฏธ์ง€์ •์‹œ ...) * @param {Function} fCondition ์กฐ๊ฑด ํ•จ์ˆ˜. ๋‚ด๋ถ€์—์„œ true๋ฅผ ๋ฆฌํ„ดํ•˜๋Š” ๋™์•ˆ์—๋งŒ ๋ง์ค„์ž„์„ ์ง„ํ–‰ํ•œ๋‹ค. * @author senxation * @example //150ํ”ฝ์…€ ์ดํ•˜๊ฐ€ ๋˜๋„๋ก strong ๋‚ด๋ถ€์˜ ๋‚ด์šฉ์„ ์ค„์ž„ <strong id="a">๋ง์ค„์ž„์„์ ์šฉํ• ๋‚ด์šฉ๋ง์ค„์ž„์„์ ์šฉํ• ๋‚ด์šฉ๋ง์ค„์ž„์„์ ์šฉํ• ๋‚ด์šฉ</strong>> ellipsisByPixel(jindo.$("a"), "...", 150); */ ellipsisByPixel : function(elText, sStringTail, nPixel, fCondition) { sStringTail = sStringTail || "..."; var welText = jindo.$Element(elText); var nCurrentWidth = welText.width(); if (nCurrentWidth < nPixel) { return; } var sText = welText.html(); var nLength = sText.length; var nIndex = 0; if (typeof fCondition == "undefined") { var nWidth = welText.html('A').width(); nCurrentWidth = nWidth; while(nCurrentWidth < nPixel) { nIndex += Math.max(Math.ceil((nLength - nIndex)/2), 1); welText.html(sText.substring(0, nIndex) + sStringTail); nCurrentWidth = welText.width(); } fCondition = function() { return true; }; } nIndex = welText.html().length - sStringTail.length; while(nCurrentWidth > nPixel) { if (!fCondition()) { break; } nIndex--; welText.html(sText.substring(0, nIndex) + sStringTail); nCurrentWidth = welText.width(); } }, /** * ์—ฌ๋Ÿฌ๊ฐœ์˜ ์—˜๋ฆฌ๋จผํŠธ๋ฅผ ๊ฐ๊ฐ์˜ ์ง€์ •๋œ ์ตœ๋Œ€๋„ˆ๋น„๋กœ ๋ง์ค„์ž„ํ•œ๋‹ค. * ๋ง์ค„์ž„ํ•  ์—˜๋ฆฌ๋จผํŠธ์˜ css white-space๊ฐ’์ด "nowrap"์ด์–ด์•ผํ•œ๋‹ค. (์ปจํ…Œ์ด๋„ˆ๋ณด๋‹ค ํ…์ŠคํŠธ๊ฐ€ ๊ธธ๋ฉด ํ–‰๋ณ€ํ™˜๋˜์ง€์•Š๊ณ  ๊ฐ€๋กœ๋กœ ๊ธธ๊ฒŒ ํ‘œํ˜„๋˜๋Š” ์ƒํƒœ) * @param {Array} aElement ๋ง์ค„์ž„ํ•  ์—˜๋ฆฌ๋จผํŠธ์˜ ๋ฐฐ์—ด. ์ง€์ •๋œ ์ˆœ์„œ๋Œ€๋กœ ๋ง์ค„์ž„ํ•œ๋‹ค. * @param {String} sStringTail ๋ง์ค„์ž„์„ ํ‘œํ˜„ํ•  ๋ฌธ์ž์—ด (๋ฏธ์ง€์ •์‹œ ...) * @param {Array} aMinWidth ๋ง์ค„์ž„ํ•  ๋„ˆ๋น„์˜ ๋ฐฐ์—ด. * @param {Function} fCondition ์กฐ๊ฑด ํ•จ์ˆ˜. ๋‚ด๋ถ€์—์„œ true๋ฅผ ๋ฆฌํ„ดํ•˜๋Š” ๋™์•ˆ์—๋งŒ ๋ง์ค„์ž„์„ ์ง„ํ–‰ํ•œ๋‹ค. * @example //#a #b #c์˜ ๋„ˆ๋น„๋ฅผ ๊ฐ๊ฐ 100, 50, 50ํ”ฝ์…€๋กœ ์ค„์ž„ (div#parent ๊ฐ€ 200ํ”ฝ์…€ ์ดํ•˜์ด๋ฉด ์ค‘๋‹จ) //#c์˜ ๋„ˆ๋น„๋ฅผ ์ค„์ด๋Š” ๋™์•ˆ fCondition์—์„œ false๋ฅผ ๋ฆฌํ„ดํ•˜๋ฉด b, a๋Š” ๋ง์ค„์ž„ ๋˜์ง€ ์•Š๋Š”๋‹ค. <div id="parent"> <strong id="a">๋ง์ค„์ž„์„์ ์šฉํ• ๋‚ด์šฉ</strong> <strong id="b">๋ง์ค„์ž„์„์ ์šฉํ• ๋‚ด์šฉ</strong> <strong id="c">๋ง์ค„์ž„์„์ ์šฉํ• ๋‚ด์šฉ</strong> <div> ellipsisElementsToDesinatedWidth([jindo.$("c"), jindo.$("b"), jindo.$("a")], "...", [100, 50, 50], function(){ if (jindo.$Element("parent").width() > 200) { return true; } return false; }); */ ellipsisElementsToDesinatedWidth : function(aElement, sStringTail, aMinWidth, fCondition) { jindo.$A(aElement).forEach(function(el, i){ if (!el) { jindo.$A.Continue(); } nhn.husky.SE2M_Utils.ellipsisByPixel(el, sStringTail, aMinWidth[i], fCondition); }); }, /** * ์ˆซ์ž๋ฅผ ์ž…๋ ฅ๋ฐ›์•„ ์ •ํ•ด์ง„ ๊ธธ์ด๋งŒํผ ์•ž์— "0"์ด ์ถ”๊ฐ€๋œ ๋ฌธ์ž์—ด์„ ๊ตฌํ•œ๋‹ค. * @param {Number} nNumber * @param {Number} nLength * @return {String} * @example paddingZero(10, 5); ==> "00010" (String) */ paddingZero : function(nNumber, nLength) { var sResult = nNumber.toString(); while (sResult.length < nLength) { sResult = ("0" + sResult); } return sResult; }, /** * string์„ byte ๋‹จ์œ„๋กœ ์งค๋ผ์„œ tail๋ฅผ ๋ถ™ํžŒ๋‹ค. * @param {String} sString * @param {Number} nByte * @param {String} sTail * @example cutStringToByte('์ผ์ด์‚ผ์‚ฌ์˜ค์œก', 6, '...') ==> '์ผ์ด์‚ผ...' (string) */ cutStringToByte : function(sString, nByte, sTail){ if(sString === null || sString.length === 0) { return sString; } sString = sString.replace(/ +/g, " "); if (!sTail && sTail != "") { sTail = "..."; } var maxByte = nByte; var n=0; var nLen = sString.length; for(var i=0; i<nLen;i++){ n += this.getCharByte(sString.charAt(i)); if(n == maxByte){ if(i == nLen-1) { return sString; } else { return sString.substring(0,i)+sTail; } } else if( n > maxByte ) { return sString.substring(0, i)+sTail; } } return sString; }, /** * ์ž…๋ ฅ๋ฐ›์€ ๋ฌธ์ž์˜ byte ๊ตฌํ•œ๋‹ค. * @param {String} ch * */ getCharByte : function(ch){ if (ch === null || ch.length < 1) { return 0; } var byteSize = 0; var str = escape(ch); if ( str.length == 1 ) { // when English then 1byte byteSize ++; } else if ( str.indexOf("%u") != -1 ) { // when Korean then 2byte byteSize += 2; } else if ( str.indexOf("%") != -1 ) { // else 3byte byteSize += str.length/3; } return byteSize; }, /** * Hash Table์—์„œ ์›ํ•˜๋Š” ํ‚ค๊ฐ’๋งŒ์„ ๊ฐ€์ง€๋Š” ํ•„ํ„ฐ๋œ ์ƒˆ๋กœ์šด Hash Table์„ ๊ตฌํ•œ๋‹ค. * @param {HashTable} htUnfiltered * @param {Array} aKey * @return {HashTable} * @author senxation * @example getFilteredHashTable({ a : 1, b : 2, c : 3, d : 4 }, ["a", "c"]); ==> { a : 1, c : 3 } */ getFilteredHashTable : function(htUnfiltered, vKey) { if (!(vKey instanceof Array)) { return arguments.callee.call(this, htUnfiltered, [ vKey ]); } var waKey = jindo.$A(vKey); return jindo.$H(htUnfiltered).filter(function(vValue, sKey){ if (waKey.has(sKey) && vValue) { return true; } else { return false; } }).$value(); }, isBlankNode : function(elNode){ var isBlankTextNode = this.isBlankTextNode; var bEmptyContent = function(elNode){ if(!elNode) { return true; } if(isBlankTextNode(elNode)){ return true; } if(elNode.tagName == "BR") { return true; } if(elNode.innerHTML == "&nbsp;" || elNode.innerHTML == "") { return true; } return false; }; var bEmptyP = function(elNode){ if(elNode.tagName == "IMG" || elNode.tagName == "IFRAME"){ return false; } if(bEmptyContent(elNode)){ return true; } if(elNode.tagName == "P"){ for(var i=elNode.childNodes.length-1; i>=0; i--){ var elTmp = elNode.childNodes[i]; if(isBlankTextNode(elTmp)){ elTmp.parentNode.removeChild(elTmp); } } if(elNode.childNodes.length == 1){ if(elNode.firstChild.tagName == "IMG" || elNode.firstChild.tagName == "IFRAME"){ return false; } if(bEmptyContent(elNode.firstChild)){ return true; } } } return false; }; if(bEmptyP(elNode)){ return true; } for(var i=0, nLen=elNode.childNodes.length; i<nLen; i++){ var elTmp = elNode.childNodes[i]; if(!bEmptyP(elTmp)){ return false; } } return true; }, isBlankTextNode : function(oNode){ var sText; if(oNode.nodeType == 3){ sText = oNode.nodeValue; sText = sText.replace(unescape("%uFEFF"), ''); if(sText == "") { return true; } } return false; }, isFirstChildOfNode : function(sTagName, sParentTagName, elNode){ if(!elNode){ return false; } if(elNode.tagName == sParentTagName && elNode.firstChild.tagName == sTagName){ return true; } return false; }, /** * elNode์˜ ์ƒ์œ„ ๋…ธ๋“œ ์ค‘ ํƒœ๊ทธ๋ช…์ด sTagName๊ณผ ์ผ์น˜ํ•˜๋Š” ๊ฒƒ์ด ์žˆ๋‹ค๋ฉด ๋ฐ˜ํ™˜. * @param {String} sTagName ๊ฒ€์ƒ‰ ํ•  ํƒœ๊ทธ๋ช… * @param {HTMLElement} elNode ๊ฒ€์ƒ‰ ์‹œ์ž‘์ ์œผ๋กœ ์‚ฌ์šฉ ํ•  ๋…ธ๋“œ * @return {HTMLElement} ๋ถ€๋ชจ ๋…ธ๋“œ ์ค‘ ํƒœ๊ทธ๋ช…์ด sTagName๊ณผ ์ผ์น˜ํ•˜๋Š” ๋…ธ๋“œ. ์—†์„ ๊ฒฝ์šฐ null ๋ฐ˜ํ™˜ */ findAncestorByTagName : function(sTagName, elNode){ while(elNode && elNode.tagName != sTagName) { elNode = elNode.parentNode; } return elNode; }, loadCSS : function(url, fnCallback){ var oDoc = document; var elHead = oDoc.getElementsByTagName("HEAD")[0]; var elStyle = oDoc.createElement ("LINK"); elStyle.setAttribute("type", "text/css"); elStyle.setAttribute("rel", "stylesheet"); elStyle.setAttribute("href", url); if(fnCallback){ if ('onload' in elStyle) { elStyle.onload = function(){ fnCallback(); }; } else { elStyle.onreadystatechange = function(){ if(elStyle.readyState != "complete"){ return; } // [SMARTEDITORSUS-308] [IE9] ์‘๋‹ต์ด 304์ธ ๊ฒฝ์šฐ // onreadystatechage ํ•ธ๋“ค๋Ÿฌ์—์„œ readyState ๊ฐ€ complete ์ธ ๊ฒฝ์šฐ๊ฐ€ ๋‘ ๋ฒˆ ๋ฐœ์ƒ // LINK ์—˜๋ฆฌ๋จผํŠธ์˜ ์†์„ฑ์œผ๋กœ ์ฝœ๋ฐฑ ์‹คํ–‰ ์—ฌ๋ถ€๋ฅผ ํ”Œ๋ž˜๊ทธ๋กœ ๋‚จ๊ฒจ๋†“์•„ ์ฒ˜๋ฆฌํ•จ if(elStyle.getAttribute("_complete")){ return; } elStyle.setAttribute("_complete", true); fnCallback(); }; } } elHead.appendChild (elStyle); }, getUniqueId : function(sPrefix) { return (sPrefix || '') + jindo.$Date().time() + (Math.random() * 100000).toFixed(); }, /** * @param {Object} oSrc value copyํ•  object * @return {Object} * @example * var oSource = [1, 3, 4, { a:1, b:2, c: { a:1 }}]; var oTarget = oSource; // call by reference oTarget = nhn.husky.SE2M_Utils.clone(oSource); oTarget[1] = 2; oTarget[3].a = 100; console.log(oSource); // check for deep copy console.log(oTarget, oTarget instanceof Object); // check instance type! */ clone : function(oSrc, oChange) { if ('undefined' != typeof(oSrc) && !!oSrc && (oSrc.constructor == Array || oSrc.constructor == Object)) { var oCopy = (oSrc.constructor == Array ? [] : {} ); for (var property in oSrc) { if ('undefined' != typeof(oChange) && !!oChange[property]) { oCopy[property] = arguments.callee(oChange[property]); } else { oCopy[property] = arguments.callee(oSrc[property]); } } return oCopy; } return oSrc; }, getHtmlTagAttr : function(sHtmlTag, sAttr) { var rx = new RegExp('\\s' + sAttr + "=('([^']*)'|\"([^\"]*)\"|([^\"' >]*))", 'i'); var aResult = rx.exec(sHtmlTag); if (!aResult) { return ''; } var sAttrTmp = (aResult[1] || aResult[2] || aResult[3]); // for chrome 5.x bug! if (!!sAttrTmp) { sAttrTmp = sAttrTmp.replace(/[\"]/g, ''); } return sAttrTmp; }, /** * iframe ์˜์—ญ์˜ aling ์ •๋ณด๋ฅผ ๋‹ค์‹œ ์„ธํŒ…ํ•˜๋Š” ๋ถ€๋ถ„. * iframe ํ˜•ํƒœ์˜ ์‚ฐ์ถœ๋ฌผ์„ ์—๋””ํ„ฐ์— ์‚ฝ์ž… ์ดํ›„์— ์—๋””ํ„ฐ ์ •๋ ฌ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ ํ•˜์˜€์„๋•Œ ir_to_db ์ด์ „ ์‹œ์ ์—์„œ divํƒœ๊ทธ์— ์ •๋ ฌ์„ ๋„ฃ์–ด์ฃผ๋Š” ๋กœ์ง์ž„. * ๋ธŒ๋ผ์šฐ์ € ํ˜•ํƒœ์— ๋”ฐ๋ผ ์ •๋ ฌ ํƒœ๊ทธ๊ฐ€ iframe์„ ๊ฐ์‹ธ๋Š” div ํ˜น์€ p ํƒœ๊ทธ์— ์ •๋ ฌ์ด ์ถ”๊ฐ€๋œ๋‹ค. * @param {HTMLElement} el iframe์˜ parentNode * @param {Document} oDoc document */ // [COM-1151] SE2M_PreStringConverter ์—์„œ ์ˆ˜์ •ํ•˜๋„๋ก ๋ณ€๊ฒฝ iframeAlignConverter : function(el, oDoc){ var sTagName = el.tagName.toUpperCase(); if(sTagName == "DIV" || sTagName == 'P'){ //irToDbDOM ์—์„œ ์ตœ์ƒ์œ„ ๋…ธ๋“œ๊ฐ€ div ์—˜๋ฆฌ๋จผํŠธ ์ด๋ฏ€๋กœ parentNode๊ฐ€ ์—†์œผ๋ฉด ์ตœ์ƒ์˜ div ๋…ธ๋“œ ์ด๋ฏ€๋กœ ๋ฆฌํ„ดํ•œ๋‹ค. if(el.parentNode === null ){ return; } var elWYSIWYGDoc = oDoc; var wel = jindo.$Element(el); var sHtml = wel.html(); //ํ˜„์žฌ align์„ ์–ป์–ด์˜ค๊ธฐ. var sAlign = jindo.$Element(el).attr('align') || jindo.$Element(el).css('text-align'); //if(!sAlign){ // P > DIV์˜ ๊ฒฝ์šฐ ๋ฌธ์ œ ๋ฐœ์ƒ, ์ˆ˜์ • ํ™”๋ฉด์— ๋“ค์–ด ์™”์„ ๋•Œ ํƒœ๊ทธ ๊นจ์ง // return; //} //์ƒˆ๋กœ์šด div ๋…ธ๋“œ ์ƒ์„ฑํ•œ๋‹ค. var welAfter = jindo.$Element(jindo.$('<div></div>', elWYSIWYGDoc)); welAfter.html(sHtml).attr('align', sAlign); wel.replace(welAfter); } }, /** * jindo.$JSON.fromXML์„ ๋ณ€ํ™˜ํ•œ ๋ฉ”์„œ๋“œ. * ์†Œ์ˆซ์ ์ด ์žˆ๋Š” ๊ฒฝ์šฐ์˜ ์ฒ˜๋ฆฌ ์‹œ์— ์ˆซ์ž๋กœ ๋ณ€ํ™˜ํ•˜์ง€ ์•Š๋„๋ก ํ•จ(parseFloat ์‚ฌ์šฉ ์•ˆํ•˜๋„๋ก ์ˆ˜์ •) * ๊ด€๋ จ BTS : [COM-1093] * @param {String} sXML XML ํ˜•ํƒœ์˜ ๋ฌธ์ž์—ด * @return {jindo.$JSON} */ getJsonDatafromXML : function(sXML) { var o = {}; var re = /\s*<(\/?[\w:\-]+)((?:\s+[\w:\-]+\s*=\s*(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'))*)\s*((?:\/>)|(?:><\/\1>|\s*))|\s*<!\[CDATA\[([\w\W]*?)\]\]>\s*|\s*>?([^<]*)/ig; var re2= /^[0-9]+(?:\.[0-9]+)?$/; var re3= /^\s+$/g; var ec = {"&amp;":"&","&nbsp;":" ","&quot;":"\"","&lt;":"<","&gt;":">"}; var fg = {tags:["/"],stack:[o]}; var es = function(s){ if (typeof s == "undefined") { return ""; } return s.replace(/&[a-z]+;/g, function(m){ return (typeof ec[m] == "string")?ec[m]:m; }); }; var at = function(s,c) { s.replace(/([\w\:\-]+)\s*=\s*(?:"((?:\\"|[^"])*)"|'((?:\\'|[^'])*)')/g, function($0,$1,$2,$3) { c[$1] = es(($2?$2.replace(/\\"/g,'"'):undefined)||($3?$3.replace(/\\'/g,"'"):undefined)); }); }; var em = function(o) { for(var x in o){ if (o.hasOwnProperty(x)) { if(Object.prototype[x]) { continue; } return false; } } return true; }; // $0 : ์ „์ฒด // $1 : ํƒœ๊ทธ๋ช… // $2 : ์†์„ฑ๋ฌธ์ž์—ด // $3 : ๋‹ซ๋Š”ํƒœ๊ทธ // $4 : CDATA๋ฐ”๋””๊ฐ’ // $5 : ๊ทธ๋ƒฅ ๋ฐ”๋””๊ฐ’ var cb = function($0,$1,$2,$3,$4,$5) { var cur, cdata = ""; var idx = fg.stack.length - 1; if (typeof $1 == "string" && $1) { if ($1.substr(0,1) != "/") { var has_attr = (typeof $2 == "string" && $2); var closed = (typeof $3 == "string" && $3); var newobj = (!has_attr && closed)?"":{}; cur = fg.stack[idx]; if (typeof cur[$1] == "undefined") { cur[$1] = newobj; cur = fg.stack[idx+1] = cur[$1]; } else if (cur[$1] instanceof Array) { var len = cur[$1].length; cur[$1][len] = newobj; cur = fg.stack[idx+1] = cur[$1][len]; } else { cur[$1] = [cur[$1], newobj]; cur = fg.stack[idx+1] = cur[$1][1]; } if (has_attr) { at($2,cur); } fg.tags[idx+1] = $1; if (closed) { fg.tags.length--; fg.stack.length--; } } else { fg.tags.length--; fg.stack.length--; } } else if (typeof $4 == "string" && $4) { cdata = $4; } else if (typeof $5 == "string" && $5.replace(re3, "")) { // [SMARTEDITORSUS-1525] ๋‹ซ๋Š” ํƒœ๊ทธ์ธ๋ฐ ๊ณต๋ฐฑ๋ฌธ์ž๊ฐ€ ๋“ค์–ด์žˆ์–ด cdata ๊ฐ’์„ ๋ฎ์–ด์“ฐ๋Š” ๊ฒฝ์šฐ ๋ฐฉ์ง€ cdata = es($5); } if (cdata.length > 0) { var par = fg.stack[idx-1]; var tag = fg.tags[idx]; if (re2.test(cdata)) { //cdata = parseFloat(cdata); }else if (cdata == "true" || cdata == "false"){ cdata = new Boolean(cdata); } if(typeof par =='undefined') { return; } if (par[tag] instanceof Array) { var o = par[tag]; if (typeof o[o.length-1] == "object" && !em(o[o.length-1])) { o[o.length-1].$cdata = cdata; o[o.length-1].toString = function(){ return cdata; }; } else { o[o.length-1] = cdata; } } else { if (typeof par[tag] == "object" && !em(par[tag])) { par[tag].$cdata = cdata; par[tag].toString = function() { return cdata; }; } else { par[tag] = cdata; } } } }; sXML = sXML.replace(/<(\?|\!-)[^>]*>/g, ""); sXML.replace(re, cb); return jindo.$Json(o); } }; /** * nhn.husky.AutoResizer * HTML๋ชจ๋“œ์™€ TEXT ๋ชจ๋“œ์˜ ํŽธ์ง‘ ์˜์—ญ์ธ TEXTAREA์— ๋Œ€ํ•œ ์ž๋™ํ™•์žฅ ์ฒ˜๋ฆฌ */ nhn.husky.AutoResizer = jindo.$Class({ welHiddenDiv : null, welCloneDiv : null, elContainer : null, $init : function(el, htOption){ var aCopyStyle = [ 'lineHeight', 'textDecoration', 'letterSpacing', 'fontSize', 'fontFamily', 'fontStyle', 'fontWeight', 'textTransform', 'textAlign', 'direction', 'wordSpacing', 'fontSizeAdjust', 'paddingTop', 'paddingLeft', 'paddingBottom', 'paddingRight', 'width' ], i = aCopyStyle.length, oCss = { "position" : "absolute", "top" : -9999, "left" : -9999, "opacity": 0, "overflow": "hidden", "wordWrap" : "break-word" }; this.nMinHeight = htOption.nMinHeight; this.wfnCallback = htOption.wfnCallback; this.elContainer = el.parentNode; this.welTextArea = jindo.$Element(el); // autoresize๋ฅผ ์ ์šฉํ•  TextArea this.welHiddenDiv = jindo.$Element('<div>'); this.wfnResize = jindo.$Fn(this._resize, this); this.sOverflow = this.welTextArea.css("overflow"); this.welTextArea.css("overflow", "hidden"); while(i--){ oCss[aCopyStyle[i]] = this.welTextArea.css(aCopyStyle[i]); } this.welHiddenDiv.css(oCss); this.nLastHeight = this.welTextArea.height(); }, bind : function(){ this.welCloneDiv = jindo.$Element(this.welHiddenDiv.$value().cloneNode(false)); this.wfnResize.attach(this.welTextArea, "keyup"); this.welCloneDiv.appendTo(this.elContainer); this._resize(); }, unbind : function(){ this.wfnResize.detach(this.welTextArea, "keyup"); this.welTextArea.css("overflow", this.sOverflow); if(this.welCloneDiv){ this.welCloneDiv.leave(); } }, _resize : function(){ var sContents = this.welTextArea.$value().value, bExpand = false, nHeight; if(sContents === this.sContents){ return; } this.sContents = sContents.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/ /g, '&nbsp;').replace(/\n/g, '<br>'); this.sContents += "<br>"; // ๋งˆ์ง€๋ง‰ ๊ฐœํ–‰ ๋’ค์— <br>์„ ๋” ๋ถ™์—ฌ์ฃผ์–ด์•ผ ๋Š˜์–ด๋‚˜๋Š” ๋†’์ด๊ฐ€ ๋™์ผํ•จ this.welCloneDiv.html(this.sContents); nHeight = this.welCloneDiv.height(); if(nHeight < this.nMinHeight){ nHeight = this.nMinHeight; } this.welTextArea.css("height", nHeight + "px"); this.elContainer.style.height = nHeight + "px"; if(this.nLastHeight < nHeight){ bExpand = true; } this.wfnCallback(bExpand); } }); /** * ๋ฌธ์ž๋ฅผ ์—ฐ๊ฒฐํ•˜๋Š” '+' ๋Œ€์‹ ์— java์™€ ์œ ์‚ฌํ•˜๊ฒŒ ์ฒ˜๋ฆฌํ•˜๋„๋ก ๋ฌธ์ž์—ด ์ฒ˜๋ฆฌํ•˜๋„๋ก ๋งŒ๋“œ๋Š” object * @author nox * @example var sTmp1 = new StringBuffer(); sTmp1.append('1').append('2').append('3'); var sTmp2 = new StringBuffer('1'); sTmp2.append('2').append('3'); var sTmp3 = new StringBuffer('1').append('2').append('3'); */ if ('undefined' != typeof(StringBuffer)) { StringBuffer = {}; } StringBuffer = function(str) { this._aString = []; if ('undefined' != typeof(str)) { this.append(str); } }; StringBuffer.prototype.append = function(str) { this._aString.push(str); return this; }; StringBuffer.prototype.toString = function() { return this._aString.join(''); }; StringBuffer.prototype.setLength = function(nLen) { if('undefined' == typeof(nLen) || 0 >= nLen) { this._aString.length = 0; } else { this._aString.length = nLen; } }; /** * Installed Font Detector * @author hooriza * * @see http://remysharp.com/2008/07/08/how-to-detect-if-a-font-is-installed-only-using-javascript/ */ (function() { var oDummy = null, rx = /,/gi; IsInstalledFont = function(sFont) { var sDefFont = sFont == 'Comic Sans MS' ? 'Courier New' : 'Comic Sans MS'; if (!oDummy) { oDummy = document.createElement('div'); } var sStyle = 'position:absolute !important; font-size:200px !important; left:-9999px !important; top:-9999px !important;'; oDummy.innerHTML = 'mmmmiiiii'+unescape('%uD55C%uAE00'); oDummy.style.cssText = sStyle + 'font-family:"' + sDefFont + '" !important'; var elBody = document.body || document.documentElement; if(elBody.firstChild){ elBody.insertBefore(oDummy, elBody.firstChild); }else{ document.body.appendChild(oDummy); } var sOrg = oDummy.offsetWidth + '-' + oDummy.offsetHeight; oDummy.style.cssText = sStyle + 'font-family:"' + sFont.replace(rx, '","') + '", "' + sDefFont + '" !important'; var bInstalled = sOrg != (oDummy.offsetWidth + '-' + oDummy.offsetHeight); document.body.removeChild(oDummy); return bInstalled; }; })(); //{ /** * @fileOverview This file contains Husky plugin that takes care of the operations related to string conversion. Ususally used to convert the IR value. * @name hp_StringConverterManager.js */ nhn.husky.StringConverterManager = jindo.$Class({ name : "StringConverterManager", oConverters : null, $init : function(){ this.oConverters = {}; this.oConverters_DOM = {}; this.oAgent = jindo.$Agent().navigator(); }, $BEFORE_MSG_APP_READY : function(){ this.oApp.exec("ADD_APP_PROPERTY", ["applyConverter", jindo.$Fn(this.applyConverter, this).bind()]); this.oApp.exec("ADD_APP_PROPERTY", ["addConverter", jindo.$Fn(this.addConverter, this).bind()]); this.oApp.exec("ADD_APP_PROPERTY", ["addConverter_DOM", jindo.$Fn(this.addConverter_DOM, this).bind()]); }, applyConverter : function(sRuleName, sContents, oDocument){ //string์„ ๋„ฃ๋Š” ์ด์œ :IE์˜ ๊ฒฝ์šฐ,๋ณธ๋ฌธ ์•ž์— ์žˆ๋Š” html ์ฃผ์„์ด ์‚ญ์ œ๋˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๊ธฐ๋•Œ๋ฌธ์— ์ž„์‹œ string์„ ์ถ”๊ฐ€ํ•ด์ค€๊ฒƒ์ž„. var sTmpStr = "@"+(new Date()).getTime()+"@"; var rxTmpStr = new RegExp(sTmpStr, "g"); var oRes = {sContents:sTmpStr+sContents}; oDocument = oDocument || document; this.oApp.exec("MSG_STRING_CONVERTER_STARTED", [sRuleName, oRes]); // this.oApp.exec("MSG_STRING_CONVERTER_STARTED_"+sRuleName, [oRes]); var aConverters; sContents = oRes.sContents; aConverters = this.oConverters_DOM[sRuleName]; if(aConverters){ var elContentsHolder = oDocument.createElement("DIV"); elContentsHolder.innerHTML = sContents; for(var i=0; i<aConverters.length; i++){ aConverters[i](elContentsHolder); } sContents = elContentsHolder.innerHTML; // ๋‚ด์šฉ๋ฌผ์— EMBED๋“ฑ์ด ์žˆ์„ ๊ฒฝ์šฐ IE์—์„œ ํŽ˜์ด์ง€ ๋‚˜๊ฐˆ ๋•Œ ๊ถŒํ•œ ์˜ค๋ฅ˜ ๋ฐœ์ƒ ํ•  ์ˆ˜ ์žˆ์–ด ๋ช…์‹œ์ ์œผ๋กœ ๋…ธ๋“œ ์‚ญ์ œ. if(!!elContentsHolder.parentNode){ elContentsHolder.parentNode.removeChild(elContentsHolder); } elContentsHolder = null; //IE์˜ ๊ฒฝ์šฐ, sContents๋ฅผ innerHTML๋กœ ๋„ฃ๋Š” ๊ฒฝ์šฐ string๊ณผ <p>tag ์‚ฌ์ด์— '\n\'๊ฐœํ–‰๋ฌธ์ž๋ฅผ ๋„ฃ์–ด์ค€๋‹ค. if( jindo.$Agent().navigator().ie ){ sTmpStr = sTmpStr +'(\r\n)?'; //ie+win์—์„œ๋Š” ๊ฐœํ–‰์ด \r\n๋กœ ๋“ค์–ด๊ฐ. rxTmpStr = new RegExp(sTmpStr , "g"); } } aConverters = this.oConverters[sRuleName]; if(aConverters){ for(var i=0; i<aConverters.length; i++){ var sTmpContents = aConverters[i](sContents); if(typeof sTmpContents != "undefined"){ sContents = sTmpContents; } } } oRes = {sContents:sContents}; this.oApp.exec("MSG_STRING_CONVERTER_ENDED", [sRuleName, oRes]); oRes.sContents = oRes.sContents.replace(rxTmpStr, ""); return oRes.sContents; }, $ON_ADD_CONVERTER : function(sRuleName, funcConverter){ var aCallerStack = this.oApp.aCallerStack; funcConverter.sPluginName = aCallerStack[aCallerStack.length-2].name; this.addConverter(sRuleName, funcConverter); }, $ON_ADD_CONVERTER_DOM : function(sRuleName, funcConverter){ var aCallerStack = this.oApp.aCallerStack; funcConverter.sPluginName = aCallerStack[aCallerStack.length-2].name; this.addConverter_DOM(sRuleName, funcConverter); }, addConverter : function(sRuleName, funcConverter){ var aConverters = this.oConverters[sRuleName]; if(!aConverters){ this.oConverters[sRuleName] = []; } this.oConverters[sRuleName][this.oConverters[sRuleName].length] = funcConverter; }, addConverter_DOM : function(sRuleName, funcConverter){ var aConverters = this.oConverters_DOM[sRuleName]; if(!aConverters){ this.oConverters_DOM[sRuleName] = []; } this.oConverters_DOM[sRuleName][this.oConverters_DOM[sRuleName].length] = funcConverter; } }); //} /*[ * ATTACH_HOVER_EVENTS * * ์ฃผ์–ด์ง„ HTML์—˜๋ฆฌ๋จผํŠธ์— Hover ์ด๋ฒคํŠธ ๋ฐœ์ƒ์‹œ ํŠน์ • ํด๋ž˜์Šค๊ฐ€ ํ• ๋‹น ๋˜๋„๋ก ์„ค์ • * * aElms array Hover ์ด๋ฒคํŠธ๋ฅผ ๊ฑธ HTML Element ๋ชฉ๋ก * sHoverClass string Hover ์‹œ์— ํ• ๋‹น ํ•  ํด๋ž˜์Šค * ---------------------------------------------------------------------------]*/ /** * @pluginDesc Husky Framework์—์„œ ์ž์ฃผ ์‚ฌ์šฉ๋˜๋Š” ์œ ํ‹ธ์„ฑ ๋ฉ”์‹œ์ง€๋ฅผ ์ฒ˜๋ฆฌํ•˜๋Š” ํ”Œ๋Ÿฌ๊ทธ์ธ */ nhn.husky.Utils = jindo.$Class({ name : "Utils", $init : function(){ var oAgentInfo = jindo.$Agent(); var oNavigatorInfo = oAgentInfo.navigator(); if(oNavigatorInfo.ie && oNavigatorInfo.version == 6){ try{ document.execCommand('BackgroundImageCache', false, true); }catch(e){} } }, $BEFORE_MSG_APP_READY : function(){ this.oApp.exec("ADD_APP_PROPERTY", ["htBrowser", jindo.$Agent().navigator()]); }, $ON_ATTACH_HOVER_EVENTS : function(aElms, htOptions){ htOptions = htOptions || []; var sHoverClass = htOptions.sHoverClass || "hover"; var fnElmToSrc = htOptions.fnElmToSrc || function(el){return el}; var fnElmToTarget = htOptions.fnElmToTarget || function(el){return el}; if(!aElms) return; var wfAddClass = jindo.$Fn(function(wev){ jindo.$Element(fnElmToTarget(wev.currentElement)).addClass(sHoverClass); }, this); var wfRemoveClass = jindo.$Fn(function(wev){ jindo.$Element(fnElmToTarget(wev.currentElement)).removeClass(sHoverClass); }, this); for(var i=0, len = aElms.length; i<len; i++){ var elSource = fnElmToSrc(aElms[i]); wfAddClass.attach(elSource, "mouseover"); wfRemoveClass.attach(elSource, "mouseout"); wfAddClass.attach(elSource, "focus"); wfRemoveClass.attach(elSource, "blur"); } } }); /*[ * SE_FIT_IFRAME * * ์Šค๋งˆํŠธ์—๋””ํ„ฐ ์‚ฌ์ด์ฆˆ์— ๋งž๊ฒŒ iframe์‚ฌ์ด์ฆˆ๋ฅผ ์กฐ์ ˆํ•œ๋‹ค. * * none * ---------------------------------------------------------------------------]*/ /** * @pluginDesc ์—๋””ํ„ฐ๋ฅผ ์‹ธ๊ณ  ์žˆ๋Š” iframe ์‚ฌ์ด์ฆˆ ์กฐ์ ˆ์„ ๋‹ด๋‹นํ•˜๋Š” ํ”Œ๋Ÿฌ๊ทธ์ธ */ nhn.husky.SE_OuterIFrameControl = $Class({ name : "SE_OuterIFrameControl", oResizeGrip : null, $init : function(oAppContainer){ // page up, page down, home, end, left, up, right, down this.aHeightChangeKeyMap = [-100, 100, 500, -500, -1, -10, 1, 10]; this._assignHTMLObjects(oAppContainer); //ํ‚ค๋ณด๋“œ ์ด๋ฒคํŠธ this.$FnKeyDown = $Fn(this._keydown, this); if(this.oResizeGrip){ this.$FnKeyDown.attach(this.oResizeGrip, "keydown"); } //๋งˆ์šฐ์Šค ์ด๋ฒคํŠธ if(!!jindo.$Agent().navigator().ie){ this.$FnMouseDown = $Fn(this._mousedown, this); this.$FnMouseMove = $Fn(this._mousemove, this); this.$FnMouseMove_Parent = $Fn(this._mousemove_parent, this); this.$FnMouseUp = $Fn(this._mouseup, this); if(this.oResizeGrip){ this.$FnMouseDown.attach(this.oResizeGrip, "mousedown"); } } }, _assignHTMLObjects : function(oAppContainer){ oAppContainer = $(oAppContainer) || document; this.oResizeGrip = cssquery.getSingle(".husky_seditor_editingArea_verticalResizer", oAppContainer); this.elIFrame = window.frameElement; this.welIFrame = $Element(this.elIFrame); }, $ON_MSG_APP_READY : function(){ this.oApp.exec("SE_FIT_IFRAME", []); }, $ON_MSG_EDITING_AREA_SIZE_CHANGED : function(){ this.oApp.exec("SE_FIT_IFRAME", []); }, $ON_SE_FIT_IFRAME : function(){ this.elIFrame.style.height = document.body.offsetHeight+"px"; }, $AFTER_RESIZE_EDITING_AREA_BY : function(ipWidthChange, ipHeightChange){ this.oApp.exec("SE_FIT_IFRAME", []); }, _keydown : function(oEvent){ var oKeyInfo = oEvent.key(); // 33, 34: page up/down, 35,36: end/home, 37,38,39,40: left, up, right, down if(oKeyInfo.keyCode >= 33 && oKeyInfo.keyCode <= 40){ this.oApp.exec("MSG_EDITING_AREA_RESIZE_STARTED", []); this.oApp.exec("RESIZE_EDITING_AREA_BY", [0, this.aHeightChangeKeyMap[oKeyInfo.keyCode-33]]); this.oApp.exec("MSG_EDITING_AREA_RESIZE_ENDED", []); oEvent.stop(); } }, _mousedown : function(oEvent){ this.iStartHeight = oEvent.pos().clientY; this.iStartHeightOffset = oEvent.pos().layerY; this.$FnMouseMove.attach(document, "mousemove"); this.$FnMouseMove_Parent.attach(parent.document, "mousemove"); this.$FnMouseUp.attach(document, "mouseup"); this.$FnMouseUp.attach(parent.document, "mouseup"); this.iStartHeight = oEvent.pos().clientY; this.oApp.exec("MSG_EDITING_AREA_RESIZE_STARTED", [this.$FnMouseDown, this.$FnMouseMove, this.$FnMouseUp]); }, _mousemove : function(oEvent){ var iHeightChange = oEvent.pos().clientY - this.iStartHeight; this.oApp.exec("RESIZE_EDITING_AREA_BY", [0, iHeightChange]); }, _mousemove_parent : function(oEvent){ var iHeightChange = oEvent.pos().pageY - (this.welIFrame.offset().top + this.iStartHeight); this.oApp.exec("RESIZE_EDITING_AREA_BY", [0, iHeightChange]); }, _mouseup : function(oEvent){ this.$FnMouseMove.detach(document, "mousemove"); this.$FnMouseMove_Parent.detach(parent.document, "mousemove"); this.$FnMouseUp.detach(document, "mouseup"); this.$FnMouseUp.detach(parent.document, "mouseup"); this.oApp.exec("MSG_EDITING_AREA_RESIZE_ENDED", [this.$FnMouseDown, this.$FnMouseMove, this.$FnMouseUp]); } }); // Sample plugin. Use CTRL+T to toggle the toolbar nhn.husky.SE_ToolbarToggler = $Class({ name : "SE_ToolbarToggler", bUseToolbar : true, $init : function(oAppContainer, bUseToolbar){ this._assignHTMLObjects(oAppContainer, bUseToolbar); }, _assignHTMLObjects : function(oAppContainer, bUseToolbar){ oAppContainer = $(oAppContainer) || document; this.toolbarArea = cssquery.getSingle(".se2_tool", oAppContainer); //์„ค์ •์ด ์—†๊ฑฐ๋‚˜, ์‚ฌ์šฉํ•˜๊ฒ ๋‹ค๊ณ  ํ‘œ์‹œํ•œ ๊ฒฝ์šฐ block ์ฒ˜๋ฆฌ if( typeof(bUseToolbar) == 'undefined' || bUseToolbar === true){ this.toolbarArea.style.display = "block"; }else{ this.toolbarArea.style.display = "none"; } }, $ON_MSG_APP_READY : function(){ this.oApp.exec("REGISTER_HOTKEY", ["ctrl+t", "SE_TOGGLE_TOOLBAR", []]); }, $ON_SE_TOGGLE_TOOLBAR : function(){ this.toolbarArea.style.display = (this.toolbarArea.style.display == "none")?"block":"none"; this.oApp.exec("MSG_EDITING_AREA_SIZE_CHANGED", []); } }); //{ /** * @fileOverview This file contains Husky plugin that takes care of loading css files dynamically * @name hp_SE2B_CSSLoader.js */ nhn.husky.SE2B_CSSLoader = jindo.$Class({ name : "SE2B_CSSLoader", bCssLoaded : false, // load & continue with the message right away. aInstantLoadTrigger : ["OPEN_QE_LAYER", "SHOW_ACTIVE_LAYER", "SHOW_DIALOG_LAYER"], // if a rendering bug occurs in IE, give some delay before continue processing the message. aDelayedLoadTrigger : ["MSG_SE_OBJECT_EDIT_REQUESTED", "OBJECT_MODIFY", "MSG_SE_DUMMY_OBJECT_EDIT_REQUESTED", "TOGGLE_TOOLBAR_ACTIVE_LAYER", "SHOW_TOOLBAR_ACTIVE_LAYER"], $init : function(){ this.htOptions = nhn.husky.SE2M_Configuration.SE2B_CSSLoader; // only IE's slow if(!jindo.$Agent().navigator().ie){ this.loadSE2CSS(); }else{ for(var i=0, nLen = this.aInstantLoadTrigger.length; i<nLen; i++){ this["$BEFORE_"+this.aInstantLoadTrigger[i]] = jindo.$Fn(function(){ this.loadSE2CSS(); }, this).bind(); } for(var i=0, nLen = this.aDelayedLoadTrigger.length; i<nLen; i++){ var sMsg = this.aDelayedLoadTrigger[i]; this["$BEFORE_"+this.aDelayedLoadTrigger[i]] = jindo.$Fn(function(sMsg){ var aArgs = jindo.$A(arguments).$value(); aArgs = aArgs.splice(1, aArgs.length-1); return this.loadSE2CSS(sMsg, aArgs); }, this).bind(sMsg); } } }, /* $BEFORE_REEDIT_ITEM_ACTION : function(){ return this.loadSE2CSS("REEDIT_ITEM_ACTION", arguments); }, $BEFORE_OBJECT_MODIFY : function(){ return this.loadSE2CSS("OBJECT_MODIFY", arguments); }, $BEFORE_MSG_SE_DUMMY_OBJECT_EDIT_REQUESTED : function(){ return this.loadSE2CSS("MSG_SE_DUMMY_OBJECT_EDIT_REQUESTED", arguments); }, $BEFORE_TOGGLE_DBATTACHMENT_LAYER : function(){ return this.loadSE2CSS("TOGGLE_DBATTACHMENT_LAYER", arguments); }, $BEFORE_SHOW_WRITE_REVIEW_DESIGN_SELECT_LAYER : function(){ this.loadSE2CSS(); }, $BEFORE_OPEN_QE_LAYER : function(){ this.loadSE2CSS(); }, $BEFORE_TOGGLE_TOOLBAR_ACTIVE_LAYER : function(){ return this.loadSE2CSS("TOGGLE_TOOLBAR_ACTIVE_LAYER", arguments); }, $BEFORE_SHOW_TOOLBAR_ACTIVE_LAYER : function(){ return this.loadSE2CSS("SHOW_TOOLBAR_ACTIVE_LAYER", arguments); }, $BEFORE_SHOW_ACTIVE_LAYER : function(){ this.loadSE2CSS(); }, $BEFORE_SHOW_DIALOG_LAYER : function(){ this.loadSE2CSS(); }, $BEFORE_TOGGLE_ITEM_LAYER : function(){ return this.loadSE2CSS("TOGGLE_ITEM_LAYER", arguments); }, */ // if a rendering bug occurs in IE, pass sMsg and oArgs to give some delay before the message is processed. loadSE2CSS : function(sMsg, oArgs){ if(this.bCssLoaded){return true;} this.bCssLoaded = true; var fnCallback = null; if(sMsg){ fnCallback = jindo.$Fn(this.oApp.exec, this.oApp).bind(sMsg, oArgs); } //nhn.husky.SE2M_Utils.loadCSS("css/smart_editor2.css"); nhn.husky.SE2M_Utils.loadCSS(this.htOptions.sCSSBaseURI+"/smart_editor2_items.css", fnCallback); return false; } }); //} /** * @name nhn.husky.SE2B_Customize_ToolBar * @description ๋ฉ”์ผ ์ „์šฉ ์ปค์Šคํ„ฐ๋งˆ์ด์ฆˆ ํˆด๋ฐ”๋กœ ๋”๋ณด๊ธฐ ๋ ˆ์ด์–ด ๊ด€๋ฆฌ๋งŒ์„ ๋‹ด๋‹นํ•˜๊ณ  ์žˆ์Œ. * @class * @author HyeKyoung,NHN AjaxUI Lab, CMD Division * @version 0.1.0 * @since */ nhn.husky.SE2B_Customize_ToolBar = jindo.$Class(/** @lends nhn.husky.SE2B_Customize_ToolBar */{ name : "SE2B_Customize_ToolBar", /** * @constructs * @param {Object} oAppContainer ์—๋””ํ„ฐ๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ์ปจํ…Œ์ด๋„ˆ */ $init : function(oAppContainer) { this._assignHTMLElements(oAppContainer); }, $BEFORE_MSG_APP_READY : function(){ this._addEventMoreButton(); }, /** * @private * @description DOM์—˜๋ฆฌ๋จผํŠธ๋ฅผ ์ˆ˜์ง‘ํ•˜๋Š” ๋ฉ”์†Œ๋“œ * @param {Object} oAppContainer ํˆด๋ฐ” ํฌํ•จ ์—๋””ํ„ฐ๋ฅผ ๊ฐ์‹ธ๊ณ  ์žˆ๋Š” div ์—˜๋ฆฌ๋จผํŠธ */ _assignHTMLElements : function(oAppContainer) { this.oAppContainer = oAppContainer; this.elTextToolBarArea = jindo.$$.getSingle("div.se2_tool"); this.elTextMoreButton = jindo.$$.getSingle("button.se2_text_tool_more", this.elTextToolBarArea); this.elTextMoreButtonParent = this.elTextMoreButton.parentNode; this.welTextMoreButtonParent = jindo.$Element(this.elTextMoreButtonParent); this.elMoreLayer = jindo.$$.getSingle("div.se2_sub_text_tool"); }, _addEventMoreButton : function (){ this.oApp.registerBrowserEvent(this.elTextMoreButton, "click", "EVENT_CLICK_EXPAND_VIEW"); this.oApp.registerBrowserEvent(this.elMoreLayer, "click", "EVENT_CLICK_EXPAND_VIEW"); }, $ON_EVENT_CLICK_EXPAND_VIEW : function(weEvent){ this.oApp.exec("TOGGLE_EXPAND_VIEW", [this.elTextMoreButton]); weEvent.stop(); }, $ON_TOGGLE_EXPAND_VIEW : function(){ if(!this.welTextMoreButtonParent.hasClass("active")){ this.oApp.exec("SHOW_EXPAND_VIEW"); } else { this.oApp.exec("HIDE_EXPAND_VIEW"); } }, $ON_CHANGE_EDITING_MODE : function(sMode){ if(sMode != "WYSIWYG"){ this.elTextMoreButton.disabled =true; this.welTextMoreButtonParent.removeClass("active"); this.oApp.exec("HIDE_EXPAND_VIEW"); }else{ this.elTextMoreButton.disabled =false; } }, $AFTER_SHOW_ACTIVE_LAYER : function(){ this.oApp.exec("HIDE_EXPAND_VIEW"); }, $AFTER_SHOW_DIALOG_LAYER : function(){ this.oApp.exec("HIDE_EXPAND_VIEW"); }, $ON_SHOW_EXPAND_VIEW : function(){ this.welTextMoreButtonParent.addClass("active"); this.elMoreLayer.style.display = "block"; }, $ON_HIDE_EXPAND_VIEW : function(){ this.welTextMoreButtonParent.removeClass("active"); this.elMoreLayer.style.display = "none"; }, /** * CHANGE_EDITING_MODE๋ชจ๋“œ ์ดํ›„์— ํ˜ธ์ถœ๋˜์–ด์•ผ ํ•จ. * WYSIWYG ๋ชจ๋“œ๊ฐ€ ํ™œ์„ฑํ™”๋˜๊ธฐ ์ „์— ํ˜ธ์ถœ์ด ๋˜๋ฉด APPLY_FONTCOLOR์—์„œ ์—๋Ÿฌ ๋ฐœ์ƒ. */ $ON_RESET_TOOLBAR : function(){ if(this.oApp.getEditingMode() !== "WYSIWYG"){ return; } //์ŠคํŽ ์ฒดํฌ ๋‹ซ๊ธฐ this.oApp.exec("END_SPELLCHECK"); //์—ด๋ฆฐ ํŒ์—…์„ ๋‹ซ๊ธฐ ์œ„ํ•ด์„œ this.oApp.exec("DISABLE_ALL_UI"); this.oApp.exec("ENABLE_ALL_UI"); //๊ธ€์ž์ƒ‰๊ณผ ๊ธ€์ž ๋ฐฐ๊ฒฝ์ƒ‰์„ ์ œ์™ธํ•œ ์„ธํŒ… this.oApp.exec("RESET_STYLE_STATUS"); this.oApp.exec("CHECK_STYLE_CHANGE"); //์ตœ๊ทผ ์‚ฌ์šฉํ•œ ๊ธ€์ž์ƒ‰ ์…‹ํŒ…. this.oApp.exec("APPLY_FONTCOLOR", ["#000000"]); //๋”๋ณด๊ธฐ ์˜์—ญ ๋‹ซ๊ธฐ. this.oApp.exec("HIDE_EXPAND_VIEW"); } }); if(typeof window.nhn=='undefined'){window.nhn = {};} /** * @fileOverview This file contains a message mapping(Korean), which is used to map the message code to the actual message * @name husky_SE2B_Lang_ko_KR.js * @ unescape */ var oMessageMap = { 'SE_EditingAreaManager.onExit' : '๋‚ด์šฉ์ด ๋ณ€๊ฒฝ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.', 'SE_Color.invalidColorCode' : '์ƒ‰์ƒ ์ฝ”๋“œ๋ฅผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”. \n\n ์˜ˆ) #000000, #FF0000, #FFFFFF, #ffffff, ffffff', 'SE_Hyperlink.invalidURL' : '์ž…๋ ฅํ•˜์‹  URL์ด ์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์Šต๋‹ˆ๋‹ค.', 'SE_FindReplace.keywordMissing' : '์ฐพ์œผ์‹ค ๋‹จ์–ด๋ฅผ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”.', 'SE_FindReplace.keywordNotFound' : '์ฐพ์œผ์‹ค ๋‹จ์–ด๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.', 'SE_FindReplace.replaceAllResultP1' : '์ผ์น˜ํ•˜๋Š” ๋‚ด์šฉ์ด ์ด ', 'SE_FindReplace.replaceAllResultP2' : '๊ฑด ๋ฐ”๋€Œ์—ˆ์Šต๋‹ˆ๋‹ค.', 'SE_FindReplace.notSupportedBrowser' : 'ํ˜„์žฌ ์‚ฌ์šฉํ•˜๊ณ  ๊ณ„์‹  ๋ธŒ๋ผ์šฐ์ €์—์„œ๋Š” ์‚ฌ์šฉํ•˜์‹ค์ˆ˜ ์—†๋Š” ๊ธฐ๋Šฅ์ž…๋‹ˆ๋‹ค.\n\n์ด์šฉ์— ๋ถˆํŽธ์„ ๋“œ๋ ค ์ฃ„์†กํ•ฉ๋‹ˆ๋‹ค.', 'SE_FindReplace.replaceKeywordNotFound' : '๋ฐ”๋€” ๋‹จ์–ด๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค', 'SE_LineHeight.invalidLineHeight' : '์ž˜๋ชป๋œ ๊ฐ’์ž…๋‹ˆ๋‹ค.', 'SE_Footnote.defaultText' : '๊ฐ์ฃผ๋‚ด์šฉ์„ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”', 'SE.failedToLoadFlash' : 'ํ”Œ๋ž˜์‹œ๊ฐ€ ์ฐจ๋‹จ๋˜์–ด ์žˆ์–ด ํ•ด๋‹น ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.', 'SE2M_EditingModeChanger.confirmTextMode' : 'ํ…์ŠคํŠธ ๋ชจ๋“œ๋กœ ์ „ํ™˜ํ•˜๋ฉด ์ž‘์„ฑ๋œ ๋‚ด์šฉ์€ ์œ ์ง€๋˜๋‚˜, \n\n๊ธ€๊ผด ๋“ฑ์˜ ํŽธ์ง‘ํšจ๊ณผ์™€ ์ด๋ฏธ์ง€ ๋“ฑ์˜ ์ฒจ๋ถ€๋‚ด์šฉ์ด ๋ชจ๋‘ ์‚ฌ๋ผ์ง€๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.\n\n์ „ํ™˜ํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?', 'SE2M_FontNameWithLayerUI.sSampleText' : '๊ฐ€๋‚˜๋‹ค๋ผ' };
import React from 'react'; import Button from '../../src/Button'; import FABButton from '../../src/FABButton'; import IconButton from '../../src/IconButton'; import Icon from '../../src/Icon'; class Demo extends React.Component { render() { return ( <div> <h1>Colored FAB Button</h1> <p>Colored FAB button</p> <FABButton colored={true} ripple={false}> <Icon name="add" /> </FABButton> <p>Colored FAB button with ripple</p> <FABButton colored={true}> <Icon name="add" /> </FABButton> <h1>FAB Button</h1> <p>FAB Button</p> <FABButton ripple={false}> <Icon name="add" /> </FABButton> <p>FAB Button with ripple</p> <FABButton> <Icon name="add" /> </FABButton> <p>Disabled FAB Button</p> <FABButton disabled={true}> <Icon name="add" /> </FABButton> <h1>Raised Button</h1> <p>Raised button</p> <Button raised={true} ripple={false}>Button</Button> <p>Raised button with ripple</p> <Button raised={true}>Button</Button> <p>Raised disabled button</p> <Button raised={true} disabled={true}>Button</Button> <h1>Colored Raised Button</h1> <p>Raised button</p> <Button raised={true} colored={true} ripple={false}>Button</Button> <p>Accent-colored raised button</p> <Button raised={true} accent={true} ripple={false}>Button</Button> <p>Accent-colored raised button with ripple</p> <Button raised={true} accent={true}>Button</Button> <h1>Flat button</h1> <p>Flat button</p> <Button ripple={false}>Button</Button> <p>Flat button with ripple</p> <Button>Button</Button> <p>Disabled Flat button</p> <Button disabled={true}>Button</Button> <h1>Colored Flat button</h1> <p>Primary-colored Flat button</p> <Button primary={true} ripple={false}>Button</Button> <p>Accent-colored flat button</p> <Button accent={true} ripple={false}>Button</Button> <h1>Icon Button</h1> <p>Icon button</p> <IconButton name="mood" ripple={false} /> <p>Colored Icon button</p> <IconButton name="mood" colored={true} ripple={false} /> <h1>Mini FAB Button</h1> <p>Mini FAB Button</p> <FABButton mini={true}> <Icon name="add" /> </FABButton> <p>Colored Mini FAB Button</p> <FABButton mini={true} colored={true}> <Icon name="add" /> </FABButton> </div> ); } } React.render(<Demo />, document.getElementById('app'));
var moment = require("../../index"); exports["Asia/Aden"] = { "1949" : function (t) { t.equal(moment("1949-12-31T21:00:05+00:00").tz("Asia/Aden").format("HH:mm:ss"), "23:59:59", "1949-12-31T21:00:05+00:00 should be 23:59:59 LMT"); t.equal(moment("1949-12-31T21:00:06+00:00").tz("Asia/Aden").format("HH:mm:ss"), "00:00:06", "1949-12-31T21:00:06+00:00 should be 00:00:06 AST"); t.equal(moment("1949-12-31T21:00:05+00:00").tz("Asia/Aden").zone(), -10794 / 60, "1949-12-31T21:00:05+00:00 should be -10794 / 60 minutes offset in LMT"); t.equal(moment("1949-12-31T21:00:06+00:00").tz("Asia/Aden").zone(), -180, "1949-12-31T21:00:06+00:00 should be -180 minutes offset in AST"); t.done(); } };
/*jshint node:true, laxbreak:true */ 'use strict'; module.exports = function(grunt) { grunt.config.merge({ /** * Turns any JSON files into JavaScript files. */ json: { jsonToJS: { options: { namespace: 'JSON_DATA', includePath: false, processName: function(filename) { return filename.toLowerCase(); } }, src: ['<%= env.DIR_SRC %>/assets/data/**/*.json'], dest: '<%= env.DIR_SRC %>/assets/scripts/json.js' } } }); grunt.registerTask('jsonToJS', [ 'json:jsonToJS' ]); };
/** * optimize.js - frame optimizer for ttystudio * Copyright (c) 2015, Christopher Jeffrey (MIT License). * https://github.com/chjj/ttystudio */ /** * Optimizer */ function Optimizer(options) { this.options = options || {}; } Optimizer.prototype.reset = function(frame) { delete this.damage; }; Optimizer.prototype.offset = function(frame) { var bmp = frame.data || frame , left = null , top = null , right = null , bottom = null , x , y , cell , hash; if (!this.damage) { this.damage = []; for (y = 0; y < bmp.length; y++) { bline = []; for (x = 0; x < bmp[y].length; x++) { bline.push(null); } this.damage.push(bline); } } for (y = 0; y < bmp.length; y++) { cline = bmp[y]; for (x = 0; x < cline.length; x++) { cell = cline[x]; hash = (cell.r << 24) | (cell.g << 16) | (cell.b << 8) | (cell.a << 0); if (this.damage[y][x] !== hash) { if (left === null) left = x; else if (x < left) left = x; if (top === null) top = y; } } } for (y = bmp.length - 1; y >= 0; y--) { cline = bmp[y]; for (x = cline.length - 1; x >= 0; x--) { cell = cline[x]; hash = (cell.r << 24) | (cell.g << 16) | (cell.b << 8) | (cell.a << 0); if (this.damage[y][x] !== hash) { if (right === null) right = x + 1; else if (x + 1 > right) right = x + 1; if (bottom === null) bottom = y + 1; } this.damage[y][x] = hash; } } if (left === null) left = 0; if (right === null) right = 1; if (top === null) top = 0; if (bottom === null) bottom = 1; if (left > right) { throw new Error('optimizer failed: left > right'); } if (top > bottom) { throw new Error('optimizer failed: top > bottom'); } bmp = bmp.slice(top, bottom); for (y = 0; y < bmp.length; y++) { bmp[y] = bmp[y].slice(left, right); } this.log('frame dimensions: %dx%d', bmp[0].length, bmp.length); return { left: left, top: top, data: bmp, optimized: true }; }; Optimizer.prototype.log = function() { if (!this.options.log) return; return console.error.apply(console, arguments); }; /** * Expose */ module.exports = Optimizer;
๏ปฟ/*!@license * Infragistics.Web.ClientUI data source localization resources 15.1.20151.1005 * * Copyright (c) 2011-2015 Infragistics Inc. * * http://www.infragistics.com/ * */ /*global jQuery */ (function ($) { $.ig = $.ig || {}; if (!$.ig.DataSourceLocale) { $.ig.DataSourceLocale = {}; $.extend($.ig.DataSourceLocale, { locale: { invalidDataSource: "La source de donnรฉes fournie est invalide. Il s'agit d'un scalaire.", unknownDataSource: "Impossible de dรฉterminer le type de source de donnรฉes. Veuillez prรฉciser s'il s'agit de donnรฉes JSON ou XML.", errorParsingArrays: "Une erreur s'est produite lors de l'analyse syntaxique des donnรฉes de tableaux et de l'application du schรฉma de donnรฉes dรฉfiniย : ", errorParsingJson: "Une erreur s'est produite lors de l'analyse syntaxique des donnรฉes JSON et de l'application du schรฉma de donnรฉes dรฉfiniย : ", errorParsingXml: "Une erreur s'est produite lors de l'analyse syntaxique des donnรฉes XML et de l'application du schรฉma de donnรฉes dรฉfiniย : ", errorParsingHtmlTable: "Une erreur s'est produite lors de l'extraction des donnรฉes du tableau HTML et lors de l'application du schรฉmaย : ", errorExpectedTbodyParameter: "Un corps ou un tableau รฉtait attendu comme paramรจtre.", errorTableWithIdNotFound: "Le tableau HTML avec l'ID suivant n'a pas รฉtรฉ trouvรฉย : ", errorParsingHtmlTableNoSchema: "Une erreur s'est produite lors de l'analyse syntaxique du tableau DOMย : ", errorParsingJsonNoSchema: "Une erreur s'est produite lors de l'analyse syntaxique/l'รฉvaluation de la chaรฎne JSONย : ", errorParsingXmlNoSchema: "Une erreur s'est produite lors de l'analyse syntaxique de la chaรฎne XMLย : ", errorXmlSourceWithoutSchema: "La source de donnรฉes fournie est un document xml, mais il n'existe pas de schรฉma de donnรฉes dรฉfini ($.IgDataSchema) ", errorUnrecognizedFilterCondition: " La condition de filtre spรฉcifiรฉe n'a pas รฉtรฉ reconnueย : ", errorRemoteRequest: "La requรชte ร  distance pour rรฉcupรฉrer les donnรฉes a รฉchouรฉย : ", errorSchemaMismatch: "Les donnรฉes entrรฉes ne coรฏncident pas avec le schรฉma, le champ suivant n'a pas pu รชtre cartographiรฉย : ", errorSchemaFieldCountMismatch: "Les donnรฉes entrรฉes ne coรฏncident pas avec le schรฉma en termes de nombre de champs. ", errorUnrecognizedResponseType: "Le type de rรฉponse n'a pas รฉtรฉ dรฉfini correctement ou il รฉtait impossible de le dรฉtecter automatiquement. Veuillez dรฉfinir settings.responseDataType et/ou settings.responseContentType.", hierarchicalTablesNotSupported: "Les tableaux ne sont pas pris en charge pour HierarchicalSchema", cannotBuildTemplate: "Le modรจle jQuery n'a pas pu รชtre crรฉรฉ. Aucune archive prรฉsente dans la source de donnรฉes et aucune colonne dรฉfinie.", unrecognizedCondition: "Condition de filtrage non reconnue dans l'expression suivanteย : ", fieldMismatch: "L'expression suivante contient un champ ou une condition de filtrage invalideย : ", noSortingFields: "Aucun champ spรฉcifiรฉ. Spรฉcifiez au moins un champ de tri pour utiliser l'option de tri ().", filteringNoSchema: "Aucun schรฉma/champ spรฉcifiรฉ. Spรฉcifiez un schรฉma avec des dรฉfinitions et types de champs pour pouvoir filtrer la source de donnรฉes." } }); } })(jQuery);
'use strict'; // ------------------------------------------------------------------------------ // Requirements // ------------------------------------------------------------------------------ var rule = require('../rules/no-jquery-angularelement'); var RuleTester = require('eslint').RuleTester; var commonFalsePositives = require('./utils/commonFalsePositives'); // ------------------------------------------------------------------------------ // Tests // ------------------------------------------------------------------------------ var eslintTester = new RuleTester(); eslintTester.run('no-jquery-angularelement', rule, { valid: [ 'angular.element("#id")' ].concat(commonFalsePositives), invalid: [ {code: '$(angular.element("#id"))', errors: [{message: 'angular.element returns already a jQLite element. No need to wrap with the jQuery object'}]}, {code: 'jQuery(angular.element("#id"))', errors: [{message: 'angular.element returns already a jQLite element. No need to wrap with the jQuery object'}]} ] });
//------------------------------------------------------------------------------------------------------- // Copyright (C) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. //------------------------------------------------------------------------------------------------------- function write(v) { WScript.Echo(v + ""); } function foo() {} write(new Number(+0) >> new Number(+0)); write(new Number(+0) >> new Number(-0)); write(new Number(+0) >> new Number(0)); write(new Number(+0) >> new Number(0.0)); write(new Number(+0) >> new Number(-0.0)); write(new Number(+0) >> new Number(+0.0)); write(new Number(+0) >> new Number(1)); write(new Number(+0) >> new Number(10)); write(new Number(+0) >> new Number(10.0)); write(new Number(+0) >> new Number(10.1)); write(new Number(+0) >> new Number(-1)); write(new Number(+0) >> new Number(-10)); write(new Number(+0) >> new Number(-10.0)); write(new Number(+0) >> new Number(-10.1)); write(new Number(+0) >> new Number(Number.MAX_VALUE)); write(new Number(+0) >> new Number(Number.MIN_VALUE)); write(new Number(+0) >> new Number(Number.NaN)); write(new Number(+0) >> new Number(Number.POSITIVE_INFINITY)); write(new Number(+0) >> new Number(Number.NEGATIVE_INFINITY)); write(new Number(+0) >> ''); write(new Number(+0) >> 0xa); write(new Number(+0) >> 04); write(new Number(+0) >> 'hello'); write(new Number(+0) >> 'hel' + 'lo'); write(new Number(+0) >> String('')); write(new Number(+0) >> String('hello')); write(new Number(+0) >> String('h' + 'ello')); write(new Number(+0) >> new String('')); write(new Number(+0) >> new String('hello')); write(new Number(+0) >> new String('he' + 'llo')); write(new Number(+0) >> new Object()); write(new Number(+0) >> new Object()); write(new Number(+0) >> [1, 2, 3]); write(new Number(+0) >> [1 ,2 , 3]); write(new Number(+0) >> new Array(3)); write(new Number(+0) >> Array(3)); write(new Number(+0) >> new Array(1 ,2 ,3)); write(new Number(+0) >> Array(1)); write(new Number(+0) >> foo); write(new Number(-0) >> undefined); write(new Number(-0) >> null); write(new Number(-0) >> true); write(new Number(-0) >> false); write(new Number(-0) >> Boolean(true)); write(new Number(-0) >> Boolean(false)); write(new Number(-0) >> new Boolean(true)); write(new Number(-0) >> new Boolean(false)); write(new Number(-0) >> NaN); write(new Number(-0) >> +0); write(new Number(-0) >> -0); write(new Number(-0) >> 0); write(new Number(-0) >> 0.0); write(new Number(-0) >> -0.0); write(new Number(-0) >> +0.0); write(new Number(-0) >> 1); write(new Number(-0) >> 10); write(new Number(-0) >> 10.0); write(new Number(-0) >> 10.1); write(new Number(-0) >> -1); write(new Number(-0) >> -10); write(new Number(-0) >> -10.0); write(new Number(-0) >> -10.1); write(new Number(-0) >> Number.MAX_VALUE); write(new Number(-0) >> Number.MIN_VALUE); write(new Number(-0) >> Number.NaN); write(new Number(-0) >> Number.POSITIVE_INFINITY); write(new Number(-0) >> Number.NEGATIVE_INFINITY); write(new Number(-0) >> new Number(NaN)); write(new Number(-0) >> new Number(+0)); write(new Number(-0) >> new Number(-0)); write(new Number(-0) >> new Number(0)); write(new Number(-0) >> new Number(0.0)); write(new Number(-0) >> new Number(-0.0)); write(new Number(-0) >> new Number(+0.0)); write(new Number(-0) >> new Number(1)); write(new Number(-0) >> new Number(10)); write(new Number(-0) >> new Number(10.0)); write(new Number(-0) >> new Number(10.1)); write(new Number(-0) >> new Number(-1)); write(new Number(-0) >> new Number(-10)); write(new Number(-0) >> new Number(-10.0)); write(new Number(-0) >> new Number(-10.1)); write(new Number(-0) >> new Number(Number.MAX_VALUE)); write(new Number(-0) >> new Number(Number.MIN_VALUE)); write(new Number(-0) >> new Number(Number.NaN)); write(new Number(-0) >> new Number(Number.POSITIVE_INFINITY)); write(new Number(-0) >> new Number(Number.NEGATIVE_INFINITY)); write(new Number(-0) >> ''); write(new Number(-0) >> 0xa); write(new Number(-0) >> 04); write(new Number(-0) >> 'hello'); write(new Number(-0) >> 'hel' + 'lo'); write(new Number(-0) >> String('')); write(new Number(-0) >> String('hello')); write(new Number(-0) >> String('h' + 'ello')); write(new Number(-0) >> new String('')); write(new Number(-0) >> new String('hello')); write(new Number(-0) >> new String('he' + 'llo')); write(new Number(-0) >> new Object()); write(new Number(-0) >> new Object()); write(new Number(-0) >> [1, 2, 3]); write(new Number(-0) >> [1 ,2 , 3]); write(new Number(-0) >> new Array(3)); write(new Number(-0) >> Array(3)); write(new Number(-0) >> new Array(1 ,2 ,3)); write(new Number(-0) >> Array(1)); write(new Number(-0) >> foo); write(new Number(0) >> undefined); write(new Number(0) >> null); write(new Number(0) >> true); write(new Number(0) >> false); write(new Number(0) >> Boolean(true)); write(new Number(0) >> Boolean(false)); write(new Number(0) >> new Boolean(true)); write(new Number(0) >> new Boolean(false)); write(new Number(0) >> NaN); write(new Number(0) >> +0); write(new Number(0) >> -0); write(new Number(0) >> 0); write(new Number(0) >> 0.0); write(new Number(0) >> -0.0); write(new Number(0) >> +0.0); write(new Number(0) >> 1); write(new Number(0) >> 10); write(new Number(0) >> 10.0); write(new Number(0) >> 10.1); write(new Number(0) >> -1); write(new Number(0) >> -10); write(new Number(0) >> -10.0); write(new Number(0) >> -10.1); write(new Number(0) >> Number.MAX_VALUE); write(new Number(0) >> Number.MIN_VALUE); write(new Number(0) >> Number.NaN); write(new Number(0) >> Number.POSITIVE_INFINITY); write(new Number(0) >> Number.NEGATIVE_INFINITY); write(new Number(0) >> new Number(NaN)); write(new Number(0) >> new Number(+0)); write(new Number(0) >> new Number(-0)); write(new Number(0) >> new Number(0)); write(new Number(0) >> new Number(0.0)); write(new Number(0) >> new Number(-0.0)); write(new Number(0) >> new Number(+0.0)); write(new Number(0) >> new Number(1)); write(new Number(0) >> new Number(10)); write(new Number(0) >> new Number(10.0)); write(new Number(0) >> new Number(10.1)); write(new Number(0) >> new Number(-1)); write(new Number(0) >> new Number(-10)); write(new Number(0) >> new Number(-10.0)); write(new Number(0) >> new Number(-10.1)); write(new Number(0) >> new Number(Number.MAX_VALUE)); write(new Number(0) >> new Number(Number.MIN_VALUE)); write(new Number(0) >> new Number(Number.NaN)); write(new Number(0) >> new Number(Number.POSITIVE_INFINITY)); write(new Number(0) >> new Number(Number.NEGATIVE_INFINITY)); write(new Number(0) >> ''); write(new Number(0) >> 0xa); write(new Number(0) >> 04); write(new Number(0) >> 'hello'); write(new Number(0) >> 'hel' + 'lo'); write(new Number(0) >> String('')); write(new Number(0) >> String('hello')); write(new Number(0) >> String('h' + 'ello')); write(new Number(0) >> new String('')); write(new Number(0) >> new String('hello')); write(new Number(0) >> new String('he' + 'llo')); write(new Number(0) >> new Object()); write(new Number(0) >> new Object()); write(new Number(0) >> [1, 2, 3]); write(new Number(0) >> [1 ,2 , 3]); write(new Number(0) >> new Array(3)); write(new Number(0) >> Array(3)); write(new Number(0) >> new Array(1 ,2 ,3)); write(new Number(0) >> Array(1)); write(new Number(0) >> foo); write(new Number(0.0) >> undefined); write(new Number(0.0) >> null); write(new Number(0.0) >> true); write(new Number(0.0) >> false); write(new Number(0.0) >> Boolean(true)); write(new Number(0.0) >> Boolean(false)); write(new Number(0.0) >> new Boolean(true)); write(new Number(0.0) >> new Boolean(false)); write(new Number(0.0) >> NaN); write(new Number(0.0) >> +0); write(new Number(0.0) >> -0); write(new Number(0.0) >> 0); write(new Number(0.0) >> 0.0); write(new Number(0.0) >> -0.0); write(new Number(0.0) >> +0.0); write(new Number(0.0) >> 1); write(new Number(0.0) >> 10); write(new Number(0.0) >> 10.0); write(new Number(0.0) >> 10.1); write(new Number(0.0) >> -1); write(new Number(0.0) >> -10); write(new Number(0.0) >> -10.0); write(new Number(0.0) >> -10.1); write(new Number(0.0) >> Number.MAX_VALUE); write(new Number(0.0) >> Number.MIN_VALUE); write(new Number(0.0) >> Number.NaN); write(new Number(0.0) >> Number.POSITIVE_INFINITY); write(new Number(0.0) >> Number.NEGATIVE_INFINITY); write(new Number(0.0) >> new Number(NaN)); write(new Number(0.0) >> new Number(+0)); write(new Number(0.0) >> new Number(-0)); write(new Number(0.0) >> new Number(0)); write(new Number(0.0) >> new Number(0.0)); write(new Number(0.0) >> new Number(-0.0)); write(new Number(0.0) >> new Number(+0.0)); write(new Number(0.0) >> new Number(1)); write(new Number(0.0) >> new Number(10)); write(new Number(0.0) >> new Number(10.0)); write(new Number(0.0) >> new Number(10.1)); write(new Number(0.0) >> new Number(-1)); write(new Number(0.0) >> new Number(-10)); write(new Number(0.0) >> new Number(-10.0)); write(new Number(0.0) >> new Number(-10.1)); write(new Number(0.0) >> new Number(Number.MAX_VALUE)); write(new Number(0.0) >> new Number(Number.MIN_VALUE)); write(new Number(0.0) >> new Number(Number.NaN)); write(new Number(0.0) >> new Number(Number.POSITIVE_INFINITY)); write(new Number(0.0) >> new Number(Number.NEGATIVE_INFINITY)); write(new Number(0.0) >> ''); write(new Number(0.0) >> 0xa); write(new Number(0.0) >> 04); write(new Number(0.0) >> 'hello'); write(new Number(0.0) >> 'hel' + 'lo'); write(new Number(0.0) >> String('')); write(new Number(0.0) >> String('hello')); write(new Number(0.0) >> String('h' + 'ello')); write(new Number(0.0) >> new String('')); write(new Number(0.0) >> new String('hello')); write(new Number(0.0) >> new String('he' + 'llo')); write(new Number(0.0) >> new Object()); write(new Number(0.0) >> new Object()); write(new Number(0.0) >> [1, 2, 3]); write(new Number(0.0) >> [1 ,2 , 3]); write(new Number(0.0) >> new Array(3)); write(new Number(0.0) >> Array(3)); write(new Number(0.0) >> new Array(1 ,2 ,3)); write(new Number(0.0) >> Array(1)); write(new Number(0.0) >> foo); write(new Number(-0.0) >> undefined); write(new Number(-0.0) >> null); write(new Number(-0.0) >> true); write(new Number(-0.0) >> false); write(new Number(-0.0) >> Boolean(true)); write(new Number(-0.0) >> Boolean(false)); write(new Number(-0.0) >> new Boolean(true)); write(new Number(-0.0) >> new Boolean(false)); write(new Number(-0.0) >> NaN); write(new Number(-0.0) >> +0); write(new Number(-0.0) >> -0); write(new Number(-0.0) >> 0); write(new Number(-0.0) >> 0.0); write(new Number(-0.0) >> -0.0); write(new Number(-0.0) >> +0.0); write(new Number(-0.0) >> 1); write(new Number(-0.0) >> 10); write(new Number(-0.0) >> 10.0); write(new Number(-0.0) >> 10.1); write(new Number(-0.0) >> -1); write(new Number(-0.0) >> -10); write(new Number(-0.0) >> -10.0); write(new Number(-0.0) >> -10.1); write(new Number(-0.0) >> Number.MAX_VALUE); write(new Number(-0.0) >> Number.MIN_VALUE); write(new Number(-0.0) >> Number.NaN); write(new Number(-0.0) >> Number.POSITIVE_INFINITY); write(new Number(-0.0) >> Number.NEGATIVE_INFINITY); write(new Number(-0.0) >> new Number(NaN)); write(new Number(-0.0) >> new Number(+0)); write(new Number(-0.0) >> new Number(-0)); write(new Number(-0.0) >> new Number(0)); write(new Number(-0.0) >> new Number(0.0)); write(new Number(-0.0) >> new Number(-0.0)); write(new Number(-0.0) >> new Number(+0.0)); write(new Number(-0.0) >> new Number(1)); write(new Number(-0.0) >> new Number(10)); write(new Number(-0.0) >> new Number(10.0)); write(new Number(-0.0) >> new Number(10.1)); write(new Number(-0.0) >> new Number(-1)); write(new Number(-0.0) >> new Number(-10)); write(new Number(-0.0) >> new Number(-10.0)); write(new Number(-0.0) >> new Number(-10.1)); write(new Number(-0.0) >> new Number(Number.MAX_VALUE)); write(new Number(-0.0) >> new Number(Number.MIN_VALUE)); write(new Number(-0.0) >> new Number(Number.NaN)); write(new Number(-0.0) >> new Number(Number.POSITIVE_INFINITY)); write(new Number(-0.0) >> new Number(Number.NEGATIVE_INFINITY)); write(new Number(-0.0) >> ''); write(new Number(-0.0) >> 0xa); write(new Number(-0.0) >> 04); write(new Number(-0.0) >> 'hello'); write(new Number(-0.0) >> 'hel' + 'lo'); write(new Number(-0.0) >> String('')); write(new Number(-0.0) >> String('hello')); write(new Number(-0.0) >> String('h' + 'ello')); write(new Number(-0.0) >> new String('')); write(new Number(-0.0) >> new String('hello')); write(new Number(-0.0) >> new String('he' + 'llo')); write(new Number(-0.0) >> new Object()); write(new Number(-0.0) >> new Object()); write(new Number(-0.0) >> [1, 2, 3]); write(new Number(-0.0) >> [1 ,2 , 3]); write(new Number(-0.0) >> new Array(3)); write(new Number(-0.0) >> Array(3)); write(new Number(-0.0) >> new Array(1 ,2 ,3)); write(new Number(-0.0) >> Array(1)); write(new Number(-0.0) >> foo); write(new Number(+0.0) >> undefined); write(new Number(+0.0) >> null); write(new Number(+0.0) >> true); write(new Number(+0.0) >> false); write(new Number(+0.0) >> Boolean(true)); write(new Number(+0.0) >> Boolean(false)); write(new Number(+0.0) >> new Boolean(true)); write(new Number(+0.0) >> new Boolean(false)); write(new Number(+0.0) >> NaN); write(new Number(+0.0) >> +0); write(new Number(+0.0) >> -0); write(new Number(+0.0) >> 0); write(new Number(+0.0) >> 0.0); write(new Number(+0.0) >> -0.0); write(new Number(+0.0) >> +0.0); write(new Number(+0.0) >> 1); write(new Number(+0.0) >> 10); write(new Number(+0.0) >> 10.0); write(new Number(+0.0) >> 10.1); write(new Number(+0.0) >> -1); write(new Number(+0.0) >> -10); write(new Number(+0.0) >> -10.0); write(new Number(+0.0) >> -10.1); write(new Number(+0.0) >> Number.MAX_VALUE); write(new Number(+0.0) >> Number.MIN_VALUE); write(new Number(+0.0) >> Number.NaN); write(new Number(+0.0) >> Number.POSITIVE_INFINITY); write(new Number(+0.0) >> Number.NEGATIVE_INFINITY); write(new Number(+0.0) >> new Number(NaN)); write(new Number(+0.0) >> new Number(+0)); write(new Number(+0.0) >> new Number(-0)); write(new Number(+0.0) >> new Number(0)); write(new Number(+0.0) >> new Number(0.0)); write(new Number(+0.0) >> new Number(-0.0)); write(new Number(+0.0) >> new Number(+0.0)); write(new Number(+0.0) >> new Number(1)); write(new Number(+0.0) >> new Number(10)); write(new Number(+0.0) >> new Number(10.0)); write(new Number(+0.0) >> new Number(10.1)); write(new Number(+0.0) >> new Number(-1)); write(new Number(+0.0) >> new Number(-10)); write(new Number(+0.0) >> new Number(-10.0)); write(new Number(+0.0) >> new Number(-10.1)); write(new Number(+0.0) >> new Number(Number.MAX_VALUE)); write(new Number(+0.0) >> new Number(Number.MIN_VALUE)); write(new Number(+0.0) >> new Number(Number.NaN)); write(new Number(+0.0) >> new Number(Number.POSITIVE_INFINITY)); write(new Number(+0.0) >> new Number(Number.NEGATIVE_INFINITY)); write(new Number(+0.0) >> ''); write(new Number(+0.0) >> 0xa); write(new Number(+0.0) >> 04); write(new Number(+0.0) >> 'hello'); write(new Number(+0.0) >> 'hel' + 'lo'); write(new Number(+0.0) >> String('')); write(new Number(+0.0) >> String('hello')); write(new Number(+0.0) >> String('h' + 'ello')); write(new Number(+0.0) >> new String('')); write(new Number(+0.0) >> new String('hello')); write(new Number(+0.0) >> new String('he' + 'llo')); write(new Number(+0.0) >> new Object()); write(new Number(+0.0) >> new Object()); write(new Number(+0.0) >> [1, 2, 3]); write(new Number(+0.0) >> [1 ,2 , 3]); write(new Number(+0.0) >> new Array(3)); write(new Number(+0.0) >> Array(3)); write(new Number(+0.0) >> new Array(1 ,2 ,3)); write(new Number(+0.0) >> Array(1)); write(new Number(+0.0) >> foo); write(new Number(1) >> undefined); write(new Number(1) >> null); write(new Number(1) >> true); write(new Number(1) >> false); write(new Number(1) >> Boolean(true)); write(new Number(1) >> Boolean(false)); write(new Number(1) >> new Boolean(true)); write(new Number(1) >> new Boolean(false)); write(new Number(1) >> NaN); write(new Number(1) >> +0); write(new Number(1) >> -0); write(new Number(1) >> 0); write(new Number(1) >> 0.0); write(new Number(1) >> -0.0); write(new Number(1) >> +0.0); write(new Number(1) >> 1); write(new Number(1) >> 10); write(new Number(1) >> 10.0); write(new Number(1) >> 10.1); write(new Number(1) >> -1); write(new Number(1) >> -10); write(new Number(1) >> -10.0); write(new Number(1) >> -10.1); write(new Number(1) >> Number.MAX_VALUE); write(new Number(1) >> Number.MIN_VALUE); write(new Number(1) >> Number.NaN); write(new Number(1) >> Number.POSITIVE_INFINITY); write(new Number(1) >> Number.NEGATIVE_INFINITY); write(new Number(1) >> new Number(NaN)); write(new Number(1) >> new Number(+0)); write(new Number(1) >> new Number(-0)); write(new Number(1) >> new Number(0)); write(new Number(1) >> new Number(0.0)); write(new Number(1) >> new Number(-0.0)); write(new Number(1) >> new Number(+0.0)); write(new Number(1) >> new Number(1)); write(new Number(1) >> new Number(10)); write(new Number(1) >> new Number(10.0)); write(new Number(1) >> new Number(10.1)); write(new Number(1) >> new Number(-1)); write(new Number(1) >> new Number(-10)); write(new Number(1) >> new Number(-10.0)); write(new Number(1) >> new Number(-10.1)); write(new Number(1) >> new Number(Number.MAX_VALUE)); write(new Number(1) >> new Number(Number.MIN_VALUE)); write(new Number(1) >> new Number(Number.NaN)); write(new Number(1) >> new Number(Number.POSITIVE_INFINITY)); write(new Number(1) >> new Number(Number.NEGATIVE_INFINITY)); write(new Number(1) >> ''); write(new Number(1) >> 0xa); write(new Number(1) >> 04); write(new Number(1) >> 'hello'); write(new Number(1) >> 'hel' + 'lo'); write(new Number(1) >> String('')); write(new Number(1) >> String('hello')); write(new Number(1) >> String('h' + 'ello')); write(new Number(1) >> new String('')); write(new Number(1) >> new String('hello')); write(new Number(1) >> new String('he' + 'llo')); write(new Number(1) >> new Object()); write(new Number(1) >> new Object()); write(new Number(1) >> [1, 2, 3]); write(new Number(1) >> [1 ,2 , 3]); write(new Number(1) >> new Array(3)); write(new Number(1) >> Array(3)); write(new Number(1) >> new Array(1 ,2 ,3)); write(new Number(1) >> Array(1)); write(new Number(1) >> foo); write(new Number(10) >> undefined); write(new Number(10) >> null); write(new Number(10) >> true); write(new Number(10) >> false); write(new Number(10) >> Boolean(true)); write(new Number(10) >> Boolean(false)); write(new Number(10) >> new Boolean(true)); write(new Number(10) >> new Boolean(false)); write(new Number(10) >> NaN); write(new Number(10) >> +0); write(new Number(10) >> -0); write(new Number(10) >> 0); write(new Number(10) >> 0.0); write(new Number(10) >> -0.0); write(new Number(10) >> +0.0); write(new Number(10) >> 1); write(new Number(10) >> 10); write(new Number(10) >> 10.0); write(new Number(10) >> 10.1); write(new Number(10) >> -1); write(new Number(10) >> -10); write(new Number(10) >> -10.0); write(new Number(10) >> -10.1); write(new Number(10) >> Number.MAX_VALUE); write(new Number(10) >> Number.MIN_VALUE); write(new Number(10) >> Number.NaN); write(new Number(10) >> Number.POSITIVE_INFINITY); write(new Number(10) >> Number.NEGATIVE_INFINITY); write(new Number(10) >> new Number(NaN)); write(new Number(10) >> new Number(+0)); write(new Number(10) >> new Number(-0)); write(new Number(10) >> new Number(0)); write(new Number(10) >> new Number(0.0)); write(new Number(10) >> new Number(-0.0)); write(new Number(10) >> new Number(+0.0)); write(new Number(10) >> new Number(1)); write(new Number(10) >> new Number(10)); write(new Number(10) >> new Number(10.0)); write(new Number(10) >> new Number(10.1)); write(new Number(10) >> new Number(-1)); write(new Number(10) >> new Number(-10)); write(new Number(10) >> new Number(-10.0)); write(new Number(10) >> new Number(-10.1)); write(new Number(10) >> new Number(Number.MAX_VALUE)); write(new Number(10) >> new Number(Number.MIN_VALUE)); write(new Number(10) >> new Number(Number.NaN)); write(new Number(10) >> new Number(Number.POSITIVE_INFINITY)); write(new Number(10) >> new Number(Number.NEGATIVE_INFINITY)); write(new Number(10) >> ''); write(new Number(10) >> 0xa); write(new Number(10) >> 04); write(new Number(10) >> 'hello'); write(new Number(10) >> 'hel' + 'lo'); write(new Number(10) >> String('')); write(new Number(10) >> String('hello')); write(new Number(10) >> String('h' + 'ello')); write(new Number(10) >> new String('')); write(new Number(10) >> new String('hello')); write(new Number(10) >> new String('he' + 'llo')); write(new Number(10) >> new Object()); write(new Number(10) >> new Object()); write(new Number(10) >> [1, 2, 3]); write(new Number(10) >> [1 ,2 , 3]); write(new Number(10) >> new Array(3)); write(new Number(10) >> Array(3)); write(new Number(10) >> new Array(1 ,2 ,3)); write(new Number(10) >> Array(1)); write(new Number(10) >> foo); write(new Number(10.0) >> undefined); write(new Number(10.0) >> null); write(new Number(10.0) >> true); write(new Number(10.0) >> false); write(new Number(10.0) >> Boolean(true)); write(new Number(10.0) >> Boolean(false)); write(new Number(10.0) >> new Boolean(true)); write(new Number(10.0) >> new Boolean(false)); write(new Number(10.0) >> NaN); write(new Number(10.0) >> +0); write(new Number(10.0) >> -0); write(new Number(10.0) >> 0); write(new Number(10.0) >> 0.0); write(new Number(10.0) >> -0.0); write(new Number(10.0) >> +0.0); write(new Number(10.0) >> 1); write(new Number(10.0) >> 10); write(new Number(10.0) >> 10.0); write(new Number(10.0) >> 10.1); write(new Number(10.0) >> -1); write(new Number(10.0) >> -10); write(new Number(10.0) >> -10.0); write(new Number(10.0) >> -10.1); write(new Number(10.0) >> Number.MAX_VALUE); write(new Number(10.0) >> Number.MIN_VALUE); write(new Number(10.0) >> Number.NaN); write(new Number(10.0) >> Number.POSITIVE_INFINITY); write(new Number(10.0) >> Number.NEGATIVE_INFINITY); write(new Number(10.0) >> new Number(NaN)); write(new Number(10.0) >> new Number(+0)); write(new Number(10.0) >> new Number(-0)); write(new Number(10.0) >> new Number(0)); write(new Number(10.0) >> new Number(0.0)); write(new Number(10.0) >> new Number(-0.0)); write(new Number(10.0) >> new Number(+0.0)); write(new Number(10.0) >> new Number(1)); write(new Number(10.0) >> new Number(10)); write(new Number(10.0) >> new Number(10.0)); write(new Number(10.0) >> new Number(10.1)); write(new Number(10.0) >> new Number(-1)); write(new Number(10.0) >> new Number(-10)); write(new Number(10.0) >> new Number(-10.0)); write(new Number(10.0) >> new Number(-10.1)); write(new Number(10.0) >> new Number(Number.MAX_VALUE)); write(new Number(10.0) >> new Number(Number.MIN_VALUE)); write(new Number(10.0) >> new Number(Number.NaN)); write(new Number(10.0) >> new Number(Number.POSITIVE_INFINITY)); write(new Number(10.0) >> new Number(Number.NEGATIVE_INFINITY)); write(new Number(10.0) >> ''); write(new Number(10.0) >> 0xa); write(new Number(10.0) >> 04); write(new Number(10.0) >> 'hello'); write(new Number(10.0) >> 'hel' + 'lo'); write(new Number(10.0) >> String('')); write(new Number(10.0) >> String('hello')); write(new Number(10.0) >> String('h' + 'ello')); write(new Number(10.0) >> new String('')); write(new Number(10.0) >> new String('hello')); write(new Number(10.0) >> new String('he' + 'llo')); write(new Number(10.0) >> new Object()); write(new Number(10.0) >> new Object()); write(new Number(10.0) >> [1, 2, 3]); write(new Number(10.0) >> [1 ,2 , 3]); write(new Number(10.0) >> new Array(3)); write(new Number(10.0) >> Array(3)); write(new Number(10.0) >> new Array(1 ,2 ,3)); write(new Number(10.0) >> Array(1)); write(new Number(10.0) >> foo); write(new Number(10.1) >> undefined); write(new Number(10.1) >> null); write(new Number(10.1) >> true); write(new Number(10.1) >> false); write(new Number(10.1) >> Boolean(true)); write(new Number(10.1) >> Boolean(false)); write(new Number(10.1) >> new Boolean(true)); write(new Number(10.1) >> new Boolean(false)); write(new Number(10.1) >> NaN); write(new Number(10.1) >> +0); write(new Number(10.1) >> -0); write(new Number(10.1) >> 0); write(new Number(10.1) >> 0.0); write(new Number(10.1) >> -0.0); write(new Number(10.1) >> +0.0); write(new Number(10.1) >> 1); write(new Number(10.1) >> 10); write(new Number(10.1) >> 10.0); write(new Number(10.1) >> 10.1); write(new Number(10.1) >> -1); write(new Number(10.1) >> -10); write(new Number(10.1) >> -10.0); write(new Number(10.1) >> -10.1); write(new Number(10.1) >> Number.MAX_VALUE); write(new Number(10.1) >> Number.MIN_VALUE); write(new Number(10.1) >> Number.NaN); write(new Number(10.1) >> Number.POSITIVE_INFINITY); write(new Number(10.1) >> Number.NEGATIVE_INFINITY); write(new Number(10.1) >> new Number(NaN)); write(new Number(10.1) >> new Number(+0)); write(new Number(10.1) >> new Number(-0)); write(new Number(10.1) >> new Number(0)); write(new Number(10.1) >> new Number(0.0)); write(new Number(10.1) >> new Number(-0.0)); write(new Number(10.1) >> new Number(+0.0)); write(new Number(10.1) >> new Number(1)); write(new Number(10.1) >> new Number(10)); write(new Number(10.1) >> new Number(10.0)); write(new Number(10.1) >> new Number(10.1)); write(new Number(10.1) >> new Number(-1)); write(new Number(10.1) >> new Number(-10)); write(new Number(10.1) >> new Number(-10.0)); write(new Number(10.1) >> new Number(-10.1)); write(new Number(10.1) >> new Number(Number.MAX_VALUE)); write(new Number(10.1) >> new Number(Number.MIN_VALUE)); write(new Number(10.1) >> new Number(Number.NaN)); write(new Number(10.1) >> new Number(Number.POSITIVE_INFINITY)); write(new Number(10.1) >> new Number(Number.NEGATIVE_INFINITY)); write(new Number(10.1) >> ''); write(new Number(10.1) >> 0xa); write(new Number(10.1) >> 04); write(new Number(10.1) >> 'hello'); write(new Number(10.1) >> 'hel' + 'lo'); write(new Number(10.1) >> String('')); write(new Number(10.1) >> String('hello')); write(new Number(10.1) >> String('h' + 'ello')); write(new Number(10.1) >> new String('')); write(new Number(10.1) >> new String('hello')); write(new Number(10.1) >> new String('he' + 'llo')); write(new Number(10.1) >> new Object()); write(new Number(10.1) >> new Object()); write(new Number(10.1) >> [1, 2, 3]); write(new Number(10.1) >> [1 ,2 , 3]); write(new Number(10.1) >> new Array(3)); write(new Number(10.1) >> Array(3)); write(new Number(10.1) >> new Array(1 ,2 ,3)); write(new Number(10.1) >> Array(1)); write(new Number(10.1) >> foo); write(new Number(-1) >> undefined); write(new Number(-1) >> null); write(new Number(-1) >> true); write(new Number(-1) >> false); write(new Number(-1) >> Boolean(true)); write(new Number(-1) >> Boolean(false)); write(new Number(-1) >> new Boolean(true)); write(new Number(-1) >> new Boolean(false)); write(new Number(-1) >> NaN); write(new Number(-1) >> +0); write(new Number(-1) >> -0); write(new Number(-1) >> 0); write(new Number(-1) >> 0.0); write(new Number(-1) >> -0.0); write(new Number(-1) >> +0.0); write(new Number(-1) >> 1); write(new Number(-1) >> 10); write(new Number(-1) >> 10.0); write(new Number(-1) >> 10.1); write(new Number(-1) >> -1); write(new Number(-1) >> -10); write(new Number(-1) >> -10.0); write(new Number(-1) >> -10.1); write(new Number(-1) >> Number.MAX_VALUE); write(new Number(-1) >> Number.MIN_VALUE); write(new Number(-1) >> Number.NaN); write(new Number(-1) >> Number.POSITIVE_INFINITY); write(new Number(-1) >> Number.NEGATIVE_INFINITY); write(new Number(-1) >> new Number(NaN)); write(new Number(-1) >> new Number(+0)); write(new Number(-1) >> new Number(-0)); write(new Number(-1) >> new Number(0)); write(new Number(-1) >> new Number(0.0)); write(new Number(-1) >> new Number(-0.0)); write(new Number(-1) >> new Number(+0.0)); write(new Number(-1) >> new Number(1)); write(new Number(-1) >> new Number(10)); write(new Number(-1) >> new Number(10.0)); write(new Number(-1) >> new Number(10.1)); write(new Number(-1) >> new Number(-1)); write(new Number(-1) >> new Number(-10)); write(new Number(-1) >> new Number(-10.0)); write(new Number(-1) >> new Number(-10.1)); write(new Number(-1) >> new Number(Number.MAX_VALUE)); write(new Number(-1) >> new Number(Number.MIN_VALUE)); write(new Number(-1) >> new Number(Number.NaN)); write(new Number(-1) >> new Number(Number.POSITIVE_INFINITY)); write(new Number(-1) >> new Number(Number.NEGATIVE_INFINITY)); write(new Number(-1) >> ''); write(new Number(-1) >> 0xa); write(new Number(-1) >> 04); write(new Number(-1) >> 'hello'); write(new Number(-1) >> 'hel' + 'lo'); write(new Number(-1) >> String('')); write(new Number(-1) >> String('hello')); write(new Number(-1) >> String('h' + 'ello')); write(new Number(-1) >> new String('')); write(new Number(-1) >> new String('hello')); write(new Number(-1) >> new String('he' + 'llo')); write(new Number(-1) >> new Object()); write(new Number(-1) >> new Object()); write(new Number(-1) >> [1, 2, 3]); write(new Number(-1) >> [1 ,2 , 3]); write(new Number(-1) >> new Array(3)); write(new Number(-1) >> Array(3)); write(new Number(-1) >> new Array(1 ,2 ,3)); write(new Number(-1) >> Array(1)); write(new Number(-1) >> foo); write(new Number(-10) >> undefined); write(new Number(-10) >> null); write(new Number(-10) >> true); write(new Number(-10) >> false); write(new Number(-10) >> Boolean(true)); write(new Number(-10) >> Boolean(false)); write(new Number(-10) >> new Boolean(true)); write(new Number(-10) >> new Boolean(false)); write(new Number(-10) >> NaN); write(new Number(-10) >> +0); write(new Number(-10) >> -0); write(new Number(-10) >> 0); write(new Number(-10) >> 0.0); write(new Number(-10) >> -0.0); write(new Number(-10) >> +0.0); write(new Number(-10) >> 1); write(new Number(-10) >> 10); write(new Number(-10) >> 10.0); write(new Number(-10) >> 10.1); write(new Number(-10) >> -1); write(new Number(-10) >> -10); write(new Number(-10) >> -10.0); write(new Number(-10) >> -10.1); write(new Number(-10) >> Number.MAX_VALUE); write(new Number(-10) >> Number.MIN_VALUE); write(new Number(-10) >> Number.NaN); write(new Number(-10) >> Number.POSITIVE_INFINITY); write(new Number(-10) >> Number.NEGATIVE_INFINITY); write(new Number(-10) >> new Number(NaN)); write(new Number(-10) >> new Number(+0)); write(new Number(-10) >> new Number(-0)); write(new Number(-10) >> new Number(0)); write(new Number(-10) >> new Number(0.0)); write(new Number(-10) >> new Number(-0.0)); write(new Number(-10) >> new Number(+0.0)); write(new Number(-10) >> new Number(1)); write(new Number(-10) >> new Number(10)); write(new Number(-10) >> new Number(10.0)); write(new Number(-10) >> new Number(10.1)); write(new Number(-10) >> new Number(-1)); write(new Number(-10) >> new Number(-10)); write(new Number(-10) >> new Number(-10.0)); write(new Number(-10) >> new Number(-10.1)); write(new Number(-10) >> new Number(Number.MAX_VALUE)); write(new Number(-10) >> new Number(Number.MIN_VALUE)); write(new Number(-10) >> new Number(Number.NaN)); write(new Number(-10) >> new Number(Number.POSITIVE_INFINITY)); write(new Number(-10) >> new Number(Number.NEGATIVE_INFINITY)); write(new Number(-10) >> ''); write(new Number(-10) >> 0xa); write(new Number(-10) >> 04); write(new Number(-10) >> 'hello'); write(new Number(-10) >> 'hel' + 'lo'); write(new Number(-10) >> String('')); write(new Number(-10) >> String('hello')); write(new Number(-10) >> String('h' + 'ello')); write(new Number(-10) >> new String('')); write(new Number(-10) >> new String('hello')); write(new Number(-10) >> new String('he' + 'llo')); write(new Number(-10) >> new Object()); write(new Number(-10) >> new Object()); write(new Number(-10) >> [1, 2, 3]); write(new Number(-10) >> [1 ,2 , 3]); write(new Number(-10) >> new Array(3)); write(new Number(-10) >> Array(3)); write(new Number(-10) >> new Array(1 ,2 ,3)); write(new Number(-10) >> Array(1)); write(new Number(-10) >> foo); write(new Number(-10.0) >> undefined); write(new Number(-10.0) >> null); write(new Number(-10.0) >> true); write(new Number(-10.0) >> false); write(new Number(-10.0) >> Boolean(true)); write(new Number(-10.0) >> Boolean(false)); write(new Number(-10.0) >> new Boolean(true)); write(new Number(-10.0) >> new Boolean(false)); write(new Number(-10.0) >> NaN); write(new Number(-10.0) >> +0); write(new Number(-10.0) >> -0); write(new Number(-10.0) >> 0); write(new Number(-10.0) >> 0.0); write(new Number(-10.0) >> -0.0); write(new Number(-10.0) >> +0.0); write(new Number(-10.0) >> 1); write(new Number(-10.0) >> 10); write(new Number(-10.0) >> 10.0); write(new Number(-10.0) >> 10.1); write(new Number(-10.0) >> -1); write(new Number(-10.0) >> -10); write(new Number(-10.0) >> -10.0); write(new Number(-10.0) >> -10.1); write(new Number(-10.0) >> Number.MAX_VALUE); write(new Number(-10.0) >> Number.MIN_VALUE); write(new Number(-10.0) >> Number.NaN); write(new Number(-10.0) >> Number.POSITIVE_INFINITY); write(new Number(-10.0) >> Number.NEGATIVE_INFINITY); write(new Number(-10.0) >> new Number(NaN)); write(new Number(-10.0) >> new Number(+0)); write(new Number(-10.0) >> new Number(-0)); write(new Number(-10.0) >> new Number(0)); write(new Number(-10.0) >> new Number(0.0)); write(new Number(-10.0) >> new Number(-0.0)); write(new Number(-10.0) >> new Number(+0.0)); write(new Number(-10.0) >> new Number(1)); write(new Number(-10.0) >> new Number(10)); write(new Number(-10.0) >> new Number(10.0)); write(new Number(-10.0) >> new Number(10.1)); write(new Number(-10.0) >> new Number(-1)); write(new Number(-10.0) >> new Number(-10)); write(new Number(-10.0) >> new Number(-10.0)); write(new Number(-10.0) >> new Number(-10.1)); write(new Number(-10.0) >> new Number(Number.MAX_VALUE)); write(new Number(-10.0) >> new Number(Number.MIN_VALUE)); write(new Number(-10.0) >> new Number(Number.NaN)); write(new Number(-10.0) >> new Number(Number.POSITIVE_INFINITY)); write(new Number(-10.0) >> new Number(Number.NEGATIVE_INFINITY)); write(new Number(-10.0) >> ''); write(new Number(-10.0) >> 0xa); write(new Number(-10.0) >> 04); write(new Number(-10.0) >> 'hello'); write(new Number(-10.0) >> 'hel' + 'lo'); write(new Number(-10.0) >> String('')); write(new Number(-10.0) >> String('hello')); write(new Number(-10.0) >> String('h' + 'ello')); write(new Number(-10.0) >> new String('')); write(new Number(-10.0) >> new String('hello')); write(new Number(-10.0) >> new String('he' + 'llo')); write(new Number(-10.0) >> new Object()); write(new Number(-10.0) >> new Object()); write(new Number(-10.0) >> [1, 2, 3]); write(new Number(-10.0) >> [1 ,2 , 3]); write(new Number(-10.0) >> new Array(3)); write(new Number(-10.0) >> Array(3)); write(new Number(-10.0) >> new Array(1 ,2 ,3)); write(new Number(-10.0) >> Array(1)); write(new Number(-10.0) >> foo); write(new Number(-10.1) >> undefined); write(new Number(-10.1) >> null); write(new Number(-10.1) >> true); write(new Number(-10.1) >> false); write(new Number(-10.1) >> Boolean(true)); write(new Number(-10.1) >> Boolean(false)); write(new Number(-10.1) >> new Boolean(true)); write(new Number(-10.1) >> new Boolean(false)); write(new Number(-10.1) >> NaN); write(new Number(-10.1) >> +0); write(new Number(-10.1) >> -0); write(new Number(-10.1) >> 0); write(new Number(-10.1) >> 0.0); write(new Number(-10.1) >> -0.0); write(new Number(-10.1) >> +0.0); write(new Number(-10.1) >> 1); write(new Number(-10.1) >> 10); write(new Number(-10.1) >> 10.0); write(new Number(-10.1) >> 10.1); write(new Number(-10.1) >> -1); write(new Number(-10.1) >> -10); write(new Number(-10.1) >> -10.0); write(new Number(-10.1) >> -10.1); write(new Number(-10.1) >> Number.MAX_VALUE); write(new Number(-10.1) >> Number.MIN_VALUE); write(new Number(-10.1) >> Number.NaN); write(new Number(-10.1) >> Number.POSITIVE_INFINITY); write(new Number(-10.1) >> Number.NEGATIVE_INFINITY); write(new Number(-10.1) >> new Number(NaN)); write(new Number(-10.1) >> new Number(+0)); write(new Number(-10.1) >> new Number(-0)); write(new Number(-10.1) >> new Number(0)); write(new Number(-10.1) >> new Number(0.0)); write(new Number(-10.1) >> new Number(-0.0)); write(new Number(-10.1) >> new Number(+0.0)); write(new Number(-10.1) >> new Number(1)); write(new Number(-10.1) >> new Number(10)); write(new Number(-10.1) >> new Number(10.0)); write(new Number(-10.1) >> new Number(10.1)); write(new Number(-10.1) >> new Number(-1)); write(new Number(-10.1) >> new Number(-10)); write(new Number(-10.1) >> new Number(-10.0)); write(new Number(-10.1) >> new Number(-10.1)); write(new Number(-10.1) >> new Number(Number.MAX_VALUE)); write(new Number(-10.1) >> new Number(Number.MIN_VALUE)); write(new Number(-10.1) >> new Number(Number.NaN)); write(new Number(-10.1) >> new Number(Number.POSITIVE_INFINITY)); write(new Number(-10.1) >> new Number(Number.NEGATIVE_INFINITY)); write(new Number(-10.1) >> ''); write(new Number(-10.1) >> 0xa); write(new Number(-10.1) >> 04); write(new Number(-10.1) >> 'hello'); write(new Number(-10.1) >> 'hel' + 'lo'); write(new Number(-10.1) >> String('')); write(new Number(-10.1) >> String('hello')); write(new Number(-10.1) >> String('h' + 'ello')); write(new Number(-10.1) >> new String('')); write(new Number(-10.1) >> new String('hello')); write(new Number(-10.1) >> new String('he' + 'llo')); write(new Number(-10.1) >> new Object()); write(new Number(-10.1) >> new Object()); write(new Number(-10.1) >> [1, 2, 3]); write(new Number(-10.1) >> [1 ,2 , 3]); write(new Number(-10.1) >> new Array(3)); write(new Number(-10.1) >> Array(3)); write(new Number(-10.1) >> new Array(1 ,2 ,3)); write(new Number(-10.1) >> Array(1)); write(new Number(-10.1) >> foo); write(new Number(Number.MAX_VALUE) >> undefined); write(new Number(Number.MAX_VALUE) >> null); write(new Number(Number.MAX_VALUE) >> true); write(new Number(Number.MAX_VALUE) >> false); write(new Number(Number.MAX_VALUE) >> Boolean(true)); write(new Number(Number.MAX_VALUE) >> Boolean(false)); write(new Number(Number.MAX_VALUE) >> new Boolean(true)); write(new Number(Number.MAX_VALUE) >> new Boolean(false)); write(new Number(Number.MAX_VALUE) >> NaN); write(new Number(Number.MAX_VALUE) >> +0); write(new Number(Number.MAX_VALUE) >> -0); write(new Number(Number.MAX_VALUE) >> 0); write(new Number(Number.MAX_VALUE) >> 0.0); write(new Number(Number.MAX_VALUE) >> -0.0); write(new Number(Number.MAX_VALUE) >> +0.0); write(new Number(Number.MAX_VALUE) >> 1); write(new Number(Number.MAX_VALUE) >> 10); write(new Number(Number.MAX_VALUE) >> 10.0); write(new Number(Number.MAX_VALUE) >> 10.1); write(new Number(Number.MAX_VALUE) >> -1); write(new Number(Number.MAX_VALUE) >> -10); write(new Number(Number.MAX_VALUE) >> -10.0); write(new Number(Number.MAX_VALUE) >> -10.1); write(new Number(Number.MAX_VALUE) >> Number.MAX_VALUE); write(new Number(Number.MAX_VALUE) >> Number.MIN_VALUE); write(new Number(Number.MAX_VALUE) >> Number.NaN); write(new Number(Number.MAX_VALUE) >> Number.POSITIVE_INFINITY); write(new Number(Number.MAX_VALUE) >> Number.NEGATIVE_INFINITY); write(new Number(Number.MAX_VALUE) >> new Number(NaN)); write(new Number(Number.MAX_VALUE) >> new Number(+0)); write(new Number(Number.MAX_VALUE) >> new Number(-0)); write(new Number(Number.MAX_VALUE) >> new Number(0)); write(new Number(Number.MAX_VALUE) >> new Number(0.0)); write(new Number(Number.MAX_VALUE) >> new Number(-0.0)); write(new Number(Number.MAX_VALUE) >> new Number(+0.0)); write(new Number(Number.MAX_VALUE) >> new Number(1)); write(new Number(Number.MAX_VALUE) >> new Number(10)); write(new Number(Number.MAX_VALUE) >> new Number(10.0)); write(new Number(Number.MAX_VALUE) >> new Number(10.1)); write(new Number(Number.MAX_VALUE) >> new Number(-1)); write(new Number(Number.MAX_VALUE) >> new Number(-10)); write(new Number(Number.MAX_VALUE) >> new Number(-10.0)); write(new Number(Number.MAX_VALUE) >> new Number(-10.1)); write(new Number(Number.MAX_VALUE) >> new Number(Number.MAX_VALUE)); write(new Number(Number.MAX_VALUE) >> new Number(Number.MIN_VALUE)); write(new Number(Number.MAX_VALUE) >> new Number(Number.NaN)); write(new Number(Number.MAX_VALUE) >> new Number(Number.POSITIVE_INFINITY)); write(new Number(Number.MAX_VALUE) >> new Number(Number.NEGATIVE_INFINITY)); write(new Number(Number.MAX_VALUE) >> ''); write(new Number(Number.MAX_VALUE) >> 0xa); write(new Number(Number.MAX_VALUE) >> 04); write(new Number(Number.MAX_VALUE) >> 'hello'); write(new Number(Number.MAX_VALUE) >> 'hel' + 'lo'); write(new Number(Number.MAX_VALUE) >> String('')); write(new Number(Number.MAX_VALUE) >> String('hello')); write(new Number(Number.MAX_VALUE) >> String('h' + 'ello')); write(new Number(Number.MAX_VALUE) >> new String('')); write(new Number(Number.MAX_VALUE) >> new String('hello')); write(new Number(Number.MAX_VALUE) >> new String('he' + 'llo')); write(new Number(Number.MAX_VALUE) >> new Object()); write(new Number(Number.MAX_VALUE) >> new Object()); write(new Number(Number.MAX_VALUE) >> [1, 2, 3]); write(new Number(Number.MAX_VALUE) >> [1 ,2 , 3]); write(new Number(Number.MAX_VALUE) >> new Array(3)); write(new Number(Number.MAX_VALUE) >> Array(3)); write(new Number(Number.MAX_VALUE) >> new Array(1 ,2 ,3)); write(new Number(Number.MAX_VALUE) >> Array(1)); write(new Number(Number.MAX_VALUE) >> foo); write(new Number(Number.MIN_VALUE) >> undefined); write(new Number(Number.MIN_VALUE) >> null); write(new Number(Number.MIN_VALUE) >> true); write(new Number(Number.MIN_VALUE) >> false); write(new Number(Number.MIN_VALUE) >> Boolean(true)); write(new Number(Number.MIN_VALUE) >> Boolean(false)); write(new Number(Number.MIN_VALUE) >> new Boolean(true)); write(new Number(Number.MIN_VALUE) >> new Boolean(false)); write(new Number(Number.MIN_VALUE) >> NaN); write(new Number(Number.MIN_VALUE) >> +0);
var common = require('../common.js'); var assert = require('assert'); var Signal = process.binding('signal_wrap').Signal; // Test Signal `this` safety // https://github.com/joyent/node/issues/6690 assert.throws(function() { var s = new Signal(); var nots = { start: s.start }; nots.start(9); }, TypeError);
/** * @license React * react-is.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = global || self, factory(global.ReactIs = {})); }(this, (function (exports) { 'use strict'; // ATTENTION // When adding new symbols to this file, // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' // The Symbol used to tag the ReactElement-like types. If there is no native Symbol // nor polyfill, then a plain number is used for performance. var REACT_ELEMENT_TYPE = 0xeac7; var REACT_PORTAL_TYPE = 0xeaca; var REACT_FRAGMENT_TYPE = 0xeacb; var REACT_STRICT_MODE_TYPE = 0xeacc; var REACT_PROFILER_TYPE = 0xead2; var REACT_PROVIDER_TYPE = 0xeacd; var REACT_CONTEXT_TYPE = 0xeace; var REACT_FORWARD_REF_TYPE = 0xead0; var REACT_SUSPENSE_TYPE = 0xead1; var REACT_SUSPENSE_LIST_TYPE = 0xead8; var REACT_MEMO_TYPE = 0xead3; var REACT_LAZY_TYPE = 0xead4; var REACT_SCOPE_TYPE = 0xead7; var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1; var REACT_OFFSCREEN_TYPE = 0xeae2; var REACT_LEGACY_HIDDEN_TYPE = 0xeae3; var REACT_CACHE_TYPE = 0xeae4; var REACT_TRACING_MARKER_TYPE = 0xeae5; if (typeof Symbol === 'function' && Symbol.for) { var symbolFor = Symbol.for; REACT_ELEMENT_TYPE = symbolFor('react.element'); REACT_PORTAL_TYPE = symbolFor('react.portal'); REACT_FRAGMENT_TYPE = symbolFor('react.fragment'); REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode'); REACT_PROFILER_TYPE = symbolFor('react.profiler'); REACT_PROVIDER_TYPE = symbolFor('react.provider'); REACT_CONTEXT_TYPE = symbolFor('react.context'); REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref'); REACT_SUSPENSE_TYPE = symbolFor('react.suspense'); REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list'); REACT_MEMO_TYPE = symbolFor('react.memo'); REACT_LAZY_TYPE = symbolFor('react.lazy'); REACT_SCOPE_TYPE = symbolFor('react.scope'); REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode'); REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen'); REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden'); REACT_CACHE_TYPE = symbolFor('react.cache'); REACT_TRACING_MARKER_TYPE = symbolFor('react.tracing_marker'); } // Filter certain DOM attributes (e.g. src, href) if their values are empty strings. var enableCache = false; // Only used in www builds. var enableScopeAPI = false; // Experimental Create Event Handle API. var enableTransitionTracing = false; var REACT_MODULE_REFERENCE = 0; if (typeof Symbol === 'function') { REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); } function isValidElementType(type) { if (typeof type === 'string' || typeof type === 'function') { return true; } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCache || enableTransitionTracing ) { return true; } if (typeof type === 'object' && type !== null) { if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) { return true; } } return false; } function typeOf(object) { if (typeof object === 'object' && object !== null) { var $$typeof = object.$$typeof; switch ($$typeof) { case REACT_ELEMENT_TYPE: var type = object.type; switch (type) { case REACT_FRAGMENT_TYPE: case REACT_PROFILER_TYPE: case REACT_STRICT_MODE_TYPE: case REACT_SUSPENSE_TYPE: case REACT_SUSPENSE_LIST_TYPE: return type; default: var $$typeofType = type && type.$$typeof; switch ($$typeofType) { case REACT_CONTEXT_TYPE: case REACT_FORWARD_REF_TYPE: case REACT_LAZY_TYPE: case REACT_MEMO_TYPE: case REACT_PROVIDER_TYPE: return $$typeofType; default: return $$typeof; } } case REACT_PORTAL_TYPE: return $$typeof; } } return undefined; } var ContextConsumer = REACT_CONTEXT_TYPE; var ContextProvider = REACT_PROVIDER_TYPE; var Element = REACT_ELEMENT_TYPE; var ForwardRef = REACT_FORWARD_REF_TYPE; var Fragment = REACT_FRAGMENT_TYPE; var Lazy = REACT_LAZY_TYPE; var Memo = REACT_MEMO_TYPE; var Portal = REACT_PORTAL_TYPE; var Profiler = REACT_PROFILER_TYPE; var StrictMode = REACT_STRICT_MODE_TYPE; var Suspense = REACT_SUSPENSE_TYPE; var SuspenseList = REACT_SUSPENSE_LIST_TYPE; var hasWarnedAboutDeprecatedIsAsyncMode = false; var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated function isAsyncMode(object) { { if (!hasWarnedAboutDeprecatedIsAsyncMode) { hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.'); } } return false; } function isConcurrentMode(object) { { if (!hasWarnedAboutDeprecatedIsConcurrentMode) { hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.'); } } return false; } function isContextConsumer(object) { return typeOf(object) === REACT_CONTEXT_TYPE; } function isContextProvider(object) { return typeOf(object) === REACT_PROVIDER_TYPE; } function isElement(object) { return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; } function isForwardRef(object) { return typeOf(object) === REACT_FORWARD_REF_TYPE; } function isFragment(object) { return typeOf(object) === REACT_FRAGMENT_TYPE; } function isLazy(object) { return typeOf(object) === REACT_LAZY_TYPE; } function isMemo(object) { return typeOf(object) === REACT_MEMO_TYPE; } function isPortal(object) { return typeOf(object) === REACT_PORTAL_TYPE; } function isProfiler(object) { return typeOf(object) === REACT_PROFILER_TYPE; } function isStrictMode(object) { return typeOf(object) === REACT_STRICT_MODE_TYPE; } function isSuspense(object) { return typeOf(object) === REACT_SUSPENSE_TYPE; } function isSuspenseList(object) { return typeOf(object) === REACT_SUSPENSE_LIST_TYPE; } exports.ContextConsumer = ContextConsumer; exports.ContextProvider = ContextProvider; exports.Element = Element; exports.ForwardRef = ForwardRef; exports.Fragment = Fragment; exports.Lazy = Lazy; exports.Memo = Memo; exports.Portal = Portal; exports.Profiler = Profiler; exports.StrictMode = StrictMode; exports.Suspense = Suspense; exports.SuspenseList = SuspenseList; exports.isAsyncMode = isAsyncMode; exports.isConcurrentMode = isConcurrentMode; exports.isContextConsumer = isContextConsumer; exports.isContextProvider = isContextProvider; exports.isElement = isElement; exports.isForwardRef = isForwardRef; exports.isFragment = isFragment; exports.isLazy = isLazy; exports.isMemo = isMemo; exports.isPortal = isPortal; exports.isProfiler = isProfiler; exports.isStrictMode = isStrictMode; exports.isSuspense = isSuspense; exports.isSuspenseList = isSuspenseList; exports.isValidElementType = isValidElementType; exports.typeOf = typeOf; })));
import{generateUtilityClass,generateUtilityClasses}from"@material-ui/unstyled";export function getSnackbarUtilityClass(t){return generateUtilityClass("MuiSnackbar",t)};var snackbarClasses=generateUtilityClasses("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);export default snackbarClasses;
function rad(deg) { return deg * PI / 180; } function deg(rad) { return rad / PI * 180; } function pixelToGeo(x, y) { var res = {}; x /= MAP_SIZE; y /= MAP_SIZE; res[LAT] = y <= 0 ? 90 : y >= 1 ? -90 : deg(2 * atan(exp(PI * (1 - 2*y))) - HALF_PI); res[LON] = (x === 1 ? 1 : (x%1 + 1) % 1) * 360 - 180; return res; } function geoToPixel(lat, lon) { var latitude = min(1, max(0, 0.5 - (log(tan(QUARTER_PI + HALF_PI * lat / 180)) / PI) / 2)), longitude = lon/360 + 0.5; return { x: longitude*MAP_SIZE <<0, y: latitude *MAP_SIZE <<0 }; } function fromRange(sVal, sMin, sMax, dMin, dMax) { sVal = min(max(sVal, sMin), sMax); var rel = (sVal-sMin) / (sMax-sMin), range = dMax-dMin; return min(max(dMin + rel*range, dMin), dMax); } function isVisible(polygon) { var maxX = WIDTH+ORIGIN_X, maxY = HEIGHT+ORIGIN_Y; // TODO: checking footprint is sufficient for visibility - NOT VALID FOR SHADOWS! for (var i = 0, il = polygon.length-3; i < il; i+=2) { if (polygon[i] > ORIGIN_X && polygon[i] < maxX && polygon[i+1] > ORIGIN_Y && polygon[i+1] < maxY) { return true; } } return false; }
'use strict'; module.exports = require('./lib/asyncLoop');
'use strict'; var getBuiltIn = require('../internals/get-built-in'); var uncurryThis = require('../internals/function-uncurry-this'); var aCallable = require('../internals/a-callable'); var lengthOfArrayLike = require('../internals/length-of-array-like'); var toObject = require('../internals/to-object'); var arraySpeciesCreate = require('../internals/array-species-create'); var Map = getBuiltIn('Map'); var MapPrototype = Map.prototype; var mapForEach = uncurryThis(MapPrototype.forEach); var mapHas = uncurryThis(MapPrototype.has); var mapSet = uncurryThis(MapPrototype.set); var push = uncurryThis([].push); // `Array.prototype.uniqueBy` method // https://github.com/tc39/proposal-array-unique module.exports = function uniqueBy(resolver) { var that = toObject(this); var length = lengthOfArrayLike(that); var result = arraySpeciesCreate(that, 0); var map = new Map(); var resolverFunction = resolver != null ? aCallable(resolver) : function (value) { return value; }; var index, item, key; for (index = 0; index < length; index++) { item = that[index]; key = resolverFunction(item); if (!mapHas(map, key)) mapSet(map, key, item); } mapForEach(map, function (value) { push(result, value); }); return result; };
$(function(){ $(".win-homepage").click(function(){ if(document.all){ document.body.style.behavior = 'url(#default#homepage)'; document.body.setHomePage(document.URL); }else{alert("่ฎพ็ฝฎ้ฆ–้กตๅคฑ่ดฅ๏ผŒ่ฏทๆ‰‹ๅŠจ่ฎพ็ฝฎ๏ผ");} }); $(".win-favorite").click(function(){ var sURL=document.URL; var sTitle=document.title; try {window.external.addFavorite(sURL, sTitle);} catch(e){ try{window.sidebar.addPanel(sTitle, sURL, "");} catch(e){alert("ๅŠ ๅ…ฅๆ”ถ่—ๅคฑ่ดฅ๏ผŒ่ฏทไฝฟ็”จCtrl+D่ฟ›่กŒๆทปๅŠ ");} } }); $(".win-forward").click(function(){ window.history.forward(1); }); $(".win-back").click(function(){ window.history.back(-1); }); $(".win-backtop").click(function(){$('body,html').animate({scrollTop:0},1000);return false;}); $(".win-refresh").click(function(){ window.location.reload(); }); $(".win-print").click(function(){ window.print(); }); $(".win-close").click(function(){ window.close(); }); $('.checkall').click(function(){ var e=$(this); var name=e.attr("name"); var checkfor=e.attr("checkfor"); var type; if (checkfor!='' && checkfor!=null && checkfor!=undefined){ type=e.closest('form').find("input[name='"+checkfor+"']"); }else{ type=e.closest('form').find("input[type='checkbox']"); }; if (name=="checkall"){ $(type).each(function(index, element){ element.checked=true; }); e.attr("name","ok"); }else{ $(type).each(function(index, element){ element.checked=false; }); e.attr("name","checkall"); } }); $('.dropdown-toggle').click(function(){ $(this).closest('.button-group, .drop').addClass("open"); }); $(document).bind("click",function(e){ if($(e.target).closest(".button-group.open, .drop.open").length == 0){ $(".button-group, .drop").removeClass("open"); } }); $checkplaceholder=function(){ var input = document.createElement('input'); return 'placeholder' in input; }; if(!$checkplaceholder()){ $("textarea[placeholder], input[placeholder]").each(function(index, element){ var content=false; if($(this).val().length ===0 || $(this).val()==$(this).attr("placeholder")){content=true}; if(content){ $(element).val($(element).attr("placeholder")); $(element).css("color","rgb(169,169,169)"); $(element).data("pintuerholder",$(element).css("color")); $(element).focus(function(){$hideplaceholder($(this));}); $(element).blur(function(){$showplaceholder($(this));}); } }) }; $showplaceholder=function(element){ if( ($(element).val().length ===0 || $(element).val()==$(element).attr("placeholder")) && $(element).attr("type")!="password"){ $(element).val($(element).attr("placeholder")); $(element).data("pintuerholder",$(element).css("color")); $(element).css("color","rgb(169,169,169)"); } }; var $hideplaceholder=function(element){ if($(element).data("pintuerholder")){ $(element).val(""); $(element).css("color", $(element).data("pintuerholder")); $(element).removeData("pintuerholder"); } }; $('textarea, input, select').blur(function(){ var e=$(this); if(e.attr("data-validate")){ e.closest('.field').find(".input-help").remove(); var $checkdata=e.attr("data-validate").split(','); var $checkvalue=e.val(); var $checkstate=true; var $checktext=""; if(e.attr("placeholder")==$checkvalue){$checkvalue="";} if($checkvalue!="" || e.attr("data-validate").indexOf("required")>=0){ for(var i=0;i<$checkdata.length;i++){ var $checktype=$checkdata[i].split(':'); if(! $pintuercheck(e,$checktype[0],$checkvalue)){ $checkstate=false; $checktext=$checktext+"<li>"+$checktype[1]+"</li>"; } } }; if($checkstate){ e.closest('.form-group').removeClass("check-error"); e.parent().find(".input-help").remove(); e.closest('.form-group').addClass("check-success"); }else{ e.closest('.form-group').removeClass("check-success"); e.closest('.form-group').addClass("check-error"); e.closest('.field').append('<div class="input-help"><ul>'+$checktext+'</ul></div>'); } } }); $pintuercheck=function(element,type,value){ $pintu=value.replace(/(^\s*)|(\s*$)/g, ""); switch(type){ case "required":return /[^(^\s*)|(\s*$)]/.test($pintu);break; case "chinese":return /^[\u0391-\uFFE5]+$/.test($pintu);break; case "number":return /^\d+$/.test($pintu);break; case "integer":return /^[-\+]?\d+$/.test($pintu);break; case "plusinteger":return /^[+]?\d+$/.test($pintu);break; case "double":return /^[-\+]?\d+(\.\d+)?$/.test($pintu);break; case "plusdouble":return /^[+]?\d+(\.\d+)?$/.test($pintu);break; case "english":return /^[A-Za-z]+$/.test($pintu);break; case "username":return /^[a-z]\w{3,}$/i.test($pintu);break; case "mobile":return /^((\(\d{3}\))|(\d{3}\-))?13[0-9]\d{8}?$|15[89]\d{8}?$|170\d{8}?$|147\d{8}?$/.test($pintu);break; case "phone":return /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/.test($pintu);break; case "tel":return /^((\(\d{3}\))|(\d{3}\-))?13[0-9]\d{8}?$|15[89]\d{8}?$|170\d{8}?$|147\d{8}?$/.test($pintu) || /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/.test($pintu);break; case "email":return /^[^@]+@[^@]+\.[^@]+$/.test($pintu);break; case "url":return /^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/.test($pintu);break; case "ip":return /^[\d\.]{7,15}$/.test($pintu);break; case "qq":return /^[1-9]\d{4,10}$/.test($pintu);break; case "currency":return /^\d+(\.\d+)?$/.test($pintu);break; case "zip":return /^[1-9]\d{5}$/.test($pintu);break; case "radio": var radio=element.closest('form').find('input[name="'+element.attr("name")+'"]:checked').length; return eval(radio==1); break; default: var $test=type.split('#'); if($test.length>1){ switch($test[0]){ case "compare": return eval(Number($pintu)+$test[1]); break; case "regexp": return new RegExp($test[1],"gi").test($pintu); break; case "length": var $length; if(element.attr("type")=="checkbox"){ $length=element.closest('form').find('input[name="'+element.attr("name")+'"]:checked').length; }else{ $length=$pintu.replace(/[\u4e00-\u9fa5]/g,"***").length; } return eval($length+$test[1]); break; case "ajax": var $getdata; var $url=$test[1]+$pintu; $.ajaxSetup({async:false}); $.getJSON($url,function(data){ $getdata=data.getdata; }); if($getdata=="true"){return true;} break; case "repeat": return $pintu==jQuery('input[name="'+$test[1]+'"]').eq(0).val(); break; default:return true;break; } break; }else{ return true; } } }; $('form').submit(function(){ $(this).find('input[data-validate],textarea[data-validate],select[data-validate]').trigger("blur"); $(this).find('input[placeholder],textarea[placeholder]').each(function(){$hideplaceholder($(this));}); var numError = $(this).find('.check-error').length; if(numError){ $(this).find('.check-error').first().find('input[data-validate],textarea[data-validate],select[data-validate]').first().focus().select(); return false; } }); $('.form-reset').click(function(){ $(this).closest('form').find(".input-help").remove(); $(this).closest('form').find('.form-submit').removeAttr('disabled'); $(this).closest('form').find('.form-group').removeClass("check-error"); $(this).closest('form').find('.form-group').removeClass("check-success"); }); $('.tab .tab-nav li').each(function(){ var e=$(this); var trigger=e.closest('.tab').attr("data-toggle"); if (trigger=="hover"){ e.mouseover(function(){ $showtabs(e); }); e.click(function(){ return false; }); }else{ e.click(function(){ $showtabs(e); return false; }); } }); $showtabs=function(e){ var detail=e.children("a").attr("href"); e.closest('.tab .tab-nav').find("li").removeClass("active"); e.closest('.tab').find(".tab-body .tab-panel").removeClass("active"); e.addClass("active"); $(detail).addClass("active"); }; $('.dialogs').each(function(){ var e=$(this); var trigger=e.attr("data-toggle"); if (trigger=="hover"){ e.mouseover(function(){ $showdialogs(e); }); }else if(trigger=="click"){ e.click(function(){ $showdialogs(e); }); } }); $showdialogs=function(e){ var trigger=e.attr("data-toggle"); var getid=e.attr("data-target"); var data=e.attr("data-url"); var mask=e.attr("data-mask"); var width=e.attr("data-width"); var detail=""; var masklayout=$('<div class="dialog-mask"></div>'); if(width==null){width="80%";} if (mask=="1"){ $("body").append(masklayout); } detail='<div class="dialog-win" style="position:fixed;width:'+width+';z-index:11;">'; if(getid!=null){detail=detail+$(getid).html();} if(data!=null){detail=detail+$.ajax({url:data,async:false}).responseText;} detail=detail+'</div>'; var win=$(detail); win.find(".dialog").addClass("open"); $("body").append(win); var x=parseInt($(window).width()-win.outerWidth())/2; var y=parseInt($(window).height()-win.outerHeight())/2; if (y<=10){y="10"} win.css({"left":x,"top":y}); win.find(".dialog-close,.close").each(function(){ $(this).click(function(){ win.remove(); $('.dialog-mask').remove(); }); }); masklayout.click(function(){ win.remove(); $(this).remove(); }); }; $('.tips').each(function(){ var e=$(this); var title=e.attr("title"); var trigger=e.attr("data-toggle"); e.attr("title",""); if (trigger=="" || trigger==null){trigger="hover";} if (trigger=="hover"){ e.mouseover(function(){ $showtips(e,title); }); }else if(trigger=="click"){ e.click(function(){ $showtips(e,title); }); }else if(trigger=="show"){ e.ready(function(){ $showtips(e,title); }); } }); $showtips=function(e,title){ var trigger=e.attr("data-toggle"); var place=e.attr("data-place"); var width=e.attr("data-width"); var css=e.attr("data-style"); var image=e.attr("data-image"); var content=e.attr("content"); var getid=e.attr("data-target"); var data=e.attr("data-url"); var x=0; var y=0; var html=""; var detail=""; if(image!=null){detail=detail+'<img class="image" src="'+image+'" />';} if(content!=null){detail=detail+'<p class="tip-body">'+content+'</p>';} if(getid!=null){detail=detail+$(getid).html();} if(data!=null){detail=detail+$.ajax({url:data,async:false}).responseText;} if(title!=null && title!=""){ if(detail!=null && detail!=""){detail='<p class="tip-title"><strong>'+title+'</strong></p>'+detail;}else{detail='<p class="tip-line">'+title+'</p>';} } detail='<div class="tip">'+detail+'</div>'; html=$(detail); $("body").append( html ); if(width!=null){ html.css("width",width); } if(place=="" || place==null){place="top";} if(place=="left"){ x=e.offset().left - html.outerWidth()-5; y=e.offset().top - html.outerHeight()/2 + e.outerHeight()/2; }else if(place=="top"){ x=e.offset().left - html.outerWidth()/2 + e.outerWidth()/2; y=e.offset().top - html.outerHeight()-5; }else if(place=="right"){ x=e.offset().left + e.outerWidth()+5; y=e.offset().top - html.outerHeight()/2 + e.outerHeight()/2; }else if(place=="bottom"){ x=e.offset().left - html.outerWidth()/2 + e.outerWidth()/2; y=e.offset().top + e.outerHeight()+5; } if (css!=""){html.addClass(css);} html.css({"left":x+"px","top":y+"px","position":"absolute"}); if (trigger=="hover" || trigger=="click" || trigger==null){ e.mouseout(function(){html.remove();e.attr("title",title)}); } }; $('.alert .close').each(function(){ $(this).click(function(){ $(this).closest('.alert').remove(); }); }); $('.radio label').each(function(){ var e=$(this); e.click(function(){ e.closest('.radio').find("label").removeClass("active"); e.addClass("active"); }); }); $('.checkbox label').each(function(){ var e=$(this); e.click(function(){ if(e.find('input').is(':checked')){ e.addClass("active"); }else{ e.removeClass("active"); }; }); }); $('.collapse .panel-head').each(function(){ var e=$(this); e.click(function(){ e.closest('.collapse').find(".panel").removeClass("active"); e.closest('.panel').addClass("active"); }); }); $('.icon-navicon').each(function(){ var e=$(this); var target=e.attr("data-target"); e.click(function(){ $(target).toggleClass("nav-navicon"); }); }); $('.banner').each(function(){ var e=$(this); var pointer=e.attr("data-pointer"); var interval=e.attr("data-interval"); var style=e.attr("data-style"); var items=e.attr("data-item"); var items_s=e.attr("data-small"); var items_m=e.attr("data-middle"); var items_b=e.attr("data-big"); var num=e.find(".carousel .item").length; var win=$(window).width(); var i=1; if(interval==null){interval=5}; if(items==null || items<1){items=1}; if(items_s!=null && win>760){items=items_s}; if(items_m!=null && win>1000){items=items_m}; if(items_b!=null && win>1200){items=items_b}; var itemWidth=Math.ceil(e.outerWidth()/items); var page=Math.ceil(num/items); e.find(".carousel .item").css("width",itemWidth+ "px"); e.find(".carousel").css("width",itemWidth*num + "px"); var carousel=function(){ i++; if(i>page){i=1;} $showbanner(e,i,items,num); }; var play=setInterval(carousel,interval*600); e.mouseover(function(){clearInterval(play);}); e.mouseout(function(){play=setInterval(carousel,interval*600);}); if(pointer!=0 && page>1){ var point='<ul class="pointer"><li value="1" class="active"></li>'; for (var j=1;j<page;j++){ point=point+' <li value="'+(j+1)+'"></li>'; }; point=point+'</ul>'; var pager=$(point); if(style!=null){pager.addClass(style);}; e.append(pager); pager.css("left",e.outerWidth()*0.5 - pager.outerWidth()*0.5+"px"); pager.find("li").click(function(){ $showbanner(e,$(this).val(),items,num); }); var lefter=$('<div class="pager-prev icon-angle-left"></div>'); var righter=$('<div class="pager-next icon-angle-right"></div>'); if(style!=null){lefter.addClass(style);righter.addClass(style);}; e.append(lefter); e.append(righter); lefter.click(function(){ i--; if(i<1){i=page;} $showbanner(e,i,items,num); }); righter.click(function(){ i++; if(i>page){i=1;} $showbanner(e,i,items,num); }); }; }); $showbanner=function(e,i,items,num){ var after=0,leftx=0; leftx = - Math.ceil(e.outerWidth()/items)*(items)*(i-1); if(i*items > num){after=i*items-num;leftx= - Math.ceil(e.outerWidth()/items)*(num-items);}; e.find(".carousel").stop(true, true).animate({"left":leftx+"px"},800); e.find(".pointer li").removeClass("active"); e.find(".pointer li").eq(i-1).addClass("active"); }; $(".spy a").each(function(){ var e=$(this); var t=e.closest(".spy"); var target=t.attr("data-target"); var top=t.attr("data-offset-spy"); var thistarget=""; var thistop=""; if(top==null){top=0;}; if(target==null){thistarget=$(window);}else{thistarget=$(target);}; thistarget.bind("scroll",function(){ if(target==null){ thistop=$(e.attr("href")).offset().top - $(window).scrollTop() - parseInt(top); }else{ thistop=$(e.attr("href")).offset().top - thistarget.offset().top - parseInt(top); }; if(thistop<0){ t.find('li').removeClass("active"); e.parents('li').addClass("active"); }; }); }); $(".fixed").each(function(){ var e=$(this); var style=e.attr("data-style"); var top=e.attr("data-offset-fixed"); if(top==null){top=e.offset().top;}else{top=e.offset().top - parseInt(top);}; if(style==null){style="fixed-top";}; $(window).bind("scroll",function(){ var thistop=top - $(window).scrollTop(); if(style=="fixed-top" && thistop<0){ e.addClass("fixed-top"); }else{ e.removeClass("fixed-top"); }; var thisbottom=top - $(window).scrollTop()-$(window).height(); if(style=="fixed-bottom" && thisbottom>0){ e.addClass("fixed-bottom"); }else{ e.removeClass("fixed-bottom"); }; }); }); })
// 43: array - `Array.prototype.values` // To do: make all tests pass, leave the assert lines unchanged! describe('`Array.prototype.values` returns an iterator for all values in the array', () => { it('`values()` returns an iterator', function() { const arr = ['k', 'e', 'y']; const iterator = arr.values(); assert.deepEqual(iterator.next(), {value: void 0, done: true}); }); it('use iterator to drop first key', function() { const arr = ['keys', 'values', 'entries']; const iterator = arr.values(); iterator.___(); assert.deepEqual([...iterator], ['values', 'entries']); }); it('empty array contains no values', function() { const arr = [...[...[...[...'1']]]]; const values = [...arr.values()]; assert.equal(values.length, 0); }); it('a sparse array without real values has values though', function() { const arr = [, 0]; const keys = [...arr.values()]; assert.deepEqual(keys, [void 0, void 0]); }); it('also includes holes in sparse arrays', function() { const arr = ['a']; assert.deepEqual([...arr.values()], ['a', void 0, 'c']); }); });
'use strict'; require('./testUtils'); var utils = require('../lib/utils'); var expect = require('chai').expect; describe('utils', function() { describe('makeURLInterpolator', function() { it('Interpolates values into a prepared template', function() { var template = utils.makeURLInterpolator('/some/url/{foo}/{baz}?ok=1'); expect( template({foo: 1, baz: 2}) ).to.equal('/some/url/1/2?ok=1'); expect( template({foo: '', baz: ''}) ).to.equal('/some/url//?ok=1'); expect( // Test encoding: template({foo: 'FOO', baz: '__::baz::__'}) ).to.equal('/some/url/FOO/__%3A%3Abaz%3A%3A__?ok=1'); }); }); describe('stringifyRequestData', function() { it('Creates a string from an object, handling shallow nested objects', function() { expect(utils.stringifyRequestData({ test: 1, foo: 'baz', somethingElse: '::""%&', nested: { 1: 2, 'a n o t h e r': null }, arr: [1, 2, 3] })).to.equal([ 'test=1', 'foo=baz', 'somethingElse=%3A%3A%22%22%25%26', 'nested%5B1%5D=2', // Unencoded: nested[1]=2 'nested%5Ba%20n%20o%20t%20h%20e%20r%5D=', 'arr%5B%5D=1', 'arr%5B%5D=2', 'arr%5B%5D=3' ].join('&')); }); it('Ensures empty objects are represented', function() { expect(utils.stringifyRequestData({ test: {} })).to.equal('test='); }); }); describe('protoExtend', function() { it('Provides an extension mechanism', function() { function A() {} A.extend = utils.protoExtend; var B = A.extend({ constructor: function() { this.called = true; } }); expect(new B()).to.be.an.instanceof(A); expect(new B()).to.be.an.instanceof(B); expect(new B().called).to.equal(true); expect(B.extend === utils.protoExtend).to.equal(true); }); }); });
/*! * iButton jQuery Plug-in * * Copyright 2011 Giva, Inc. (http://www.givainc.com/labs/) * * 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. * * Date: 2011-07-26 * Rev: 1.0.03 */ ;(function($){ // set default options $.iButton = { version: "1.0.03", setDefaults: function(options){ $.extend(defaults, options); } }; $.fn.iButton = function(options) { var method = typeof arguments[0] == "string" && arguments[0]; var args = method && Array.prototype.slice.call(arguments, 1) || arguments; // get a reference to the first iButton found var self = (this.length == 0) ? null : $.data(this[0], "iButton"); // if a method is supplied, execute it for non-empty results if( self && method && this.length ){ // if request a copy of the object, return it if( method.toLowerCase() == "object" ) return self; // if method is defined, run it and return either it's results or the chain else if( self[method] ){ // define a result variable to return to the jQuery chain var result; this.each(function (i){ // apply the method to the current element var r = $.data(this, "iButton")[method].apply(self, args); // if first iteration we need to check if we're done processing or need to add it to the jquery chain if( i == 0 && r ){ // if this is a jQuery item, we need to store them in a collection if( !!r.jquery ){ result = $([]).add(r); // otherwise, just store the result and stop executing } else { result = r; // since we're a non-jQuery item, just cancel processing further items return false; } // keep adding jQuery objects to the results } else if( !!r && !!r.jquery ){ result = result.add(r); } }); // return either the results (which could be a jQuery object) or the original chain return result || this; // everything else, return the chain } else return this; // initializing request (only do if iButton not already initialized) } else { // create a new iButton for each object found return this.each(function (){ new iButton(this, options); }); }; }; // count instances var counter = 0; // detect iPhone var iButton = function (input, options){ var self = this , $input = $(input) , id = ++counter , disabled = false , width = {} , mouse = {dragging: false, clicked: null} , dragStart = {position: null, offset: null, time: null } // make a copy of the options and use the metadata if provided , options = $.extend({}, defaults, options, (!!$.metadata ? $input.metadata() : {})) // check to see if we're using the default labels , bDefaultLabelsUsed = (options.labelOn == ON && options.labelOff == OFF) // set valid field types , allow = ":checkbox, :radio"; // only do for checkboxes buttons, if matches inside that node if( !$input.is(allow) ) return $input.find(allow).iButton(options); // if iButton already exists, stop processing else if($.data($input[0], "iButton") ) return; // store a reference to this marquee $.data($input[0], "iButton", self); // if using the "auto" setting, then don't resize handle or container if using the default label (since we'll trust the CSS) if( options.resizeHandle == "auto" ) options.resizeHandle = !bDefaultLabelsUsed; if( options.resizeContainer == "auto" ) options.resizeContainer = !bDefaultLabelsUsed; // toggles the state of a button (or can turn on/off) this.toggle = function (t){ var toggle = (arguments.length > 0) ? t : !$input[0].checked; $input.prop("checked", toggle).trigger("change"); }; // disable/enable the control this.disable = function (t){ var toggle = (arguments.length > 0) ? t : !disabled; // mark the control disabled disabled = toggle; // mark the input disabled $input.attr("disabled", toggle); // set the diabled styles $container[toggle ? "addClass" : "removeClass"](options.classDisabled); // run callback if( $.isFunction(options.disable) ) options.disable.apply(self, [disabled, $input, options]); }; // repaint the button this.repaint = function (){ positionHandle(); }; // this will destroy the iButton style this.destroy = function (){ // remove behaviors $([$input[0], $container[0]]).unbind(".iButton"); $(document).unbind(".iButton_" + id); // move the checkbox to it's original location $container.after($input).remove(); // kill the reference $.data($input[0], "iButton", null); // run callback if( $.isFunction(options.destroy) ) options.destroy.apply(self, [$input, options]); }; $input // create the wrapper code .wrap('<div class="' + $.trim(options.classContainer + ' ' + options.className) + '" />') .after( '<div class="' + options.classHandle + '"><div class="' + options.classHandleRight + '"><div class="' + options.classHandleMiddle + '" /></div></div>' + '<div class="' + options.classLabelOff + '"><span><label>'+ options.labelOff + '</label></span></div>' + '<div class="' + options.classLabelOn + '"><span><label>' + options.labelOn + '</label></span></div>' + '<div class="' + options.classPaddingLeft + '"></div><div class="' + options.classPaddingRight + '"></div>' ); var $container = $input.parent() , $handle = $input.siblings("." + options.classHandle) , $offlabel = $input.siblings("." + options.classLabelOff) , $offspan = $offlabel.children("span") , $onlabel = $input.siblings("." + options.classLabelOn) , $onspan = $onlabel.children("span"); // if we need to do some resizing, get the widths only once if( options.resizeHandle || options.resizeContainer ){ width.onspan = $onspan.outerWidth(); width.offspan = $offspan.outerWidth(); } // automatically resize the handle if( options.resizeHandle ){ if (options.handleWidth) { width.handle = options.handleWidth; } else { if (width.onspan > 0) { width.handle = Math.min(width.onspan, width.offspan); } else { width.handle = width.offspan; } } $handle.css("width", width.handle); } else { width.handle = $handle.width(); } // automatically resize the control if( options.resizeContainer ){ width.container = (Math.max(width.onspan, width.offspan) + width.handle + 10); $container.css("width", width.container); // adjust the off label to match the new container size $offlabel.css("width", width.container - 5); } else { width.container = $container.width() + 3; console.log(width.container); } var handleRight = width.container - width.handle - 5; var positionHandle = function (animate){ var checked = $input[0].checked , x = (checked) ? handleRight : 0 , animate = (arguments.length > 0) ? arguments[0] : true; if( animate && options.enableFx ){ $handle.stop().animate({left: x}, options.duration, options.easing); $onlabel.stop().animate({width: x + 4}, options.duration, options.easing); $onspan.stop().animate({marginLeft: x - handleRight}, options.duration, options.easing); $offspan.stop().animate({marginRight: -x}, options.duration, options.easing); } else { $handle.css("left", x); $onlabel.css("width", x + 4); $onspan.css("marginLeft", x - handleRight); $offspan.css("marginRight", -x); } }; // place the buttons in their default location positionHandle(false); var getDragPos = function(e){ return e.pageX || ((e.originalEvent.changedTouches) ? e.originalEvent.changedTouches[0].pageX : 0); }; // monitor mouse clicks in the container $container.bind("mousedown.iButton touchstart.iButton", function(e) { // abort if disabled or allow clicking the input to toggle the status (if input is visible) if( $(e.target).is(allow) || disabled || (!options.allowRadioUncheck && $input.is(":radio:checked")) ) return; e.preventDefault(); mouse.clicked = $handle; dragStart.position = getDragPos(e); dragStart.offset = dragStart.position - (parseInt($handle.css("left"), 10) || 0); dragStart.time = (new Date()).getTime(); return false; }); // make sure dragging support is enabled if( options.enableDrag ){ // monitor mouse movement on the page $(document).bind("mousemove.iButton_" + id + " touchmove.iButton_" + id, function(e) { // if we haven't clicked on the container, cancel event if( mouse.clicked != $handle ){ return } e.preventDefault(); var x = getDragPos(e); if( x != dragStart.offset ){ mouse.dragging = true; $container.addClass(options.classHandleActive); } // make sure number is between 0 and 1 var pct = Math.min(1, Math.max(0, (x - dragStart.offset) / handleRight)); $handle.css("left", pct * handleRight); $onlabel.css("width", pct * handleRight + 4); $offspan.css("marginRight", -pct * handleRight); $onspan.css("marginLeft", -(1 - pct) * handleRight); return false; }); } // monitor when the mouse button is released $(document).bind("mouseup.iButton_" + id + " touchend.iButton_" + id, function(e) { if( mouse.clicked != $handle ){ return false } e.preventDefault(); // track if the value has changed var changed = true; // if not dragging or click time under a certain millisecond, then just toggle if( !mouse.dragging || (((new Date()).getTime() - dragStart.time) < options.clickOffset ) ){ var checked = $input[0].checked; $input.prop("checked", !checked); // run callback if( $.isFunction(options.click) ) options.click.apply(self, [!checked, $input, options]); } else { var x = getDragPos(e); var pct = (x - dragStart.offset) / handleRight; var checked = (pct >= 0.5); // if the value is the same, don't run change event if( $input[0].checked == checked ) changed = false; $input.prop("checked", checked); } // remove the active handler class $container.removeClass(options.classHandleActive); mouse.clicked = null; mouse.dragging = null; // run any change event for the element if( changed ) $input.trigger("change"); // if the value didn't change, just reset the handle else positionHandle(); return false; }); // animate when we get a change event $input .bind("change.iButton", function (){ // move handle positionHandle(); // if a radio element, then we must repaint the other elements in it's group to show them as not selected if( $input.is(":radio") ){ var el = $input[0]; // try to use the DOM to get the grouped elements, but if not in a form get by name attr var $radio = $(el.form ? el.form[el.name] : ":radio[name=" + el.name + "]"); // repaint the radio elements that are not checked $radio.filter(":not(:checked)").iButton("repaint"); } // run callback if( $.isFunction(options.change) ) options.change.apply(self, [$input, options]); }) // if the element has focus, we need to highlight the container .bind("focus.iButton", function (){ $container.addClass(options.classFocus); }) // if the element has focus, we need to highlight the container .bind("blur.iButton", function (){ $container.removeClass(options.classFocus); }); // if a click event is registered, we must register on the checkbox so it's fired if triggered on the checkbox itself if( $.isFunction(options.click) ){ $input.bind("click.iButton", function (){ options.click.apply(self, [$input[0].checked, $input, options]); }); } // if the field is disabled, mark it as such if( $input.is(":disabled") ) this.disable(true); // run the init callback if( $.isFunction(options.init) ) options.init.apply(self, [$input, options]); }; var defaults = { duration: 200 // the speed of the animation , easing: "swing" // the easing animation to use , labelOn: "ON" // the text to show when toggled on , labelOff: "OFF" // the text to show when toggled off , resizeHandle: "auto" // determines if handle should be resized , resizeContainer: "auto" // determines if container should be resized , enableDrag: true // determines if we allow dragging , enableFx: true // determines if we show animation , allowRadioUncheck: false // determine if a radio button should be able to be unchecked , clickOffset: 120 // if millseconds between a mousedown & mouseup event this value, then considered a mouse click , handleWidth: 30 // define the class statements , className: "" , classContainer: "ibutton-container" , classDisabled: "ibutton-disabled" , classFocus: "ibutton-focus" , classLabelOn: "ibutton-label-on" , classLabelOff: "ibutton-label-off" , classHandle: "ibutton-handle" , classHandleMiddle: "ibutton-handle-middle" , classHandleRight: "ibutton-handle-right" , classHandleActive: "ibutton-active-handle" , classPaddingLeft: "ibutton-padding-left" , classPaddingRight: "ibutton-padding-right" // event handlers , init: null // callback that occurs when a iButton is initialized , change: null // callback that occurs when the button state is changed , click: null // callback that occurs when the button is clicked , disable: null // callback that occurs when the button is disabled/enabled , destroy: null // callback that occurs when the button is destroyed }, ON = defaults.labelOn, OFF = defaults.labelOff; })(jQuery);
var forever = require('forever-monitor'); var child = new (forever.Monitor)('app.js', { max: 3 }); child.on('exit', function () { console.warn('app.js has exited after 3 restarts'); }); child.start();
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /** * @name: S15.1.3.2_A1.13_T1; * @section: 15.1.3.2; * @assertion: If B = 110xxxxx (n = 2) and C != 10xxxxxx (C - first of octets after B), throw URIError; * @description: Complex tests. B = [0xC0 - 0xDF], C = [0x00, 0x7F]; */ errorCount = 0; count = 0; var indexP; var indexO = 0; for (indexB = 0xC0; indexB <= 0xDF; indexB++) { count++; hexB = decimalToHexString(indexB); result = true; for (indexC = 0x00; indexC <= 0x7F; indexC++) { hexC = decimalToHexString(indexC); try { decodeURIComponent("%" + hexB.substring(2) + "%" + hexC.substring(2)); } catch (e) { if ((e instanceof URIError) === true) continue; } result = false; } if (result !== true) { if (indexO === 0) { indexO = indexB; } else { if ((indexB - indexP) !== 1) { if ((indexP - indexO) !== 0) { var hexP = decimalToHexString(indexP); var hexO = decimalToHexString(indexO); $ERROR('#' + hexO + '-' + hexP + ' '); } else { var hexP = decimalToHexString(indexP); $ERROR('#' + hexP + ' '); } indexO = indexB; } } indexP = indexB; errorCount++; } } if (errorCount > 0) { if ((indexP - indexO) !== 0) { var hexP = decimalToHexString(indexP); var hexO = decimalToHexString(indexO); $ERROR('#' + hexO + '-' + hexP + ' '); } else { var hexP = decimalToHexString(indexP); $ERROR('#' + hexP + ' '); } $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); } function decimalToHexString(n) { n = Number(n); var h = ""; for (var i = 3; i >= 0; i--) { if (n >= Math.pow(16, i)) { var t = Math.floor(n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String(t); } } else { h += "0"; } } return h; }
const R = require('ramda') const Type = require('union-type') const patch = require('snabbdom').init([ require('snabbdom/modules/class'), require('snabbdom/modules/props'), require('snabbdom/modules/eventlisteners'), require('snabbdom/modules/style'), ]); const h = require('snabbdom/h') require('./style.css') let component = require('./counters.js') let state = component.init() let vnode const render = () => vnode = patch(vnode, component.view(update, state)) // If hot module replacement is enabled if (module.hot) { // We accept updates to the top component module.hot.accept('./counters.js', (comp) => { // Mutate the variable holding our component component = require('./counters.js') // Render view in the case that any view functions has changed render() }) } const update = (action) => { state = component.update(action, state) render() } // Begin rendering when the DOM is ready window.addEventListener('DOMContentLoaded', () => { vnode = document.getElementById('container') render() })
require([ 'jquery', 'underscore', 'routing', 'oroui/js/mediator', 'orotranslation/js/translator' ], function($, _, routing, mediator, __) { 'use strict'; $(function() { var _searchFlag = false; var timeout = 700; var searchBarContainer = $('#search-div'); var searchBarInput = searchBarContainer.find('#search-bar-search'); var searchBarFrame = searchBarContainer.find('div.header-search-frame'); var searchBarDropdown = searchBarContainer.find('#search-bar-dropdown'); var searchBarButton = searchBarContainer.find('#search-bar-button'); var searchBarForm = $('#search-bar-from'); var searchDropdown = searchBarContainer.find('#search-dropdown'); mediator.bind('page:beforeChange', function() { searchBarContainer.removeClass('header-search-focused'); $('#oroplatform-header .search-form .search').val(''); }); mediator.bind('page:afterChange', searchByTagClose); $(document).on('click', '.search-view-more-link', function(evt) { $('#top-search-form').submit(); return false; }); $('.search-form').submit(function() { var $searchString = $.trim($(this).find('.search').val()); if ($searchString.length === 0) { return false; } searchByTagClose(); }); searchBarDropdown.find('li a').click(function(e) { searchBarDropdown .find('li.active') .removeClass('active'); $(this) .closest('li') .addClass('active'); searchBarForm.val($(this).parent().attr('data-alias')); searchBarButton.find('.search-bar-type').html($(this).html()); updateSearchBar(); searchByTagClose(); e.preventDefault(); }); var searchInterval = null; function searchByTag() { clearInterval(searchInterval); var queryString = searchBarInput.val(); if (queryString === '' || queryString.length < 3) { searchBarContainer.removeClass('header-search-focused'); searchDropdown.empty(); } else { $.ajax({ url: routing.generate('oro_search_suggestion'), data: { search: queryString, from: searchBarForm.val(), max_results: 5 }, success: function(data) { var noResults; searchBarContainer.removeClass('header-search-focused'); searchDropdown.html(data); var countAll = searchDropdown.find('ul').attr('data-count'); var count = searchDropdown.find('li').length; if (count === 0) { noResults = __('oro.search.quick_search.noresults'); searchDropdown.html('<li><span>' + noResults + '</span></li>'); } else if (countAll > count) { searchDropdown.append($('.search-more').html()); } $('#recordsCount').val(count); searchBarContainer.addClass('header-search-focused'); } }); } } function searchByTagClose() { if (searchBarInput.size()) { var queryString2 = searchBarInput.val(); searchBarContainer .removeClass('header-search-focused') .toggleClass('search-focus', queryString2.length > 0); } } function updateSearchBar() { searchBarFrame.css('margin-left', searchBarButton.outerWidth()); searchBarFrame.css('margin-right', searchBarFrame.find('.btn-search').outerWidth()); } searchBarInput.keydown(function(event) { if (event.keyCode === 13) { $('#top-search-form').submit(); event.preventDefault(); return false; } }); searchBarInput.keypress(function(e) { if (e.keyCode === 8 || e.keyCode === 46 || (e.which !== 0 && e.charCode !== 0 && !e.ctrlKey && !e.altKey)) { clearInterval(searchInterval); searchInterval = setInterval(searchByTag, timeout); } else { switch (e.keyCode) { case 40: case 38: searchBarContainer.addClass('header-search-focused'); searchDropdown.find('a:first').focus(); e.preventDefault(); return false; case 27: searchBarContainer.removeClass('header-search-focused'); break; } } }); $(document).on('keydown', '#search-dropdown a', function(evt) { var $this = $(this); function selectPrevious() { $this.parent('li').prev().find('a').focus(); evt.stopPropagation(); evt.preventDefault(); return false; } function selectNext() { $this.parent('li').next().find('a').focus(); evt.stopPropagation(); evt.preventDefault(); return false; } switch (evt.keyCode) { case 13: // Enter key case 32: // Space bar this.click(); evt.stopPropagation(); break; case 9: // Tab key if (evt.shiftKey) { selectPrevious(); } else { selectNext(); } evt.preventDefault(); break; case 38: // Up arrow selectPrevious(); break; case 40: // Down arrow selectNext(); break; case 27: searchBarContainer.removeClass('header-search-focused'); searchBarInput.focus(); break; } }); $(document).on('focus', '#search-dropdown a', function() { $(this).parent('li').addClass('hovered'); }); $(document).on('focusout', '#search-dropdown a', function() { $(this).parent('li').removeClass('hovered'); }); searchBarInput.focusout(function() { if (!_searchFlag) { searchByTagClose(); } }); searchBarContainer .mouseenter(function() { _searchFlag = true; }) .mouseleave(function() { _searchFlag = false; }); searchBarInput.focusin(function() { searchBarContainer.addClass('search-focus'); updateSearchBar(); }); }); });
import angular from 'angular'; // Create the module where our functionality can attach to let dashboardModule = angular.module('app.dashboard', []); // Include our UI-Router config settings import DashboardConfig from './dashboard.config'; dashboardModule.config(DashboardConfig); // Controllers import DashboardCtrl from './dashboard.controller'; dashboardModule.controller('DashboardCtrl', DashboardCtrl); export default dashboardModule;
var QueryCommand = require('./query_command').QueryCommand, InsertCommand = require('./insert_command').InsertCommand, inherits = require('util').inherits, debug = require('util').debug, crypto = require('crypto'), inspect = require('util').inspect; /** Db Command **/ var DbCommand = exports.DbCommand = function(dbInstance, collectionName, queryOptions, numberToSkip, numberToReturn, query, returnFieldSelector, options) { QueryCommand.call(this); this.collectionName = collectionName; this.queryOptions = queryOptions; this.numberToSkip = numberToSkip; this.numberToReturn = numberToReturn; this.query = query; this.returnFieldSelector = returnFieldSelector; this.db = dbInstance; // Make sure we don't get a null exception options = options == null ? {} : options; // Let us defined on a command basis if we want functions to be serialized or not if(options['serializeFunctions'] != null && options['serializeFunctions']) { this.serializeFunctions = true; } }; inherits(DbCommand, QueryCommand); // Constants DbCommand.SYSTEM_NAMESPACE_COLLECTION = "system.namespaces"; DbCommand.SYSTEM_INDEX_COLLECTION = "system.indexes"; DbCommand.SYSTEM_PROFILE_COLLECTION = "system.profile"; DbCommand.SYSTEM_USER_COLLECTION = "system.users"; DbCommand.SYSTEM_COMMAND_COLLECTION = "$cmd"; // New commands DbCommand.NcreateIsMasterCommand = function(db, databaseName) { return new DbCommand(db, databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'ismaster':1}, null); }; // Provide constructors for different db commands DbCommand.createIsMasterCommand = function(db) { return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'ismaster':1}, null); }; DbCommand.createCollectionInfoCommand = function(db, selector) { return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_NAMESPACE_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, 0, selector, null); }; DbCommand.createGetNonceCommand = function(db) { return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'getnonce':1}, null); }; DbCommand.createAuthenticationCommand = function(db, username, password, nonce) { // Use node md5 generator var md5 = crypto.createHash('md5'); // Generate keys used for authentication md5.update(username + ":mongo:" + password); var hash_password = md5.digest('hex'); // Final key md5 = crypto.createHash('md5'); md5.update(nonce + username + hash_password); var key = md5.digest('hex'); // Creat selector var selector = {'authenticate':1, 'user':username, 'nonce':nonce, 'key':key}; // Create db command return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NONE, 0, -1, selector, null); }; DbCommand.createLogoutCommand = function(db) { return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'logout':1}, null); }; DbCommand.createCreateCollectionCommand = function(db, collectionName, options) { var selector = {'create':collectionName}; // Modify the options to ensure correct behaviour for(var name in options) { if(options[name] != null && options[name].constructor != Function) selector[name] = options[name]; } // Execute the command return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, selector, null); }; DbCommand.createDropCollectionCommand = function(db, collectionName) { return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'drop':collectionName}, null); }; DbCommand.createRenameCollectionCommand = function(db, fromCollectionName, toCollectionName) { var renameCollection = db.databaseName + "." + fromCollectionName; var toCollection = db.databaseName + "." + toCollectionName; return new DbCommand(db, "admin." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'renameCollection':renameCollection, 'to':toCollection}, null); }; DbCommand.createGetLastErrorCommand = function(options, db) { var args = Array.prototype.slice.call(arguments, 0); db = args.pop(); options = args.length ? args.shift() : {}; // Final command var command = {'getlasterror':1}; // If we have an options Object let's merge in the fields (fsync/wtimeout/w) if('object' === typeof options) { for(var name in options) { command[name] = options[name] } } // Execute command return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, command, null); }; DbCommand.createGetLastStatusCommand = DbCommand.createGetLastErrorCommand; DbCommand.createGetPreviousErrorsCommand = function(db) { return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'getpreverror':1}, null); }; DbCommand.createResetErrorHistoryCommand = function(db) { return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'reseterror':1}, null); }; DbCommand.createCreateIndexCommand = function(db, collectionName, fieldOrSpec, options) { var finalUnique = options == null || 'object' === typeof options ? false : options; var fieldHash = {}; var indexes = []; var keys; var sparse; var background; var geoMin, geoMax; // If the options is a hash if(options != null && 'object' === typeof options) { finalUnique = options['unique'] != null ? options['unique'] : false; sparse = options['sparse'] != null ? options['sparse'] : false; background = options['background'] != null ? options['background'] : false; geoMin = options['min'] != null ? options['min'] : null; geoMax = options['max'] != null ? options['max'] : null; } // Get all the fields accordingly if (fieldOrSpec.constructor === String) { // 'type' indexes.push(fieldOrSpec + '_' + 1); fieldHash[fieldOrSpec] = 1; } else if (fieldOrSpec.constructor === Array) { // [{location:'2d'}, ...] fieldOrSpec.forEach(function(f) { if (f.constructor === String) { // [{location:'2d'}, 'type'] indexes.push(f + '_' + 1); fieldHash[f] = 1; } else if (f.constructor === Array) { // [['location', '2d'],['type', 1]] indexes.push(f[0] + '_' + (f[1] || 1)); fieldHash[f[0]] = f[1] || 1; } else if (f.constructor === Object) { // [{location:'2d'}, {type:1}] keys = Object.keys(f); keys.forEach(function(k) { indexes.push(k + '_' + f[k]); fieldHash[k] = f[k]; }); } else { // undefined } }); } else if (fieldOrSpec.constructor === Object) { // {location:'2d', type:1} keys = Object.keys(fieldOrSpec); keys.forEach(function(key) { indexes.push(key + '_' + fieldOrSpec[key]); fieldHash[key] = fieldOrSpec[key]; }); } else { // undefined } // Generate the index name var indexName = indexes.join("_"); // Build the selector var selector = {'ns':(db.databaseName + "." + collectionName), 'key':fieldHash, 'name':indexName}; selector['unique'] = finalUnique; selector['sparse'] = sparse; selector['background'] = background; if (geoMin !== null) selector['min'] = geoMin; if (geoMax !== null) selector['max'] = geoMax; // Create the insert command for the index and return the document return new InsertCommand(db, db.databaseName + "." + DbCommand.SYSTEM_INDEX_COLLECTION, false).add(selector); }; DbCommand.logoutCommand = function(db, command_hash) { return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, command_hash, null); } DbCommand.createDropIndexCommand = function(db, collectionName, indexName) { return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'deleteIndexes':collectionName, 'index':indexName}, null); }; DbCommand.createDropDatabaseCommand = function(db) { return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, {'dropDatabase':1}, null); }; DbCommand.createDbCommand = function(db, command_hash, options) { return new DbCommand(db, db.databaseName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, command_hash, null, options); }; DbCommand.createAdminDbCommand = function(db, command_hash) { return new DbCommand(db, "admin." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, command_hash, null); };
'use strict'; module.exports = function (client) { client.disco.addFeature('vcard-temp'); client.getVCard = function (jid, cb) { return this.sendIq({ to: jid, type: 'get', vCardTemp: true }, cb); }; client.publishVCard = function (vcard, cb) { return this.sendIq({ type: 'set', vCardTemp: vcard }, cb); }; };
/* ============================================================ * DataTables * Generate advanced tables with sorting, export options using * jQuery DataTables plugin * For DEMO purposes only. Extract what you need. * ============================================================ */ (function($) { 'use strict'; var responsiveHelper = undefined; var breakpointDefinition = { tablet: 1024, phone: 480 }; // Initialize datatable showing a search box at the top right corner var initTableWithSearch = function() { var table = $('#tableWithSearch'); var settings = { "sDom": "<t><'row'<p i>>", "destroy": true, "scrollCollapse": true, "oLanguage": { "sLengthMenu": "_MENU_ ", "sInfo": "Showing <b>_START_ to _END_</b> of _TOTAL_ entries" }, "iDisplayLength": 5 }; table.dataTable(settings); // search box for table $('#search-table').keyup(function() { table.fnFilter($(this).val()); }); } // Initialize datatable with ability to add rows dynamically var initTableWithDynamicRows = function() { var table = $('#tableWithDynamicRows'); var settings = { "sDom": "<t><'row'<p i>>", "destroy": true, "scrollCollapse": true, "oLanguage": { "sLengthMenu": "_MENU_ ", "sInfo": "Showing <b>_START_ to _END_</b> of _TOTAL_ entries" }, "iDisplayLength": 5 }; table.dataTable(settings); $('#show-modal').click(function() { $('#addNewAppModal').modal('show'); }); $('#add-app').click(function() { table.dataTable().fnAddData([ $("#appName").val(), $("#appDescription").val(), $("#appPrice").val(), $("#appNotes").val() ]); $('#addNewAppModal').modal('hide'); }); } // Initialize datatable showing export options var initTableWithExportOptions = function() { var table = $('#tableWithExportOptions'); var settings = { "sDom": "<'exportOptions'T><'table-responsive't><'row'<p i>>", "destroy": true, "scrollCollapse": true, "oLanguage": { "sLengthMenu": "_MENU_ ", "sInfo": "Showing <b>_START_ to _END_</b> of _TOTAL_ entries" }, "iDisplayLength": 5, "oTableTools": { "sSwfPath": "assets/plugins/jquery-datatable/extensions/TableTools/swf/copy_csv_xls_pdf.swf", "aButtons": [{ "sExtends": "csv", "sButtonText": "<i class='pg-grid'></i>", }, { "sExtends": "xls", "sButtonText": "<i class='fa fa-file-excel-o'></i>", }, { "sExtends": "pdf", "sButtonText": "<i class='fa fa-file-pdf-o'></i>", }, { "sExtends": "copy", "sButtonText": "<i class='fa fa-copy'></i>", }] }, fnDrawCallback: function(oSettings) { $('.export-options-container').append($('.exportOptions')); $('#ToolTables_tableWithExportOptions_0').tooltip({ title: 'Export as CSV', container: 'body' }); $('#ToolTables_tableWithExportOptions_1').tooltip({ title: 'Export as Excel', container: 'body' }); $('#ToolTables_tableWithExportOptions_2').tooltip({ title: 'Export as PDF', container: 'body' }); $('#ToolTables_tableWithExportOptions_3').tooltip({ title: 'Copy data', container: 'body' }); } }; table.dataTable(settings); } initTableWithSearch(); initTableWithDynamicRows(); initTableWithExportOptions(); })(window.jQuery);
module.exports = { 'name': 'setIsSubset', 'category': 'Set', 'syntax': [ 'setIsSubset(set1, set2)' ], 'description': 'Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.', 'examples': [ 'setIsSubset([1, 2], [3, 4, 5, 6])', 'setIsSubset([3, 4], [3, 4, 5, 6])' ], 'seealso': [ 'setUnion', 'setIntersect', 'setDifference' ] };
const GroupStore = require('app/stores/groupStore'); const SelectedGroupStore = require('app/stores/selectedGroupStore'); describe('SelectedGroupStore', function() { beforeEach(function() { SelectedGroupStore.records = {}; this.sandbox = sinon.sandbox.create(); this.trigger = this.sandbox.spy(SelectedGroupStore, 'trigger'); }); afterEach(function() { this.sandbox.restore(); }); describe('prune()', function() { it('removes records no longer in the GroupStore', function() { this.sandbox.stub(GroupStore, 'getAllItemIds', () => ['3']); SelectedGroupStore.records = {1: true, 2: true, 3: true}; SelectedGroupStore.prune(); expect(SelectedGroupStore.records).to.eql({3: true}); }); it('doesn\'t have any effect when already in sync', function() { this.sandbox.stub(GroupStore, 'getAllItemIds', () => ['1', '2', '3']); SelectedGroupStore.records = {1: true, 2: true, 3: true}; SelectedGroupStore.prune(); expect(SelectedGroupStore.records).to.eql({1: true, 2: true, 3: true}); }); }); describe('add()', function() { it('defaults value of new ids to \'allSelected()\'', function() { SelectedGroupStore.records = {1: true}; SelectedGroupStore.add([2]); expect(SelectedGroupStore.records).to.eql({1: true, 2: true}); }); it('does not update existing ids', function() { SelectedGroupStore.records = {1: false, 2: true}; SelectedGroupStore.add([3]); expect(SelectedGroupStore.records).to.eql({1: false, 2: true, 3: false}); }); }); describe('onGroupChange()', function() { beforeEach(function() { this.prune = this.sandbox.stub(SelectedGroupStore, 'prune'); this.add = this.sandbox.stub(SelectedGroupStore, 'add'); }); it('adds new ids', function() { SelectedGroupStore.onGroupChange([]); expect(this.add.called).to.be.true; }); it('prunes stale records', function() { SelectedGroupStore.onGroupChange([]); expect(this.prune.called).to.be.true; }); it('triggers an update', function() { SelectedGroupStore.onGroupChange([]); expect(this.trigger.called).to.be.true; }); }); describe('allSelected()', function() { it('returns true when all ids are selected', function() { SelectedGroupStore.records = {1: true, 2: true}; expect(SelectedGroupStore.allSelected()).to.be.true; }); it('returns false when some ids are selected', function() { SelectedGroupStore.records = {1: true, 2: false}; expect(SelectedGroupStore.allSelected()).to.be.false; }); it('returns false when no ids are selected', function() { SelectedGroupStore.records = {1: false, 2: false}; expect(SelectedGroupStore.allSelected()).to.be.false; }); it('returns false when there are no ids', function() { expect(SelectedGroupStore.allSelected()).to.be.false; }); }); describe('anySelected()', function() { it('returns true if any ids are selected', function() { SelectedGroupStore.records = {1: true, 2: false}; expect(SelectedGroupStore.anySelected()).to.be.true; }); it('returns false when no ids are selected', function() { SelectedGroupStore.records = {1: false, 2: false}; expect(SelectedGroupStore.anySelected()).to.be.false; }); }); describe('multiSelected()', function() { it('returns true when multiple ids are selected', function() { SelectedGroupStore.records = {1: true, 2: true, 3: false}; expect(SelectedGroupStore.multiSelected()).to.be.true; }); it('returns false when a single id is selected', function() { SelectedGroupStore.records = {1: true, 2: false}; expect(SelectedGroupStore.multiSelected()).to.be.false; }); it('returns false when no ids are selected', function() { SelectedGroupStore.records = {1: false, 2: false}; expect(SelectedGroupStore.multiSelected()).to.be.false; }); }); describe('getSelectedIds()', function() { it('returns selected ids', function() { SelectedGroupStore.records = {1: true, 2: false, 3: true}; let ids = SelectedGroupStore.getSelectedIds(); expect(ids.has('1')).to.be.true; expect(ids.has('3')).to.be.true; expect(ids.size).to.eql(2); }); it('returns empty set with no selected ids', function() { SelectedGroupStore.records = {1: false}; let ids = SelectedGroupStore.getSelectedIds(); expect(ids.has('1')).to.be.false; expect(ids.size).to.eql(0); }); }); describe('isSelected()', function() { it('returns true if id is selected', function() { SelectedGroupStore.records = {1: true}; expect(SelectedGroupStore.isSelected(1)).to.be.true; }); it('returns false if id is unselected or unknown', function() { SelectedGroupStore.records = {1: false}; expect(SelectedGroupStore.isSelected(1)).to.be.false; expect(SelectedGroupStore.isSelected(2)).to.be.false; expect(SelectedGroupStore.isSelected()).to.be.false; }); }); describe('deselectAll()', function() { it('sets all records to false', function() { SelectedGroupStore.records = {1: true, 2: true, 3: false}; SelectedGroupStore.deselectAll(); expect(SelectedGroupStore.records).to.eql({1: false, 2: false, 3: false}); }); it('triggers an update', function() { SelectedGroupStore.deselectAll(); expect(this.trigger.called).to.be.true; }); }); describe('toggleSelect()', function() { it('toggles state given pre-existing id', function() { SelectedGroupStore.records = {1: true}; SelectedGroupStore.toggleSelect(1); expect(SelectedGroupStore.records[1]).to.be.false; }); it('does not toggle state given unknown id', function() { SelectedGroupStore.toggleSelect(1); SelectedGroupStore.toggleSelect(); SelectedGroupStore.toggleSelect(undefined); expect(SelectedGroupStore.records).to.eql({}); }); it('triggers an update given pre-existing id', function() { SelectedGroupStore.records = {1: true}; SelectedGroupStore.toggleSelect(1); expect(this.trigger.called).to.be.true; }); it('does not trigger an update given unknown id', function() { SelectedGroupStore.toggleSelect(); expect(this.trigger.called).to.be.false; }); }); describe('toggleSelectAll()', function() { it('selects all ids if any are unselected', function() { SelectedGroupStore.records = {1: true, 2: false}; SelectedGroupStore.toggleSelectAll(); expect(SelectedGroupStore.records).to.eql({1: true, 2: true}); }); it('unselects all ids if all are selected', function() { SelectedGroupStore.records = {1: true, 2: true}; SelectedGroupStore.toggleSelectAll(); expect(SelectedGroupStore.records).to.eql({1: false, 2: false}); }); it('triggers an update', function() { SelectedGroupStore.toggleSelectAll(); expect(this.trigger.called).to.be.true; }); }); });
module.exports = { entry: "./index", performance: false };
function good() { let obj = { val: true }; return { data: obj }; }
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const webpackMerge = require('webpack-merge'); const config_1 = require("./config"); const webpack_configs_1 = require("./webpack-configs"); const path = require('path'); class NgCliWebpackConfig { constructor(buildOptions, appConfig) { this.validateBuildOptions(buildOptions); const configPath = config_1.CliConfig.configFilePath(); const projectRoot = path.dirname(configPath); appConfig = this.addAppConfigDefaults(appConfig); buildOptions = this.addTargetDefaults(buildOptions); buildOptions = this.mergeConfigs(buildOptions, appConfig); this.wco = { projectRoot, buildOptions, appConfig }; } buildConfig() { let webpackConfigs = [ webpack_configs_1.getCommonConfig(this.wco), webpack_configs_1.getBrowserConfig(this.wco), webpack_configs_1.getStylesConfig(this.wco), this.getTargetConfig(this.wco) ]; if (this.wco.appConfig.main || this.wco.appConfig.polyfills) { const typescriptConfigPartial = this.wco.buildOptions.aot ? webpack_configs_1.getAotConfig(this.wco) : webpack_configs_1.getNonAotConfig(this.wco); webpackConfigs.push(typescriptConfigPartial); } this.config = webpackMerge(webpackConfigs); return this.config; } getTargetConfig(webpackConfigOptions) { switch (webpackConfigOptions.buildOptions.target) { case 'development': return webpack_configs_1.getDevConfig(webpackConfigOptions); case 'production': return webpack_configs_1.getProdConfig(webpackConfigOptions); } } // Validate build options validateBuildOptions(buildOptions) { buildOptions.target = buildOptions.target || 'development'; if (buildOptions.target !== 'development' && buildOptions.target !== 'production') { throw new Error("Invalid build target. Only 'development' and 'production' are available."); } } // Fill in defaults for build targets addTargetDefaults(buildOptions) { const targetDefaults = { development: { environment: 'dev', outputHashing: 'media', sourcemaps: true, extractCss: false }, production: { environment: 'prod', outputHashing: 'all', sourcemaps: false, extractCss: true, aot: true } }; return Object.assign({}, targetDefaults[buildOptions.target], buildOptions); } // Fill in defaults from .angular-cli.json mergeConfigs(buildOptions, appConfig) { const mergeableOptions = { outputPath: appConfig.outDir, deployUrl: appConfig.deployUrl }; return Object.assign({}, mergeableOptions, buildOptions); } addAppConfigDefaults(appConfig) { const appConfigDefaults = { testTsconfig: appConfig.tsconfig, scripts: [], styles: [] }; // can't use Object.assign here because appConfig has a lot of getters/setters for (let key of Object.keys(appConfigDefaults)) { appConfig[key] = appConfig[key] || appConfigDefaults[key]; } return appConfig; } } exports.NgCliWebpackConfig = NgCliWebpackConfig; //# sourceMappingURL=/users/hans/sources/angular-cli/models/webpack-config.js.map
/* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * 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 Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. 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. * * ***** END LICENSE BLOCK ***** */ __ace_shadowed__.define('ace/mode/verilog', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/verilog_highlight_rules', 'ace/range'], function(require, exports, module) { var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var Tokenizer = require("../tokenizer").Tokenizer; var VerilogHighlightRules = require("./verilog_highlight_rules").VerilogHighlightRules; var Range = require("../range").Range; var Mode = function() { this.HighlightRules = VerilogHighlightRules; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; }).call(Mode.prototype); exports.Mode = Mode; }); __ace_shadowed__.define('ace/mode/verilog_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var VerilogHighlightRules = function() { var keywords = "always|and|assign|automatic|begin|buf|bufif0|bufif1|case|casex|casez|cell|cmos|config|" + "deassign|default|defparam|design|disable|edge|else|end|endcase|endconfig|endfunction|endgenerate|endmodule|" + "endprimitive|endspecify|endtable|endtask|event|for|force|forever|fork|function|generate|genvar|highz0|" + "highz1|if|ifnone|incdir|include|initial|inout|input|instance|integer|join|large|liblist|library|localparam|" + "macromodule|medium|module|nand|negedge|nmos|nor|noshowcancelled|not|notif0|notif1|or|output|parameter|pmos|" + "posedge|primitive|pull0|pull1|pulldown|pullup|pulsestyle_onevent|pulsestyle_ondetect|rcmos|real|realtime|" + "reg|release|repeat|rnmos|rpmos|rtran|rtranif0|rtranif1|scalared|showcancelled|signed|small|specify|specparam|" + "strong0|strong1|supply0|supply1|table|task|time|tran|tranif0|tranif1|tri|tri0|tri1|triand|trior|trireg|" + "unsigned|use|vectored|wait|wand|weak0|weak1|while|wire|wor|xnor|xor" + "begin|bufif0|bufif1|case|casex|casez|config|else|end|endcase|endconfig|endfunction|" + "endgenerate|endmodule|endprimitive|endspecify|endtable|endtask|for|forever|function|generate|if|ifnone|" + "macromodule|module|primitive|repeat|specify|table|task|while"; var builtinConstants = ( "true|false|null" ); var builtinFunctions = ( "count|min|max|avg|sum|rank|now|coalesce|main" ); var keywordMapper = this.createKeywordMapper({ "support.function": builtinFunctions, "keyword": keywords, "constant.language": builtinConstants }, "identifier", true); this.$rules = { "start" : [ { token : "comment", regex : "//.*$" }, { token : "string", // " string regex : '".*?"' }, { token : "string", // ' string regex : "'.*?'" }, { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" }, { token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|=" }, { token : "paren.lparen", regex : "[\\(]" }, { token : "paren.rparen", regex : "[\\)]" }, { token : "text", regex : "\\s+" } ] }; }; oop.inherits(VerilogHighlightRules, TextHighlightRules); exports.VerilogHighlightRules = VerilogHighlightRules; });
var common = require("./common") , odbc = require("../") , db = new odbc.ODBC() , assert = require("assert") , exitCode = 0 ; db.createConnection(function (err, conn) { conn.openSync(common.connectionString); conn.createStatement(function (err, stmt) { var r, result, caughtError; //try excuting without preparing or binding. try { result = stmt.executeSync(); } catch (e) { caughtError = e; } try { assert.ok(caughtError); } catch (e) { console.log(e.message); exitCode = 1; } //try incorrectly binding a string and then executeSync try { r = stmt.bind("select 1 + 1 as col1"); } catch (e) { caughtError = e; } try { assert.equal(caughtError.message, "Argument 1 must be an Array"); r = stmt.prepareSync("select 1 + ? as col1"); assert.equal(r, true, "prepareSync did not return true"); r = stmt.bindSync([2]); assert.equal(r, true, "bindSync did not return true"); result = stmt.executeSync(); assert.equal(result.constructor.name, "ODBCResult"); r = result.fetchAllSync(); assert.deepEqual(r, [ { col1: 3 } ]); r = result.closeSync(); assert.equal(r, true, "closeSync did not return true"); result = stmt.executeSync(); assert.equal(result.constructor.name, "ODBCResult"); r = result.fetchAllSync(); assert.deepEqual(r, [ { col1: 3 } ]); console.log(r); } catch (e) { console.log(e); exitCode = 1; } conn.closeSync(); if (exitCode) { console.log("failed"); } else { console.log("success"); } process.exit(exitCode); }); });
module.exports={A:{A:{"1":"E B A","2":"UB","8":"J","132":"C G"},B:{"1":"D X g H L"},C:{"1":"0 2 4 F I J C G E B A D X g H L M N O P Q R S T U V W u Y Z a b c d e f K h i j k l m n o p q r w x v z t s QB PB","2":"1 SB"},D:{"1":"0 2 4 8 F I J C G E B A D X g H L M N O P Q R S T U V W u Y Z a b c d e f K h i j k l m n o p q r w x v z t s EB AB TB BB CB"},E:{"1":"7 F I J C G E B A FB GB HB IB JB KB","2":"DB"},F:{"1":"5 6 A D H L M N O P Q R S T U V W u Y Z a b c d e f K h i j k l m n o p q r LB MB NB OB RB y","2":"E"},G:{"1":"3 7 9 G A VB WB XB YB ZB aB bB cB"},H:{"1":"dB"},I:{"1":"1 3 F s eB fB gB hB iB jB"},J:{"1":"C B"},K:{"1":"5 6 B A D K y"},L:{"1":"8"},M:{"1":"t"},N:{"1":"B A"},O:{"1":"kB"},P:{"1":"F I"},Q:{"1":"lB"},R:{"1":"mB"}},B:2,C:"CSS3 selectors"};
var Cancel = require('../../../lib/cancel/Cancel'); describe('Cancel', function() { describe('toString', function() { it('returns correct result when message is not specified', function() { var cancel = new Cancel(); expect(cancel.toString()).toBe('Cancel'); }); it('returns correct result when message is specified', function() { var cancel = new Cancel('Operation has been canceled.'); expect(cancel.toString()).toBe('Cancel: Operation has been canceled.'); }); }); });
// @flow export default class Rocket { country: string; year: number; name: string; constructor (country: string, name: string, year: number) { this.country = country; this.name = name; this.year = year; } launch (payload: number) { if (payload < 0 || payload > this.maxPayload) return 'We have a problem!'; return 'Rocket launched succesfully!'; } maxPayload: number = 6900; }
/** @license * @pnp/config-store v1.1.1 - pnp - provides a way to manage configuration within your application * MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE) * Copyright (c) 2018 Microsoft * docs: https://pnp.github.io/pnpjs/ * source: https:github.com/pnp/pnpjs * bugs: https://github.com/pnp/pnpjs/issues */ import { Dictionary, PnPClientStorage } from '@pnp/common'; import { Logger } from '@pnp/logging'; /** * Class used to manage the current application settings * */ class Settings { /** * Creates a new instance of the settings class * * @constructor */ constructor() { this._settings = new Dictionary(); } /** * Adds a new single setting, or overwrites a previous setting with the same key * * @param {string} key The key used to store this setting * @param {string} value The setting value to store */ add(key, value) { this._settings.add(key, value); } /** * Adds a JSON value to the collection as a string, you must use getJSON to rehydrate the object when read * * @param {string} key The key used to store this setting * @param {any} value The setting value to store */ addJSON(key, value) { this._settings.add(key, JSON.stringify(value)); } /** * Applies the supplied hash to the setting collection overwriting any existing value, or created new values * * @param {TypedHash<any>} hash The set of values to add */ apply(hash) { return new Promise((resolve, reject) => { try { this._settings.merge(hash); resolve(); } catch (e) { reject(e); } }); } /** * Loads configuration settings into the collection from the supplied provider and returns a Promise * * @param {IConfigurationProvider} provider The provider from which we will load the settings */ load(provider) { return new Promise((resolve, reject) => { provider.getConfiguration().then((value) => { this._settings.merge(value); resolve(); }).catch(reject); }); } /** * Gets a value from the configuration * * @param {string} key The key whose value we want to return. Returns null if the key does not exist * @return {string} string value from the configuration */ get(key) { return this._settings.get(key); } /** * Gets a JSON value, rehydrating the stored string to the original object * * @param {string} key The key whose value we want to return. Returns null if the key does not exist * @return {any} object from the configuration */ getJSON(key) { const o = this.get(key); if (typeof o === "undefined" || o === null) { return o; } return JSON.parse(o); } } class NoCacheAvailableException extends Error { constructor(msg = "Cannot create a caching configuration provider since cache is not available.") { super(msg); this.name = "NoCacheAvailableException"; Logger.log({ data: {}, level: 3 /* Error */, message: `[${this.name}]::${this.message}` }); } } /** * A caching provider which can wrap other non-caching providers * */ class CachingConfigurationProvider { /** * Creates a new caching configuration provider * @constructor * @param {IConfigurationProvider} wrappedProvider Provider which will be used to fetch the configuration * @param {string} cacheKey Key that will be used to store cached items to the cache * @param {IPnPClientStore} cacheStore OPTIONAL storage, which will be used to store cached settings. */ constructor(wrappedProvider, cacheKey, cacheStore) { this.wrappedProvider = wrappedProvider; this.cacheKey = cacheKey; this.wrappedProvider = wrappedProvider; this.store = (cacheStore) ? cacheStore : this.selectPnPCache(); } /** * Gets the wrapped configuration providers * * @return {IConfigurationProvider} Wrapped configuration provider */ getWrappedProvider() { return this.wrappedProvider; } /** * Loads the configuration values either from the cache or from the wrapped provider * * @return {Promise<TypedHash<string>>} Promise of loaded configuration values */ getConfiguration() { // Cache not available, pass control to the wrapped provider if ((!this.store) || (!this.store.enabled)) { return this.wrappedProvider.getConfiguration(); } return this.store.getOrPut(this.cacheKey, () => { return this.wrappedProvider.getConfiguration().then((providedConfig) => { this.store.put(this.cacheKey, providedConfig); return providedConfig; }); }); } selectPnPCache() { const pnpCache = new PnPClientStorage(); if ((pnpCache.local) && (pnpCache.local.enabled)) { return pnpCache.local; } if ((pnpCache.session) && (pnpCache.session.enabled)) { return pnpCache.session; } throw new NoCacheAvailableException(); } } /** * A configuration provider which loads configuration values from a SharePoint list * */ class SPListConfigurationProvider { /** * Creates a new SharePoint list based configuration provider * @constructor * @param {string} webUrl Url of the SharePoint site, where the configuration list is located * @param {string} listTitle Title of the SharePoint list, which contains the configuration settings (optional, default: "config") * @param {string} keyFieldName The name of the field in the list to use as the setting key (optional, default: "Title") * @param {string} valueFieldName The name of the field in the list to use as the setting value (optional, default: "Value") */ constructor(web, listTitle = "config", keyFieldName = "Title", valueFieldName = "Value") { this.web = web; this.listTitle = listTitle; this.keyFieldName = keyFieldName; this.valueFieldName = valueFieldName; } /** * Loads the configuration values from the SharePoint list * * @return {Promise<TypedHash<string>>} Promise of loaded configuration values */ getConfiguration() { return this.web.lists.getByTitle(this.listTitle).items.select(this.keyFieldName, this.valueFieldName).get() .then((data) => data.reduce((c, item) => { c[item[this.keyFieldName]] = item[this.valueFieldName]; return c; }, {})); } /** * Wraps the current provider in a cache enabled provider * * @return {CachingConfigurationProvider} Caching providers which wraps the current provider */ asCaching(cacheKey = `pnp_configcache_splist_${this.web.toUrl()}+${this.listTitle}`) { return new CachingConfigurationProvider(this, cacheKey); } } export { Settings, CachingConfigurationProvider, SPListConfigurationProvider, NoCacheAvailableException }; //# sourceMappingURL=config-store.js.map
// Custom jQuery // ----------------------------------- (function(window, document, $, undefined){ $(function(){ // BOOTSTRAP SLIDER CTRL // ----------------------------------- $('[data-ui-slider]').slider(); // CHOSEN // ----------------------------------- $('.chosen-select').chosen(); // DATETIMEPICKER // ----------------------------------- $('#datetimepicker').datetimepicker({ icons: { time: 'fa fa-clock-o', date: 'fa fa-calendar', up: 'fa fa-chevron-up', down: 'fa fa-chevron-down', previous: 'fa fa-chevron-left', next: 'fa fa-chevron-right', today: 'fa fa-crosshairs', clear: 'fa fa-trash' } }); }); })(window, document, window.jQuery);
/*! * jQuery JavaScript Library v1.11.0 -css,-css/addGetHookIf,-css/curCSS,-css/defaultDisplay,-css/hiddenVisibleSelectors,-css/support,-css/swap,-css/var/cssExpand,-css/var/isHidden,-css/var/rmargin,-css/var/rnumnonpx,-effects,-effects/Tween,-effects/animatedSelector,-effects/support,-dimensions,-offset * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2014-09-24T05:24Z */ (function( global, factory ) { if ( typeof module === "object" && typeof module.exports === "object" ) { // For CommonJS and CommonJS-like environments where a proper window is present, // execute the factory and get jQuery // For environments that do not inherently posses a window with a document // (such as Node.js), expose a jQuery-making factory as module.exports // This accentuates the need for the creation of a real window // e.g. var jQuery = require("jquery")(window); // See ticket #14549 for more info module.exports = global.document ? factory( global, true ) : function( w ) { if ( !w.document ) { throw new Error( "jQuery requires a window with a document" ); } return factory( w ); }; } else { factory( global ); } // Pass this if window is not defined yet }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { // Can't do this because several apps including ASP.NET trace // the stack via arguments.caller.callee and Firefox dies if // you try to trace through "use strict" call chains. (#13335) // Support: Firefox 18+ // var deletedIds = []; var slice = deletedIds.slice; var concat = deletedIds.concat; var push = deletedIds.push; var indexOf = deletedIds.indexOf; var class2type = {}; var toString = class2type.toString; var hasOwn = class2type.hasOwnProperty; var trim = "".trim; var support = {}; var version = "1.11.0 -css,-css/addGetHookIf,-css/curCSS,-css/defaultDisplay,-css/hiddenVisibleSelectors,-css/support,-css/swap,-css/var/cssExpand,-css/var/isHidden,-css/var/rmargin,-css/var/rnumnonpx,-effects,-effects/Tween,-effects/animatedSelector,-effects/support,-dimensions,-offset", // Define a local copy of jQuery jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' // Need init if jQuery is called (just allow error to be thrown if not included) return new jQuery.fn.init( selector, context ); }, // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { return letter.toUpperCase(); }; jQuery.fn = jQuery.prototype = { // The current version of jQuery being used jquery: version, constructor: jQuery, // Start with an empty selector selector: "", // The default length of a jQuery object is 0 length: 0, toArray: function() { return slice.call( this ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num != null ? // Return a 'clean' array ( num < 0 ? this[ num + this.length ] : this[ num ] ) : // Return just the object slice.call( this ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems ) { // Build a new jQuery matched element set var ret = jQuery.merge( this.constructor(), elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jQuery.each( this, callback, args ); }, map: function( callback ) { return this.pushStack( jQuery.map(this, function( elem, i ) { return callback.call( elem, i, elem ); })); }, slice: function() { return this.pushStack( slice.apply( this, arguments ) ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, eq: function( i ) { var len = this.length, j = +i + ( i < 0 ? len : 0 ); return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); }, end: function() { return this.prevObject || this.constructor(null); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: push, sort: deletedIds.sort, splice: deletedIds.splice }; jQuery.extend = jQuery.fn.extend = function() { var src, copyIsArray, copy, name, options, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; // skip the boolean and the target target = arguments[ i ] || {}; i++; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction(target) ) { target = {}; } // extend jQuery itself if only one argument is passed if ( i === length ) { target = this; i--; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) { // Extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && jQuery.isArray(src) ? src : []; } else { clone = src && jQuery.isPlainObject(src) ? src : {}; } // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; }; jQuery.extend({ // Unique for each copy of jQuery on the page expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), // Assume jQuery is ready without the ready module isReady: true, error: function( msg ) { throw new Error( msg ); }, noop: function() {}, // See test/unit/core.js for details concerning isFunction. // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). isFunction: function( obj ) { return jQuery.type(obj) === "function"; }, isArray: Array.isArray || function( obj ) { return jQuery.type(obj) === "array"; }, isWindow: function( obj ) { /* jshint eqeqeq: false */ return obj != null && obj == obj.window; }, isNumeric: function( obj ) { // parseFloat NaNs numeric-cast false positives (null|true|false|"") // ...but misinterprets leading-number strings, particularly hex literals ("0x...") // subtraction forces infinities to NaN return obj - parseFloat( obj ) >= 0; }, isEmptyObject: function( obj ) { var name; for ( name in obj ) { return false; } return true; }, isPlainObject: function( obj ) { var key; // Must be an Object. // Because of IE, we also have to check the presence of the constructor property. // Make sure that DOM nodes and window objects don't pass through, as well if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } try { // Not own constructor property must be Object if ( obj.constructor && !hasOwn.call(obj, "constructor") && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { return false; } } catch ( e ) { // IE8,9 Will throw exceptions on certain host objects #9897 return false; } // Support: IE<9 // Handle iteration over inherited properties before own properties. if ( support.ownLast ) { for ( key in obj ) { return hasOwn.call( obj, key ); } } // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. for ( key in obj ) {} return key === undefined || hasOwn.call( obj, key ); }, type: function( obj ) { if ( obj == null ) { return obj + ""; } return typeof obj === "object" || typeof obj === "function" ? class2type[ toString.call(obj) ] || "object" : typeof obj; }, // Evaluates a script in a global context // Workarounds based on findings by Jim Driscoll // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context globalEval: function( data ) { if ( data && jQuery.trim( data ) ) { // We use execScript on Internet Explorer // We use an anonymous function so that context is window // rather than jQuery in Firefox ( window.execScript || function( data ) { window[ "eval" ].call( window, data ); } )( data ); } }, // Convert dashed to camelCase; used by the css and data modules // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, // args is for internal usage only each: function( obj, callback, args ) { var value, i = 0, length = obj.length, isArray = isArraylike( obj ); if ( args ) { if ( isArray ) { for ( ; i < length; i++ ) { value = callback.apply( obj[ i ], args ); if ( value === false ) { break; } } } else { for ( i in obj ) { value = callback.apply( obj[ i ], args ); if ( value === false ) { break; } } } // A special, fast, case for the most common use of each } else { if ( isArray ) { for ( ; i < length; i++ ) { value = callback.call( obj[ i ], i, obj[ i ] ); if ( value === false ) { break; } } } else { for ( i in obj ) { value = callback.call( obj[ i ], i, obj[ i ] ); if ( value === false ) { break; } } } } return obj; }, // Use native String.trim function wherever possible trim: trim && !trim.call("\uFEFF\xA0") ? function( text ) { return text == null ? "" : trim.call( text ); } : // Otherwise use our own trimming functionality function( text ) { return text == null ? "" : ( text + "" ).replace( rtrim, "" ); }, // results is for internal usage only makeArray: function( arr, results ) { var ret = results || []; if ( arr != null ) { if ( isArraylike( Object(arr) ) ) { jQuery.merge( ret, typeof arr === "string" ? [ arr ] : arr ); } else { push.call( ret, arr ); } } return ret; }, inArray: function( elem, arr, i ) { var len; if ( arr ) { if ( indexOf ) { return indexOf.call( arr, elem, i ); } len = arr.length; i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; for ( ; i < len; i++ ) { // Skip accessing in sparse arrays if ( i in arr && arr[ i ] === elem ) { return i; } } } return -1; }, merge: function( first, second ) { var len = +second.length, j = 0, i = first.length; while ( j < len ) { first[ i++ ] = second[ j++ ]; } // Support: IE<9 // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists) if ( len !== len ) { while ( second[j] !== undefined ) { first[ i++ ] = second[ j++ ]; } } first.length = i; return first; }, grep: function( elems, callback, invert ) { var callbackInverse, matches = [], i = 0, length = elems.length, callbackExpect = !invert; // Go through the array, only saving the items // that pass the validator function for ( ; i < length; i++ ) { callbackInverse = !callback( elems[ i ], i ); if ( callbackInverse !== callbackExpect ) { matches.push( elems[ i ] ); } } return matches; }, // arg is for internal usage only map: function( elems, callback, arg ) { var value, i = 0, length = elems.length, isArray = isArraylike( elems ), ret = []; // Go through the array, translating each of the items to their new values if ( isArray ) { for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret.push( value ); } } // Go through every key on the object, } else { for ( i in elems ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret.push( value ); } } } // Flatten any nested arrays return concat.apply( [], ret ); }, // A global GUID counter for objects guid: 1, // Bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { var args, proxy, tmp; if ( typeof context === "string" ) { tmp = fn[ context ]; context = fn; fn = tmp; } // Quick check to determine if target is callable, in the spec // this throws a TypeError, but we will just return undefined. if ( !jQuery.isFunction( fn ) ) { return undefined; } // Simulated bind args = slice.call( arguments, 2 ); proxy = function() { return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || jQuery.guid++; return proxy; }, now: function() { return +( new Date() ); }, // jQuery.support is not used in Core but other projects attach their // properties to it so it needs to exist. support: support }); // Populate the class2type map jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); }); function isArraylike( obj ) { var length = obj.length, type = jQuery.type( obj ); if ( type === "function" || jQuery.isWindow( obj ) ) { return false; } if ( obj.nodeType === 1 && length ) { return true; } return type === "array" || length === 0 || typeof length === "number" && length > 0 && ( length - 1 ) in obj; } var Sizzle = /*! * Sizzle CSS Selector Engine v1.10.16 * http://sizzlejs.com/ * * Copyright 2013 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2014-01-13 */ (function( window ) { var i, support, Expr, getText, isXML, compile, outermostContext, sortInput, hasDuplicate, // Local document vars setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, // Instance-specific data expando = "sizzle" + -(new Date()), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), sortOrder = function( a, b ) { if ( a === b ) { hasDuplicate = true; } return 0; }, // General-purpose constants strundefined = typeof undefined, MAX_NEGATIVE = 1 << 31, // Instance methods hasOwn = ({}).hasOwnProperty, arr = [], pop = arr.pop, push_native = arr.push, push = arr.push, slice = arr.slice, // Use a stripped-down indexOf 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; }, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", // 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 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + "*(?:([*^$|!~]?=)" + 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 + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), rpseudo = new RegExp( pseudos ), ridentifier = new RegExp( "^" + identifier + "$" ), matchExpr = { "ID": new RegExp( "^#(" + characterEncoding + ")" ), "CLASS": new RegExp( "^\\.(" + 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" ), "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), // For use in libraries implementing .is() // We use this for POS matching in `select` "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rnative = /^[^{]+\{\s*\[native \w/, // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, rescape = /'|\\/g, // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), funescape = function( _, escaped, escapedWhitespace ) { var high = "0x" + escaped - 0x10000; // NaN means non-codepoint // Support: Firefox // Workaround erroneous numeric interpretation of +"0x" return high !== high || escapedWhitespace ? escaped : high < 0 ? // BMP codepoint String.fromCharCode( high + 0x10000 ) : // Supplemental Plane codepoint (surrogate pair) String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); }; // Optimize for push.apply( _, NodeList ) try { push.apply( (arr = slice.call( preferredDoc.childNodes )), preferredDoc.childNodes ); // Support: Android<4.0 // Detect silently failing push.apply arr[ preferredDoc.childNodes.length ].nodeType; } catch ( e ) { push = { apply: arr.length ? // Leverage slice if possible function( target, els ) { push_native.apply( target, slice.call(els) ); } : // Support: IE<9 // Otherwise append directly function( target, els ) { var j = target.length, i = 0; // Can't trust NodeList.length while ( (target[j++] = els[i++]) ) {} target.length = j - 1; } }; } function Sizzle( selector, context, results, seed ) { var 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 (jQuery #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 || !rbuggyQSA.test( selector )) ) { nid = old = 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 ) && testContext( 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 ); } /** * Create key-value caches of limited size * @returns {Function(string, Object)} Returns the Object data after storing it on itself with * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) * deleting the oldest entry */ function createCache() { var keys = []; function cache( key, value ) { // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) if ( keys.push( key + " " ) > Expr.cacheLength ) { // Only keep the most recent entries delete cache[ keys.shift() ]; } return (cache[ key + " " ] = value); } return cache; } /** * Mark a function for special use by Sizzle * @param {Function} fn The function to mark */ function markFunction( fn ) { fn[ expando ] = true; return fn; } /** * Support testing using an element * @param {Function} fn Passed the created div and expects a boolean result */ function assert( fn ) { var div = document.createElement("div"); try { return !!fn( div ); } catch (e) { return false; } finally { // Remove from its parent by default if ( div.parentNode ) { div.parentNode.removeChild( div ); } // release memory in IE div = null; } } /** * Adds the same handler for all of the specified attrs * @param {String} attrs Pipe-separated list of attributes * @param {Function} handler The method that will be applied */ function addHandle( attrs, handler ) { var arr = attrs.split("|"), i = attrs.length; while ( i-- ) { Expr.attrHandle[ arr[i] ] = handler; } } /** * Checks document order of two siblings * @param {Element} a * @param {Element} b * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b */ function siblingCheck( a, b ) { var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); // Use IE sourceIndex if available on both nodes if ( diff ) { return diff; } // Check if b follows a if ( cur ) { while ( (cur = cur.nextSibling) ) { if ( cur === b ) { return -1; } } } return a ? 1 : -1; } /** * Returns a function to use in pseudos for input types * @param {String} type */ function createInputPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; } /** * Returns a function to use in pseudos for buttons * @param {String} type */ function createButtonPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; } /** * Returns a function to use in pseudos for positionals * @param {Function} fn */ function createPositionalPseudo( fn ) { return markFunction(function( argument ) { argument = +argument; return markFunction(function( seed, matches ) { var j, matchIndexes = fn( [], seed.length, argument ), i = matchIndexes.length; // Match elements found at the specified indexes while ( i-- ) { if ( seed[ (j = matchIndexes[i]) ] ) { seed[j] = !(matches[j] = seed[j]); } } }); }); } /** * Checks a node for validity as a Sizzle context * @param {Element|Object=} context * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value */ function testContext( context ) { return context && typeof context.getElementsByTagName !== strundefined && context; } // Expose support vars for convenience support = Sizzle.support = {}; /** * Detects XML nodes * @param {Element|Object} elem An element or a document * @returns {Boolean} True iff elem is a non-HTML XML node */ isXML = Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = elem && (elem.ownerDocument || elem).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; /** * Sets document-related variables once based on the current document * @param {Element|Object} [doc] An element or document object to use to set the document * @returns {Object} Returns the current document */ setDocument = Sizzle.setDocument = function( node ) { var hasCompare, doc = node ? node.ownerDocument || node : preferredDoc, parent = doc.defaultView; // 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 ); // Support: IE>8 // If iframe document is assigned to "document" variable and if iframe has been reloaded, // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 // IE6-8 do not support the defaultView property so parent will be undefined if ( parent && parent !== parent.top ) { // IE11 does not have attachEvent, so all must suffer if ( parent.addEventListener ) { parent.addEventListener( "unload", function() { setDocument(); }, false ); } else if ( parent.attachEvent ) { parent.attachEvent( "onunload", function() { setDocument(); }); } } /* Attributes ---------------------------------------------------------------------- */ // Support: IE<8 // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) support.attributes = assert(function( div ) { div.className = "i"; return !div.getAttribute("className"); }); /* getElement(s)By* ---------------------------------------------------------------------- */ // Check if getElementsByTagName("*") returns only elements support.getElementsByTagName = assert(function( div ) { div.appendChild( doc.createComment("") ); return !div.getElementsByTagName("*").length; }); // Check if getElementsByClassName can be trusted support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) { div.innerHTML = "<div class='a'></div><div class='a i'></div>"; // Support: Safari<4 // Catch class over-caching div.firstChild.className = "i"; // Support: Opera<10 // Catch gEBCN failure to find non-leading classes return div.getElementsByClassName("i").length === 2; }); // Support: IE<10 // Check if getElementById returns elements by name // The broken getElementById methods don't pick up programatically-set names, // so use a roundabout getElementsByName test support.getById = assert(function( div ) { docElem.appendChild( div ).id = expando; return !doc.getElementsByName || !doc.getElementsByName( expando ).length; }); // ID find and filter if ( support.getById ) { 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 { // Support: IE6/7 // getElementById is not reliable as a find shortcut delete Expr.find["ID"]; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { var node = typeof elem.getAttributeNode !== 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; }; // Class Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { return context.getElementsByClassName( className ); } }; /* QSA/matchesSelector ---------------------------------------------------------------------- */ // QSA and matchesSelector support // matchesSelector(:active) reports false when true (IE9/Opera 11.5) rbuggyMatches = []; // qSa(:focus) reports false when true (Chrome 21) // We allow this because of a bug in IE8/9 that throws an error // whenever `document.activeElement` is accessed on an iframe // So, we allow :focus to pass through QSA all the time to avoid the IE error // See http://bugs.jquery.com/ticket/13378 rbuggyQSA = []; if ( (support.qsa = rnative.test( 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 t=''><option selected=''></option></select>"; // Support: IE8, Opera 10-12 // Nothing should be selected when empty strings follow ^= or $= or *= if ( div.querySelectorAll("[t^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); } // Support: IE8 // Boolean attributes and "value" are not treated correctly if ( !div.querySelectorAll("[selected]").length ) { rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); } // 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 ) { // Support: Windows 8 Native Apps // The type and name attributes are restricted during .innerHTML assignment var input = doc.createElement("input"); input.setAttribute( "type", "hidden" ); div.appendChild( input ).setAttribute( "name", "D" ); // Support: IE8 // Enforce case-sensitivity of name attribute if ( div.querySelectorAll("[name=d]").length ) { rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":enabled").length ) { rbuggyQSA.push( ":enabled", ":disabled" ); } // Opera 10-11 does not throw on post-comma invalid pseudos div.querySelectorAll("*,:x"); rbuggyQSA.push(",.*:"); }); } if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { assert(function( div ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9) support.disconnectedMatch = matches.call( div, "div" ); // This should fail with an exception // Gecko does not error, returns false instead matches.call( div, "[s!='']:x" ); rbuggyMatches.push( "!=", pseudos ); }); } rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); /* Contains ---------------------------------------------------------------------- */ hasCompare = rnative.test( docElem.compareDocumentPosition ); // Element contains another // Purposefully does not implement inclusive descendent // As in, an element does not contain itself contains = hasCompare || rnative.test( docElem.contains ) ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!( bup && bup.nodeType === 1 && ( adown.contains ? adown.contains( bup ) : a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 )); } : function( a, b ) { if ( b ) { while ( (b = b.parentNode) ) { if ( b === a ) { return true; } } } return false; }; /* Sorting ---------------------------------------------------------------------- */ // Document order sorting sortOrder = hasCompare ? function( a, b ) { // Flag for duplicate removal if ( a === b ) { hasDuplicate = true; return 0; } // Sort on method existence if only one input has compareDocumentPosition var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; if ( compare ) { return compare; } // Calculate position if both inputs belong to the same document compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? a.compareDocumentPosition( b ) : // Otherwise we know they are disconnected 1; // Disconnected nodes if ( compare & 1 || (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { // Choose the first element that is related to our preferred document if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { return -1; } if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { return 1; } // Maintain original order return sortInput ? ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 0; } return compare & 4 ? -1 : 1; } : function( a, b ) { // Exit early if the nodes are identical if ( a === b ) { hasDuplicate = true; return 0; } var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [ a ], bp = [ b ]; // Parentless nodes are either documents or disconnected if ( !aup || !bup ) { return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : sortInput ? ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 0; // If the nodes are siblings, we can do a quick check } else if ( aup === bup ) { return siblingCheck( a, b ); } // Otherwise we need full lists of their ancestors for comparison cur = a; while ( (cur = cur.parentNode) ) { ap.unshift( cur ); } cur = b; while ( (cur = cur.parentNode) ) { bp.unshift( cur ); } // Walk down the tree looking for a discrepancy while ( ap[i] === bp[i] ) { i++; } return i ? // Do a sibling check if the nodes have a common ancestor siblingCheck( ap[i], bp[i] ) : // Otherwise nodes in our document sort first ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0; }; return doc; }; Sizzle.matches = function( expr, elements ) { return Sizzle( expr, null, null, elements ); }; Sizzle.matchesSelector = function( elem, expr ) { // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } // Make sure that attribute selectors are quoted expr = expr.replace( rattributeQuotes, "='$1']" ); if ( support.matchesSelector && documentIsHTML && ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { try { var ret = matches.call( elem, expr ); // IE 9's matchesSelector returns false on disconnected nodes if ( ret || support.disconnectedMatch || // As well, disconnected nodes are said to be in a document // fragment in IE 9 elem.document && elem.document.nodeType !== 11 ) { return ret; } } catch(e) {} } return Sizzle( expr, document, null, [elem] ).length > 0; }; Sizzle.contains = function( context, elem ) { // Set document vars if needed if ( ( context.ownerDocument || context ) !== document ) { setDocument( context ); } return contains( context, elem ); }; Sizzle.attr = function( elem, name ) { // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } var fn = Expr.attrHandle[ name.toLowerCase() ], // Don't get fooled by Object.prototype properties (jQuery #13807) val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? fn( elem, name, !documentIsHTML ) : undefined; return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute( name ) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null; }; Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; /** * Document sorting and removing duplicates * @param {ArrayLike} results */ Sizzle.uniqueSort = function( results ) { var elem, duplicates = [], j = 0, i = 0; // Unless we *know* we can detect duplicates, assume their presence hasDuplicate = !support.detectDuplicates; sortInput = !support.sortStable && results.slice( 0 ); results.sort( sortOrder ); if ( hasDuplicate ) { while ( (elem = results[i++]) ) { if ( elem === results[ i ] ) { j = duplicates.push( i ); } } while ( j-- ) { results.splice( duplicates[ j ], 1 ); } } // Clear input after sorting to release objects // See https://github.com/jquery/sizzle/pull/225 sortInput = null; return results; }; /** * Utility function for retrieving the text value of an array of DOM nodes * @param {Array|Element} elem */ getText = Sizzle.getText = function( elem ) { var node, ret = "", i = 0, nodeType = elem.nodeType; if ( !nodeType ) { // If no nodeType, this is expected to be an array while ( (node = elem[i++]) ) { // Do not traverse comment nodes ret += getText( node ); } } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { // Use textContent for elements // innerText usage removed for consistency of new lines (jQuery #11153) if ( typeof elem.textContent === "string" ) { return elem.textContent; } else { // Traverse its children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { ret += getText( elem ); } } } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } // Do not include comment or processing instruction nodes return ret; }; Expr = Sizzle.selectors = { // Can be adjusted by the user cacheLength: 50, createPseudo: markFunction, match: matchExpr, attrHandle: {}, find: {}, relative: { ">": { dir: "parentNode", first: true }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: true }, "~": { dir: "previousSibling" } }, preFilter: { "ATTR": function( match ) { match[1] = match[1].replace( runescape, funescape ); // Move the given value to match[3] whether quoted or unquoted match[3] = ( match[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[3] && match[4] !== undefined ) { 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( nodeNameSelector ) { var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); return nodeNameSelector === "*" ? function() { return true; } : function( elem ) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, "CLASS": function( className ) { var pattern = classCache[ className + " " ]; return pattern || (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && classCache( className, function( elem ) { return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== 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 negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), // but not by others (comment: 8; processing instruction: 7; etc.) // nodeType < 6 works because attributes (2) do not appear as children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { if ( elem.nodeType < 6 ) { return false; } } return true; }, "parent": function( elem ) { return !Expr.pseudos["empty"]( elem ); }, // Element/input types "header": function( elem ) { return rheader.test( elem.nodeName ); }, "input": function( elem ) { return rinputs.test( elem.nodeName ); }, "button": function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === "button" || name === "button"; }, "text": function( elem ) { var attr; return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && // Support: IE<8 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); }, // Position-in-collection "first": createPositionalPseudo(function() { return [ 0 ]; }), "last": createPositionalPseudo(function( matchIndexes, length ) { return [ length - 1 ]; }), "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { return [ argument < 0 ? argument + length : argument ]; }), "even": createPositionalPseudo(function( matchIndexes, length ) { var i = 0; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "odd": createPositionalPseudo(function( matchIndexes, length ) { var i = 1; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; --i >= 0; ) { matchIndexes.push( i ); } return matchIndexes; }), "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; ++i < length; ) { matchIndexes.push( i ); } return matchIndexes; }) } }; Expr.pseudos["nth"] = Expr.pseudos["eq"]; // Add button/input type pseudos for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { Expr.pseudos[ i ] = createInputPseudo( i ); } for ( i in { submit: true, reset: true } ) { Expr.pseudos[ i ] = createButtonPseudo( i ); } // Easy API for creating new setFilters function setFilters() {} setFilters.prototype = Expr.filters = Expr.pseudos; Expr.setFilters = new setFilters(); 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 oldCache, outerCache, newCache = [ 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 ( (oldCache = outerCache[ dir ]) && oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { // Assign to newCache so results back-propagate to previous elements return (newCache[ 2 ] = oldCache[ 2 ]); } else { // Reuse newcache so results back-propagate to previous elements outerCache[ dir ] = newCache; // A match means we're done; a fail means we have to keep checking if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { return true; } } } } } }; } function elementMatcher( matchers ) { return matchers.length > 1 ? function( elem, context, xml ) { var i = matchers.length; while ( i-- ) { if ( !matchers[i]( elem, context, xml ) ) { return false; } } return true; } : matchers[0]; } function 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( // If the preceding token was a descendant combinator, insert an implicit any-element `*` tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) ).replace( rtrim, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), j < len && toSelector( tokens ) ); } matchers.push( matcher ); } } return elementMatcher( matchers ); } function matcherFromGroupMatchers( elementMatchers, setMatchers ) { var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function( seed, context, xml, results, outermost ) { var elem, j, matcher, matchedCount = 0, i = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, // We must always have either seed elements or outermost context elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), // Use integer dirruns iff this is the outermost matcher dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), len = elems.length; if ( outermost ) { outermostContext = context !== document && context; } // Add elements passing elementMatchers directly to results // Keep `i` a string if there are no elements so `matchedCount` will be "00" below // Support: IE<9, Safari // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id for ( ; i !== len && (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { j = 0; while ( (matcher = elementMatchers[j++]) ) { if ( matcher( elem, context, xml ) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; } } // Track unmatched elements for set filters if ( bySet ) { // They will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedCount--; } // Lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // 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" && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; if ( !context ) { return results; } selector = selector.slice( tokens.shift().value.length ); } // Fetch a seed set for right-to-left matching i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; while ( i-- ) { token = tokens[i]; // Abort if we hit a combinator if ( Expr.relative[ (type = token.type) ] ) { break; } if ( (find = Expr.find[ type ]) ) { // Search, expanding context for leading sibling combinators if ( (seed = find( token.matches[0].replace( runescape, funescape ), rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context )) ) { // If seed is empty or no tokens remain, we can return early tokens.splice( i, 1 ); selector = seed.length && toSelector( tokens ); if ( !selector ) { push.apply( results, seed ); return results; } break; } } } } } // Compile and execute a filtering function // Provide `match` to avoid retokenization if we modified the selector above compile( selector, match )( seed, context, !documentIsHTML, results, rsibling.test( selector ) && testContext( context.parentNode ) || context ); return results; } // One-time assignments // Sort stability support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; // Support: Chrome<14 // Always assume duplicates if they aren't passed to the comparison function support.detectDuplicates = !!hasDuplicate; // Initialize against the default document setDocument(); // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) // Detached nodes confoundingly follow *each other* support.sortDetached = assert(function( div1 ) { // Should return 1, but returns 4 (following) return div1.compareDocumentPosition( document.createElement("div") ) & 1; }); // Support: IE<8 // Prevent attribute/property "interpolation" // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx if ( !assert(function( div ) { div.innerHTML = "<a href='#'></a>"; return div.firstChild.getAttribute("href") === "#" ; }) ) { addHandle( "type|href|height|width", function( elem, name, isXML ) { if ( !isXML ) { return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); } }); } // Support: IE<9 // Use defaultValue in place of getAttribute("value") if ( !support.attributes || !assert(function( div ) { div.innerHTML = "<input/>"; div.firstChild.setAttribute( "value", "" ); return div.firstChild.getAttribute( "value" ) === ""; }) ) { addHandle( "value", function( elem, name, isXML ) { if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { return elem.defaultValue; } }); } // Support: IE<9 // Use getAttributeNode to fetch booleans when getAttribute lies if ( !assert(function( div ) { return div.getAttribute("disabled") == null; }) ) { addHandle( booleans, function( elem, name, isXML ) { var val; if ( !isXML ) { return elem[ name ] === true ? name.toLowerCase() : (val = elem.getAttributeNode( name )) && val.specified ? val.value : null; } }); } return Sizzle; })( window ); jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.pseudos; jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; var rneedsContext = jQuery.expr.match.needsContext; var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); var risSimple = /^.[^:#\[\.,]*$/; // Implement the identical functionality for filter and not function winnow( elements, qualifier, not ) { if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep( elements, function( elem, i ) { /* jshint -W018 */ return !!qualifier.call( elem, i, elem ) !== not; }); } if ( qualifier.nodeType ) { return jQuery.grep( elements, function( elem ) { return ( elem === qualifier ) !== not; }); } if ( typeof qualifier === "string" ) { if ( risSimple.test( qualifier ) ) { return jQuery.filter( qualifier, elements, not ); } qualifier = jQuery.filter( qualifier, elements ); } return jQuery.grep( elements, function( elem ) { return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; }); } jQuery.filter = function( expr, elems, not ) { var elem = elems[ 0 ]; if ( not ) { expr = ":not(" + expr + ")"; } return elems.length === 1 && elem.nodeType === 1 ? jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { return elem.nodeType === 1; })); }; jQuery.fn.extend({ find: function( selector ) { var i, ret = [], self = this, len = self.length; if ( typeof selector !== "string" ) { return this.pushStack( jQuery( selector ).filter(function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( self[ i ], this ) ) { return true; } } }) ); } for ( i = 0; i < len; i++ ) { jQuery.find( selector, self[ i ], ret ); } // Needed because $( selector, context ) becomes $( context ).find( selector ) ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); ret.selector = this.selector ? this.selector + " " + selector : selector; return ret; }, filter: function( selector ) { return this.pushStack( winnow(this, selector || [], false) ); }, not: function( selector ) { return this.pushStack( winnow(this, selector || [], true) ); }, is: function( selector ) { return !!winnow( this, // If this is a positional/relative selector, check membership in the returned set // so $("p:first").is("p:last") won't return true for a doc with two "p". typeof selector === "string" && rneedsContext.test( selector ) ? jQuery( selector ) : selector || [], false ).length; } }); // Initialize a jQuery object // A central reference to the root jQuery(document) var rootjQuery, // Use the correct document accordingly with window argument (sandbox) document = window.document, // A simple way to check for HTML strings // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) // Strict HTML recognition (#11290: must start with <) rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, init = jQuery.fn.init = function( selector, context ) { var match, elem; // HANDLE: $(""), $(null), $(undefined), $(false) if ( !selector ) { return this; } // Handle HTML strings if ( typeof selector === "string" ) { if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { // Assume that strings that start and end with <> are HTML and skip the regex check match = [ null, selector, null ]; } else { match = rquickExpr.exec( selector ); } // Match html or make sure no context is specified for #id if ( match && (match[1] || !context) ) { // HANDLE: $(html) -> $(array) if ( match[1] ) { context = context instanceof jQuery ? context[0] : context; // scripts is true for back-compat // Intentionally let the error be thrown if parseHTML is not present jQuery.merge( this, jQuery.parseHTML( match[1], context && context.nodeType ? context.ownerDocument || context : document, true ) ); // HANDLE: $(html, props) if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { for ( match in context ) { // Properties of context are called as methods if possible if ( jQuery.isFunction( this[ match ] ) ) { this[ match ]( context[ match ] ); // ...and otherwise set as attributes } else { this.attr( match, context[ match ] ); } } } return this; // HANDLE: $(#id) } else { elem = document.getElementById( match[2] ); // 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 and Opera return items // by name instead of ID if ( elem.id !== match[2] ) { return rootjQuery.find( selector ); } // Otherwise, we inject the element directly into the jQuery object this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; } // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return ( context || rootjQuery ).find( selector ); // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor( context ).find( selector ); } // HANDLE: $(DOMElement) } else if ( selector.nodeType ) { this.context = this[0] = selector; this.length = 1; return this; // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { return typeof rootjQuery.ready !== "undefined" ? rootjQuery.ready( selector ) : // Execute immediately if ready is not present selector( jQuery ); } if ( selector.selector !== undefined ) { this.selector = selector.selector; this.context = selector.context; } return jQuery.makeArray( selector, this ); }; // Give the init function the jQuery prototype for later instantiation init.prototype = jQuery.fn; // Initialize central reference rootjQuery = jQuery( document ); var rparentsprev = /^(?:parents|prev(?:Until|All))/, // methods guaranteed to produce a unique set when starting from a unique set guaranteedUnique = { children: true, contents: true, next: true, prev: true }; jQuery.extend({ dir: function( elem, dir, until ) { var matched = [], cur = elem[ dir ]; while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { if ( cur.nodeType === 1 ) { matched.push( cur ); } cur = cur[dir]; } return matched; }, sibling: function( n, elem ) { var r = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { r.push( n ); } } return r; } }); jQuery.fn.extend({ has: function( target ) { var i, targets = jQuery( target, this ), len = targets.length; return this.filter(function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( this, targets[i] ) ) { return true; } } }); }, closest: function( selectors, context ) { var cur, i = 0, l = this.length, matched = [], pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? jQuery( selectors, context || this.context ) : 0; for ( ; i < l; i++ ) { for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { // Always skip document fragments if ( cur.nodeType < 11 && (pos ? pos.index(cur) > -1 : // Don't pass non-elements to Sizzle cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors)) ) { matched.push( cur ); break; } } } return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); }, // Determine the position of an element within // the matched set of elements index: function( elem ) { // No argument, return index in parent if ( !elem ) { return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; } // index in selector if ( typeof elem === "string" ) { return jQuery.inArray( this[0], jQuery( elem ) ); } // Locate the position of the desired element return jQuery.inArray( // If it receives a jQuery object, the first element is used elem.jquery ? elem[0] : elem, this ); }, add: function( selector, context ) { return this.pushStack( jQuery.unique( jQuery.merge( this.get(), jQuery( selector, context ) ) ) ); }, addBack: function( selector ) { return this.add( selector == null ? this.prevObject : this.prevObject.filter(selector) ); } }); function sibling( cur, dir ) { do { cur = cur[ dir ]; } while ( cur && cur.nodeType !== 1 ); return cur; } jQuery.each({ parent: function( elem ) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function( elem ) { return jQuery.dir( elem, "parentNode" ); }, parentsUntil: function( elem, i, until ) { return jQuery.dir( elem, "parentNode", until ); }, next: function( elem ) { return sibling( elem, "nextSibling" ); }, prev: function( elem ) { return sibling( elem, "previousSibling" ); }, nextAll: function( elem ) { return jQuery.dir( elem, "nextSibling" ); }, prevAll: function( elem ) { return jQuery.dir( elem, "previousSibling" ); }, nextUntil: function( elem, i, until ) { return jQuery.dir( elem, "nextSibling", until ); }, prevUntil: function( elem, i, until ) { return jQuery.dir( elem, "previousSibling", until ); }, siblings: function( elem ) { return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); }, children: function( elem ) { return jQuery.sibling( elem.firstChild ); }, contents: function( elem ) { return jQuery.nodeName( elem, "iframe" ) ? elem.contentDocument || elem.contentWindow.document : jQuery.merge( [], elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { var ret = jQuery.map( this, fn, until ); if ( name.slice( -5 ) !== "Until" ) { selector = until; } if ( selector && typeof selector === "string" ) { ret = jQuery.filter( selector, ret ); } if ( this.length > 1 ) { // Remove duplicates if ( !guaranteedUnique[ name ] ) { ret = jQuery.unique( ret ); } // Reverse order for parents* and prev-derivatives if ( rparentsprev.test( name ) ) { ret = ret.reverse(); } } return this.pushStack( ret ); }; }); var rnotwhite = (/\S+/g); // String to Object options format cache var optionsCache = {}; // Convert String-formatted options into Object-formatted ones and store in cache function createOptions( options ) { var object = optionsCache[ options ] = {}; jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { object[ flag ] = true; }); return object; } /* * Create a callback list using the following parameters: * * options: an optional list of space-separated options that will change how * the callback list behaves or a more traditional option object * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible options: * * once: will ensure the callback list can only be fired once (like a Deferred) * * memory: will keep track of previous values and will call any callback added * after the list has been fired right away with the latest "memorized" * values (like a Deferred) * * unique: will ensure a callback can only be added once (no duplicate in the list) * * stopOnFalse: interrupt callings when a callback returns false * */ jQuery.Callbacks = function( options ) { // Convert options from String-formatted to Object-formatted if needed // (we check in cache first) options = typeof options === "string" ? ( optionsCache[ options ] || createOptions( options ) ) : jQuery.extend( {}, options ); var // Flag to know if list is currently firing firing, // Last fire value (for non-forgettable lists) memory, // Flag to know if list was already fired fired, // End of the loop when firing firingLength, // Index of currently firing callback (modified by remove if needed) firingIndex, // First callback to fire (used internally by add and fireWith) firingStart, // Actual callback list list = [], // Stack of fire calls for repeatable lists stack = !options.once && [], // Fire callbacks fire = function( data ) { memory = options.memory && data; fired = true; firingIndex = firingStart || 0; firingStart = 0; firingLength = list.length; firing = true; for ( ; list && firingIndex < firingLength; firingIndex++ ) { if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { memory = false; // To prevent further calls using add break; } } firing = false; if ( list ) { if ( stack ) { if ( stack.length ) { fire( stack.shift() ); } } else if ( memory ) { list = []; } else { self.disable(); } } }, // Actual Callbacks object self = { // Add a callback or a collection of callbacks to the list add: function() { if ( list ) { // First, we save the current length var start = list.length; (function add( args ) { jQuery.each( args, function( _, arg ) { var type = jQuery.type( arg ); if ( type === "function" ) { if ( !options.unique || !self.has( arg ) ) { list.push( arg ); } } else if ( arg && arg.length && type !== "string" ) { // Inspect recursively add( arg ); } }); })( arguments ); // Do we need to add the callbacks to the // current firing batch? if ( firing ) { firingLength = list.length; // With memory, if we're not firing then // we should call right away } else if ( memory ) { firingStart = start; fire( memory ); } } return this; }, // Remove a callback from the list remove: function() { if ( list ) { jQuery.each( arguments, function( _, arg ) { var index; while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { list.splice( index, 1 ); // Handle firing indexes if ( firing ) { if ( index <= firingLength ) { firingLength--; } if ( index <= firingIndex ) { firingIndex--; } } } }); } return this; }, // Check if a given callback is in the list. // If no argument is given, return whether or not list has callbacks attached. has: function( fn ) { return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); }, // Remove all callbacks from the list empty: function() { list = []; firingLength = 0; return this; }, // Have the list do nothing anymore disable: function() { list = stack = memory = undefined; return this; }, // Is it disabled? disabled: function() { return !list; }, // Lock the list in its current state lock: function() { stack = undefined; if ( !memory ) { self.disable(); } return this; }, // Is it locked? locked: function() { return !stack; }, // Call all callbacks with the given context and arguments fireWith: function( context, args ) { if ( list && ( !fired || stack ) ) { args = args || []; args = [ context, args.slice ? args.slice() : args ]; if ( firing ) { stack.push( args ); } else { fire( args ); } } return this; }, // Call all the callbacks with the given arguments fire: function() { self.fireWith( this, arguments ); return this; }, // To know if the callbacks have already been called at least once fired: function() { return !!fired; } }; return self; }; jQuery.extend({ Deferred: function( func ) { var tuples = [ // action, add listener, listener list, final state [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], [ "notify", "progress", jQuery.Callbacks("memory") ] ], state = "pending", promise = { state: function() { return state; }, always: function() { deferred.done( arguments ).fail( arguments ); return this; }, then: function( /* fnDone, fnFail, fnProgress */ ) { var fns = arguments; return jQuery.Deferred(function( newDefer ) { jQuery.each( tuples, function( i, tuple ) { var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; // deferred[ done | fail | progress ] for forwarding actions to newDefer deferred[ tuple[1] ](function() { var returned = fn && fn.apply( this, arguments ); if ( returned && jQuery.isFunction( returned.promise ) ) { returned.promise() .done( newDefer.resolve ) .fail( newDefer.reject ) .progress( newDefer.notify ); } else { newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); } }); }); fns = null; }).promise(); }, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object promise: function( obj ) { return obj != null ? jQuery.extend( obj, promise ) : promise; } }, deferred = {}; // Keep pipe for back-compat promise.pipe = promise.then; // Add list-specific methods jQuery.each( tuples, function( i, tuple ) { var list = tuple[ 2 ], stateString = tuple[ 3 ]; // promise[ done | fail | progress ] = list.add promise[ tuple[1] ] = list.add; // Handle state if ( stateString ) { list.add(function() { // state = [ resolved | rejected ] state = stateString; // [ reject_list | resolve_list ].disable; progress_list.lock }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); } // deferred[ resolve | reject | notify ] deferred[ tuple[0] ] = function() { deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); return this; }; deferred[ tuple[0] + "With" ] = list.fireWith; }); // Make the deferred a promise promise.promise( deferred ); // Call given func if any if ( func ) { func.call( deferred, deferred ); } // All done! return deferred; }, // Deferred helper when: function( subordinate /* , ..., subordinateN */ ) { var i = 0, resolveValues = slice.call( arguments ), length = resolveValues.length, // the count of uncompleted subordinates remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, // the master Deferred. If resolveValues consist of only a single Deferred, just use that. deferred = remaining === 1 ? subordinate : jQuery.Deferred(), // Update function for both resolve and progress values updateFunc = function( i, contexts, values ) { return function( value ) { contexts[ i ] = this; values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; if ( values === progressValues ) { deferred.notifyWith( contexts, values ); } else if ( !(--remaining) ) { deferred.resolveWith( contexts, values ); } }; }, progressValues, progressContexts, resolveContexts; // add listeners to Deferred subordinates; treat others as resolved if ( length > 1 ) { progressValues = new Array( length ); progressContexts = new Array( length ); resolveContexts = new Array( length ); for ( ; i < length; i++ ) { if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { resolveValues[ i ].promise() .done( updateFunc( i, resolveContexts, resolveValues ) ) .fail( deferred.reject ) .progress( updateFunc( i, progressContexts, progressValues ) ); } else { --remaining; } } } // if we're not waiting on anything, resolve the master if ( !remaining ) { deferred.resolveWith( resolveContexts, resolveValues ); } return deferred.promise(); } }); // The deferred used on DOM ready var readyList; jQuery.fn.ready = function( fn ) { // Add the callback jQuery.ready.promise().done( fn ); return this; }; jQuery.extend({ // Is the DOM ready to be used? Set to true once it occurs. isReady: false, // A counter to track how many items to wait for before // the ready event fires. See #6781 readyWait: 1, // Hold (or release) the ready event holdReady: function( hold ) { if ( hold ) { jQuery.readyWait++; } else { jQuery.ready( true ); } }, // Handle when the DOM is ready ready: function( wait ) { // Abort if there are pending holds or we're already ready if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { return; } // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( !document.body ) { return setTimeout( jQuery.ready ); } // Remember that the DOM is ready jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be if ( wait !== true && --jQuery.readyWait > 0 ) { return; } // If there are functions bound, to execute readyList.resolveWith( document, [ jQuery ] ); // Trigger any bound ready events if ( jQuery.fn.trigger ) { jQuery( document ).trigger("ready").off("ready"); } } }); /** * Clean-up method for dom ready events */ function detach() { if ( document.addEventListener ) { document.removeEventListener( "DOMContentLoaded", completed, false ); window.removeEventListener( "load", completed, false ); } else { document.detachEvent( "onreadystatechange", completed ); window.detachEvent( "onload", completed ); } } /** * The ready event handler and self cleanup method */ function completed() { // readyState === "complete" is good enough for us to call the dom ready in oldIE if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { detach(); jQuery.ready(); } } jQuery.ready.promise = function( obj ) { if ( !readyList ) { readyList = jQuery.Deferred(); // Catch cases where $(document).ready() is called after the browser event has already occurred. // we once tried to use readyState "interactive" here, but it caused issues like the one // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 if ( document.readyState === "complete" ) { // Handle it asynchronously to allow scripts the opportunity to delay ready setTimeout( jQuery.ready ); // Standards-based browsers support DOMContentLoaded } else if ( document.addEventListener ) { // Use the handy event callback document.addEventListener( "DOMContentLoaded", completed, false ); // A fallback to window.onload, that will always work window.addEventListener( "load", completed, false ); // If IE event model is used } else { // Ensure firing before onload, maybe late but safe also for iframes document.attachEvent( "onreadystatechange", completed ); // A fallback to window.onload, that will always work window.attachEvent( "onload", completed ); // If IE and not a frame // continually check to see if the document is ready var top = false; try { top = window.frameElement == null && document.documentElement; } catch(e) {} if ( top && top.doScroll ) { (function doScrollCheck() { if ( !jQuery.isReady ) { try { // Use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ top.doScroll("left"); } catch(e) { return setTimeout( doScrollCheck, 50 ); } // detach all dom ready events detach(); // and execute any waiting functions jQuery.ready(); } })(); } } } return readyList.promise( obj ); }; var strundefined = typeof undefined; // Support: IE<9 // Iteration over object's inherited properties before its own var i; for ( i in jQuery( support ) ) { break; } support.ownLast = i !== "0"; // Note: most support tests are defined in their respective modules. // false until the test is run support.inlineBlockNeedsLayout = false; jQuery(function() { // We need to execute this one support test ASAP because we need to know // if body.style.zoom needs to be set. var container, div, body = document.getElementsByTagName("body")[0]; if ( !body ) { // Return for frameset docs that don't have a body return; } // Setup container = document.createElement( "div" ); container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; div = document.createElement( "div" ); body.appendChild( container ).appendChild( div ); if ( typeof div.style.zoom !== strundefined ) { // Support: IE<8 // Check if natively block-level elements act like inline-block // elements when setting their display to 'inline' and giving // them layout div.style.cssText = "border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1"; if ( (support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 )) ) { // Prevent IE 6 from affecting layout for positioned elements #11048 // Prevent IE from shrinking the body in IE 7 mode #12869 // Support: IE<8 body.style.zoom = 1; } } body.removeChild( container ); // Null elements to avoid leaks in IE container = div = null; }); (function() { var div = document.createElement( "div" ); // Execute the test only if not already executed in another module. if (support.deleteExpando == null) { // Support: IE<9 support.deleteExpando = true; try { delete div.test; } catch( e ) { support.deleteExpando = false; } } // Null elements to avoid leaks in IE. div = null; })(); /** * Determines whether an object can have data */ jQuery.acceptData = function( elem ) { var noData = jQuery.noData[ (elem.nodeName + " ").toLowerCase() ], nodeType = +elem.nodeType || 1; // Do not set data on non-element DOM nodes because it will not be cleared (#8335). return nodeType !== 1 && nodeType !== 9 ? false : // Nodes accept data unless otherwise specified; rejection can be conditional !noData || noData !== true && elem.getAttribute("classid") === noData; }; var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /([A-Z])/g; function dataAttr( elem, key, data ) { // If nothing was found internally, try to fetch any // data from the HTML5 data-* attribute if ( data === undefined && elem.nodeType === 1 ) { var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); data = elem.getAttribute( name ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : // Only convert to a number if it doesn't change the string +data + "" === data ? +data : rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch( e ) {} // Make sure we set the data so it isn't changed later jQuery.data( elem, key, data ); } else { data = undefined; } } return data; } // checks a cache object for emptiness function isEmptyDataObject( obj ) { var name; for ( name in obj ) { // if the public data object is empty, the private is still empty if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { continue; } if ( name !== "toJSON" ) { return false; } } return true; } function internalData( elem, name, data, pvt /* Internal Use Only */ ) { if ( !jQuery.acceptData( elem ) ) { return; } var ret, thisCache, internalKey = jQuery.expando, // We have to handle DOM nodes and JS objects differently because IE6-7 // can't GC object references properly across the DOM-JS boundary isNode = elem.nodeType, // Only DOM nodes need the global jQuery cache; JS object data is // attached directly to the object so GC can occur automatically cache = isNode ? jQuery.cache : elem, // Only defining an ID for JS objects if its cache already exists allows // the code to shortcut on the same path as a DOM node with no cache id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; // Avoid doing any more work than we need to when trying to get data on an // object that has no data at all if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) { return; } if ( !id ) { // Only DOM nodes need a new unique ID for each element since their data // ends up in the global cache if ( isNode ) { id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++; } else { id = internalKey; } } if ( !cache[ id ] ) { // Avoid exposing jQuery metadata on plain JS objects when the object // is serialized using JSON.stringify cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; } // An object can be passed to jQuery.data instead of a key/value pair; this gets // shallow copied over onto the existing cache if ( typeof name === "object" || typeof name === "function" ) { if ( pvt ) { cache[ id ] = jQuery.extend( cache[ id ], name ); } else { cache[ id ].data = jQuery.extend( cache[ id ].data, name ); } } thisCache = cache[ id ]; // jQuery data() is stored in a separate object inside the object's internal data // cache in order to avoid key collisions between internal data and user-defined // data. if ( !pvt ) { if ( !thisCache.data ) { thisCache.data = {}; } thisCache = thisCache.data; } if ( data !== undefined ) { thisCache[ jQuery.camelCase( name ) ] = data; } // Check for both converted-to-camel and non-converted data property names // If a data property was specified if ( typeof name === "string" ) { // First Try to find as-is property data ret = thisCache[ name ]; // Test for null|undefined property data if ( ret == null ) { // Try to find the camelCased property ret = thisCache[ jQuery.camelCase( name ) ]; } } else { ret = thisCache; } return ret; } function internalRemoveData( elem, name, pvt ) { if ( !jQuery.acceptData( elem ) ) { return; } var thisCache, i, isNode = elem.nodeType, // See jQuery.data for more information cache = isNode ? jQuery.cache : elem, id = isNode ? elem[ jQuery.expando ] : jQuery.expando; // If there is already no cache entry for this object, there is no // purpose in continuing if ( !cache[ id ] ) { return; } if ( name ) { thisCache = pvt ? cache[ id ] : cache[ id ].data; if ( thisCache ) { // Support array or space separated string names for data keys if ( !jQuery.isArray( name ) ) { // try the string as a key before any manipulation if ( name in thisCache ) { name = [ name ]; } else { // split the camel cased version by spaces unless a key with the spaces exists name = jQuery.camelCase( name ); if ( name in thisCache ) { name = [ name ]; } else { name = name.split(" "); } } } else { // If "name" is an array of keys... // When data is initially created, via ("key", "val") signature, // keys will be converted to camelCase. // Since there is no way to tell _how_ a key was added, remove // both plain key and camelCase key. #12786 // This will only penalize the array argument path. name = name.concat( jQuery.map( name, jQuery.camelCase ) ); } i = name.length; while ( i-- ) { delete thisCache[ name[i] ]; } // If there is no data left in the cache, we want to continue // and let the cache object itself get destroyed if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { return; } } } // See jQuery.data for more information if ( !pvt ) { delete cache[ id ].data; // Don't destroy the parent cache unless the internal data object // had been the only thing left in it if ( !isEmptyDataObject( cache[ id ] ) ) { return; } } // Destroy the cache if ( isNode ) { jQuery.cleanData( [ elem ], true ); // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) /* jshint eqeqeq: false */ } else if ( support.deleteExpando || cache != cache.window ) { /* jshint eqeqeq: true */ delete cache[ id ]; // When all else fails, null } else { cache[ id ] = null; } } jQuery.extend({ cache: {}, // The following elements (space-suffixed to avoid Object.prototype collisions) // throw uncatchable exceptions if you attempt to set expando properties noData: { "applet ": true, "embed ": true, // ...but Flash objects (which have this classid) *can* handle expandos "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" }, hasData: function( elem ) { elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; return !!elem && !isEmptyDataObject( elem ); }, data: function( elem, name, data ) { return internalData( elem, name, data ); }, removeData: function( elem, name ) { return internalRemoveData( elem, name ); }, // For internal use only. _data: function( elem, name, data ) { return internalData( elem, name, data, true ); }, _removeData: function( elem, name ) { return internalRemoveData( elem, name, true ); } }); jQuery.fn.extend({ data: function( key, value ) { var i, name, data, elem = this[0], attrs = elem && elem.attributes; // Special expections of .data basically thwart jQuery.access, // so implement the relevant behavior ourselves // Gets all values if ( key === undefined ) { if ( this.length ) { data = jQuery.data( elem ); if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { i = attrs.length; while ( i-- ) { name = attrs[i].name; if ( name.indexOf("data-") === 0 ) { name = jQuery.camelCase( name.slice(5) ); dataAttr( elem, name, data[ name ] ); } } jQuery._data( elem, "parsedAttrs", true ); } } return data; } // Sets multiple values if ( typeof key === "object" ) { return this.each(function() { jQuery.data( this, key ); }); } return arguments.length > 1 ? // Sets one value this.each(function() { jQuery.data( this, key, value ); }) : // Gets one value // Try to fetch any internally stored data first elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined; }, removeData: function( key ) { return this.each(function() { jQuery.removeData( this, key ); }); } }); jQuery.extend({ queue: function( elem, type, data ) { var queue; if ( elem ) { type = ( type || "fx" ) + "queue"; queue = jQuery._data( elem, type ); // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !queue || jQuery.isArray(data) ) { queue = jQuery._data( elem, type, jQuery.makeArray(data) ); } else { queue.push( data ); } } return queue || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks( elem, type ), next = function() { jQuery.dequeue( elem, type ); }; // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); startLength--; } if ( fn ) { // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift( "inprogress" ); } // clear up the last queue stop function delete hooks.stop; fn.call( elem, next, hooks ); } if ( !startLength && hooks ) { hooks.empty.fire(); } }, // not intended for public consumption - generates a queueHooks object, or returns the current one _queueHooks: function( elem, type ) { var key = type + "queueHooks"; return jQuery._data( elem, key ) || jQuery._data( elem, key, { empty: jQuery.Callbacks("once memory").add(function() { jQuery._removeData( elem, type + "queue" ); jQuery._removeData( elem, key ); }) }); } }); jQuery.fn.extend({ queue: function( type, data ) { var setter = 2; if ( typeof type !== "string" ) { data = type; type = "fx"; setter--; } if ( arguments.length < setter ) { return jQuery.queue( this[0], type ); } return data === undefined ? this : this.each(function() { var queue = jQuery.queue( this, type, data ); // ensure a hooks for this queue jQuery._queueHooks( this, type ); if ( type === "fx" && queue[0] !== "inprogress" ) { jQuery.dequeue( this, type ); } }); }, dequeue: function( type ) { return this.each(function() { jQuery.dequeue( this, type ); }); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); }, // Get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function( type, obj ) { var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function() { if ( !( --count ) ) { defer.resolveWith( elements, [ elements ] ); } }; if ( typeof type !== "string" ) { obj = type; type = undefined; } type = type || "fx"; while ( i-- ) { tmp = jQuery._data( elements[ i ], type + "queueHooks" ); if ( tmp && tmp.empty ) { count++; tmp.empty.add( resolve ); } } resolve(); return defer.promise( obj ); } }); var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; // Multifunctional method to get and set values of a collection // The value/s can optionally be executed if it's a function var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { var i = 0, length = elems.length, bulk = key == null; // Sets many values if ( jQuery.type( key ) === "object" ) { chainable = true; for ( i in key ) { jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); } // Sets one value } else if ( value !== undefined ) { chainable = true; if ( !jQuery.isFunction( value ) ) { raw = true; } if ( bulk ) { // Bulk operations run against the entire set if ( raw ) { fn.call( elems, value ); fn = null; // ...except when executing function values } else { bulk = fn; fn = function( elem, key, value ) { return bulk.call( jQuery( elem ), value ); }; } } if ( fn ) { for ( ; i < length; i++ ) { fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); } } } return chainable ? elems : // Gets bulk ? fn.call( elems ) : length ? fn( elems[0], key ) : emptyGet; }; var rcheckableType = (/^(?:checkbox|radio)$/i); (function() { var fragment = document.createDocumentFragment(), div = document.createElement("div"), input = document.createElement("input"); // Setup div.setAttribute( "className", "t" ); div.innerHTML = " <link/><table></table><a href='/a'>a</a>"; // IE strips leading whitespace when .innerHTML is used support.leadingWhitespace = div.firstChild.nodeType === 3; // Make sure that tbody elements aren't automatically inserted // IE will insert them into empty tables support.tbody = !div.getElementsByTagName( "tbody" ).length; // Make sure that link elements get serialized correctly by innerHTML // This requires a wrapper element in IE support.htmlSerialize = !!div.getElementsByTagName( "link" ).length; // Makes sure cloning an html5 element does not cause problems // Where outerHTML is undefined, this still works support.html5Clone = document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>"; // Check if a disconnected checkbox will retain its checked // value of true after appended to the DOM (IE6/7) input.type = "checkbox"; input.checked = true; fragment.appendChild( input ); support.appendChecked = input.checked; // Make sure textarea (and checkbox) defaultValue is properly cloned // Support: IE6-IE11+ div.innerHTML = "<textarea>x</textarea>"; support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; // #11217 - WebKit loses check when the name is after the checked attribute fragment.appendChild( div ); div.innerHTML = "<input type='radio' checked='checked' name='t'/>"; // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 // old WebKit doesn't clone checked state correctly in fragments support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; // Support: IE<9 // Opera does not clone events (and typeof div.attachEvent === undefined). // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() support.noCloneEvent = true; if ( div.attachEvent ) { div.attachEvent( "onclick", function() { support.noCloneEvent = false; }); div.cloneNode( true ).click(); } // Execute the test only if not already executed in another module. if (support.deleteExpando == null) { // Support: IE<9 support.deleteExpando = true; try { delete div.test; } catch( e ) { support.deleteExpando = false; } } // Null elements to avoid leaks in IE. fragment = div = input = null; })(); (function() { var i, eventName, div = document.createElement( "div" ); // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event) for ( i in { submit: true, change: true, focusin: true }) { eventName = "on" + i; if ( !(support[ i + "Bubbles" ] = eventName in window) ) { // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) div.setAttribute( eventName, "t" ); support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false; } } // Null elements to avoid leaks in IE. div = null; })(); var rformElems = /^(?:input|select|textarea)$/i, rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|contextmenu)|click/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; function returnTrue() { return true; } function returnFalse() { return false; } function safeActiveElement() { try { return document.activeElement; } catch ( err ) { } } /* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */ jQuery.event = { global: {}, add: function( elem, types, handler, data, selector ) { var tmp, events, t, handleObjIn, special, eventHandle, handleObj, handlers, type, namespaces, origType, elemData = jQuery._data( elem ); // Don't attach events to noData or text/comment nodes (but allow plain objects) if ( !elemData ) { return; } // Caller can pass in an object of custom data in lieu of the handler if ( handler.handler ) { handleObjIn = handler; handler = handleObjIn.handler; selector = handleObjIn.selector; } // Make sure that the handler has a unique ID, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; } // Init the element's event structure and main handler, if this is the first if ( !(events = elemData.events) ) { events = elemData.events = {}; } if ( !(eventHandle = elemData.handle) ) { eventHandle = elemData.handle = function( e ) { // Discard the second event of a jQuery.event.trigger() and // when an event is called after a page has unloaded return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : undefined; }; // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events eventHandle.elem = elem; } // Handle multiple events separated by a space types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[t] ) || []; type = origType = tmp[1]; namespaces = ( tmp[2] || "" ).split( "." ).sort(); // There *must* be a type, no attaching namespace-only handlers if ( !type ) { continue; } // If event changes its type, use the special event handlers for the changed type special = jQuery.event.special[ type ] || {}; // If selector defined, determine special event api type, otherwise given type type = ( selector ? special.delegateType : special.bindType ) || type; // Update special based on newly reset type special = jQuery.event.special[ type ] || {}; // handleObj is passed to all event handlers handleObj = jQuery.extend({ type: type, origType: origType, data: data, handler: handler, guid: handler.guid, selector: selector, needsContext: selector && jQuery.expr.match.needsContext.test( selector ), namespace: namespaces.join(".") }, handleObjIn ); // Init the event handler queue if we're the first if ( !(handlers = events[ type ]) ) { handlers = events[ type ] = []; handlers.delegateCount = 0; // Only use addEventListener/attachEvent if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { // Bind the global event handler to the element if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle, false ); } else if ( elem.attachEvent ) { elem.attachEvent( "on" + type, eventHandle ); } } } if ( special.add ) { special.add.call( elem, handleObj ); if ( !handleObj.handler.guid ) { handleObj.handler.guid = handler.guid; } } // Add to the element's handler list, delegates in front if ( selector ) { handlers.splice( handlers.delegateCount++, 0, handleObj ); } else { handlers.push( handleObj ); } // Keep track of which events have ever been used, for event optimization jQuery.event.global[ type ] = true; } // Nullify elem to prevent memory leaks in IE elem = null; }, // Detach an event or set of events from an element remove: function( elem, types, handler, selector, mappedTypes ) { var j, handleObj, tmp, origCount, t, events, special, handlers, type, namespaces, origType, elemData = jQuery.hasData( elem ) && jQuery._data( elem ); if ( !elemData || !(events = elemData.events) ) { return; } // Once for each type.namespace in types; type may be omitted types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[t] ) || []; type = origType = tmp[1]; namespaces = ( tmp[2] || "" ).split( "." ).sort(); // Unbind all events (on this namespace, if provided) for the element if ( !type ) { for ( type in events ) { jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); } continue; } special = jQuery.event.special[ type ] || {}; type = ( selector ? special.delegateType : special.bindType ) || type; handlers = events[ type ] || []; tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); // Remove matching events origCount = j = handlers.length; while ( j-- ) { handleObj = handlers[ j ]; if ( ( mappedTypes || origType === handleObj.origType ) && ( !handler || handler.guid === handleObj.guid ) && ( !tmp || tmp.test( handleObj.namespace ) ) && ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { handlers.splice( j, 1 ); if ( handleObj.selector ) { handlers.delegateCount--; } if ( special.remove ) { special.remove.call( elem, handleObj ); } } } // Remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) if ( origCount && !handlers.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } delete events[ type ]; } } // Remove the expando if it's no longer used if ( jQuery.isEmptyObject( events ) ) { delete elemData.handle; // removeData also checks for emptiness and clears the expando if empty // so use it instead of delete jQuery._removeData( elem, "events" ); } }, trigger: function( event, data, elem, onlyHandlers ) { var handle, ontype, cur, bubbleType, special, tmp, i, eventPath = [ elem || document ], type = hasOwn.call( event, "type" ) ? event.type : event, namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; cur = tmp = elem = elem || document; // Don't do events on text and comment nodes if ( elem.nodeType === 3 || elem.nodeType === 8 ) { return; } // focus/blur morphs to focusin/out; ensure we're not firing them right now if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { return; } if ( type.indexOf(".") >= 0 ) { // Namespaced trigger; create a regexp to match event type in handle() namespaces = type.split("."); type = namespaces.shift(); namespaces.sort(); } ontype = type.indexOf(":") < 0 && "on" + type; // Caller can pass in a jQuery.Event object, Object, or just an event type string event = event[ jQuery.expando ] ? event : new jQuery.Event( type, typeof event === "object" && event ); // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) event.isTrigger = onlyHandlers ? 2 : 3; event.namespace = namespaces.join("."); event.namespace_re = event.namespace ? new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : null; // Clean up the event in case it is being reused event.result = undefined; if ( !event.target ) { event.target = elem; } // Clone any incoming data and prepend the event, creating the handler arg list data = data == null ? [ event ] : jQuery.makeArray( data, [ event ] ); // Allow special events to draw outside the lines special = jQuery.event.special[ type ] || {}; if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { return; } // Determine event propagation path in advance, per W3C events spec (#9951) // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { bubbleType = special.delegateType || type; if ( !rfocusMorph.test( bubbleType + type ) ) { cur = cur.parentNode; } for ( ; cur; cur = cur.parentNode ) { eventPath.push( cur ); tmp = cur; } // Only add window if we got to document (e.g., not plain obj or detached DOM) if ( tmp === (elem.ownerDocument || document) ) { eventPath.push( tmp.defaultView || tmp.parentWindow || window ); } } // Fire handlers on the event path i = 0; while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { event.type = i > 1 ? bubbleType : special.bindType || type; // jQuery handler handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } // Native handler handle = ontype && cur[ ontype ]; if ( handle && handle.apply && jQuery.acceptData( cur ) ) { event.result = handle.apply( cur, data ); if ( event.result === false ) { event.preventDefault(); } } } event.type = type; // If nobody prevented the default action, do it now if ( !onlyHandlers && !event.isDefaultPrevented() ) { if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && jQuery.acceptData( elem ) ) { // Call a native DOM method on the target with the same name name as the event. // Can't use an .isFunction() check here because IE6/7 fails that test. // Don't do default actions on window, that's where global variables be (#6170) if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { // Don't re-trigger an onFOO event when we call its FOO() method tmp = elem[ ontype ]; if ( tmp ) { elem[ ontype ] = null; } // Prevent re-triggering of the same event, since we already bubbled it above jQuery.event.triggered = type; try { elem[ type ](); } catch ( e ) { // IE<9 dies on focus/blur to hidden element (#1486,#12518) // only reproducible on winXP IE8 native, not IE9 in IE8 mode } jQuery.event.triggered = undefined; if ( tmp ) { elem[ ontype ] = tmp; } } } } return event.result; }, dispatch: function( event ) { // Make a writable jQuery.Event from the native event object event = jQuery.event.fix( event ); var i, ret, handleObj, matched, j, handlerQueue = [], args = slice.call( arguments ), handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], special = jQuery.event.special[ event.type ] || {}; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[0] = event; event.delegateTarget = this; // Call the preDispatch hook for the mapped type, and let it bail if desired if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { return; } // Determine handlers handlerQueue = jQuery.event.handlers.call( this, event, handlers ); // Run delegates first; they may want to stop propagation beneath us i = 0; while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { event.currentTarget = matched.elem; j = 0; while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { // Triggered event must either 1) have no namespace, or // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { event.handleObj = handleObj; event.data = handleObj.data; ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) .apply( matched.elem, args ); if ( ret !== undefined ) { if ( (event.result = ret) === false ) { event.preventDefault(); event.stopPropagation(); } } } } } // Call the postDispatch hook for the mapped type if ( special.postDispatch ) { special.postDispatch.call( this, event ); } return event.result; }, handlers: function( event, handlers ) { var sel, handleObj, matches, i, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target; // Find delegate handlers // Black-hole SVG <use> instance trees (#13180) // Avoid non-left-click bubbling in Firefox (#3861) if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { /* jshint eqeqeq: false */ for ( ; cur != this; cur = cur.parentNode || this ) { /* jshint eqeqeq: true */ // Don't check non-elements (#13208) // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { matches = []; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; // Don't conflict with Object.prototype properties (#13203) sel = handleObj.selector + " "; if ( matches[ sel ] === undefined ) { matches[ sel ] = handleObj.needsContext ? jQuery( sel, this ).index( cur ) >= 0 : jQuery.find( sel, this, null, [ cur ] ).length; } if ( matches[ sel ] ) { matches.push( handleObj ); } } if ( matches.length ) { handlerQueue.push({ elem: cur, handlers: matches }); } } } } // Add the remaining (directly-bound) handlers if ( delegateCount < handlers.length ) { handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); } return handlerQueue; }, fix: function( event ) { if ( event[ jQuery.expando ] ) { return event; } // Create a writable copy of the event object and normalize some properties var i, prop, copy, type = event.type, originalEvent = event, fixHook = this.fixHooks[ type ]; if ( !fixHook ) { this.fixHooks[ type ] = fixHook = rmouseEvent.test( type ) ? this.mouseHooks : rkeyEvent.test( type ) ? this.keyHooks : {}; } copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; event = new jQuery.Event( originalEvent ); i = copy.length; while ( i-- ) { prop = copy[ i ]; event[ prop ] = originalEvent[ prop ]; } // Support: IE<9 // Fix target property (#1925) if ( !event.target ) { event.target = originalEvent.srcElement || document; } // Support: Chrome 23+, Safari? // Target should not be a text node (#504, #13143) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } // Support: IE<9 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) event.metaKey = !!event.metaKey; return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; }, // Includes some event props shared by KeyEvent and MouseEvent props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks: {}, keyHooks: { props: "char charCode key keyCode".split(" "), filter: function( event, original ) { // Add which for key events if ( event.which == null ) { event.which = original.charCode != null ? original.charCode : original.keyCode; } return event; } }, mouseHooks: { props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), filter: function( event, original ) { var body, eventDoc, doc, button = original.button, fromElement = original.fromElement; // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && original.clientX != null ) { eventDoc = event.target.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); } // Add relatedTarget, if necessary if ( !event.relatedTarget && fromElement ) { event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; } // Add which for click: 1 === left; 2 === middle; 3 === right // Note: button is not normalized, so don't use it if ( !event.which && button !== undefined ) { event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); } return event; } }, special: { load: { // Prevent triggered image.load events from bubbling to window.load noBubble: true }, focus: { // Fire native event if possible so blur/focus sequence is correct trigger: function() { if ( this !== safeActiveElement() && this.focus ) { try { this.focus(); return false; } catch ( e ) { // Support: IE<9 // If we error on focus to hidden element (#1486, #12518), // let .trigger() run the handlers } } }, delegateType: "focusin" }, blur: { trigger: function() { if ( this === safeActiveElement() && this.blur ) { this.blur(); return false; } }, delegateType: "focusout" }, click: { // For checkbox, fire native event so checked state will be right trigger: function() { if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { this.click(); return false; } }, // For cross-browser consistency, don't fire native .click() on links _default: function( event ) { return jQuery.nodeName( event.target, "a" ); } }, beforeunload: { postDispatch: function( event ) { // Even when returnValue equals to undefined Firefox will still show alert if ( event.result !== undefined ) { event.originalEvent.returnValue = event.result; } } } }, simulate: function( type, elem, event, bubble ) { // Piggyback on a donor event to simulate a different one. // Fake originalEvent to avoid donor's stopPropagation, but if the // simulated event prevents default then we do the same on the donor. var e = jQuery.extend( new jQuery.Event(), event, { type: type, isSimulated: true, originalEvent: {} } ); if ( bubble ) { jQuery.event.trigger( e, null, elem ); } else { jQuery.event.dispatch.call( elem, e ); } if ( e.isDefaultPrevented() ) { event.preventDefault(); } } }; jQuery.removeEvent = document.removeEventListener ? function( elem, type, handle ) { if ( elem.removeEventListener ) { elem.removeEventListener( type, handle, false ); } } : function( elem, type, handle ) { var name = "on" + type; if ( elem.detachEvent ) { // #8545, #7054, preventing memory leaks for custom events in IE6-8 // detachEvent needed property on element, by name of that event, to properly expose it to GC if ( typeof elem[ name ] === strundefined ) { elem[ name ] = null; } elem.detachEvent( name, handle ); } }; jQuery.Event = function( src, props ) { // Allow instantiation without the 'new' keyword if ( !(this instanceof jQuery.Event) ) { return new jQuery.Event( src, props ); } // Event object if ( src && src.type ) { this.originalEvent = src; this.type = src.type; // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && ( // Support: IE < 9 src.returnValue === false || // Support: Android < 4.0 src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; // Event type } else { this.type = src; } // Put explicitly provided properties onto the event object if ( props ) { jQuery.extend( this, props ); } // Create a timestamp if incoming event doesn't have one this.timeStamp = src && src.timeStamp || jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; }; // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse, preventDefault: function() { var e = this.originalEvent; this.isDefaultPrevented = returnTrue; if ( !e ) { return; } // If preventDefault exists, run it on the original event if ( e.preventDefault ) { e.preventDefault(); // Support: IE // Otherwise set the returnValue property of the original event to false } else { e.returnValue = false; } }, stopPropagation: function() { var e = this.originalEvent; this.isPropagationStopped = returnTrue; if ( !e ) { return; } // If stopPropagation exists, run it on the original event if ( e.stopPropagation ) { e.stopPropagation(); } // Support: IE // Set the cancelBubble property of the original event to true e.cancelBubble = true; }, stopImmediatePropagation: function() { this.isImmediatePropagationStopped = returnTrue; this.stopPropagation(); } }; // Create mouseenter/leave events using mouseover/out and event-time checks jQuery.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { delegateType: fix, bindType: fix, handle: function( event ) { var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj; // For mousenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window if ( !related || (related !== target && !jQuery.contains( target, related )) ) { event.type = handleObj.origType; ret = handleObj.handler.apply( this, arguments ); event.type = fix; } return ret; } }; }); // IE submit delegation if ( !support.submitBubbles ) { jQuery.event.special.submit = { setup: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Lazy-add a submit handler when a descendant form may potentially be submitted jQuery.event.add( this, "click._submit keypress._submit", function( e ) { // Node name check avoids a VML-related crash in IE (#9807) var elem = e.target, form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; if ( form && !jQuery._data( form, "submitBubbles" ) ) { jQuery.event.add( form, "submit._submit", function( event ) { event._submit_bubble = true; }); jQuery._data( form, "submitBubbles", true ); } }); // return undefined since we don't need an event listener }, postDispatch: function( event ) { // If form was submitted by the user, bubble the event up the tree if ( event._submit_bubble ) { delete event._submit_bubble; if ( this.parentNode && !event.isTrigger ) { jQuery.event.simulate( "submit", this.parentNode, event, true ); } } }, teardown: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Remove delegated handlers; cleanData eventually reaps submit handlers attached above jQuery.event.remove( this, "._submit" ); } }; } // IE change delegation and checkbox/radio fix if ( !support.changeBubbles ) { jQuery.event.special.change = { setup: function() { if ( rformElems.test( this.nodeName ) ) { // IE doesn't fire change on a check/radio until blur; trigger it on click // after a propertychange. Eat the blur-change in special.change.handle. // This still fires onchange a second time for check/radio after blur. if ( this.type === "checkbox" || this.type === "radio" ) { jQuery.event.add( this, "propertychange._change", function( event ) { if ( event.originalEvent.propertyName === "checked" ) { this._just_changed = true; } }); jQuery.event.add( this, "click._change", function( event ) { if ( this._just_changed && !event.isTrigger ) { this._just_changed = false; } // Allow triggered, simulated change events (#11500) jQuery.event.simulate( "change", this, event, true ); }); } return false; } // Delegated event; lazy-add a change handler on descendant inputs jQuery.event.add( this, "beforeactivate._change", function( e ) { var elem = e.target; if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { jQuery.event.add( elem, "change._change", function( event ) { if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { jQuery.event.simulate( "change", this.parentNode, event, true ); } }); jQuery._data( elem, "changeBubbles", true ); } }); }, handle: function( event ) { var elem = event.target; // Swallow native change events from checkbox/radio, we already triggered them above if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { return event.handleObj.handler.apply( this, arguments ); } }, teardown: function() { jQuery.event.remove( this, "._change" ); return !rformElems.test( this.nodeName ); } }; } // Create "bubbling" focus and blur events if ( !support.focusinBubbles ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { // Attach a single capturing handler on the document while someone wants focusin/focusout var handler = function( event ) { jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); }; jQuery.event.special[ fix ] = { setup: function() { var doc = this.ownerDocument || this, attaches = jQuery._data( doc, fix ); if ( !attaches ) { doc.addEventListener( orig, handler, true ); } jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); }, teardown: function() { var doc = this.ownerDocument || this, attaches = jQuery._data( doc, fix ) - 1; if ( !attaches ) { doc.removeEventListener( orig, handler, true ); jQuery._removeData( doc, fix ); } else { jQuery._data( doc, fix, attaches ); } } }; }); } jQuery.fn.extend({ on: function( types, selector, data, fn, /*INTERNAL*/ one ) { var type, origFn; // Types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-Object, selector, data ) if ( typeof selector !== "string" ) { // ( types-Object, data ) data = data || selector; selector = undefined; } for ( type in types ) { this.on( type, selector, data, types[ type ], one ); } return this; } if ( data == null && fn == null ) { // ( types, fn ) fn = selector; data = selector = undefined; } else if ( fn == null ) { if ( typeof selector === "string" ) { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if ( fn === false ) { fn = returnFalse; } else if ( !fn ) { return this; } if ( one === 1 ) { origFn = fn; fn = function( event ) { // Can use an empty set, since event contains the info jQuery().off( event ); return origFn.apply( this, arguments ); }; // Use same guid so caller can remove using origFn fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); } return this.each( function() { jQuery.event.add( this, types, fn, data, selector ); }); }, one: function( types, selector, data, fn ) { return this.on( types, selector, data, fn, 1 ); }, off: function( types, selector, fn ) { var handleObj, type; if ( types && types.preventDefault && types.handleObj ) { // ( event ) dispatched jQuery.Event handleObj = types.handleObj; jQuery( types.delegateTarget ).off( handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler ); return this; } if ( typeof types === "object" ) { // ( types-object [, selector] ) for ( type in types ) { this.off( type, selector, types[ type ] ); } return this; } if ( selector === false || typeof selector === "function" ) { // ( types [, fn] ) fn = selector; selector = undefined; } if ( fn === false ) { fn = returnFalse; } return this.each(function() { jQuery.event.remove( this, types, fn, selector ); }); }, trigger: function( type, data ) { return this.each(function() { jQuery.event.trigger( type, data, this ); }); }, triggerHandler: function( type, data ) { var elem = this[0]; if ( elem ) { return jQuery.event.trigger( type, data, elem, true ); } } }); function createSafeFragment( document ) { var list = nodeNames.split( "|" ), safeFrag = document.createDocumentFragment(); if ( safeFrag.createElement ) { while ( list.length ) { safeFrag.createElement( list.pop() ); } } return safeFrag; } var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), rleadingWhitespace = /^\s+/, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, rtagName = /<([\w:]+)/, rtbody = /<tbody/i, rhtml = /<|&#?\w+;/, rnoInnerhtml = /<(?:script|style|link)/i, // checked="checked" or checked rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rscriptType = /^$|\/(?:java|ecma)script/i, rscriptTypeMasked = /^true\/(.*)/, rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, // We have to close these tags to support XHTML (#13200) wrapMap = { option: [ 1, "<select multiple='multiple'>", "</select>" ], legend: [ 1, "<fieldset>", "</fieldset>" ], area: [ 1, "<map>", "</map>" ], param: [ 1, "<object>", "</object>" ], thead: [ 1, "<table>", "</table>" ], tr: [ 2, "<table><tbody>", "</tbody></table>" ], col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, // unless wrapped in a div with non-breaking characters in front of it. _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ] }, safeFragment = createSafeFragment( document ), fragmentDiv = safeFragment.appendChild( document.createElement("div") ); wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; function getAll( context, tag ) { var elems, elem, i = 0, found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) : typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) : undefined; if ( !found ) { for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { if ( !tag || jQuery.nodeName( elem, tag ) ) { found.push( elem ); } else { jQuery.merge( found, getAll( elem, tag ) ); } } } return tag === undefined || tag && jQuery.nodeName( context, tag ) ? jQuery.merge( [ context ], found ) : found; } // Used in buildFragment, fixes the defaultChecked property function fixDefaultChecked( elem ) { if ( rcheckableType.test( elem.type ) ) { elem.defaultChecked = elem.checked; } } // Support: IE<8 // Manipulating tables requires a tbody function manipulationTarget( elem, content ) { return jQuery.nodeName( elem, "table" ) && jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? elem.getElementsByTagName("tbody")[0] || elem.appendChild( elem.ownerDocument.createElement("tbody") ) : elem; } // Replace/restore the type attribute of script elements for safe DOM manipulation function disableScript( elem ) { elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; return elem; } function restoreScript( elem ) { var match = rscriptTypeMasked.exec( elem.type ); if ( match ) { elem.type = match[1]; } else { elem.removeAttribute("type"); } return elem; } // Mark scripts as having already been evaluated function setGlobalEval( elems, refElements ) { var elem, i = 0; for ( ; (elem = elems[i]) != null; i++ ) { jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); } } function cloneCopyEvent( src, dest ) { if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { return; } var type, i, l, oldData = jQuery._data( src ), curData = jQuery._data( dest, oldData ), events = oldData.events; if ( events ) { delete curData.handle; curData.events = {}; for ( type in events ) { for ( i = 0, l = events[ type ].length; i < l; i++ ) { jQuery.event.add( dest, type, events[ type ][ i ] ); } } } // make the cloned public data object a copy from the original if ( curData.data ) { curData.data = jQuery.extend( {}, curData.data ); } } function fixCloneNodeIssues( src, dest ) { var nodeName, e, data; // We do not need to do anything for non-Elements if ( dest.nodeType !== 1 ) { return; } nodeName = dest.nodeName.toLowerCase(); // IE6-8 copies events bound via attachEvent when using cloneNode. if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { data = jQuery._data( dest ); for ( e in data.events ) { jQuery.removeEvent( dest, e, data.handle ); } // Event data gets referenced instead of copied if the expando gets copied too dest.removeAttribute( jQuery.expando ); } // IE blanks contents when cloning scripts, and tries to evaluate newly-set text if ( nodeName === "script" && dest.text !== src.text ) { disableScript( dest ).text = src.text; restoreScript( dest ); // IE6-10 improperly clones children of object elements using classid. // IE10 throws NoModificationAllowedError if parent is null, #12132. } else if ( nodeName === "object" ) { if ( dest.parentNode ) { dest.outerHTML = src.outerHTML; } // This path appears unavoidable for IE9. When cloning an object // element in IE9, the outerHTML strategy above is not sufficient. // If the src has innerHTML and the destination does not, // copy the src.innerHTML into the dest.innerHTML. #10324 if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { dest.innerHTML = src.innerHTML; } } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { // IE6-8 fails to persist the checked state of a cloned checkbox // or radio button. Worse, IE6-7 fail to give the cloned element // a checked appearance if the defaultChecked value isn't also set dest.defaultChecked = dest.checked = src.checked; // IE6-7 get confused and end up setting the value of a cloned // checkbox/radio button to an empty string instead of "on" if ( dest.value !== src.value ) { dest.value = src.value; } // IE6-8 fails to return the selected option to the default selected // state when cloning options } else if ( nodeName === "option" ) { dest.defaultSelected = dest.selected = src.defaultSelected; // IE6-8 fails to set the defaultValue to the correct value when // cloning other types of input fields } else if ( nodeName === "input" || nodeName === "textarea" ) { dest.defaultValue = src.defaultValue; } } jQuery.extend({ clone: function( elem, dataAndEvents, deepDataAndEvents ) { var destElements, node, clone, i, srcElements, inPage = jQuery.contains( elem.ownerDocument, elem ); if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { clone = elem.cloneNode( true ); // IE<=8 does not properly clone detached, unknown element nodes } else { fragmentDiv.innerHTML = elem.outerHTML; fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); } if ( (!support.noCloneEvent || !support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 destElements = getAll( clone ); srcElements = getAll( elem ); // Fix all IE cloning issues for ( i = 0; (node = srcElements[i]) != null; ++i ) { // Ensure that the destination node is not null; Fixes #9587 if ( destElements[i] ) { fixCloneNodeIssues( node, destElements[i] ); } } } // Copy the events from the original to the clone if ( dataAndEvents ) { if ( deepDataAndEvents ) { srcElements = srcElements || getAll( elem ); destElements = destElements || getAll( clone ); for ( i = 0; (node = srcElements[i]) != null; i++ ) { cloneCopyEvent( node, destElements[i] ); } } else { cloneCopyEvent( elem, clone ); } } // Preserve script evaluation history destElements = getAll( clone, "script" ); if ( destElements.length > 0 ) { setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); } destElements = srcElements = node = null; // Return the cloned set return clone; }, buildFragment: function( elems, context, scripts, selection ) { var j, elem, contains, tmp, tag, tbody, wrap, l = elems.length, // Ensure a safe fragment safe = createSafeFragment( context ), nodes = [], i = 0; for ( ; i < l; i++ ) { elem = elems[ i ]; if ( elem || elem === 0 ) { // Add nodes directly if ( jQuery.type( elem ) === "object" ) { jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); // Convert non-html into a text node } else if ( !rhtml.test( elem ) ) { nodes.push( context.createTextNode( elem ) ); // Convert html into DOM nodes } else { tmp = tmp || safe.appendChild( context.createElement("div") ); // Deserialize a standard representation tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase(); wrap = wrapMap[ tag ] || wrapMap._default; tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2]; // Descend through wrappers to the right content j = wrap[0]; while ( j-- ) { tmp = tmp.lastChild; } // Manually add leading whitespace removed by IE if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); } // Remove IE's autoinserted <tbody> from table fragments if ( !support.tbody ) { // String was a <table>, *may* have spurious <tbody> elem = tag === "table" && !rtbody.test( elem ) ? tmp.firstChild : // String was a bare <thead> or <tfoot> wrap[1] === "<table>" && !rtbody.test( elem ) ? tmp : 0; j = elem && elem.childNodes.length; while ( j-- ) { if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { elem.removeChild( tbody ); } } } jQuery.merge( nodes, tmp.childNodes ); // Fix #12392 for WebKit and IE > 9 tmp.textContent = ""; // Fix #12392 for oldIE while ( tmp.firstChild ) { tmp.removeChild( tmp.firstChild ); } // Remember the top-level container for proper cleanup tmp = safe.lastChild; } } } // Fix #11356: Clear elements from fragment if ( tmp ) { safe.removeChild( tmp ); } // Reset defaultChecked for any radios and checkboxes // about to be appended to the DOM in IE 6/7 (#8060) if ( !support.appendChecked ) { jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); } i = 0; while ( (elem = nodes[ i++ ]) ) { // #4087 - If origin and destination elements are the same, and this is // that element, do not do anything if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { continue; } contains = jQuery.contains( elem.ownerDocument, elem ); // Append to fragment tmp = getAll( safe.appendChild( elem ), "script" ); // Preserve script evaluation history if ( contains ) { setGlobalEval( tmp ); } // Capture executables if ( scripts ) { j = 0; while ( (elem = tmp[ j++ ]) ) { if ( rscriptType.test( elem.type || "" ) ) { scripts.push( elem ); } } } } tmp = null; return safe; }, cleanData: function( elems, /* internal */ acceptData ) { var elem, type, id, data, i = 0, internalKey = jQuery.expando, cache = jQuery.cache, deleteExpando = support.deleteExpando, special = jQuery.event.special; for ( ; (elem = elems[i]) != null; i++ ) { if ( acceptData || jQuery.acceptData( elem ) ) { id = elem[ internalKey ]; data = id && cache[ id ]; if ( data ) { if ( data.events ) { for ( type in data.events ) { if ( special[ type ] ) { jQuery.event.remove( elem, type ); // This is a shortcut to avoid jQuery.event.remove's overhead } else { jQuery.removeEvent( elem, type, data.handle ); } } } // Remove cache only if it was not already removed by jQuery.event.remove if ( cache[ id ] ) { delete cache[ id ]; // IE does not allow us to delete expando properties from nodes, // nor does it have a removeAttribute function on Document nodes; // we must handle all of these cases if ( deleteExpando ) { delete elem[ internalKey ]; } else if ( typeof elem.removeAttribute !== strundefined ) { elem.removeAttribute( internalKey ); } else { elem[ internalKey ] = null; } deletedIds.push( id ); } } } } } }); jQuery.fn.extend({ text: function( value ) { return access( this, function( value ) { return value === undefined ? jQuery.text( this ) : this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); }, null, value, arguments.length ); }, append: function() { return this.domManip( arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.appendChild( elem ); } }); }, prepend: function() { return this.domManip( arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.insertBefore( elem, target.firstChild ); } }); }, before: function() { return this.domManip( arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this ); } }); }, after: function() { return this.domManip( arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this.nextSibling ); } }); }, remove: function( selector, keepData /* Internal Use Only */ ) { var elem, elems = selector ? jQuery.filter( selector, this ) : this, i = 0; for ( ; (elem = elems[i]) != null; i++ ) { if ( !keepData && elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem ) ); } if ( elem.parentNode ) { if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { setGlobalEval( getAll( elem, "script" ) ); } elem.parentNode.removeChild( elem ); } } return this; }, empty: function() { var elem, i = 0; for ( ; (elem = this[i]) != null; i++ ) { // Remove element nodes and prevent memory leaks if ( elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem, false ) ); } // Remove any remaining nodes while ( elem.firstChild ) { elem.removeChild( elem.firstChild ); } // If this is a select, ensure that it displays empty (#12336) // Support: IE<9 if ( elem.options && jQuery.nodeName( elem, "select" ) ) { elem.options.length = 0; } } return this; }, clone: function( dataAndEvents, deepDataAndEvents ) { dataAndEvents = dataAndEvents == null ? false : dataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; return this.map(function() { return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); }); }, html: function( value ) { return access( this, function( value ) { var elem = this[ 0 ] || {}, i = 0, l = this.length; if ( value === undefined ) { return elem.nodeType === 1 ? elem.innerHTML.replace( rinlinejQuery, "" ) : undefined; } // See if we can take a shortcut and just use innerHTML if ( typeof value === "string" && !rnoInnerhtml.test( value ) && ( support.htmlSerialize || !rnoshimcache.test( value ) ) && ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && !wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) { value = value.replace( rxhtmlTag, "<$1></$2>" ); try { for (; i < l; i++ ) { // Remove element nodes and prevent memory leaks elem = this[i] || {}; if ( elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem, false ) ); elem.innerHTML = value; } } elem = 0; // If using innerHTML throws an exception, use the fallback method } catch(e) {} } if ( elem ) { this.empty().append( value ); } }, null, value, arguments.length ); }, replaceWith: function() { var arg = arguments[ 0 ]; // Make the changes, replacing each context element with the new content this.domManip( arguments, function( elem ) { arg = this.parentNode; jQuery.cleanData( getAll( this ) ); if ( arg ) { arg.replaceChild( elem, this ); } }); // Force removal if there was no new content (e.g., from empty arguments) return arg && (arg.length || arg.nodeType) ? this : this.remove(); }, detach: function( selector ) { return this.remove( selector, true ); }, domManip: function( args, callback ) { // Flatten any nested arrays args = concat.apply( [], args ); var first, node, hasScripts, scripts, doc, fragment, i = 0, l = this.length, set = this, iNoClone = l - 1, value = args[0], isFunction = jQuery.isFunction( value ); // We can't cloneNode fragments that contain checked, in WebKit if ( isFunction || ( l > 1 && typeof value === "string" && !support.checkClone && rchecked.test( value ) ) ) { return this.each(function( index ) { var self = set.eq( index ); if ( isFunction ) { args[0] = value.call( this, index, self.html() ); } self.domManip( args, callback ); }); } if ( l ) { fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); first = fragment.firstChild; if ( fragment.childNodes.length === 1 ) { fragment = first; } if ( first ) { scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); hasScripts = scripts.length; // Use the original fragment for the last item instead of the first because it can end up // being emptied incorrectly in certain situations (#8070). for ( ; i < l; i++ ) { node = fragment; if ( i !== iNoClone ) { node = jQuery.clone( node, true, true ); // Keep references to cloned scripts for later restoration if ( hasScripts ) { jQuery.merge( scripts, getAll( node, "script" ) ); } } callback.call( this[i], node, i ); } if ( hasScripts ) { doc = scripts[ scripts.length - 1 ].ownerDocument; // Reenable scripts jQuery.map( scripts, restoreScript ); // Evaluate executable scripts on first document insertion for ( i = 0; i < hasScripts; i++ ) { node = scripts[ i ]; if ( rscriptType.test( node.type || "" ) && !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { if ( node.src ) { // Optional AJAX dependency, but won't run scripts if not present if ( jQuery._evalUrl ) { jQuery._evalUrl( node.src ); } } else { jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); } } } } // Fix #11809: Avoid leaking memory fragment = first = null; } } return this; } }); jQuery.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function( name, original ) { jQuery.fn[ name ] = function( selector ) { var elems, i = 0, ret = [], insert = jQuery( selector ), last = insert.length - 1; for ( ; i <= last; i++ ) { elems = i === last ? this : this.clone(true); jQuery( insert[i] )[ original ]( elems ); // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() push.apply( ret, elems.get() ); } return this.pushStack( ret ); }; }); // Based off of the plugin by Clint Helfers, with permission. // http://blindsignals.com/index.php/2009/07/jquery-delay/ jQuery.fn.delay = function( time, type ) { time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; type = type || "fx"; return this.queue( type, function( next, hooks ) { var timeout = setTimeout( next, time ); hooks.stop = function() { clearTimeout( timeout ); }; }); }; (function() { var a, input, select, opt, div = document.createElement("div" ); // Setup div.setAttribute( "className", "t" ); div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; a = div.getElementsByTagName("a")[ 0 ]; // First batch of tests. select = document.createElement("select"); opt = select.appendChild( document.createElement("option") ); input = div.getElementsByTagName("input")[ 0 ]; a.style.cssText = "top:1px"; // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) support.getSetAttribute = div.className !== "t"; // Get the style information from getAttribute // (IE uses .cssText instead) support.style = /top/.test( a.getAttribute("style") ); // Make sure that URLs aren't manipulated // (IE normalizes it by default) support.hrefNormalized = a.getAttribute("href") === "/a"; // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) support.checkOn = !!input.value; // Make sure that a selected-by-default option has a working selected property. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) support.optSelected = opt.selected; // Tests for enctype support on a form (#6743) support.enctype = !!document.createElement("form").enctype; // Make sure that the options inside disabled selects aren't marked as disabled // (WebKit marks them as disabled) select.disabled = true; support.optDisabled = !opt.disabled; // Support: IE8 only // Check if we can trust getAttribute("value") input = document.createElement( "input" ); input.setAttribute( "value", "" ); support.input = input.getAttribute( "value" ) === ""; // Check if an input maintains its value after becoming a radio input.value = "t"; input.setAttribute( "type", "radio" ); support.radioValue = input.value === "t"; // Null elements to avoid leaks in IE. a = input = select = opt = div = null; })(); var rreturn = /\r/g; jQuery.fn.extend({ val: function( value ) { var hooks, ret, isFunction, elem = this[0]; if ( !arguments.length ) { if ( elem ) { hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { return ret; } ret = elem.value; return typeof ret === "string" ? // handle most common string cases ret.replace(rreturn, "") : // handle cases where value is null/undef or number ret == null ? "" : ret; } return; } isFunction = jQuery.isFunction( value ); return this.each(function( i ) { var val; if ( this.nodeType !== 1 ) { return; } if ( isFunction ) { val = value.call( this, i, jQuery( this ).val() ); } else { val = value; } // Treat null/undefined as ""; convert numbers to string if ( val == null ) { val = ""; } else if ( typeof val === "number" ) { val += ""; } else if ( jQuery.isArray( val ) ) { val = jQuery.map( val, function( value ) { return value == null ? "" : value + ""; }); } hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; // If set returns undefined, fall back to normal setting if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { this.value = val; } }); } }); jQuery.extend({ valHooks: { option: { get: function( elem ) { var val = jQuery.find.attr( elem, "value" ); return val != null ? val : jQuery.text( elem ); } }, select: { get: function( elem ) { var value, option, options = elem.options, index = elem.selectedIndex, one = elem.type === "select-one" || index < 0, values = one ? null : [], max = one ? index + 1 : options.length, i = index < 0 ? max : one ? index : 0; // Loop through all the selected options for ( ; i < max; i++ ) { option = options[ i ]; // oldIE doesn't update selected after form reset (#2551) if ( ( option.selected || i === index ) && // Don't return options that are disabled or in a disabled optgroup ( support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { // Get the specific value for the option value = jQuery( option ).val(); // We don't need an array for one selects if ( one ) { return value; } // Multi-Selects return an array values.push( value ); } } return values; }, set: function( elem, value ) { var optionSet, option, options = elem.options, values = jQuery.makeArray( value ), i = options.length; while ( i-- ) { option = options[ i ]; if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0 ) { // Support: IE6 // When new option element is added to select box we need to // force reflow of newly added node in order to workaround delay // of initialization properties try { option.selected = optionSet = true; } catch ( _ ) { // Will be executed only in IE6 option.scrollHeight; } } else { option.selected = false; } } // Force browsers to behave consistently when non-matching value is set if ( !optionSet ) { elem.selectedIndex = -1; } return options; } } } }); // Radios and checkboxes getter/setter jQuery.each([ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = { set: function( elem, value ) { if ( jQuery.isArray( value ) ) { return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); } } }; if ( !support.checkOn ) { jQuery.valHooks[ this ].get = function( elem ) { // Support: Webkit // "" is returned instead of "on" if a value isn't specified return elem.getAttribute("value") === null ? "on" : elem.value; }; } }); var nodeHook, boolHook, attrHandle = jQuery.expr.attrHandle, ruseDefault = /^(?:checked|selected)$/i, getSetAttribute = support.getSetAttribute, getSetInput = support.input; jQuery.fn.extend({ attr: function( name, value ) { return access( this, jQuery.attr, name, value, arguments.length > 1 ); }, removeAttr: function( name ) { return this.each(function() { jQuery.removeAttr( this, name ); }); } }); jQuery.extend({ attr: function( elem, name, value ) { var hooks, ret, nType = elem.nodeType; // don't get/set attributes on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } // Fallback to prop when attributes are not supported if ( typeof elem.getAttribute === strundefined ) { return jQuery.prop( elem, name, value ); } // All attributes are lowercase // Grab necessary hook if one is defined if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { name = name.toLowerCase(); hooks = jQuery.attrHooks[ name ] || ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); } if ( value !== undefined ) { if ( value === null ) { jQuery.removeAttr( elem, name ); } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { elem.setAttribute( name, value + "" ); return value; } } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { ret = jQuery.find.attr( elem, name ); // Non-existent attributes return null, we normalize to undefined return ret == null ? undefined : ret; } }, removeAttr: function( elem, value ) { var name, propName, i = 0, attrNames = value && value.match( rnotwhite ); if ( attrNames && elem.nodeType === 1 ) { while ( (name = attrNames[i++]) ) { propName = jQuery.propFix[ name ] || name; // Boolean attributes get special treatment (#10870) if ( jQuery.expr.match.bool.test( name ) ) { // Set corresponding property to false if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { elem[ propName ] = false; // Support: IE<9 // Also clear defaultChecked/defaultSelected (if appropriate) } else { elem[ jQuery.camelCase( "default-" + name ) ] = elem[ propName ] = false; } // See #9699 for explanation of this approach (setting first, then removal) } else { jQuery.attr( elem, name, "" ); } elem.removeAttribute( getSetAttribute ? name : propName ); } } }, attrHooks: { type: { set: function( elem, value ) { if ( !support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { // Setting the type on a radio button after the value resets the value in IE6-9 // Reset value to default in case type is set after value during creation var val = elem.value; elem.setAttribute( "type", value ); if ( val ) { elem.value = val; } return value; } } } } }); // Hook for boolean attributes boolHook = { set: function( elem, value, name ) { if ( value === false ) { // Remove boolean attributes when set to false jQuery.removeAttr( elem, name ); } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { // IE<8 needs the *property* name elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); // Use defaultChecked and defaultSelected for oldIE } else { elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; } return name; } }; // Retrieve booleans specially jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { var getter = attrHandle[ name ] || jQuery.find.attr; attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ? function( elem, name, isXML ) { var ret, handle; if ( !isXML ) { // Avoid an infinite loop by temporarily removing this function from the getter handle = attrHandle[ name ]; attrHandle[ name ] = ret; ret = getter( elem, name, isXML ) != null ? name.toLowerCase() : null; attrHandle[ name ] = handle; } return ret; } : function( elem, name, isXML ) { if ( !isXML ) { return elem[ jQuery.camelCase( "default-" + name ) ] ? name.toLowerCase() : null; } }; }); // fix oldIE attroperties if ( !getSetInput || !getSetAttribute ) { jQuery.attrHooks.value = { set: function( elem, value, name ) { if ( jQuery.nodeName( elem, "input" ) ) { // Does not return so that setAttribute is also used elem.defaultValue = value; } else { // Use nodeHook if defined (#1954); otherwise setAttribute is fine return nodeHook && nodeHook.set( elem, value, name ); } } }; } // IE6/7 do not support getting/setting some attributes with get/setAttribute if ( !getSetAttribute ) { // Use this for any attribute in IE6/7 // This fixes almost every IE6/7 issue nodeHook = { set: function( elem, value, name ) { // Set the existing or create a new attribute node var ret = elem.getAttributeNode( name ); if ( !ret ) { elem.setAttributeNode( (ret = elem.ownerDocument.createAttribute( name )) ); } ret.value = value += ""; // Break association with cloned elements by also using setAttribute (#9646) if ( name === "value" || value === elem.getAttribute( name ) ) { return value; } } }; // Some attributes are constructed with empty-string values when not defined attrHandle.id = attrHandle.name = attrHandle.coords = function( elem, name, isXML ) { var ret; if ( !isXML ) { return (ret = elem.getAttributeNode( name )) && ret.value !== "" ? ret.value : null; } }; // Fixing value retrieval on a button requires this module jQuery.valHooks.button = { get: function( elem, name ) { var ret = elem.getAttributeNode( name ); if ( ret && ret.specified ) { return ret.value; } }, set: nodeHook.set }; // Set contenteditable to false on removals(#10429) // Setting to empty string throws an error as an invalid value jQuery.attrHooks.contenteditable = { set: function( elem, value, name ) { nodeHook.set( elem, value === "" ? false : value, name ); } }; // Set width and height to auto instead of 0 on empty string( Bug #8150 ) // This is for removals jQuery.each([ "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = { set: function( elem, value ) { if ( value === "" ) { elem.setAttribute( name, "auto" ); return value; } } }; }); } if ( !support.style ) { jQuery.attrHooks.style = { get: function( elem ) { // Return undefined in the case of empty string // Note: IE uppercases css property names, but if we were to .toLowerCase() // .cssText, that would destroy case senstitivity in URL's, like in "background" return elem.style.cssText || undefined; }, set: function( elem, value ) { return ( elem.style.cssText = value + "" ); } }; } var rfocusable = /^(?:input|select|textarea|button|object)$/i, rclickable = /^(?:a|area)$/i; jQuery.fn.extend({ prop: function( name, value ) { return access( this, jQuery.prop, name, value, arguments.length > 1 ); }, removeProp: function( name ) { name = jQuery.propFix[ name ] || name; return this.each(function() { // try/catch handles cases where IE balks (such as removing a property on window) try { this[ name ] = undefined; delete this[ name ]; } catch( e ) {} }); } }); jQuery.extend({ propFix: { "for": "htmlFor", "class": "className" }, prop: function( elem, name, value ) { var ret, hooks, notxml, nType = elem.nodeType; // don't get/set properties on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); if ( notxml ) { // Fix name and attach hooks name = jQuery.propFix[ name ] || name; hooks = jQuery.propHooks[ name ]; } if ( value !== undefined ) { return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? ret : ( elem[ name ] = value ); } else { return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? ret : elem[ name ]; } }, propHooks: { tabIndex: { get: function( elem ) { // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ // Use proper attribute retrieval(#12072) var tabindex = jQuery.find.attr( elem, "tabindex" ); return tabindex ? parseInt( tabindex, 10 ) : rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? 0 : -1; } } } }); // Some attributes require a special call on IE // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx if ( !support.hrefNormalized ) { // href/src property should get the full normalized URL (#10299/#12915) jQuery.each([ "href", "src" ], function( i, name ) { jQuery.propHooks[ name ] = { get: function( elem ) { return elem.getAttribute( name, 4 ); } }; }); } // Support: Safari, IE9+ // mis-reports the default selected property of an option // Accessing the parent's selectedIndex property fixes it if ( !support.optSelected ) { jQuery.propHooks.selected = { get: function( elem ) { var parent = elem.parentNode; if ( parent ) { parent.selectedIndex; // Make sure that it also works with optgroups, see #5701 if ( parent.parentNode ) { parent.parentNode.selectedIndex; } } return null; } }; } jQuery.each([ "tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable" ], function() { jQuery.propFix[ this.toLowerCase() ] = this; }); // IE6/7 call enctype encoding if ( !support.enctype ) { jQuery.propFix.enctype = "encoding"; } var rclass = /[\t\r\n\f]/g; jQuery.fn.extend({ addClass: function( value ) { var classes, elem, cur, clazz, j, finalValue, i = 0, len = this.length, proceed = typeof value === "string" && value; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).addClass( value.call( this, j, this.className ) ); }); } if ( proceed ) { // The disjunction here is for better compressibility (see removeClass) classes = ( value || "" ).match( rnotwhite ) || []; for ( ; i < len; i++ ) { elem = this[ i ]; cur = elem.nodeType === 1 && ( elem.className ? ( " " + elem.className + " " ).replace( rclass, " " ) : " " ); if ( cur ) { j = 0; while ( (clazz = classes[j++]) ) { if ( cur.indexOf( " " + clazz + " " ) < 0 ) { cur += clazz + " "; } } // only assign if different to avoid unneeded rendering. finalValue = jQuery.trim( cur ); if ( elem.className !== finalValue ) { elem.className = finalValue; } } } } return this; }, removeClass: function( value ) { var classes, elem, cur, clazz, j, finalValue, i = 0, len = this.length, proceed = arguments.length === 0 || typeof value === "string" && value; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).removeClass( value.call( this, j, this.className ) ); }); } if ( proceed ) { classes = ( value || "" ).match( rnotwhite ) || []; for ( ; i < len; i++ ) { elem = this[ i ]; // This expression is here for better compressibility (see addClass) cur = elem.nodeType === 1 && ( elem.className ? ( " " + elem.className + " " ).replace( rclass, " " ) : "" ); if ( cur ) { j = 0; while ( (clazz = classes[j++]) ) { // Remove *all* instances while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { cur = cur.replace( " " + clazz + " ", " " ); } } // only assign if different to avoid unneeded rendering. finalValue = value ? jQuery.trim( cur ) : ""; if ( elem.className !== finalValue ) { elem.className = finalValue; } } } } return this; }, toggleClass: function( value, stateVal ) { var type = typeof value; if ( typeof stateVal === "boolean" && type === "string" ) { return stateVal ? this.addClass( value ) : this.removeClass( value ); } if ( jQuery.isFunction( value ) ) { return this.each(function( i ) { jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); }); } return this.each(function() { if ( type === "string" ) { // toggle individual class names var className, i = 0, self = jQuery( this ), classNames = value.match( rnotwhite ) || []; while ( (className = classNames[ i++ ]) ) { // check each className given, space separated list if ( self.hasClass( className ) ) { self.removeClass( className ); } else { self.addClass( className ); } } // Toggle whole class name } else if ( type === strundefined || type === "boolean" ) { if ( this.className ) { // store className if set jQuery._data( this, "__className__", this.className ); } // If the element has a class name or if we're passed "false", // then remove the whole classname (if there was one, the above saved it). // Otherwise bring back whatever was previously saved (if anything), // falling back to the empty string if nothing was stored. this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; } }); }, hasClass: function( selector ) { var className = " " + selector + " ", i = 0, l = this.length; for ( ; i < l; i++ ) { if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { return true; } } return false; } }); // Return jQuery for attributes-only inclusion jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { // Handle event binding jQuery.fn[ name ] = function( data, fn ) { return arguments.length > 0 ? this.on( name, null, data, fn ) : this.trigger( name ); }; }); jQuery.fn.extend({ hover: function( fnOver, fnOut ) { return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); }, bind: function( types, data, fn ) { return this.on( types, null, data, fn ); }, unbind: function( types, fn ) { return this.off( types, null, fn ); }, delegate: function( selector, types, data, fn ) { return this.on( types, selector, data, fn ); }, undelegate: function( selector, types, fn ) { // ( namespace ) or ( selector, types [, fn] ) return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); } }); var nonce = jQuery.now(); var rquery = (/\?/); var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g; jQuery.parseJSON = function( data ) { // Attempt to parse using the native JSON parser first if ( window.JSON && window.JSON.parse ) { // Support: Android 2.3 // Workaround failure to string-cast null input return window.JSON.parse( data + "" ); } var requireNonComma, depth = null, str = jQuery.trim( data + "" ); // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains // after removing valid tokens return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) { // Force termination if we see a misplaced comma if ( requireNonComma && comma ) { depth = 0; } // Perform no more replacements after returning to outermost depth if ( depth === 0 ) { return token; } // Commas must not follow "[", "{", or "," requireNonComma = open || comma; // Determine new depth // array/object open ("[" or "{"): depth += true - false (increment) // array/object close ("]" or "}"): depth += false - true (decrement) // other cases ("," or primitive): depth += true - true (numeric cast) depth += !close - !open; // Remove this token return ""; }) ) ? ( Function( "return " + str ) )() : jQuery.error( "Invalid JSON: " + data ); }; // Cross-browser xml parsing jQuery.parseXML = function( data ) { var xml, tmp; if ( !data || typeof data !== "string" ) { return null; } try { if ( window.DOMParser ) { // Standard tmp = new DOMParser(); xml = tmp.parseFromString( data, "text/xml" ); } else { // IE xml = new ActiveXObject( "Microsoft.XMLDOM" ); xml.async = "false"; xml.loadXML( data ); } } catch( e ) { xml = undefined; } if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { jQuery.error( "Invalid XML: " + data ); } return xml; }; var // Document location ajaxLocParts, ajaxLocation, rhash = /#.*$/, rts = /([?&])_=[^&]*/, rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL // #7653, #8125, #8152: local protocol detection rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/, /* Prefilters * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) * 2) These are called: * - BEFORE asking for a transport * - AFTER param serialization (s.data is a string if s.processData is true) * 3) key is the dataType * 4) the catchall symbol "*" can be used * 5) execution will start with transport dataType and THEN continue down to "*" if needed */ prefilters = {}, /* Transports bindings * 1) key is the dataType * 2) the catchall symbol "*" can be used * 3) selection will start with transport dataType and THEN go to "*" if needed */ transports = {}, // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression allTypes = "*/".concat("*"); // #8138, IE may throw an exception when accessing // a field from window.location if document.domain has been set try { ajaxLocation = location.href; } catch( e ) { // Use the href attribute of an A element // since IE will modify it given document.location ajaxLocation = document.createElement( "a" ); ajaxLocation.href = ""; ajaxLocation = ajaxLocation.href; } // Segment location into parts ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport function addToPrefiltersOrTransports( structure ) { // dataTypeExpression is optional and defaults to "*" return function( dataTypeExpression, func ) { if ( typeof dataTypeExpression !== "string" ) { func = dataTypeExpression; dataTypeExpression = "*"; } var dataType, i = 0, dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || []; if ( jQuery.isFunction( func ) ) { // For each dataType in the dataTypeExpression while ( (dataType = dataTypes[i++]) ) { // Prepend if requested if ( dataType.charAt( 0 ) === "+" ) { dataType = dataType.slice( 1 ) || "*"; (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); // Otherwise append } else { (structure[ dataType ] = structure[ dataType ] || []).push( func ); } } } }; } // Base inspection function for prefilters and transports function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { var inspected = {}, seekingTransport = ( structure === transports ); function inspect( dataType ) { var selected; inspected[ dataType ] = true; jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { options.dataTypes.unshift( dataTypeOrTransport ); inspect( dataTypeOrTransport ); return false; } else if ( seekingTransport ) { return !( selected = dataTypeOrTransport ); } }); return selected; } return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); } // A special extend for ajax options // that takes "flat" options (not to be deep extended) // Fixes #9887 function ajaxExtend( target, src ) { var deep, key, flatOptions = jQuery.ajaxSettings.flatOptions || {}; for ( key in src ) { if ( src[ key ] !== undefined ) { ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; } } if ( deep ) { jQuery.extend( true, target, deep ); } return target; } /* Handles responses to an ajax request: * - finds the right dataType (mediates between content-type and expected dataType) * - returns the corresponding response */ function ajaxHandleResponses( s, jqXHR, responses ) { var firstDataType, ct, finalDataType, type, contents = s.contents, dataTypes = s.dataTypes; // Remove auto dataType and get content-type in the process while ( dataTypes[ 0 ] === "*" ) { dataTypes.shift(); if ( ct === undefined ) { ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); } } // Check if we're dealing with a known content-type if ( ct ) { for ( type in contents ) { if ( contents[ type ] && contents[ type ].test( ct ) ) { dataTypes.unshift( type ); break; } } } // Check to see if we have a response for the expected dataType if ( dataTypes[ 0 ] in responses ) { finalDataType = dataTypes[ 0 ]; } else { // Try convertible dataTypes for ( type in responses ) { if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { finalDataType = type; break; } if ( !firstDataType ) { firstDataType = type; } } // Or just use first one finalDataType = finalDataType || firstDataType; } // If we found a dataType // We add the dataType to the list if needed // and return the corresponding response if ( finalDataType ) { if ( finalDataType !== dataTypes[ 0 ] ) { dataTypes.unshift( finalDataType ); } return responses[ finalDataType ]; } } /* Chain conversions given the request and the original response * Also sets the responseXXX fields on the jqXHR instance */ function ajaxConvert( s, response, jqXHR, isSuccess ) { var conv2, current, conv, tmp, prev, converters = {}, // Work with a copy of dataTypes in case we need to modify it for conversion dataTypes = s.dataTypes.slice(); // Create converters map with lowercased keys if ( dataTypes[ 1 ] ) { for ( conv in s.converters ) { converters[ conv.toLowerCase() ] = s.converters[ conv ]; } } current = dataTypes.shift(); // Convert to each sequential dataType while ( current ) { if ( s.responseFields[ current ] ) { jqXHR[ s.responseFields[ current ] ] = response; } // Apply the dataFilter if provided if ( !prev && isSuccess && s.dataFilter ) { response = s.dataFilter( response, s.dataType ); } prev = current; current = dataTypes.shift(); if ( current ) { // There's only work to do if current dataType is non-auto if ( current === "*" ) { current = prev; // Convert response if prev dataType is non-auto and differs from current } else if ( prev !== "*" && prev !== current ) { // Seek a direct converter conv = converters[ prev + " " + current ] || converters[ "* " + current ]; // If none found, seek a pair if ( !conv ) { for ( conv2 in converters ) { // If conv2 outputs current tmp = conv2.split( " " ); if ( tmp[ 1 ] === current ) { // If prev can be converted to accepted input conv = converters[ prev + " " + tmp[ 0 ] ] || converters[ "* " + tmp[ 0 ] ]; if ( conv ) { // Condense equivalence converters if ( conv === true ) { conv = converters[ conv2 ]; // Otherwise, insert the intermediate dataType } else if ( converters[ conv2 ] !== true ) { current = tmp[ 0 ]; dataTypes.unshift( tmp[ 1 ] ); } break; } } } } // Apply converter (if not an equivalence) if ( conv !== true ) { // Unless errors are allowed to bubble, catch and return them if ( conv && s[ "throws" ] ) { response = conv( response ); } else { try { response = conv( response ); } catch ( e ) { return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; } } } } } } return { state: "success", data: response }; } jQuery.extend({ // Counter for holding the number of active queries active: 0, // Last-Modified header cache for next request lastModified: {}, etag: {}, ajaxSettings: { url: ajaxLocation, type: "GET", isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), global: true, processData: true, async: true, contentType: "application/x-www-form-urlencoded; charset=UTF-8", /* timeout: 0, data: null, dataType: null, username: null, password: null, cache: null, throws: false, traditional: false, headers: {}, */ accepts: { "*": allTypes, text: "text/plain", html: "text/html", xml: "application/xml, text/xml", json: "application/json, text/javascript" }, contents: { xml: /xml/, html: /html/, json: /json/ }, responseFields: { xml: "responseXML", text: "responseText", json: "responseJSON" }, // Data converters // Keys separate source (or catchall "*") and destination types with a single space converters: { // Convert anything to text "* text": String, // Text to html (true = no transformation) "text html": true, // Evaluate text as a json expression "text json": jQuery.parseJSON, // Parse text as xml "text xml": jQuery.parseXML }, // For options that shouldn't be deep extended: // you can add your own custom options here if // and when you create one that shouldn't be // deep extended (see ajaxExtend) flatOptions: { url: true, context: true } }, // Creates a full fledged settings object into target // with both ajaxSettings and settings fields. // If target is omitted, writes into ajaxSettings. ajaxSetup: function( target, settings ) { return settings ? // Building a settings object ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : // Extending ajaxSettings ajaxExtend( jQuery.ajaxSettings, target ); }, ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), ajaxTransport: addToPrefiltersOrTransports( transports ), // Main method ajax: function( url, options ) { // If url is an object, simulate pre-1.5 signature if ( typeof url === "object" ) { options = url; url = undefined; } // Force options to be an object options = options || {}; var // Cross-domain detection vars parts, // Loop variable i, // URL without anti-cache param cacheURL, // Response headers as string responseHeadersString, // timeout handle timeoutTimer, // To know if global events are to be dispatched fireGlobals, transport, // Response headers responseHeaders, // Create the final options object s = jQuery.ajaxSetup( {}, options ), // Callbacks context callbackContext = s.context || s, // Context for global events is callbackContext if it is a DOM node or jQuery collection globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? jQuery( callbackContext ) : jQuery.event, // Deferreds deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks("once memory"), // Status-dependent callbacks statusCode = s.statusCode || {}, // Headers (they are sent all at once) requestHeaders = {}, requestHeadersNames = {}, // The jqXHR state state = 0, // Default abort message strAbort = "canceled", // Fake xhr jqXHR = { readyState: 0, // Builds headers hashtable if needed getResponseHeader: function( key ) { var match; if ( state === 2 ) { if ( !responseHeaders ) { responseHeaders = {}; while ( (match = rheaders.exec( responseHeadersString )) ) { responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; } } match = responseHeaders[ key.toLowerCase() ]; } return match == null ? null : match; }, // Raw string getAllResponseHeaders: function() { return state === 2 ? responseHeadersString : null; }, // Caches the header setRequestHeader: function( name, value ) { var lname = name.toLowerCase(); if ( !state ) { name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; requestHeaders[ name ] = value; } return this; }, // Overrides response content-type header overrideMimeType: function( type ) { if ( !state ) { s.mimeType = type; } return this; }, // Status-dependent callbacks statusCode: function( map ) { var code; if ( map ) { if ( state < 2 ) { for ( code in map ) { // Lazy-add the new callback in a way that preserves old ones statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; } } else { // Execute the appropriate callbacks jqXHR.always( map[ jqXHR.status ] ); } } return this; }, // Cancel the request abort: function( statusText ) { var finalText = statusText || strAbort; if ( transport ) { transport.abort( finalText ); } done( 0, finalText ); return this; } }; // Attach deferreds deferred.promise( jqXHR ).complete = completeDeferred.add; jqXHR.success = jqXHR.done; jqXHR.error = jqXHR.fail; // Remove hash character (#7531: and string promotion) // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) // Handle falsy url in the settings object (#10093: consistency with old signature) // We also use the url parameter if available s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); // Alias method option to type as per ticket #12004 s.type = options.method || options.type || s.method || s.type; // Extract dataTypes list s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ]; // A cross-domain request is in order when we have a protocol:host:port mismatch if ( s.crossDomain == null ) { parts = rurl.exec( s.url.toLowerCase() ); s.crossDomain = !!( parts && ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !== ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) ) ); } // Convert data if not already a string if ( s.data && s.processData && typeof s.data !== "string" ) { s.data = jQuery.param( s.data, s.traditional ); } // Apply prefilters inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); // If request was aborted inside a prefilter, stop there if ( state === 2 ) { return jqXHR; } // We can fire global events as of now if asked to fireGlobals = s.global; // Watch for a new set of requests if ( fireGlobals && jQuery.active++ === 0 ) { jQuery.event.trigger("ajaxStart"); } // Uppercase the type s.type = s.type.toUpperCase(); // Determine if request has content s.hasContent = !rnoContent.test( s.type ); // Save the URL in case we're toying with the If-Modified-Since // and/or If-None-Match header later on cacheURL = s.url; // More options handling for requests with no content if ( !s.hasContent ) { // If data is available, append data to url if ( s.data ) { cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); // #9682: remove data so that it's not used in an eventual retry delete s.data; } // Add anti-cache in url if needed if ( s.cache === false ) { s.url = rts.test( cacheURL ) ? // If there is already a '_' parameter, set its value cacheURL.replace( rts, "$1_=" + nonce++ ) : // Otherwise add one to the end cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++; } } // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { if ( jQuery.lastModified[ cacheURL ] ) { jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); } if ( jQuery.etag[ cacheURL ] ) { jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); } } // Set the correct header, if data is being sent if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { jqXHR.setRequestHeader( "Content-Type", s.contentType ); } // Set the Accepts header for the server, depending on the dataType jqXHR.setRequestHeader( "Accept", s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : s.accepts[ "*" ] ); // Check for headers option for ( i in s.headers ) { jqXHR.setRequestHeader( i, s.headers[ i ] ); } // Allow custom headers/mimetypes and early abort if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { // Abort if not done already and return return jqXHR.abort(); } // aborting is no longer a cancellation strAbort = "abort"; // Install callbacks on deferreds for ( i in { success: 1, error: 1, complete: 1 } ) { jqXHR[ i ]( s[ i ] ); } // Get transport transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); // If no transport, we auto-abort if ( !transport ) { done( -1, "No Transport" ); } else { jqXHR.readyState = 1; // Send global event if ( fireGlobals ) { globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); } // Timeout if ( s.async && s.timeout > 0 ) { timeoutTimer = setTimeout(function() { jqXHR.abort("timeout"); }, s.timeout ); } try { state = 1; transport.send( requestHeaders, done ); } catch ( e ) { // Propagate exception as error if not done if ( state < 2 ) { done( -1, e ); // Simply rethrow otherwise } else { throw e; } } } // Callback for when everything is done function done( status, nativeStatusText, responses, headers ) { var isSuccess, success, error, response, modified, statusText = nativeStatusText; // Called once if ( state === 2 ) { return; } // State is "done" now state = 2; // Clear timeout if it exists if ( timeoutTimer ) { clearTimeout( timeoutTimer ); } // Dereference transport for early garbage collection // (no matter how long the jqXHR object will be used) transport = undefined; // Cache response headers responseHeadersString = headers || ""; // Set readyState jqXHR.readyState = status > 0 ? 4 : 0; // Determine if successful isSuccess = status >= 200 && status < 300 || status === 304; // Get response data if ( responses ) { response = ajaxHandleResponses( s, jqXHR, responses ); } // Convert no matter what (that way responseXXX fields are always set) response = ajaxConvert( s, response, jqXHR, isSuccess ); // If successful, handle type chaining if ( isSuccess ) { // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { modified = jqXHR.getResponseHeader("Last-Modified"); if ( modified ) { jQuery.lastModified[ cacheURL ] = modified; } modified = jqXHR.getResponseHeader("etag"); if ( modified ) { jQuery.etag[ cacheURL ] = modified; } } // if no content if ( status === 204 || s.type === "HEAD" ) { statusText = "nocontent"; // if not modified } else if ( status === 304 ) { statusText = "notmodified"; // If we have data, let's convert it } else { statusText = response.state; success = response.data; error = response.error; isSuccess = !error; } } else { // We extract error from statusText // then normalize statusText and status for non-aborts error = statusText; if ( status || !statusText ) { statusText = "error"; if ( status < 0 ) { status = 0; } } } // Set data for the fake xhr object jqXHR.status = status; jqXHR.statusText = ( nativeStatusText || statusText ) + ""; // Success/Error if ( isSuccess ) { deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); } else { deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); } // Status-dependent callbacks jqXHR.statusCode( statusCode ); statusCode = undefined; if ( fireGlobals ) { globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", [ jqXHR, s, isSuccess ? success : error ] ); } // Complete completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); if ( fireGlobals ) { globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); // Handle the global AJAX counter if ( !( --jQuery.active ) ) { jQuery.event.trigger("ajaxStop"); } } } return jqXHR; }, getJSON: function( url, data, callback ) { return jQuery.get( url, data, callback, "json" ); }, getScript: function( url, callback ) { return jQuery.get( url, undefined, callback, "script" ); } }); jQuery.each( [ "get", "post" ], function( i, method ) { jQuery[ method ] = function( url, data, callback, type ) { // shift arguments if data argument was omitted if ( jQuery.isFunction( data ) ) { type = type || callback; callback = data; data = undefined; } return jQuery.ajax({ url: url, type: method, dataType: type, data: data, success: callback }); }; }); // Attach a bunch of functions for handling common AJAX events jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) { jQuery.fn[ type ] = function( fn ) { return this.on( type, fn ); }; }); jQuery._evalUrl = function( url ) { return jQuery.ajax({ url: url, type: "GET", dataType: "script", async: false, global: false, "throws": true }); }; jQuery.fn.extend({ wrapAll: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each(function(i) { jQuery(this).wrapAll( html.call(this, i) ); }); } if ( this[0] ) { // The elements to wrap the target around var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); if ( this[0].parentNode ) { wrap.insertBefore( this[0] ); } wrap.map(function() { var elem = this; while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { elem = elem.firstChild; } return elem; }).append( this ); } return this; }, wrapInner: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each(function(i) { jQuery(this).wrapInner( html.call(this, i) ); }); } return this.each(function() { var self = jQuery( this ), contents = self.contents(); if ( contents.length ) { contents.wrapAll( html ); } else { self.append( html ); } }); }, wrap: function( html ) { var isFunction = jQuery.isFunction( html ); return this.each(function(i) { jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); }); }, unwrap: function() { return this.parent().each(function() { if ( !jQuery.nodeName( this, "body" ) ) { jQuery( this ).replaceWith( this.childNodes ); } }).end(); } }); var r20 = /%20/g, rbracket = /\[\]$/, rCRLF = /\r?\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i; function buildParams( prefix, obj, traditional, add ) { var name; if ( jQuery.isArray( obj ) ) { // Serialize array item. jQuery.each( obj, function( i, v ) { if ( traditional || rbracket.test( prefix ) ) { // Treat each array item as a scalar. add( prefix, v ); } else { // Item is non-scalar (array or object), encode its numeric index. buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); } }); } else if ( !traditional && jQuery.type( obj ) === "object" ) { // Serialize object item. for ( name in obj ) { buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); } } else { // Serialize scalar item. add( prefix, obj ); } } // Serialize an array of form elements or a set of // key/values into a query string jQuery.param = function( a, traditional ) { var prefix, s = [], add = function( key, value ) { // If value is a function, invoke it and return its value value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); }; // Set traditional to true for jQuery <= 1.3.2 behavior. if ( traditional === undefined ) { traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; } // If an array was passed in, assume that it is an array of form elements. if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { // Serialize the form elements jQuery.each( a, function() { add( this.name, this.value ); }); } else { // If traditional, encode the "old" way (the way 1.3.2 or older // did it), otherwise encode params recursively. for ( prefix in a ) { buildParams( prefix, a[ prefix ], traditional, add ); } } // Return the resulting serialization return s.join( "&" ).replace( r20, "+" ); }; jQuery.fn.extend({ serialize: function() { return jQuery.param( this.serializeArray() ); }, serializeArray: function() { return this.map(function() { // Can add propHook for "elements" to filter or add form elements var elements = jQuery.prop( this, "elements" ); return elements ? jQuery.makeArray( elements ) : this; }) .filter(function() { var type = this.type; // Use .is(":disabled") so that fieldset[disabled] works return this.name && !jQuery( this ).is( ":disabled" ) && rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && ( this.checked || !rcheckableType.test( type ) ); }) .map(function( i, elem ) { var val = jQuery( this ).val(); return val == null ? null : jQuery.isArray( val ) ? jQuery.map( val, function( val ) { return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }) : { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }).get(); } }); // Create the request object // (This is still attached to ajaxSettings for backward compatibility) jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ? // Support: IE6+ function() { // XHR cannot access local files, always use ActiveX for that case return !this.isLocal && // Support: IE7-8 // oldIE XHR does not support non-RFC2616 methods (#13240) // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9 // Although this check for six methods instead of eight // since IE also does not support "trace" and "connect" /^(get|post|head|put|delete|options)$/i.test( this.type ) && createStandardXHR() || createActiveXHR(); } : // For all other browsers, use the standard XMLHttpRequest object createStandardXHR; var xhrId = 0, xhrCallbacks = {}, xhrSupported = jQuery.ajaxSettings.xhr(); // Support: IE<10 // Open requests must be manually aborted on unload (#5280) if ( window.ActiveXObject ) { jQuery( window ).on( "unload", function() { for ( var key in xhrCallbacks ) { xhrCallbacks[ key ]( undefined, true ); } }); } // Determine support properties support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); xhrSupported = support.ajax = !!xhrSupported; // Create transport if the browser can provide an xhr if ( xhrSupported ) { jQuery.ajaxTransport(function( options ) { // Cross domain only allowed if supported through XMLHttpRequest if ( !options.crossDomain || support.cors ) { var callback; return { send: function( headers, complete ) { var i, xhr = options.xhr(), id = ++xhrId; // Open the socket xhr.open( options.type, options.url, options.async, options.username, options.password ); // Apply custom fields if provided if ( options.xhrFields ) { for ( i in options.xhrFields ) { xhr[ i ] = options.xhrFields[ i ]; } } // Override mime type if needed if ( options.mimeType && xhr.overrideMimeType ) { xhr.overrideMimeType( options.mimeType ); } // X-Requested-With header // For cross-domain requests, seeing as conditions for a preflight are // akin to a jigsaw puzzle, we simply never set it to be sure. // (it can always be set on a per-request basis or even using ajaxSetup) // For same-domain requests, won't change header if already provided. if ( !options.crossDomain && !headers["X-Requested-With"] ) { headers["X-Requested-With"] = "XMLHttpRequest"; } // Set headers for ( i in headers ) { // Support: IE<9 // IE's ActiveXObject throws a 'Type Mismatch' exception when setting // request header to a null-value. // // To keep consistent with other XHR implementations, cast the value // to string and ignore `undefined`. if ( headers[ i ] !== undefined ) { xhr.setRequestHeader( i, headers[ i ] + "" ); } } // Do send the request // This may raise an exception which is actually // handled in jQuery.ajax (so no try/catch here) xhr.send( ( options.hasContent && options.data ) || null ); // Listener callback = function( _, isAbort ) { var status, statusText, responses; // Was never called and is aborted or complete if ( callback && ( isAbort || xhr.readyState === 4 ) ) { // Clean up delete xhrCallbacks[ id ]; callback = undefined; xhr.onreadystatechange = jQuery.noop; // Abort manually if needed if ( isAbort ) { if ( xhr.readyState !== 4 ) { xhr.abort(); } } else { responses = {}; status = xhr.status; // Support: IE<10 // Accessing binary-data responseText throws an exception // (#11426) if ( typeof xhr.responseText === "string" ) { responses.text = xhr.responseText; } // Firefox throws an exception when accessing // statusText for faulty cross-domain requests try { statusText = xhr.statusText; } catch( e ) { // We normalize with Webkit giving an empty statusText statusText = ""; } // Filter status for non standard behaviors // If the request is local and we have data: assume a success // (success with no data won't get notified, that's the best we // can do given current implementations) if ( !status && options.isLocal && !options.crossDomain ) { status = responses.text ? 200 : 404; // IE - #1450: sometimes returns 1223 when it should be 204 } else if ( status === 1223 ) { status = 204; } } } // Call complete if needed if ( responses ) { complete( status, statusText, responses, xhr.getAllResponseHeaders() ); } }; if ( !options.async ) { // if we're in sync mode we fire the callback callback(); } else if ( xhr.readyState === 4 ) { // (IE6 & IE7) if it's in cache and has been // retrieved directly we need to fire the callback setTimeout( callback ); } else { // Add to the list of active xhr callbacks xhr.onreadystatechange = xhrCallbacks[ id ] = callback; } }, abort: function() { if ( callback ) { callback( undefined, true ); } } }; } }); } // Functions to create xhrs function createStandardXHR() { try { return new window.XMLHttpRequest(); } catch( e ) {} } function createActiveXHR() { try { return new window.ActiveXObject( "Microsoft.XMLHTTP" ); } catch( e ) {} } // Install script dataType jQuery.ajaxSetup({ accepts: { script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" }, contents: { script: /(?:java|ecma)script/ }, converters: { "text script": function( text ) { jQuery.globalEval( text ); return text; } } }); // Handle cache's special case and global jQuery.ajaxPrefilter( "script", function( s ) { if ( s.cache === undefined ) { s.cache = false; } if ( s.crossDomain ) { s.type = "GET"; s.global = false; } }); // Bind script tag hack transport jQuery.ajaxTransport( "script", function(s) { // This transport only deals with cross domain requests if ( s.crossDomain ) { var script, head = document.head || jQuery("head")[0] || document.documentElement; return { send: function( _, callback ) { script = document.createElement("script"); script.async = true; if ( s.scriptCharset ) { script.charset = s.scriptCharset; } script.src = s.url; // Attach handlers for all browsers script.onload = script.onreadystatechange = function( _, isAbort ) { if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { // Handle memory leak in IE script.onload = script.onreadystatechange = null; // Remove the script if ( script.parentNode ) { script.parentNode.removeChild( script ); } // Dereference the script script = null; // Callback if not abort if ( !isAbort ) { callback( 200, "success" ); } } }; // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending // Use native DOM manipulation to avoid our domManip AJAX trickery head.insertBefore( script, head.firstChild ); }, abort: function() { if ( script ) { script.onload( undefined, true ); } } }; } }); var oldCallbacks = [], rjsonp = /(=)\?(?=&|$)|\?\?/; // Default jsonp settings jQuery.ajaxSetup({ jsonp: "callback", jsonpCallback: function() { var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); this[ callback ] = true; return callback; } }); // Detect, normalize options and install callbacks for jsonp requests jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { var callbackName, overwritten, responseContainer, jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? "url" : typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" ); // Handle iff the expected data type is "jsonp" or we have a parameter to set if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { // Get callback name, remembering preexisting value associated with it callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback; // Insert callback into url or form data if ( jsonProp ) { s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); } else if ( s.jsonp !== false ) { s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; } // Use data converter to retrieve json after script execution s.converters["script json"] = function() { if ( !responseContainer ) { jQuery.error( callbackName + " was not called" ); } return responseContainer[ 0 ]; }; // force json dataType s.dataTypes[ 0 ] = "json"; // Install callback overwritten = window[ callbackName ]; window[ callbackName ] = function() { responseContainer = arguments; }; // Clean-up function (fires after converters) jqXHR.always(function() { // Restore preexisting value window[ callbackName ] = overwritten; // Save back as free if ( s[ callbackName ] ) { // make sure that re-using the options doesn't screw things around s.jsonpCallback = originalSettings.jsonpCallback; // save the callback name for future use oldCallbacks.push( callbackName ); } // Call if it was a function and we have a response if ( responseContainer && jQuery.isFunction( overwritten ) ) { overwritten( responseContainer[ 0 ] ); } responseContainer = overwritten = undefined; }); // Delegate to script return "script"; } }); // data: string of html // context (optional): If specified, the fragment will be created in this context, defaults to document // keepScripts (optional): If true, will include scripts passed in the html string jQuery.parseHTML = function( data, context, keepScripts ) { if ( !data || typeof data !== "string" ) { return null; } if ( typeof context === "boolean" ) { keepScripts = context; context = false; } context = context || document; var parsed = rsingleTag.exec( data ), scripts = !keepScripts && []; // Single tag if ( parsed ) { return [ context.createElement( parsed[1] ) ]; } parsed = jQuery.buildFragment( [ data ], context, scripts ); if ( scripts && scripts.length ) { jQuery( scripts ).remove(); } return jQuery.merge( [], parsed.childNodes ); }; // Keep a copy of the old load method var _load = jQuery.fn.load; /** * Load a url into a page */ jQuery.fn.load = function( url, params, callback ) { if ( typeof url !== "string" && _load ) { return _load.apply( this, arguments ); } var selector, response, type, self = this, off = url.indexOf(" "); if ( off >= 0 ) { selector = url.slice( off, url.length ); url = url.slice( 0, off ); } // If it's a function if ( jQuery.isFunction( params ) ) { // We assume that it's the callback callback = params; params = undefined; // Otherwise, build a param string } else if ( params && typeof params === "object" ) { type = "POST"; } // If we have elements to modify, make the request if ( self.length > 0 ) { jQuery.ajax({ url: url, // if "type" variable is undefined, then "GET" method will be used type: type, dataType: "html", data: params }).done(function( responseText ) { // Save response for use in complete callback response = arguments; self.html( selector ? // If a selector was specified, locate the right elements in a dummy div // Exclude scripts to avoid IE 'Permission Denied' errors jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) : // Otherwise use the full result responseText ); }).complete( callback && function( jqXHR, status ) { self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); }); } return this; }; // The number of elements contained in the matched element set jQuery.fn.size = function() { return this.length; }; jQuery.fn.andSelf = jQuery.fn.addBack; // Register as a named AMD module, since jQuery can be concatenated with other // files that may use define, but not via a proper concatenation script that // understands anonymous AMD modules. A named AMD is safest and most robust // way to register. Lowercase jquery is used because AMD module names are // derived from file names, and jQuery is normally delivered in a lowercase // file name. Do this after creating the global so that if an AMD module wants // to call noConflict to hide this version of jQuery, it will work. if ( typeof define === "function" && define.amd ) { define( "jquery", [], function() { return jQuery; }); } var // Map over jQuery in case of overwrite _jQuery = window.jQuery, // Map over the $ in case of overwrite _$ = window.$; jQuery.noConflict = function( deep ) { if ( window.$ === jQuery ) { window.$ = _$; } if ( deep && window.jQuery === jQuery ) { window.jQuery = _jQuery; } return jQuery; }; // Expose jQuery and $ identifiers, even in // AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557) // and CommonJS for browser emulators (#13566) if ( typeof noGlobal === strundefined ) { window.jQuery = window.$ = jQuery; } return jQuery; }));
'use strict'; var util = require('./util'); var red = util.color.red; module.exports = function (report, errorsOnly) { var buf = ''; Object.keys(report.files).forEach(function (file) { var issues = report.files[file]; if (!issues.length) { if (!errorsOnly) { buf += util.color.green('PASS'); buf += '\t' + file + '\n'; } return; } buf += red('FAIL') + '\t'; buf += file + ' (' + issues.length + ')\n'; issues.forEach(function (issue) { buf += red(file + ':' + issue.line); if (issue.character) { buf += red(':' + issue.character); } buf += '\t'; buf += util.message(issue) + '\n'; }); }); if (report.failures) { buf += red([ '\n', '# JSLint failed, ', report.failures + ' ', 'violations in ', report.files_in_violation + '. ', report.file_count + ' ', 'files scanned.' ].join('')); } return buf + '\n'; };
/*! * reveal.js 2.0 r22 * http://lab.hakim.se/reveal-js * MIT licensed * * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se */ var Reveal = (function(){ var HORIZONTAL_SLIDES_SELECTOR = '.reveal .slides>section', VERTICAL_SLIDES_SELECTOR = '.reveal .slides>section.present>section', IS_TOUCH_DEVICE = !!( 'ontouchstart' in window ), // Configurations defaults, can be overridden at initialization time config = { // Display controls in the bottom right corner controls: true, // Display a presentation progress bar progress: true, // Push each slide change to the browser history history: false, // Enable keyboard shortcuts for navigation keyboard: true, // Loop the presentation loop: false, // Number of milliseconds between automatically proceeding to the // next slide, disabled when set to 0 autoSlide: 0, // Enable slide navigation via mouse wheel mouseWheel: true, // Apply a 3D roll to links on hover rollingLinks: true, // Transition style (see /css/theme) theme: 'default', // Transition style transition: 'default', // default/cube/page/concave/linear(2d), // Script dependencies to load dependencies: [] }, // The horizontal and verical index of the currently active slide indexh = 0, indexv = 0, // The previous and current slide HTML elements previousSlide, currentSlide, // Slides may hold a data-state attribute which we pick up and apply // as a class to the body. This list contains the combined state of // all current slides. state = [], // Cached references to DOM elements dom = {}, // Detect support for CSS 3D transforms supports3DTransforms = 'WebkitPerspective' in document.body.style || 'MozPerspective' in document.body.style || 'msPerspective' in document.body.style || 'OPerspective' in document.body.style || 'perspective' in document.body.style, supports2DTransforms = 'WebkitTransform' in document.body.style || 'MozTransform' in document.body.style || 'msTransform' in document.body.style || 'OTransform' in document.body.style || 'transform' in document.body.style, // Throttles mouse wheel navigation mouseWheelTimeout = 0, // An interval used to automatically move on to the next slide autoSlideTimeout = 0, // Delays updates to the URL due to a Chrome thumbnailer bug writeURLTimeout = 0, // Holds information about the currently ongoing touch input touch = { startX: 0, startY: 0, startSpan: 0, startCount: 0, handled: false, threshold: 40 }; /** * Starts up the presentation if the client is capable. */ function initialize( options ) { if( ( !supports2DTransforms && !supports3DTransforms ) ) { document.body.setAttribute( 'class', 'no-transforms' ); // If the browser doesn't support core features we won't be // using JavaScript to control the presentation return; } // Copy options over to our config object extend( config, options ); // Cache references to DOM elements dom.theme = document.querySelector( '#theme' ); dom.wrapper = document.querySelector( '.reveal' ); dom.progress = document.querySelector( '.reveal .progress' ); dom.progressbar = document.querySelector( '.reveal .progress span' ); if ( config.controls ) { dom.controls = document.querySelector( '.reveal .controls' ); dom.controlsLeft = document.querySelector( '.reveal .controls .left' ); dom.controlsRight = document.querySelector( '.reveal .controls .right' ); dom.controlsUp = document.querySelector( '.reveal .controls .up' ); dom.controlsDown = document.querySelector( '.reveal .controls .down' ); } // Loads the dependencies and continues to #start() once done load(); // Set up hiding of the browser address bar if( navigator.userAgent.match( /(iphone|ipod|android)/i ) ) { // Give the page some scrollable overflow document.documentElement.style.overflow = 'scroll'; document.body.style.height = '120%'; // Events that should trigger the address bar to hide window.addEventListener( 'load', removeAddressBar, false ); window.addEventListener( 'orientationchange', removeAddressBar, false ); } } /** * Loads the dependencies of reveal.js. Dependencies are * defined via the configuration option 'dependencies' * and will be loaded prior to starting/binding reveal.js. * Some dependencies may have an 'async' flag, if so they * will load after reveal.js has been started up. */ function load() { var scripts = [], scriptsAsync = []; for( var i = 0, len = config.dependencies.length; i < len; i++ ) { var s = config.dependencies[i]; // Load if there's no condition or the condition is truthy if( !s.condition || s.condition() ) { if( s.async ) { scriptsAsync.push( s.src ); } else { scripts.push( s.src ); } // Extension may contain callback functions if( typeof s.callback === 'function' ) { head.ready( s.src.match( /([\w\d_-]*)\.?[^\\\/]*$/i )[0], s.callback ); } } } // Called once synchronous scritps finish loading function proceed() { // Load asynchronous scripts head.js.apply( null, scriptsAsync ); start(); } if( scripts.length ) { head.ready( proceed ); // Load synchronous scripts head.js.apply( null, scripts ); } else { proceed(); } } /** * Starts up reveal.js by binding input events and navigating * to the current URL deeplink if there is one. */ function start() { // Subscribe to input addEventListeners(); // Updates the presentation to match the current configuration values configure(); // Read the initial hash readURL(); // Start auto-sliding if it's enabled cueAutoSlide(); } /** * Applies the configuration settings from the config object. */ function configure() { if( supports3DTransforms === false ) { config.transition = 'linear'; } if( config.controls && dom.controls ) { dom.controls.style.display = 'block'; } if( config.progress && dom.progress ) { dom.progress.style.display = 'block'; } // Load the theme in the config, if it's not already loaded if( config.theme && dom.theme ) { var themeURL = dom.theme.getAttribute( 'href' ); var themeFinder = /[^/]*?(?=\.css)/; var themeName = themeURL.match(themeFinder)[0]; if( config.theme !== themeName ) { themeURL = themeURL.replace(themeFinder, config.theme); dom.theme.setAttribute( 'href', themeURL ); } } if( config.transition !== 'default' ) { dom.wrapper.classList.add( config.transition ); } if( config.mouseWheel ) { document.addEventListener( 'DOMMouseScroll', onDocumentMouseScroll, false ); // FF document.addEventListener( 'mousewheel', onDocumentMouseScroll, false ); } if( config.rollingLinks ) { // Add some 3D magic to our anchors linkify(); } } function addEventListeners() { document.addEventListener( 'touchstart', onDocumentTouchStart, false ); document.addEventListener( 'touchmove', onDocumentTouchMove, false ); document.addEventListener( 'touchend', onDocumentTouchEnd, false ); window.addEventListener( 'hashchange', onWindowHashChange, false ); if( config.keyboard ) { document.addEventListener( 'keydown', onDocumentKeyDown, false ); } if ( config.controls && dom.controls ) { dom.controlsLeft.addEventListener( 'click', preventAndForward( navigateLeft ), false ); dom.controlsRight.addEventListener( 'click', preventAndForward( navigateRight ), false ); dom.controlsUp.addEventListener( 'click', preventAndForward( navigateUp ), false ); dom.controlsDown.addEventListener( 'click', preventAndForward( navigateDown ), false ); } } function removeEventListeners() { document.removeEventListener( 'keydown', onDocumentKeyDown, false ); document.removeEventListener( 'touchstart', onDocumentTouchStart, false ); document.removeEventListener( 'touchmove', onDocumentTouchMove, false ); document.removeEventListener( 'touchend', onDocumentTouchEnd, false ); window.removeEventListener( 'hashchange', onWindowHashChange, false ); if ( config.controls && dom.controls ) { dom.controlsLeft.removeEventListener( 'click', preventAndForward( navigateLeft ), false ); dom.controlsRight.removeEventListener( 'click', preventAndForward( navigateRight ), false ); dom.controlsUp.removeEventListener( 'click', preventAndForward( navigateUp ), false ); dom.controlsDown.removeEventListener( 'click', preventAndForward( navigateDown ), false ); } } /** * Extend object a with the properties of object b. * If there's a conflict, object b takes precedence. */ function extend( a, b ) { for( var i in b ) { a[ i ] = b[ i ]; } } /** * Measures the distance in pixels between point a * and point b. * * @param {Object} a point with x/y properties * @param {Object} b point with x/y properties */ function distanceBetween( a, b ) { var dx = a.x - b.x, dy = a.y - b.y; return Math.sqrt( dx*dx + dy*dy ); } /** * Prevents an events defaults behavior calls the * specified delegate. * * @param {Function} delegate The method to call * after the wrapper has been executed */ function preventAndForward( delegate ) { return function( event ) { event.preventDefault(); delegate.call(); } } /** * Causes the address bar to hide on mobile devices, * more vertical space ftw. */ function removeAddressBar() { setTimeout( function() { window.scrollTo( 0, 1 ); }, 0 ); } /** * Handler for the document level 'keydown' event. * * @param {Object} event */ function onDocumentKeyDown( event ) { // FFT: Use document.querySelector( ':focus' ) === null // instead of checking contentEditable? // Disregard the event if the target is editable or a // modifier is present if ( event.target.contentEditable != 'inherit' || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return; var triggered = false; switch( event.keyCode ) { // p, page up case 80: case 33: navigatePrev(); triggered = true; break; // n, page down case 78: case 34: navigateNext(); triggered = true; break; // h, left case 72: case 37: navigateLeft(); triggered = true; break; // l, right case 76: case 39: navigateRight(); triggered = true; break; // k, up case 75: case 38: navigateUp(); triggered = true; break; // j, down case 74: case 40: navigateDown(); triggered = true; break; // home case 36: navigateTo( 0 ); triggered = true; break; // end case 35: navigateTo( Number.MAX_VALUE ); triggered = true; break; // space case 32: overviewIsActive() ? deactivateOverview() : navigateNext(); triggered = true; break; // return case 13: if( overviewIsActive() ) { deactivateOverview(); triggered = true; } break; } // If the input resulted in a triggered action we should prevent // the browsers default behavior if( triggered ) { event.preventDefault(); } else if ( event.keyCode === 27 && supports3DTransforms ) { toggleOverview(); event.preventDefault(); } // If auto-sliding is enabled we need to cue up // another timeout cueAutoSlide(); } /** * Handler for the document level 'touchstart' event, * enables support for swipe and pinch gestures. */ function onDocumentTouchStart( event ) { touch.startX = event.touches[0].clientX; touch.startY = event.touches[0].clientY; touch.startCount = event.touches.length; // If there's two touches we need to memorize the distance // between those two points to detect pinching if( event.touches.length === 2 ) { touch.startSpan = distanceBetween( { x: event.touches[1].clientX, y: event.touches[1].clientY }, { x: touch.startX, y: touch.startY } ); } } /** * Handler for the document level 'touchmove' event. */ function onDocumentTouchMove( event ) { // Each touch should only trigger one action if( !touch.handled ) { var currentX = event.touches[0].clientX; var currentY = event.touches[0].clientY; // If the touch started off with two points and still has // two active touches; test for the pinch gesture if( event.touches.length === 2 && touch.startCount === 2 ) { // The current distance in pixels between the two touch points var currentSpan = distanceBetween( { x: event.touches[1].clientX, y: event.touches[1].clientY }, { x: touch.startX, y: touch.startY } ); // If the span is larger than the desire amount we've got // ourselves a pinch if( Math.abs( touch.startSpan - currentSpan ) > touch.threshold ) { touch.handled = true; if( currentSpan < touch.startSpan ) { activateOverview(); } else { deactivateOverview(); } } } // There was only one touch point, look for a swipe else if( event.touches.length === 1 ) { var deltaX = currentX - touch.startX, deltaY = currentY - touch.startY; if( deltaX > touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) { touch.handled = true; navigateLeft(); } else if( deltaX < -touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) { touch.handled = true; navigateRight(); } else if( deltaY > touch.threshold ) { touch.handled = true; navigateUp(); } else if( deltaY < -touch.threshold ) { touch.handled = true; navigateDown(); } } event.preventDefault(); } } /** * Handler for the document level 'touchend' event. */ function onDocumentTouchEnd( event ) { touch.handled = false; } /** * Handles mouse wheel scrolling, throttled to avoid * skipping multiple slides. */ function onDocumentMouseScroll( event ){ clearTimeout( mouseWheelTimeout ); mouseWheelTimeout = setTimeout( function() { var delta = event.detail || -event.wheelDelta; if( delta > 0 ) { navigateNext(); } else { navigatePrev(); } }, 100 ); } /** * Handler for the window level 'hashchange' event. * * @param {Object} event */ function onWindowHashChange( event ) { readURL(); } /** * Wrap all links in 3D goodness. */ function linkify() { if( supports3DTransforms && !( 'msPerspective' in document.body.style ) ) { var nodes = document.querySelectorAll( '.reveal .slides section a:not(.image)' ); for( var i = 0, len = nodes.length; i < len; i++ ) { var node = nodes[i]; if( node.textContent && !node.querySelector( 'img' ) && ( !node.className || !node.classList.contains( node, 'roll' ) ) ) { node.classList.add( 'roll' ); node.innerHTML = '<span data-title="'+ node.text +'">' + node.innerHTML + '</span>'; } }; } } /** * Displays the overview of slides (quick nav) by * scaling down and arranging all slide elements. * * Experimental feature, might be dropped if perf * can't be improved. */ function activateOverview() { dom.wrapper.classList.add( 'overview' ); var horizontalSlides = Array.prototype.slice.call( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ); for( var i = 0, len1 = horizontalSlides.length; i < len1; i++ ) { var hslide = horizontalSlides[i], htransform = 'translateZ(-2500px) translate(' + ( ( i - indexh ) * 105 ) + '%, 0%)'; hslide.setAttribute( 'data-index-h', i ); hslide.style.display = 'block'; hslide.style.WebkitTransform = htransform; hslide.style.MozTransform = htransform; hslide.style.msTransform = htransform; hslide.style.OTransform = htransform; hslide.style.transform = htransform; if( !hslide.classList.contains( 'stack' ) ) { // Navigate to this slide on click hslide.addEventListener( 'click', onOverviewSlideClicked, true ); } var verticalSlides = Array.prototype.slice.call( hslide.querySelectorAll( 'section' ) ); for( var j = 0, len2 = verticalSlides.length; j < len2; j++ ) { var vslide = verticalSlides[j], vtransform = 'translate(0%, ' + ( ( j - ( i === indexh ? indexv : 0 ) ) * 105 ) + '%)'; vslide.setAttribute( 'data-index-h', i ); vslide.setAttribute( 'data-index-v', j ); vslide.style.display = 'block'; vslide.style.WebkitTransform = vtransform; vslide.style.MozTransform = vtransform; vslide.style.msTransform = vtransform; vslide.style.OTransform = vtransform; vslide.style.transform = vtransform; // Navigate to this slide on click vslide.addEventListener( 'click', onOverviewSlideClicked, true ); } } } /** * Exits the slide overview and enters the currently * active slide. */ function deactivateOverview() { dom.wrapper.classList.remove( 'overview' ); var slides = Array.prototype.slice.call( document.querySelectorAll( '.reveal .slides section' ) ); for( var i = 0, len = slides.length; i < len; i++ ) { var element = slides[i]; // Resets all transforms to use the external styles element.style.WebkitTransform = ''; element.style.MozTransform = ''; element.style.msTransform = ''; element.style.OTransform = ''; element.style.transform = ''; element.removeEventListener( 'click', onOverviewSlideClicked ); } slide(); } /** * Checks if the overview is currently active. * * @return {Boolean} true if the overview is active, * false otherwise */ function overviewIsActive() { return dom.wrapper.classList.contains( 'overview' ); } /** * Invoked when a slide is and we're in the overview. */ function onOverviewSlideClicked( event ) { // TODO There's a bug here where the event listeners are not // removed after deactivating the overview. if( overviewIsActive() ) { event.preventDefault(); deactivateOverview(); indexh = this.getAttribute( 'data-index-h' ); indexv = this.getAttribute( 'data-index-v' ); slide(); } } /** * Updates one dimension of slides by showing the slide * with the specified index. * * @param {String} selector A CSS selector that will fetch * the group of slides we are working with * @param {Number} index The index of the slide that should be * shown * * @return {Number} The index of the slide that is now shown, * might differ from the passed in index if it was out of * bounds. */ function updateSlides( selector, index ) { // Select all slides and convert the NodeList result to // an array var slides = Array.prototype.slice.call( document.querySelectorAll( selector ) ), slidesLength = slides.length; if( slidesLength ) { // Should the index loop? if( config.loop ) { index %= slidesLength; if( index < 0 ) { index = slidesLength + index; } } // Enforce max and minimum index bounds index = Math.max( Math.min( index, slidesLength - 1 ), 0 ); for( var i = 0; i < slidesLength; i++ ) { var slide = slides[i]; // Optimization; hide all slides that are three or more steps // away from the present slide if( overviewIsActive() === false ) { // The distance loops so that it measures 1 between the first // and last slides var distance = Math.abs( ( index - i ) % ( slidesLength - 3 ) ) || 0; slide.style.display = distance > 3 ? 'none' : 'block'; } slides[i].classList.remove( 'past' ); slides[i].classList.remove( 'present' ); slides[i].classList.remove( 'future' ); if( i < index ) { // Any element previous to index is given the 'past' class slides[i].classList.add( 'past' ); } else if( i > index ) { // Any element subsequent to index is given the 'future' class slides[i].classList.add( 'future' ); } // If this element contains vertical slides if( slide.querySelector( 'section' ) ) { slides[i].classList.add( 'stack' ); } } // Mark the current slide as present slides[index].classList.add( 'present' ); // If this slide has a state associated with it, add it // onto the current state of the deck var slideState = slides[index].getAttribute( 'data-state' ); if( slideState ) { state = state.concat( slideState.split( ' ' ) ); } } else { // Since there are no slides we can't be anywhere beyond the // zeroth index index = 0; } return index; } /** * Updates the visual slides to represent the currently * set indices. */ function slide( h, v ) { // Remember where we were at before previousSlide = currentSlide; // Remember the state before this slide var stateBefore = state.concat(); // Reset the state array state.length = 0; var indexhBefore = indexh, indexvBefore = indexv; // Activate and transition to the new slide indexh = updateSlides( HORIZONTAL_SLIDES_SELECTOR, h === undefined ? indexh : h ); indexv = updateSlides( VERTICAL_SLIDES_SELECTOR, v === undefined ? indexv : v ); // Apply the new state stateLoop: for( var i = 0, len = state.length; i < len; i++ ) { // Check if this state existed on the previous slide. If it // did, we will avoid adding it repeatedly. for( var j = 0; j < stateBefore.length; j++ ) { if( stateBefore[j] === state[i] ) { stateBefore.splice( j, 1 ); continue stateLoop; } } document.documentElement.classList.add( state[i] ); // Dispatch custom event matching the state's name dispatchEvent( state[i] ); } // Clean up the remaints of the previous state while( stateBefore.length ) { document.documentElement.classList.remove( stateBefore.pop() ); } // Update progress if enabled if( config.progress && dom.progress ) { dom.progressbar.style.width = ( indexh / ( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ).length - 1 ) ) * window.innerWidth + 'px'; } // Close the overview if it's active if( overviewIsActive() ) { activateOverview(); } updateControls(); clearTimeout( writeURLTimeout ); writeURLTimeout = setTimeout( writeURL, 1500 ); // Query all horizontal slides in the deck var horizontalSlides = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ); // Find the current horizontal slide and any possible vertical slides // within it var currentHorizontalSlide = horizontalSlides[ indexh ], currentVerticalSlides = currentHorizontalSlide.querySelectorAll( 'section' ); // Store references to the previous and current slides currentSlide = currentVerticalSlides[ indexv ] || currentHorizontalSlide; // Dispatch an event if the slide changed if( indexh !== indexhBefore || indexv !== indexvBefore ) { dispatchEvent( 'slidechanged', { 'indexh': indexh, 'indexv': indexv, 'previousSlide': previousSlide, 'currentSlide': currentSlide } ); } else { // Ensure that the previous slide is never the same as the current previousSlide = null; } // Solves an edge case where the previous slide maintains the // 'present' class when navigating between adjacent vertical // stacks if( previousSlide ) { previousSlide.classList.remove( 'present' ); } } /** * Updates the state and link pointers of the controls. */ function updateControls() { if ( !config.controls || !dom.controls ) { return; } var routes = availableRoutes(); // Remove the 'enabled' class from all directions [ dom.controlsLeft, dom.controlsRight, dom.controlsUp, dom.controlsDown ].forEach( function( node ) { node.classList.remove( 'enabled' ); } ) if( routes.left ) dom.controlsLeft.classList.add( 'enabled' ); if( routes.right ) dom.controlsRight.classList.add( 'enabled' ); if( routes.up ) dom.controlsUp.classList.add( 'enabled' ); if( routes.down ) dom.controlsDown.classList.add( 'enabled' ); } /** * Determine what available routes there are for navigation. * * @return {Object} containing four booleans: left/right/up/down */ function availableRoutes() { var horizontalSlides = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ); var verticalSlides = document.querySelectorAll( VERTICAL_SLIDES_SELECTOR ); return { left: indexh > 0, right: indexh < horizontalSlides.length - 1, up: indexv > 0, down: indexv < verticalSlides.length - 1 }; } /** * Reads the current URL (hash) and navigates accordingly. */ function readURL() { var hash = window.location.hash; // Attempt to parse the hash as either an index or name var bits = hash.slice( 2 ).split( '/' ), name = hash.replace( /#|\//gi, '' ); // If the first bit is invalid and there is a name we can // assume that this is a named link if( isNaN( parseInt( bits[0] ) ) && name.length ) { // Find the slide with the specified name var slide = document.querySelector( '#' + name ); if( slide ) { // Find the position of the named slide and navigate to it var indices = Reveal.getIndices( slide ); navigateTo( indices.h, indices.v ); } // If the slide doesn't exist, navigate to the current slide else { navigateTo( indexh, indexv ); } } else { // Read the index components of the hash var h = parseInt( bits[0] ) || 0, v = parseInt( bits[1] ) || 0; navigateTo( h, v ); } } /** * Updates the page URL (hash) to reflect the current * state. */ function writeURL() { if( config.history ) { var url = '/'; // Only include the minimum possible number of components in // the URL if( indexh > 0 || indexv > 0 ) url += indexh; if( indexv > 0 ) url += '/' + indexv; window.location.hash = url; } } /** * Dispatches an event of the specified type from the * reveal DOM element. */ function dispatchEvent( type, properties ) { var event = document.createEvent( "HTMLEvents", 1, 2 ); event.initEvent( type, true, true ); extend( event, properties ); dom.wrapper.dispatchEvent( event ); } /** * Navigate to the next slide fragment. * * @return {Boolean} true if there was a next fragment, * false otherwise */ function nextFragment() { // Vertical slides: if( document.querySelector( VERTICAL_SLIDES_SELECTOR + '.present' ) ) { var verticalFragments = document.querySelectorAll( VERTICAL_SLIDES_SELECTOR + '.present .fragment:not(.visible)' ); if( verticalFragments.length ) { verticalFragments[0].classList.add( 'visible' ); // Notify subscribers of the change dispatchEvent( 'fragmentshown', { fragment: verticalFragments[0] } ); return true; } } // Horizontal slides: else { var horizontalFragments = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.present .fragment:not(.visible)' ); if( horizontalFragments.length ) { horizontalFragments[0].classList.add( 'visible' ); // Notify subscribers of the change dispatchEvent( 'fragmentshown', { fragment: horizontalFragments[0] } ); return true; } } return false; } /** * Navigate to the previous slide fragment. * * @return {Boolean} true if there was a previous fragment, * false otherwise */ function previousFragment() { // Vertical slides: if( document.querySelector( VERTICAL_SLIDES_SELECTOR + '.present' ) ) { var verticalFragments = document.querySelectorAll( VERTICAL_SLIDES_SELECTOR + '.present .fragment.visible' ); if( verticalFragments.length ) { verticalFragments[ verticalFragments.length - 1 ].classList.remove( 'visible' ); // Notify subscribers of the change dispatchEvent( 'fragmenthidden', { fragment: verticalFragments[ verticalFragments.length - 1 ] } ); return true; } } // Horizontal slides: else { var horizontalFragments = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.present .fragment.visible' ); if( horizontalFragments.length ) { horizontalFragments[ horizontalFragments.length - 1 ].classList.remove( 'visible' ); // Notify subscribers of the change dispatchEvent( 'fragmenthidden', { fragment: horizontalFragments[ horizontalFragments.length - 1 ] } ); return true; } } return false; } function cueAutoSlide() { clearTimeout( autoSlideTimeout ); // Cue the next auto-slide if enabled if( config.autoSlide ) { autoSlideTimeout = setTimeout( navigateNext, config.autoSlide ); } } /** * Triggers a navigation to the specified indices. * * @param {Number} h The horizontal index of the slide to show * @param {Number} v The vertical index of the slide to show */ function navigateTo( h, v ) { slide( h, v ); } function navigateLeft() { // Prioritize hiding fragments if( overviewIsActive() || previousFragment() === false ) { slide( indexh - 1, 0 ); } } function navigateRight() { // Prioritize revealing fragments if( overviewIsActive() || nextFragment() === false ) { slide( indexh + 1, 0 ); } } function navigateUp() { // Prioritize hiding fragments if( overviewIsActive() || previousFragment() === false ) { slide( indexh, indexv - 1 ); } } function navigateDown() { // Prioritize revealing fragments if( overviewIsActive() || nextFragment() === false ) { slide( indexh, indexv + 1 ); } } /** * Navigates backwards, prioritized in the following order: * 1) Previous fragment * 2) Previous vertical slide * 3) Previous horizontal slide */ function navigatePrev() { // Prioritize revealing fragments if( previousFragment() === false ) { if( availableRoutes().up ) { navigateUp(); } else { // Fetch the previous horizontal slide, if there is one var previousSlide = document.querySelector( '.reveal .slides>section.past:nth-child(' + indexh + ')' ); if( previousSlide ) { indexv = ( previousSlide.querySelectorAll('section').length + 1 ) || 0; indexh --; slide(); } } } } /** * Same as #navigatePrev() but navigates forwards. */ function navigateNext() { // Prioritize revealing fragments if( nextFragment() === false ) { availableRoutes().down ? navigateDown() : navigateRight(); } // If auto-sliding is enabled we need to cue up // another timeout cueAutoSlide(); } /** * Toggles the slide overview mode on and off. */ function toggleOverview() { if( overviewIsActive() ) { deactivateOverview(); } else { activateOverview(); } } // Expose some methods publicly return { initialize: initialize, navigateTo: navigateTo, navigateLeft: navigateLeft, navigateRight: navigateRight, navigateUp: navigateUp, navigateDown: navigateDown, navigatePrev: navigatePrev, navigateNext: navigateNext, toggleOverview: toggleOverview, // Adds or removes all internal event listeners (such as keyboard) addEventListeners: addEventListeners, removeEventListeners: removeEventListeners, // Returns the indices of the current, or specified, slide getIndices: function( slide ) { // By default, return the current indices var h = indexh, v = indexv; // If a slide is specified, return the indices of that slide if( slide ) { var isVertical = !!slide.parentNode.nodeName.match( /section/gi ); var slideh = isVertical ? slide.parentNode : slide; // Select all horizontal slides var horizontalSlides = Array.prototype.slice.call( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ); // Now that we know which the horizontal slide is, get its index h = Math.max( horizontalSlides.indexOf( slideh ), 0 ); // If this is a vertical slide, grab the vertical index if( isVertical ) { v = Math.max( Array.prototype.slice.call( slide.parentNode.children ).indexOf( slide ), 0 ); } } return { h: h, v: v }; }, // Returns the previous slide element, may be null getPreviousSlide: function() { return previousSlide }, // Returns the current slide element getCurrentSlide: function() { return currentSlide }, // Helper method, retrieves query string as a key/value hash getQueryHash: function() { var query = {}; location.search.replace( /[A-Z0-9]+?=(\w*)/gi, function(a) { query[ a.split( '=' ).shift() ] = a.split( '=' ).pop(); } ); return query; }, // Forward event binding to the reveal DOM element addEventListener: function( type, listener, useCapture ) { if( 'addEventListener' in window ) { ( dom.wrapper || document.querySelector( '.reveal' ) ).addEventListener( type, listener, useCapture ); } }, removeEventListener: function( type, listener, useCapture ) { if( 'addEventListener' in window ) { ( dom.wrapper || document.querySelector( '.reveal' ) ).removeEventListener( type, listener, useCapture ); } } }; })();
"use strict"; var tsApi = require('./tsapi'); var utils = require('./utils'); var fs = require('fs'); var path = require('path'); var libDirectory = '__lib/'; var Host = (function () { function Host(typescript, currentDirectory, input, externalResolve, libFileName) { var _this = this; this.getCurrentDirectory = function () { return _this.currentDirectory; }; this.writeFile = function (fileName, data, writeByteOrderMark, onError) { _this.output[fileName] = data; }; this.getSourceFile = function (fileName, languageVersion, onError) { if (fileName === '__lib.d.ts') { return Host.getLibDefault(_this.typescript, _this.libFileName, fileName); } if (fileName.substring(0, libDirectory.length) === libDirectory) { try { return Host.getLibDefault(_this.typescript, fileName.substring(libDirectory.length), fileName); } catch (e) { } try { return Host.getLibDefault(_this.typescript, 'lib.' + fileName.substring(libDirectory.length), fileName); } catch (e) { } return undefined; } var sourceFile = _this.input.getFile(fileName); if (sourceFile) return sourceFile.ts; if (_this.externalResolve) { var text = void 0; try { text = fs.readFileSync(fileName).toString('utf8'); } catch (ex) { return undefined; } _this.input.addContent(fileName, text); var sourceFile_1 = _this.input.getFile(fileName); if (sourceFile_1) return sourceFile_1.ts; } }; this.typescript = typescript; this.currentDirectory = currentDirectory; this.input = input; this.externalResolve = externalResolve; this.libFileName = libFileName; var fallback = typescript.createCompilerHost({}); this.realpath = fallback['realpath']; this.getDirectories = fallback['getDirectories']; this.reset(); } Host.getLibDefault = function (typescript, libFileName, originalFileName) { var fileName; for (var i in require.cache) { if (!Object.prototype.hasOwnProperty.call(require.cache, i) || require.cache[i] === undefined) continue; if (require.cache[i].exports === typescript) { fileName = i; } } if (fileName === undefined) { return undefined; // Not found } fileName = path.join(path.dirname(fileName), libFileName); if (this.libDefault[fileName]) { return this.libDefault[fileName]; // Already loaded } var content = fs.readFileSync(fileName).toString('utf8'); return this.libDefault[fileName] = tsApi.createSourceFile(typescript, originalFileName, content, typescript.ScriptTarget.ES3); // Will also work for ES5 & 6 }; Host.prototype.reset = function () { this.output = {}; }; Host.prototype.getNewLine = function () { return '\n'; }; Host.prototype.useCaseSensitiveFileNames = function () { return false; }; Host.prototype.getCanonicalFileName = function (filename) { return utils.normalizePath(filename); }; Host.prototype.getDefaultLibFilename = function () { return '__lib.d.ts'; }; Host.prototype.getDefaultLibFileName = function () { return '__lib.d.ts'; }; Host.prototype.getDefaultLibLocation = function () { return libDirectory; }; Host.prototype.fileExists = function (fileName) { if (fileName === '__lib.d.ts') { return true; } var sourceFile = this.input.getFile(fileName); if (sourceFile) return true; if (this.externalResolve) { try { var stat = fs.statSync(fileName); if (!stat) return false; return stat.isFile(); } catch (ex) { } } return false; }; Host.prototype.readFile = function (fileName) { var normalizedFileName = utils.normalizePath(fileName); var sourceFile = this.input.getFile(fileName); if (sourceFile) return sourceFile.content; if (this.externalResolve) { // Read the whole file (and cache contents) to prevent race conditions. var text = void 0; try { text = fs.readFileSync(fileName).toString('utf8'); } catch (ex) { return undefined; } return text; } return undefined; }; Host.libDefault = {}; return Host; }()); exports.Host = Host;
CKEDITOR.plugins.setLang('youtube', 'nl', { button : 'Youtube video insluiten', title : 'Youtube video insluiten', txtEmbed : 'Plak embedcode hier', txtUrl : 'Plak video URL', txtWidth : 'Breedte', txtHeight : 'Hoogte', chkRelated : 'Toon gesuggereerde video aan het einde van de video', txtStartAt : 'Starten op (ss of mm:ss of hh:mm:ss)', chkPrivacy : 'Privacy-enhanced mode inschakelen', chkOlderCode : 'Gebruik oude embedcode', chkAutoplay: 'Automatisch starten', chkControls: 'Afspeelbediening weergeven', noCode : 'U moet een embedcode of url ingeven', invalidEmbed : 'De ingegeven embedcode lijkt niet geldig', invalidUrl : 'De ingegeven url lijkt niet geldig', or : 'of', noWidth : 'U moet een breedte ingeven', invalidWidth : 'U moet een geldige breedte ingeven', noHeight : 'U moet een hoogte ingeven', invalidHeight : 'U moet een geldige starttijd ingeven', invalidTime : 'Inform a valid start time', txtResponsive : 'Responsive video', txtNoEmbed : 'Alleen video afbeelding en link' });
var Lab = require('lab'); var Code = require('code'); var Path = require('path'); var Config = require('../../../config'); var Manifest = require('../../../manifest'); var Hapi = require('hapi'); var HapiAuth = require('hapi-auth-cookie'); var Proxyquire = require('proxyquire'); var AuthPlugin = require('../../../server/auth'); var UserPlugin = require('../../../server/api/users'); var AuthenticatedUser = require('../fixtures/credentials-admin'); var lab = exports.lab = Lab.script(); var ModelsPlugin, request, server, stub; lab.before(function (done) { stub = { User: {} }; var proxy = {}; proxy[Path.join(process.cwd(), './server/models/user')] = stub.User; ModelsPlugin = { register: Proxyquire('hapi-mongo-models', proxy), options: Manifest.get('/plugins')['hapi-mongo-models'] }; var plugins = [HapiAuth, ModelsPlugin, AuthPlugin, UserPlugin]; server = new Hapi.Server(); server.connection({ port: Config.get('/port/web') }); server.register(plugins, function (err) { if (err) { return done(err); } done(); }); }); lab.after(function (done) { server.plugins['hapi-mongo-models'].BaseModel.disconnect(); done(); }); lab.experiment('User Plugin Result List', function () { lab.beforeEach(function (done) { request = { method: 'GET', url: '/users', credentials: AuthenticatedUser }; done(); }); lab.test('it returns an error when paged find fails', function (done) { stub.User.pagedFind = function () { var args = Array.prototype.slice.call(arguments); var callback = args.pop(); callback(Error('paged find failed')); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(500); done(); }); }); lab.test('it returns an array of documents successfully', function (done) { stub.User.pagedFind = function () { var args = Array.prototype.slice.call(arguments); var callback = args.pop(); callback(null, { data: [{}, {}, {}] }); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(200); Code.expect(response.result.data).to.be.an.array(); Code.expect(response.result.data[0]).to.be.an.object(); done(); }); }); lab.test('it returns an array of documents successfully using filters', function (done) { stub.User.pagedFind = function () { var args = Array.prototype.slice.call(arguments); var callback = args.pop(); callback(null, { data: [{}, {}, {}] }); }; request.url = '/users?username=ren&isActive=true&role=admin&limit=10&page=1'; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(200); Code.expect(response.result.data).to.be.an.array(); Code.expect(response.result.data[0]).to.be.an.object(); done(); }); }); }); lab.experiment('Users Plugin Read', function () { lab.beforeEach(function (done) { request = { method: 'GET', url: '/users/93EP150D35', credentials: AuthenticatedUser }; done(); }); lab.test('it returns an error when find by id fails', function (done) { stub.User.findById = function (id, callback) { callback(Error('find by id failed')); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(500); done(); }); }); lab.test('it returns a not found when find by id misses', function (done) { stub.User.findById = function (id, callback) { callback(); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(404); Code.expect(response.result.message).to.match(/document not found/i); done(); }); }); lab.test('it returns a document successfully', function (done) { stub.User.findById = function (id, callback) { callback(null, { _id: '93EP150D35' }); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(200); Code.expect(response.result).to.be.an.object(); done(); }); }); }); lab.experiment('Users Plugin (My) Read', function () { lab.beforeEach(function (done) { request = { method: 'GET', url: '/users/my', credentials: AuthenticatedUser }; done(); }); lab.test('it returns an error when find by id fails', function (done) { stub.User.findById = function () { var args = Array.prototype.slice.call(arguments); var callback = args.pop(); callback(Error('find by id failed')); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(500); done(); }); }); lab.test('it returns a not found when find by id misses', function (done) { stub.User.findById = function () { var args = Array.prototype.slice.call(arguments); var callback = args.pop(); callback(); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(404); Code.expect(response.result.message).to.match(/document not found/i); done(); }); }); lab.test('it returns a document successfully', function (done) { stub.User.findById = function () { var args = Array.prototype.slice.call(arguments); var callback = args.pop(); callback(null, { _id: '93EP150D35' }); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(200); Code.expect(response.result).to.be.an.object(); done(); }); }); }); lab.experiment('Users Plugin Create', function () { lab.beforeEach(function (done) { request = { method: 'POST', url: '/users', payload: { username: 'muddy', password: 'dirtandwater', email: 'mrmud@mudmail.mud' }, credentials: AuthenticatedUser }; done(); }); lab.test('it returns an error when find one fails for username check', function (done) { stub.User.findOne = function (conditions, callback) { if (conditions.username) { callback(Error('find one failed')); } else { callback(); } }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(500); done(); }); }); lab.test('it returns a conflict when find one hits for username check', function (done) { stub.User.findOne = function (conditions, callback) { if (conditions.username) { callback(null, {}); } else { callback(Error('find one failed')); } }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(409); done(); }); }); lab.test('it returns an error when find one fails for email check', function (done) { stub.User.findOne = function (conditions, callback) { if (conditions.email) { callback(Error('find one failed')); } else { callback(); } }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(500); done(); }); }); lab.test('it returns a conflict when find one hits for email check', function (done) { stub.User.findOne = function (conditions, callback) { if (conditions.email) { callback(null, {}); } else { callback(); } }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(409); done(); }); }); lab.test('it returns an error when create fails', function (done) { stub.User.findOne = function (conditions, callback) { callback(); }; stub.User.create = function (username, password, email, callback) { callback(Error('create failed')); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(500); done(); }); }); lab.test('it creates a document successfully', function (done) { stub.User.findOne = function (conditions, callback) { callback(); }; stub.User.create = function (username, password, email, callback) { callback(null, {}); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(200); Code.expect(response.result).to.be.an.object(); done(); }); }); }); lab.experiment('Users Plugin Update', function () { lab.beforeEach(function (done) { request = { method: 'PUT', url: '/users/420000000000000000000000', payload: { isActive: true, username: 'muddy', email: 'mrmud@mudmail.mud' }, credentials: AuthenticatedUser }; done(); }); lab.test('it returns an error when find one fails for username check', function (done) { stub.User.findOne = function (conditions, callback) { if (conditions.username) { callback(Error('find one failed')); } else { callback(); } }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(500); done(); }); }); lab.test('it returns a conflict when find one hits for username check', function (done) { stub.User.findOne = function (conditions, callback) { if (conditions.username) { callback(null, {}); } else { callback(Error('find one failed')); } }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(409); done(); }); }); lab.test('it returns an error when find one fails for email check', function (done) { stub.User.findOne = function (conditions, callback) { if (conditions.email) { callback(Error('find one failed')); } else { callback(); } }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(500); done(); }); }); lab.test('it returns a conflict when find one hits for email check', function (done) { stub.User.findOne = function (conditions, callback) { if (conditions.email) { callback(null, {}); } else { callback(); } }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(409); done(); }); }); lab.test('it returns an error when update fails', function (done) { stub.User.findOne = function (conditions, callback) { callback(); }; stub.User.findByIdAndUpdate = function (id, update, callback) { callback(Error('update failed')); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(500); done(); }); }); lab.test('it returns not found when find by id misses', function (done) { stub.User.findOne = function (conditions, callback) { callback(); }; stub.User.findByIdAndUpdate = function (id, update, callback) { callback(null, undefined); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(404); done(); }); }); lab.test('it updates a document successfully', function (done) { stub.User.findOne = function (conditions, callback) { callback(); }; stub.User.findByIdAndUpdate = function (id, update, callback) { callback(null, {}); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(200); Code.expect(response.result).to.be.an.object(); done(); }); }); }); lab.experiment('Users Plugin (My) Update', function () { lab.beforeEach(function (done) { request = { method: 'PUT', url: '/users/my', payload: { username: 'muddy', email: 'mrmud@mudmail.mud' }, credentials: AuthenticatedUser }; done(); }); lab.test('it returns an error when find one fails for username check', function (done) { stub.User.findOne = function (conditions, callback) { if (conditions.username) { callback(Error('find one failed')); } else { callback(); } }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(500); done(); }); }); lab.test('it returns a conflict when find one hits for username check', function (done) { stub.User.findOne = function (conditions, callback) { if (conditions.username) { callback(null, {}); } else { callback(Error('find one failed')); } }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(409); done(); }); }); lab.test('it returns an error when find one fails for email check', function (done) { stub.User.findOne = function (conditions, callback) { if (conditions.email) { callback(Error('find one failed')); } else { callback(); } }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(500); done(); }); }); lab.test('it returns a conflict when find one hits for email check', function (done) { stub.User.findOne = function (conditions, callback) { if (conditions.email) { callback(null, {}); } else { callback(); } }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(409); done(); }); }); lab.test('it returns an error when update fails', function (done) { stub.User.findOne = function (conditions, callback) { callback(); }; stub.User.findByIdAndUpdate = function () { var args = Array.prototype.slice.call(arguments); var callback = args.pop(); callback(Error('update failed')); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(500); done(); }); }); lab.test('it updates a document successfully', function (done) { stub.User.findOne = function (conditions, callback) { callback(); }; stub.User.findByIdAndUpdate = function () { var args = Array.prototype.slice.call(arguments); var callback = args.pop(); callback(null, { _id: '1D', username: 'muddy' }); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(200); Code.expect(response.result).to.be.an.object(); done(); }); }); }); lab.experiment('Users Plugin Set Password', function () { lab.beforeEach(function (done) { request = { method: 'PUT', url: '/users/420000000000000000000000/password', payload: { password: 'fromdirt' }, credentials: AuthenticatedUser }; done(); }); lab.test('it returns an error when generate password hash fails', function (done) { stub.User.generatePasswordHash = function (password, callback) { callback(Error('generate password hash failed')); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(500); done(); }); }); lab.test('it returns an error when update fails', function (done) { stub.User.generatePasswordHash = function (password, callback) { callback(null, { password: '', hash: '' }); }; stub.User.findByIdAndUpdate = function (id, update, callback) { callback(Error('update failed')); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(500); done(); }); }); lab.test('it sets the password successfully', function (done) { stub.User.generatePasswordHash = function (password, callback) { callback(null, { password: '', hash: '' }); }; stub.User.findByIdAndUpdate = function (id, update, callback) { callback(null, {}); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(200); done(); }); }); }); lab.experiment('Users Plugin (My) Set Password', function () { lab.beforeEach(function (done) { request = { method: 'PUT', url: '/users/my/password', payload: { password: 'fromdirt' }, credentials: AuthenticatedUser }; done(); }); lab.test('it returns an error when generate password hash fails', function (done) { stub.User.generatePasswordHash = function (password, callback) { callback(Error('generate password hash failed')); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(500); done(); }); }); lab.test('it returns an error when update fails', function (done) { stub.User.generatePasswordHash = function (password, callback) { callback(null, { password: '', hash: '' }); }; stub.User.findByIdAndUpdate = function () { var args = Array.prototype.slice.call(arguments); var callback = args.pop(); callback(Error('update failed')); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(500); done(); }); }); lab.test('it sets the password successfully', function (done) { stub.User.generatePasswordHash = function (password, callback) { callback(null, { password: '', hash: '' }); }; stub.User.findByIdAndUpdate = function () { var args = Array.prototype.slice.call(arguments); var callback = args.pop(); callback(null, {}); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(200); done(); }); }); }); lab.experiment('Users Plugin Delete', function () { lab.beforeEach(function (done) { request = { method: 'DELETE', url: '/users/93EP150D35', credentials: AuthenticatedUser }; done(); }); lab.test('it returns an error when delete by id fails', function (done) { stub.User.findByIdAndDelete = function (id, callback) { callback(Error('delete by id failed')); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(500); done(); }); }); lab.test('it returns a not found when delete by id misses', function (done) { stub.User.findByIdAndDelete = function (id, callback) { callback(null, undefined); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(404); Code.expect(response.result.message).to.match(/document not found/i); done(); }); }); lab.test('it deletes a document successfully', function (done) { stub.User.findByIdAndDelete = function (id, callback) { callback(null, 1); }; server.inject(request, function (response) { Code.expect(response.statusCode).to.equal(200); Code.expect(response.result.message).to.match(/success/i); done(); }); }); });
/*global process:false*/ /*global module:true*/ /*global exports:true*/ "use strict"; var transform = require('jstransform').transform; var visitors = require('./visitors'); /** * @typechecks * @param {string} source * @param {object?} options * @param {array?} excludes * @return {string} */ function transformAll(source, options, excludes) { excludes = excludes || []; // The typechecker transform must run in a second pass in order to operate on // the entire source code -- so exclude it from the first pass var visitorsList = visitors.getAllVisitors(excludes.concat('typechecker')); source = transform(visitorsList, source, options); if (excludes.indexOf('typechecks') == -1 && /@typechecks/.test(source.code)) { source = transform( visitors.transformVisitors.typechecker, source.code, options ); } return source; } function runCli(argv) { var options = {}; for (var optName in argv) { if (optName === '_' || optName === '$0') { continue; } options[optName] = optimist.argv[optName]; } if (options.help) { optimist.showHelp(); process.exit(0); } var excludes = options.excludes; delete options.excludes; var source = ''; process.stdin.resume(); process.stdin.setEncoding('utf8'); process.stdin.on('data', function (chunk) { source += chunk; }); process.stdin.on('end', function () { try { source = transformAll(source, options, excludes); } catch (e) { console.error(e.stack); process.exit(1); } process.stdout.write(source.code); }); } if (require.main === module) { var optimist = require('optimist'); optimist = optimist .usage('Usage: $0 [options]') .default('exclude', []) .boolean('help').alias('h', 'help') .boolean('minify') .describe( 'minify', 'Best-effort minification of the output source (when possible)' ) .describe( 'exclude', 'A list of transformNames to exclude' ); runCli(optimist.argv); } else { exports.transformAll = transformAll; }
/* Riot v3.8.1, @license MIT */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global.riot = factory()); }(this, (function () { 'use strict'; var __TAGS_CACHE = []; var __TAG_IMPL = {}; var YIELD_TAG = 'yield'; var GLOBAL_MIXIN = '__global_mixin'; var ATTRS_PREFIX = 'riot-'; var REF_DIRECTIVES = ['ref', 'data-ref']; var IS_DIRECTIVE = 'data-is'; var CONDITIONAL_DIRECTIVE = 'if'; var LOOP_DIRECTIVE = 'each'; var LOOP_NO_REORDER_DIRECTIVE = 'no-reorder'; var SHOW_DIRECTIVE = 'show'; var HIDE_DIRECTIVE = 'hide'; var KEY_DIRECTIVE = 'key'; var RIOT_EVENTS_KEY = '__riot-events__'; var T_STRING = 'string'; var T_OBJECT = 'object'; var T_UNDEF = 'undefined'; var T_FUNCTION = 'function'; var XLINK_NS = 'http://www.w3.org/1999/xlink'; var SVG_NS = 'http://www.w3.org/2000/svg'; var XLINK_REGEX = /^xlink:(\w+)/; var WIN = typeof window === T_UNDEF ? undefined : window; var RE_SPECIAL_TAGS = /^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?|opt(?:ion|group))$/; var RE_SPECIAL_TAGS_NO_OPTION = /^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/; var RE_EVENTS_PREFIX = /^on/; var RE_HTML_ATTRS = /([-\w]+) ?= ?(?:"([^"]*)|'([^']*)|({[^}]*}))/g; var CASE_SENSITIVE_ATTRIBUTES = { 'viewbox': 'viewBox', 'preserveaspectratio': 'preserveAspectRatio' }; var RE_BOOL_ATTRS = /^(?:disabled|checked|readonly|required|allowfullscreen|auto(?:focus|play)|compact|controls|default|formnovalidate|hidden|ismap|itemscope|loop|multiple|muted|no(?:resize|shade|validate|wrap)?|open|reversed|seamless|selected|sortable|truespeed|typemustmatch)$/; var IE_VERSION = (WIN && WIN.document || {}).documentMode | 0; /** * Shorter and fast way to select multiple nodes in the DOM * @param { String } selector - DOM selector * @param { Object } ctx - DOM node where the targets of our search will is located * @returns { Object } dom nodes found */ function $$(selector, ctx) { return [].slice.call((ctx || document).querySelectorAll(selector)) } /** * Shorter and fast way to select a single node in the DOM * @param { String } selector - unique dom selector * @param { Object } ctx - DOM node where the target of our search will is located * @returns { Object } dom node found */ function $(selector, ctx) { return (ctx || document).querySelector(selector) } /** * Create a document fragment * @returns { Object } document fragment */ function createFrag() { return document.createDocumentFragment() } /** * Create a document text node * @returns { Object } create a text node to use as placeholder */ function createDOMPlaceholder() { return document.createTextNode('') } /** * Check if a DOM node is an svg tag or part of an svg * @param { HTMLElement } el - node we want to test * @returns {Boolean} true if it's an svg node */ function isSvg(el) { var owner = el.ownerSVGElement; return !!owner || owner === null } /** * Create a generic DOM node * @param { String } name - name of the DOM node we want to create * @returns { Object } DOM node just created */ function mkEl(name) { return name === 'svg' ? document.createElementNS(SVG_NS, name) : document.createElement(name) } /** * Set the inner html of any DOM node SVGs included * @param { Object } container - DOM node where we'll inject new html * @param { String } html - html to inject * @param { Boolean } isSvg - svg tags should be treated a bit differently */ /* istanbul ignore next */ function setInnerHTML(container, html, isSvg) { // innerHTML is not supported on svg tags so we neet to treat them differently if (isSvg) { var node = container.ownerDocument.importNode( new DOMParser() .parseFromString(("<svg xmlns=\"" + SVG_NS + "\">" + html + "</svg>"), 'application/xml') .documentElement, true ); container.appendChild(node); } else { container.innerHTML = html; } } /** * Toggle the visibility of any DOM node * @param { Object } dom - DOM node we want to hide * @param { Boolean } show - do we want to show it? */ function toggleVisibility(dom, show) { dom.style.display = show ? '' : 'none'; dom.hidden = show ? false : true; } /** * Remove any DOM attribute from a node * @param { Object } dom - DOM node we want to update * @param { String } name - name of the property we want to remove */ function remAttr(dom, name) { dom.removeAttribute(name); } /** * Convert a style object to a string * @param { Object } style - style object we need to parse * @returns { String } resulting css string * @example * styleObjectToString({ color: 'red', height: '10px'}) // => 'color: red; height: 10px' */ function styleObjectToString(style) { return Object.keys(style).reduce(function (acc, prop) { return (acc + " " + prop + ": " + (style[prop]) + ";") }, '') } /** * Get the value of any DOM attribute on a node * @param { Object } dom - DOM node we want to parse * @param { String } name - name of the attribute we want to get * @returns { String | undefined } name of the node attribute whether it exists */ function getAttr(dom, name) { return dom.getAttribute(name) } /** * Set any DOM attribute * @param { Object } dom - DOM node we want to update * @param { String } name - name of the property we want to set * @param { String } val - value of the property we want to set */ function setAttr(dom, name, val) { var xlink = XLINK_REGEX.exec(name); if (xlink && xlink[1]) { dom.setAttributeNS(XLINK_NS, xlink[1], val); } else { dom.setAttribute(name, val); } } /** * Insert safely a tag to fix #1962 #1649 * @param { HTMLElement } root - children container * @param { HTMLElement } curr - node to insert * @param { HTMLElement } next - node that should preceed the current node inserted */ function safeInsert(root, curr, next) { root.insertBefore(curr, next.parentNode && next); } /** * Minimize risk: only zero or one _space_ between attr & value * @param { String } html - html string we want to parse * @param { Function } fn - callback function to apply on any attribute found */ function walkAttrs(html, fn) { if (!html) { return } var m; while (m = RE_HTML_ATTRS.exec(html)) { fn(m[1].toLowerCase(), m[2] || m[3] || m[4]); } } /** * Walk down recursively all the children tags starting dom node * @param { Object } dom - starting node where we will start the recursion * @param { Function } fn - callback to transform the child node just found * @param { Object } context - fn can optionally return an object, which is passed to children */ function walkNodes(dom, fn, context) { if (dom) { var res = fn(dom, context); var next; // stop the recursion if (res === false) { return } dom = dom.firstChild; while (dom) { next = dom.nextSibling; walkNodes(dom, fn, res); dom = next; } } } var dom = Object.freeze({ $$: $$, $: $, createFrag: createFrag, createDOMPlaceholder: createDOMPlaceholder, isSvg: isSvg, mkEl: mkEl, setInnerHTML: setInnerHTML, toggleVisibility: toggleVisibility, remAttr: remAttr, styleObjectToString: styleObjectToString, getAttr: getAttr, setAttr: setAttr, safeInsert: safeInsert, walkAttrs: walkAttrs, walkNodes: walkNodes }); var styleNode; // Create cache and shortcut to the correct property var cssTextProp; var byName = {}; var remainder = []; var needsInject = false; // skip the following code on the server if (WIN) { styleNode = ((function () { // create a new style element with the correct type var newNode = mkEl('style'); // replace any user node or insert the new one into the head var userNode = $('style[type=riot]'); setAttr(newNode, 'type', 'text/css'); /* istanbul ignore next */ if (userNode) { if (userNode.id) { newNode.id = userNode.id; } userNode.parentNode.replaceChild(newNode, userNode); } else { document.head.appendChild(newNode); } return newNode }))(); cssTextProp = styleNode.styleSheet; } /** * Object that will be used to inject and manage the css of every tag instance */ var styleManager = { styleNode: styleNode, /** * Save a tag style to be later injected into DOM * @param { String } css - css string * @param { String } name - if it's passed we will map the css to a tagname */ add: function add(css, name) { if (name) { byName[name] = css; } else { remainder.push(css); } needsInject = true; }, /** * Inject all previously saved tag styles into DOM * innerHTML seems slow: http://jsperf.com/riot-insert-style */ inject: function inject() { if (!WIN || !needsInject) { return } needsInject = false; var style = Object.keys(byName) .map(function (k) { return byName[k]; }) .concat(remainder).join('\n'); /* istanbul ignore next */ if (cssTextProp) { cssTextProp.cssText = style; } else { styleNode.innerHTML = style; } } }; /** * The riot template engine * @version v3.0.8 */ var skipRegex = (function () { //eslint-disable-line no-unused-vars var beforeReChars = '[{(,;:?=|&!^~>%*/'; var beforeReWords = [ 'case', 'default', 'do', 'else', 'in', 'instanceof', 'prefix', 'return', 'typeof', 'void', 'yield' ]; var wordsLastChar = beforeReWords.reduce(function (s, w) { return s + w.slice(-1) }, ''); var RE_REGEX = /^\/(?=[^*>/])[^[/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\]*)*\])[^[\\/]*)*?\/[gimuy]*/; var RE_VN_CHAR = /[$\w]/; function prev (code, pos) { while (--pos >= 0 && /\s/.test(code[pos])){ } return pos } function _skipRegex (code, start) { var re = /.*/g; var pos = re.lastIndex = start++; var match = re.exec(code)[0].match(RE_REGEX); if (match) { var next = pos + match[0].length; pos = prev(code, pos); var c = code[pos]; if (pos < 0 || ~beforeReChars.indexOf(c)) { return next } if (c === '.') { if (code[pos - 1] === '.') { start = next; } } else if (c === '+' || c === '-') { if (code[--pos] !== c || (pos = prev(code, pos)) < 0 || !RE_VN_CHAR.test(code[pos])) { start = next; } } else if (~wordsLastChar.indexOf(c)) { var end = pos + 1; while (--pos >= 0 && RE_VN_CHAR.test(code[pos])){ } if (~beforeReWords.indexOf(code.slice(pos + 1, end))) { start = next; } } } return start } return _skipRegex })(); /** * riot.util.brackets * * - `brackets ` - Returns a string or regex based on its parameter * - `brackets.set` - Change the current riot brackets * * @module */ /* global riot */ /* istanbul ignore next */ var brackets = (function (UNDEF) { var REGLOB = 'g', R_MLCOMMS = /\/\*[^*]*\*+(?:[^*\/][^*]*\*+)*\//g, R_STRINGS = /"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|`[^`\\]*(?:\\[\S\s][^`\\]*)*`/g, S_QBLOCKS = R_STRINGS.source + '|' + /(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source + '|' + /\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?([^<]\/)[gim]*/.source, UNSUPPORTED = RegExp('[\\' + 'x00-\\x1F<>a-zA-Z0-9\'",;\\\\]'), NEED_ESCAPE = /(?=[[\]()*+?.^$|])/g, S_QBLOCK2 = R_STRINGS.source + '|' + /(\/)(?![*\/])/.source, FINDBRACES = { '(': RegExp('([()])|' + S_QBLOCK2, REGLOB), '[': RegExp('([[\\]])|' + S_QBLOCK2, REGLOB), '{': RegExp('([{}])|' + S_QBLOCK2, REGLOB) }, DEFAULT = '{ }'; var _pairs = [ '{', '}', '{', '}', /{[^}]*}/, /\\([{}])/g, /\\({)|{/g, RegExp('\\\\(})|([[({])|(})|' + S_QBLOCK2, REGLOB), DEFAULT, /^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/, /(^|[^\\]){=[\S\s]*?}/ ]; var cachedBrackets = UNDEF, _regex, _cache = [], _settings; function _loopback (re) { return re } function _rewrite (re, bp) { if (!bp) { bp = _cache; } return new RegExp( re.source.replace(/{/g, bp[2]).replace(/}/g, bp[3]), re.global ? REGLOB : '' ) } function _create (pair) { if (pair === DEFAULT) { return _pairs } var arr = pair.split(' '); if (arr.length !== 2 || UNSUPPORTED.test(pair)) { throw new Error('Unsupported brackets "' + pair + '"') } arr = arr.concat(pair.replace(NEED_ESCAPE, '\\').split(' ')); arr[4] = _rewrite(arr[1].length > 1 ? /{[\S\s]*?}/ : _pairs[4], arr); arr[5] = _rewrite(pair.length > 3 ? /\\({|})/g : _pairs[5], arr); arr[6] = _rewrite(_pairs[6], arr); arr[7] = RegExp('\\\\(' + arr[3] + ')|([[({])|(' + arr[3] + ')|' + S_QBLOCK2, REGLOB); arr[8] = pair; return arr } function _brackets (reOrIdx) { return reOrIdx instanceof RegExp ? _regex(reOrIdx) : _cache[reOrIdx] } _brackets.split = function split (str, tmpl, _bp) { // istanbul ignore next: _bp is for the compiler if (!_bp) { _bp = _cache; } var parts = [], match, isexpr, start, pos, re = _bp[6]; var qblocks = []; var prevStr = ''; var mark, lastIndex; isexpr = start = re.lastIndex = 0; while ((match = re.exec(str))) { lastIndex = re.lastIndex; pos = match.index; if (isexpr) { if (match[2]) { var ch = match[2]; var rech = FINDBRACES[ch]; var ix = 1; rech.lastIndex = lastIndex; while ((match = rech.exec(str))) { if (match[1]) { if (match[1] === ch) { ++ix; } else if (!--ix) { break } } else { rech.lastIndex = pushQBlock(match.index, rech.lastIndex, match[2]); } } re.lastIndex = ix ? str.length : rech.lastIndex; continue } if (!match[3]) { re.lastIndex = pushQBlock(pos, lastIndex, match[4]); continue } } if (!match[1]) { unescapeStr(str.slice(start, pos)); start = re.lastIndex; re = _bp[6 + (isexpr ^= 1)]; re.lastIndex = start; } } if (str && start < str.length) { unescapeStr(str.slice(start)); } parts.qblocks = qblocks; return parts function unescapeStr (s) { if (prevStr) { s = prevStr + s; prevStr = ''; } if (tmpl || isexpr) { parts.push(s && s.replace(_bp[5], '$1')); } else { parts.push(s); } } function pushQBlock(_pos, _lastIndex, slash) { //eslint-disable-line if (slash) { _lastIndex = skipRegex(str, _pos); } if (tmpl && _lastIndex > _pos + 2) { mark = '\u2057' + qblocks.length + '~'; qblocks.push(str.slice(_pos, _lastIndex)); prevStr += str.slice(start, _pos) + mark; start = _lastIndex; } return _lastIndex } }; _brackets.hasExpr = function hasExpr (str) { return _cache[4].test(str) }; _brackets.loopKeys = function loopKeys (expr) { var m = expr.match(_cache[9]); return m ? { key: m[1], pos: m[2], val: _cache[0] + m[3].trim() + _cache[1] } : { val: expr.trim() } }; _brackets.array = function array (pair) { return pair ? _create(pair) : _cache }; function _reset (pair) { if ((pair || (pair = DEFAULT)) !== _cache[8]) { _cache = _create(pair); _regex = pair === DEFAULT ? _loopback : _rewrite; _cache[9] = _regex(_pairs[9]); } cachedBrackets = pair; } function _setSettings (o) { var b; o = o || {}; b = o.brackets; Object.defineProperty(o, 'brackets', { set: _reset, get: function () { return cachedBrackets }, enumerable: true }); _settings = o; _reset(b); } Object.defineProperty(_brackets, 'settings', { set: _setSettings, get: function () { return _settings } }); /* istanbul ignore next: in the browser riot is always in the scope */ _brackets.settings = typeof riot !== 'undefined' && riot.settings || {}; _brackets.set = _reset; _brackets.skipRegex = skipRegex; _brackets.R_STRINGS = R_STRINGS; _brackets.R_MLCOMMS = R_MLCOMMS; _brackets.S_QBLOCKS = S_QBLOCKS; _brackets.S_QBLOCK2 = S_QBLOCK2; return _brackets })(); /** * @module tmpl * * tmpl - Root function, returns the template value, render with data * tmpl.hasExpr - Test the existence of a expression inside a string * tmpl.loopKeys - Get the keys for an 'each' loop (used by `_each`) */ /* istanbul ignore next */ var tmpl = (function () { var _cache = {}; function _tmpl (str, data) { if (!str) { return str } return (_cache[str] || (_cache[str] = _create(str))).call( data, _logErr.bind({ data: data, tmpl: str }) ) } _tmpl.hasExpr = brackets.hasExpr; _tmpl.loopKeys = brackets.loopKeys; // istanbul ignore next _tmpl.clearCache = function () { _cache = {}; }; _tmpl.errorHandler = null; function _logErr (err, ctx) { err.riotData = { tagName: ctx && ctx.__ && ctx.__.tagName, _riot_id: ctx && ctx._riot_id //eslint-disable-line camelcase }; if (_tmpl.errorHandler) { _tmpl.errorHandler(err); } else if ( typeof console !== 'undefined' && typeof console.error === 'function' ) { console.error(err.message); console.log('<%s> %s', err.riotData.tagName || 'Unknown tag', this.tmpl); // eslint-disable-line console.log(this.data); // eslint-disable-line } } function _create (str) { var expr = _getTmpl(str); if (expr.slice(0, 11) !== 'try{return ') { expr = 'return ' + expr; } return new Function('E', expr + ';') // eslint-disable-line no-new-func } var RE_DQUOTE = /\u2057/g; var RE_QBMARK = /\u2057(\d+)~/g; function _getTmpl (str) { var parts = brackets.split(str.replace(RE_DQUOTE, '"'), 1); var qstr = parts.qblocks; var expr; if (parts.length > 2 || parts[0]) { var i, j, list = []; for (i = j = 0; i < parts.length; ++i) { expr = parts[i]; if (expr && (expr = i & 1 ? _parseExpr(expr, 1, qstr) : '"' + expr .replace(/\\/g, '\\\\') .replace(/\r\n?|\n/g, '\\n') .replace(/"/g, '\\"') + '"' )) { list[j++] = expr; } } expr = j < 2 ? list[0] : '[' + list.join(',') + '].join("")'; } else { expr = _parseExpr(parts[1], 0, qstr); } if (qstr.length) { expr = expr.replace(RE_QBMARK, function (_, pos) { return qstr[pos] .replace(/\r/g, '\\r') .replace(/\n/g, '\\n') }); } return expr } var RE_CSNAME = /^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/; var RE_BREND = { '(': /[()]/g, '[': /[[\]]/g, '{': /[{}]/g }; function _parseExpr (expr, asText, qstr) { expr = expr .replace(/\s+/g, ' ').trim() .replace(/\ ?([[\({},?\.:])\ ?/g, '$1'); if (expr) { var list = [], cnt = 0, match; while (expr && (match = expr.match(RE_CSNAME)) && !match.index ) { var key, jsb, re = /,|([[{(])|$/g; expr = RegExp.rightContext; key = match[2] ? qstr[match[2]].slice(1, -1).trim().replace(/\s+/g, ' ') : match[1]; while (jsb = (match = re.exec(expr))[1]) { skipBraces(jsb, re); } jsb = expr.slice(0, match.index); expr = RegExp.rightContext; list[cnt++] = _wrapExpr(jsb, 1, key); } expr = !cnt ? _wrapExpr(expr, asText) : cnt > 1 ? '[' + list.join(',') + '].join(" ").trim()' : list[0]; } return expr function skipBraces (ch, re) { var mm, lv = 1, ir = RE_BREND[ch]; ir.lastIndex = re.lastIndex; while (mm = ir.exec(expr)) { if (mm[0] === ch) { ++lv; } else if (!--lv) { break } } re.lastIndex = lv ? expr.length : ir.lastIndex; } } // istanbul ignore next: not both var // eslint-disable-next-line max-len JS_CONTEXT = '"in this?this:' + (typeof window !== 'object' ? 'global' : 'window') + ').', JS_VARNAME = /[,{][\$\w]+(?=:)|(^ *|[^$\w\.{])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g, JS_NOPROPS = /^(?=(\.[$\w]+))\1(?:[^.[(]|$)/; function _wrapExpr (expr, asText, key) { var tb; expr = expr.replace(JS_VARNAME, function (match, p, mvar, pos, s) { if (mvar) { pos = tb ? 0 : pos + match.length; if (mvar !== 'this' && mvar !== 'global' && mvar !== 'window') { match = p + '("' + mvar + JS_CONTEXT + mvar; if (pos) { tb = (s = s[pos]) === '.' || s === '(' || s === '['; } } else if (pos) { tb = !JS_NOPROPS.test(s.slice(pos)); } } return match }); if (tb) { expr = 'try{return ' + expr + '}catch(e){E(e,this)}'; } if (key) { expr = (tb ? 'function(){' + expr + '}.call(this)' : '(' + expr + ')' ) + '?"' + key + '":""'; } else if (asText) { expr = 'function(v){' + (tb ? expr.replace('return ', 'v=') : 'v=(' + expr + ')' ) + ';return v||v===0?v:""}.call(this)'; } return expr } _tmpl.version = brackets.version = 'v3.0.8'; return _tmpl })(); /* istanbul ignore next */ var observable$1 = function(el) { /** * Extend the original object or create a new empty one * @type { Object } */ el = el || {}; /** * Private variables */ var callbacks = {}, slice = Array.prototype.slice; /** * Public Api */ // extend the el object adding the observable methods Object.defineProperties(el, { /** * Listen to the given `event` ands * execute the `callback` each time an event is triggered. * @param { String } event - event id * @param { Function } fn - callback function * @returns { Object } el */ on: { value: function(event, fn) { if (typeof fn == 'function') { (callbacks[event] = callbacks[event] || []).push(fn); } return el }, enumerable: false, writable: false, configurable: false }, /** * Removes the given `event` listeners * @param { String } event - event id * @param { Function } fn - callback function * @returns { Object } el */ off: { value: function(event, fn) { if (event == '*' && !fn) { callbacks = {}; } else { if (fn) { var arr = callbacks[event]; for (var i = 0, cb; cb = arr && arr[i]; ++i) { if (cb == fn) { arr.splice(i--, 1); } } } else { delete callbacks[event]; } } return el }, enumerable: false, writable: false, configurable: false }, /** * Listen to the given `event` and * execute the `callback` at most once * @param { String } event - event id * @param { Function } fn - callback function * @returns { Object } el */ one: { value: function(event, fn) { function on() { el.off(event, on); fn.apply(el, arguments); } return el.on(event, on) }, enumerable: false, writable: false, configurable: false }, /** * Execute all callback functions that listen to * the given `event` * @param { String } event - event id * @returns { Object } el */ trigger: { value: function(event) { var arguments$1 = arguments; // getting the arguments var arglen = arguments.length - 1, args = new Array(arglen), fns, fn, i; for (i = 0; i < arglen; i++) { args[i] = arguments$1[i + 1]; // skip first argument } fns = slice.call(callbacks[event] || [], 0); for (i = 0; fn = fns[i]; ++i) { fn.apply(el, args); } if (callbacks['*'] && event != '*') { el.trigger.apply(el, ['*', event].concat(args)); } return el }, enumerable: false, writable: false, configurable: false } }); return el }; /** * Check if the passed argument is a boolean attribute * @param { String } value - * @returns { Boolean } - */ function isBoolAttr(value) { return RE_BOOL_ATTRS.test(value) } /** * Check if passed argument is a function * @param { * } value - * @returns { Boolean } - */ function isFunction(value) { return typeof value === T_FUNCTION } /** * Check if passed argument is an object, exclude null * NOTE: use isObject(x) && !isArray(x) to excludes arrays. * @param { * } value - * @returns { Boolean } - */ function isObject(value) { return value && typeof value === T_OBJECT // typeof null is 'object' } /** * Check if passed argument is undefined * @param { * } value - * @returns { Boolean } - */ function isUndefined(value) { return typeof value === T_UNDEF } /** * Check if passed argument is a string * @param { * } value - * @returns { Boolean } - */ function isString(value) { return typeof value === T_STRING } /** * Check if passed argument is empty. Different from falsy, because we dont consider 0 or false to be blank * @param { * } value - * @returns { Boolean } - */ function isBlank(value) { return isNil(value) || value === '' } /** * Check against the null and undefined values * @param { * } value - * @returns {Boolean} - */ function isNil(value) { return isUndefined(value) || value === null } /** * Check if passed argument is a kind of array * @param { * } value - * @returns { Boolean } - */ function isArray(value) { return Array.isArray(value) || value instanceof Array } /** * Check whether object's property could be overridden * @param { Object } obj - source object * @param { String } key - object property * @returns { Boolean } true if writable */ function isWritable(obj, key) { var descriptor = getPropDescriptor(obj, key); return isUndefined(obj[key]) || descriptor && descriptor.writable } var check = Object.freeze({ isBoolAttr: isBoolAttr, isFunction: isFunction, isObject: isObject, isUndefined: isUndefined, isString: isString, isBlank: isBlank, isNil: isNil, isArray: isArray, isWritable: isWritable }); /** * Specialized function for looping an array-like collection with `each={}` * @param { Array } list - collection of items * @param {Function} fn - callback function * @returns { Array } the array looped */ function each(list, fn) { var len = list ? list.length : 0; var i = 0; for (; i < len; i++) { fn(list[i], i); } return list } /** * Check whether an array contains an item * @param { Array } array - target array * @param { * } item - item to test * @returns { Boolean } - */ function contains(array, item) { return array.indexOf(item) !== -1 } /** * Convert a string containing dashes to camel case * @param { String } str - input string * @returns { String } my-string -> myString */ function toCamel(str) { return str.replace(/-(\w)/g, function (_, c) { return c.toUpperCase(); }) } /** * Faster String startsWith alternative * @param { String } str - source string * @param { String } value - test string * @returns { Boolean } - */ function startsWith(str, value) { return str.slice(0, value.length) === value } /** * Helper function to set an immutable property * @param { Object } el - object where the new property will be set * @param { String } key - object key where the new property will be stored * @param { * } value - value of the new property * @param { Object } options - set the propery overriding the default options * @returns { Object } - the initial object */ function defineProperty(el, key, value, options) { Object.defineProperty(el, key, extend({ value: value, enumerable: false, writable: false, configurable: true }, options)); return el } /** * Function returning always a unique identifier * @returns { Number } - number from 0...n */ var uid = (function() { var i = -1; return function () { return ++i; } })(); /** * Warn a message via console * @param {String} message - warning message */ function warn(message) { if (console && console.warn) { console.warn(message); } } /** * Short alias for Object.getOwnPropertyDescriptor */ var getPropDescriptor = function (o, k) { return Object.getOwnPropertyDescriptor(o, k); }; /** * Extend any object with other properties * @param { Object } src - source object * @returns { Object } the resulting extended object * * var obj = { foo: 'baz' } * extend(obj, {bar: 'bar', foo: 'bar'}) * console.log(obj) => {bar: 'bar', foo: 'bar'} * */ function extend(src) { var obj; var i = 1; var args = arguments; var l = args.length; for (; i < l; i++) { if (obj = args[i]) { for (var key in obj) { // check if this property of the source object could be overridden if (isWritable(src, key)) { src[key] = obj[key]; } } } } return src } var misc = Object.freeze({ each: each, contains: contains, toCamel: toCamel, startsWith: startsWith, defineProperty: defineProperty, uid: uid, warn: warn, getPropDescriptor: getPropDescriptor, extend: extend }); var settings$1 = extend(Object.create(brackets.settings), { skipAnonymousTags: true, // handle the auto updates on any DOM event autoUpdate: true }); /** * Trigger DOM events * @param { HTMLElement } dom - dom element target of the event * @param { Function } handler - user function * @param { Object } e - event object */ function handleEvent(dom, handler, e) { var ptag = this.__.parent; var item = this.__.item; if (!item) { while (ptag && !item) { item = ptag.__.item; ptag = ptag.__.parent; } } // override the event properties /* istanbul ignore next */ if (isWritable(e, 'currentTarget')) { e.currentTarget = dom; } /* istanbul ignore next */ if (isWritable(e, 'target')) { e.target = e.srcElement; } /* istanbul ignore next */ if (isWritable(e, 'which')) { e.which = e.charCode || e.keyCode; } e.item = item; handler.call(this, e); // avoid auto updates if (!settings$1.autoUpdate) { return } if (!e.preventUpdate) { var p = getImmediateCustomParentTag(this); // fixes #2083 if (p.isMounted) { p.update(); } } } /** * Attach an event to a DOM node * @param { String } name - event name * @param { Function } handler - event callback * @param { Object } dom - dom node * @param { Tag } tag - tag instance */ function setEventHandler(name, handler, dom, tag) { var eventName; var cb = handleEvent.bind(tag, dom, handler); // avoid to bind twice the same event // possible fix for #2332 dom[name] = null; // normalize event name eventName = name.replace(RE_EVENTS_PREFIX, ''); // cache the listener into the listeners array if (!contains(tag.__.listeners, dom)) { tag.__.listeners.push(dom); } if (!dom[RIOT_EVENTS_KEY]) { dom[RIOT_EVENTS_KEY] = {}; } if (dom[RIOT_EVENTS_KEY][name]) { dom.removeEventListener(eventName, dom[RIOT_EVENTS_KEY][name]); } dom[RIOT_EVENTS_KEY][name] = cb; dom.addEventListener(eventName, cb, false); } /** * Update dynamically created data-is tags with changing expressions * @param { Object } expr - expression tag and expression info * @param { Tag } parent - parent for tag creation * @param { String } tagName - tag implementation we want to use */ function updateDataIs(expr, parent, tagName) { var tag = expr.tag || expr.dom._tag; var ref; var ref$1 = tag ? tag.__ : {}; var head = ref$1.head; var isVirtual = expr.dom.tagName === 'VIRTUAL'; if (tag && expr.tagName === tagName) { tag.update(); return } // sync _parent to accommodate changing tagnames if (tag) { // need placeholder before unmount if(isVirtual) { ref = createDOMPlaceholder(); head.parentNode.insertBefore(ref, head); } tag.unmount(true); } // unable to get the tag name if (!isString(tagName)) { return } expr.impl = __TAG_IMPL[tagName]; // unknown implementation if (!expr.impl) { return } expr.tag = tag = initChildTag( expr.impl, { root: expr.dom, parent: parent, tagName: tagName }, expr.dom.innerHTML, parent ); each(expr.attrs, function (a) { return setAttr(tag.root, a.name, a.value); }); expr.tagName = tagName; tag.mount(); // root exist first time, after use placeholder if (isVirtual) { makeReplaceVirtual(tag, ref || tag.root); } // parent is the placeholder tag, not the dynamic tag so clean up parent.__.onUnmount = function () { var delName = tag.opts.dataIs; arrayishRemove(tag.parent.tags, delName, tag); arrayishRemove(tag.__.parent.tags, delName, tag); tag.unmount(); }; } /** * Nomalize any attribute removing the "riot-" prefix * @param { String } attrName - original attribute name * @returns { String } valid html attribute name */ function normalizeAttrName(attrName) { if (!attrName) { return null } attrName = attrName.replace(ATTRS_PREFIX, ''); if (CASE_SENSITIVE_ATTRIBUTES[attrName]) { attrName = CASE_SENSITIVE_ATTRIBUTES[attrName]; } return attrName } /** * Update on single tag expression * @this Tag * @param { Object } expr - expression logic * @returns { undefined } */ function updateExpression(expr) { if (this.root && getAttr(this.root,'virtualized')) { return } var dom = expr.dom; // remove the riot- prefix var attrName = normalizeAttrName(expr.attr); var isToggle = contains([SHOW_DIRECTIVE, HIDE_DIRECTIVE], attrName); var isVirtual = expr.root && expr.root.tagName === 'VIRTUAL'; var ref = this.__; var isAnonymous = ref.isAnonymous; var parent = dom && (expr.parent || dom.parentNode); // detect the style attributes var isStyleAttr = attrName === 'style'; var isClassAttr = attrName === 'class'; var value; // if it's a tag we could totally skip the rest if (expr._riot_id) { if (expr.__.wasCreated) { expr.update(); // if it hasn't been mounted yet, do that now. } else { expr.mount(); if (isVirtual) { makeReplaceVirtual(expr, expr.root); } } return } // if this expression has the update method it means it can handle the DOM changes by itself if (expr.update) { return expr.update() } var context = isToggle && !isAnonymous ? inheritParentProps.call(this) : this; // ...it seems to be a simple expression so we try to calculate its value value = tmpl(expr.expr, context); var hasValue = !isBlank(value); var isObj = isObject(value); // convert the style/class objects to strings if (isObj) { if (isClassAttr) { value = tmpl(JSON.stringify(value), this); } else if (isStyleAttr) { value = styleObjectToString(value); } } // remove original attribute if (expr.attr && (!expr.wasParsedOnce || !hasValue || value === false)) { // remove either riot-* attributes or just the attribute name remAttr(dom, getAttr(dom, expr.attr) ? expr.attr : attrName); } // for the boolean attributes we don't need the value // we can convert it to checked=true to checked=checked if (expr.bool) { value = value ? attrName : false; } if (expr.isRtag) { return updateDataIs(expr, this, value) } if (expr.wasParsedOnce && expr.value === value) { return } // update the expression value expr.value = value; expr.wasParsedOnce = true; // if the value is an object (and it's not a style or class attribute) we can not do much more with it if (isObj && !isClassAttr && !isStyleAttr && !isToggle) { return } // avoid to render undefined/null values if (!hasValue) { value = ''; } // textarea and text nodes have no attribute name if (!attrName) { // about #815 w/o replace: the browser converts the value to a string, // the comparison by "==" does too, but not in the server value += ''; // test for parent avoids error with invalid assignment to nodeValue if (parent) { // cache the parent node because somehow it will become null on IE // on the next iteration expr.parent = parent; if (parent.tagName === 'TEXTAREA') { parent.value = value; // #1113 if (!IE_VERSION) { dom.nodeValue = value; } // #1625 IE throws here, nodeValue } // will be available on 'updated' else { dom.nodeValue = value; } } return } // event handler if (isFunction(value)) { setEventHandler(attrName, value, dom, this); // show / hide } else if (isToggle) { toggleVisibility(dom, attrName === HIDE_DIRECTIVE ? !value : value); // handle attributes } else { if (expr.bool) { dom[attrName] = value; } if (attrName === 'value' && dom.value !== value) { dom.value = value; } else if (hasValue && value !== false) { setAttr(dom, attrName, value); } // make sure that in case of style changes // the element stays hidden if (isStyleAttr && dom.hidden) { toggleVisibility(dom, false); } } } /** * Update all the expressions in a Tag instance * @this Tag * @param { Array } expressions - expression that must be re evaluated */ function updateAllExpressions(expressions) { each(expressions, updateExpression.bind(this)); } var IfExpr = { init: function init(dom, tag, expr) { remAttr(dom, CONDITIONAL_DIRECTIVE); this.tag = tag; this.expr = expr; this.stub = createDOMPlaceholder(); this.pristine = dom; var p = dom.parentNode; p.insertBefore(this.stub, dom); p.removeChild(dom); return this }, update: function update() { this.value = tmpl(this.expr, this.tag); if (this.value && !this.current) { // insert this.current = this.pristine.cloneNode(true); this.stub.parentNode.insertBefore(this.current, this.stub); this.expressions = parseExpressions.apply(this.tag, [this.current, true]); } else if (!this.value && this.current) { // remove unmountAll(this.expressions); if (this.current._tag) { this.current._tag.unmount(); } else if (this.current.parentNode) { this.current.parentNode.removeChild(this.current); } this.current = null; this.expressions = []; } if (this.value) { updateAllExpressions.call(this.tag, this.expressions); } }, unmount: function unmount() { unmountAll(this.expressions || []); } }; var RefExpr = { init: function init(dom, parent, attrName, attrValue) { this.dom = dom; this.attr = attrName; this.rawValue = attrValue; this.parent = parent; this.hasExp = tmpl.hasExpr(attrValue); return this }, update: function update() { var old = this.value; var customParent = this.parent && getImmediateCustomParentTag(this.parent); // if the referenced element is a custom tag, then we set the tag itself, rather than DOM var tagOrDom = this.dom.__ref || this.tag || this.dom; this.value = this.hasExp ? tmpl(this.rawValue, this.parent) : this.rawValue; // the name changed, so we need to remove it from the old key (if present) if (!isBlank(old) && customParent) { arrayishRemove(customParent.refs, old, tagOrDom); } if (!isBlank(this.value) && isString(this.value)) { // add it to the refs of parent tag (this behavior was changed >=3.0) if (customParent) { arrayishAdd( customParent.refs, this.value, tagOrDom, // use an array if it's a looped node and the ref is not an expression null, this.parent.__.index ); } if (this.value !== old) { setAttr(this.dom, this.attr, this.value); } } else { remAttr(this.dom, this.attr); } // cache the ref bound to this dom node // to reuse it in future (see also #2329) if (!this.dom.__ref) { this.dom.__ref = tagOrDom; } }, unmount: function unmount() { var tagOrDom = this.tag || this.dom; var customParent = this.parent && getImmediateCustomParentTag(this.parent); if (!isBlank(this.value) && customParent) { arrayishRemove(customParent.refs, this.value, tagOrDom); } } }; /** * Convert the item looped into an object used to extend the child tag properties * @param { Object } expr - object containing the keys used to extend the children tags * @param { * } key - value to assign to the new object returned * @param { * } val - value containing the position of the item in the array * @param { Object } base - prototype object for the new item * @returns { Object } - new object containing the values of the original item * * The variables 'key' and 'val' are arbitrary. * They depend on the collection type looped (Array, Object) * and on the expression used on the each tag * */ function mkitem(expr, key, val, base) { var item = base ? Object.create(base) : {}; item[expr.key] = key; if (expr.pos) { item[expr.pos] = val; } return item } /** * Unmount the redundant tags * @param { Array } items - array containing the current items to loop * @param { Array } tags - array containing all the children tags */ function unmountRedundant(items, tags) { var i = tags.length; var j = items.length; while (i > j) { i--; remove.apply(tags[i], [tags, i]); } } /** * Remove a child tag * @this Tag * @param { Array } tags - tags collection * @param { Number } i - index of the tag to remove */ function remove(tags, i) { tags.splice(i, 1); this.unmount(); arrayishRemove(this.parent, this, this.__.tagName, true); } /** * Move the nested custom tags in non custom loop tags * @this Tag * @param { Number } i - current position of the loop tag */ function moveNestedTags(i) { var this$1 = this; each(Object.keys(this.tags), function (tagName) { moveChildTag.apply(this$1.tags[tagName], [tagName, i]); }); } /** * Move a child tag * @this Tag * @param { HTMLElement } root - dom node containing all the loop children * @param { Tag } nextTag - instance of the next tag preceding the one we want to move * @param { Boolean } isVirtual - is it a virtual tag? */ function move(root, nextTag, isVirtual) { if (isVirtual) { moveVirtual.apply(this, [root, nextTag]); } else { safeInsert(root, this.root, nextTag.root); } } /** * Insert and mount a child tag * @this Tag * @param { HTMLElement } root - dom node containing all the loop children * @param { Tag } nextTag - instance of the next tag preceding the one we want to insert * @param { Boolean } isVirtual - is it a virtual tag? */ function insert(root, nextTag, isVirtual) { if (isVirtual) { makeVirtual.apply(this, [root, nextTag]); } else { safeInsert(root, this.root, nextTag.root); } } /** * Append a new tag into the DOM * @this Tag * @param { HTMLElement } root - dom node containing all the loop children * @param { Boolean } isVirtual - is it a virtual tag? */ function append(root, isVirtual) { if (isVirtual) { makeVirtual.call(this, root); } else { root.appendChild(this.root); } } /** * Return the value we want to use to lookup the postion of our items in the collection * @param { String } keyAttr - lookup string or expression * @param { * } originalItem - original item from the collection * @param { Object } keyedItem - object created by riot via { item, i in collection } * @param { Boolean } hasKeyAttrExpr - flag to check whether the key is an expression * @returns { * } value that we will use to figure out the item position via collection.indexOf */ function getItemId(keyAttr, originalItem, keyedItem, hasKeyAttrExpr) { if (keyAttr) { return hasKeyAttrExpr ? tmpl(keyAttr, keyedItem) : originalItem[keyAttr] } return originalItem } /** * Manage tags having the 'each' * @param { HTMLElement } dom - DOM node we need to loop * @param { Tag } parent - parent tag instance where the dom node is contained * @param { String } expr - string contained in the 'each' attribute * @returns { Object } expression object for this each loop */ function _each(dom, parent, expr) { var mustReorder = typeof getAttr(dom, LOOP_NO_REORDER_DIRECTIVE) !== T_STRING || remAttr(dom, LOOP_NO_REORDER_DIRECTIVE); var keyAttr = getAttr(dom, KEY_DIRECTIVE); var hasKeyAttrExpr = keyAttr ? tmpl.hasExpr(keyAttr) : false; var tagName = getTagName(dom); var impl = __TAG_IMPL[tagName]; var parentNode = dom.parentNode; var placeholder = createDOMPlaceholder(); var child = getTag(dom); var ifExpr = getAttr(dom, CONDITIONAL_DIRECTIVE); var tags = []; var isLoop = true; var innerHTML = dom.innerHTML; var isAnonymous = !__TAG_IMPL[tagName]; var isVirtual = dom.tagName === 'VIRTUAL'; var oldItems = []; var hasKeys; // remove the each property from the original tag remAttr(dom, LOOP_DIRECTIVE); remAttr(dom, KEY_DIRECTIVE); // parse the each expression expr = tmpl.loopKeys(expr); expr.isLoop = true; if (ifExpr) { remAttr(dom, CONDITIONAL_DIRECTIVE); } // insert a marked where the loop tags will be injected parentNode.insertBefore(placeholder, dom); parentNode.removeChild(dom); expr.update = function updateEach() { // get the new items collection expr.value = tmpl(expr.val, parent); var items = expr.value; var frag = createFrag(); var isObject$$1 = !isArray(items) && !isString(items); var root = placeholder.parentNode; var tmpItems = []; // if this DOM was removed the update here is useless // this condition fixes also a weird async issue on IE in our unit test if (!root) { return } // object loop. any changes cause full redraw if (isObject$$1) { hasKeys = items || false; items = hasKeys ? Object.keys(items).map(function (key) { return mkitem(expr, items[key], key); }) : []; } else { hasKeys = false; } if (ifExpr) { items = items.filter(function (item, i) { if (expr.key && !isObject$$1) { return !!tmpl(ifExpr, mkitem(expr, item, i, parent)) } return !!tmpl(ifExpr, extend(Object.create(parent), item)) }); } // loop all the new items each(items, function (_item, i) { var item = !hasKeys && expr.key ? mkitem(expr, _item, i) : _item; var itemId = getItemId(keyAttr, _item, item, hasKeyAttrExpr); // reorder only if the items are objects var doReorder = mustReorder && typeof _item === T_OBJECT && !hasKeys; var oldPos = oldItems.indexOf(itemId); var isNew = oldPos === -1; var pos = !isNew && doReorder ? oldPos : i; // does a tag exist in this position? var tag = tags[pos]; var mustAppend = i >= oldItems.length; var mustCreate = doReorder && isNew || !doReorder && !tag; // new tag if (mustCreate) { tag = createTag(impl, { parent: parent, isLoop: isLoop, isAnonymous: isAnonymous, tagName: tagName, root: dom.cloneNode(isAnonymous), item: item, index: i, }, innerHTML); // mount the tag tag.mount(); if (mustAppend) { append.apply(tag, [frag || root, isVirtual]); } else { insert.apply(tag, [root, tags[i], isVirtual]); } if (!mustAppend) { oldItems.splice(i, 0, item); } tags.splice(i, 0, tag); if (child) { arrayishAdd(parent.tags, tagName, tag, true); } } else if (pos !== i && doReorder) { // move if (keyAttr || contains(items, oldItems[pos])) { move.apply(tag, [root, tags[i], isVirtual]); // move the old tag instance tags.splice(i, 0, tags.splice(pos, 1)[0]); // move the old item oldItems.splice(i, 0, oldItems.splice(pos, 1)[0]); } // update the position attribute if it exists if (expr.pos) { tag[expr.pos] = i; } // if the loop tags are not custom // we need to move all their custom tags into the right position if (!child && tag.tags) { moveNestedTags.call(tag, i); } } // cache the original item to use it in the events bound to this node // and its children tag.__.item = item; tag.__.index = i; tag.__.parent = parent; tmpItems[i] = itemId; if (!mustCreate) { tag.update(item); } }); // remove the redundant tags unmountRedundant(items, tags); // clone the items array oldItems = tmpItems.slice(); root.insertBefore(frag, placeholder); }; expr.unmount = function () { each(tags, function (t) { t.unmount(); }); }; return expr } /** * Walk the tag DOM to detect the expressions to evaluate * @this Tag * @param { HTMLElement } root - root tag where we will start digging the expressions * @param { Boolean } mustIncludeRoot - flag to decide whether the root must be parsed as well * @returns { Array } all the expressions found */ function parseExpressions(root, mustIncludeRoot) { var this$1 = this; var expressions = []; walkNodes(root, function (dom) { var type = dom.nodeType; var attr; var tagImpl; if (!mustIncludeRoot && dom === root) { return } // text node if (type === 3 && dom.parentNode.tagName !== 'STYLE' && tmpl.hasExpr(dom.nodeValue)) { expressions.push({dom: dom, expr: dom.nodeValue}); } if (type !== 1) { return } var isVirtual = dom.tagName === 'VIRTUAL'; // loop. each does it's own thing (for now) if (attr = getAttr(dom, LOOP_DIRECTIVE)) { if(isVirtual) { setAttr(dom, 'loopVirtual', true); } // ignore here, handled in _each expressions.push(_each(dom, this$1, attr)); return false } // if-attrs become the new parent. Any following expressions (either on the current // element, or below it) become children of this expression. if (attr = getAttr(dom, CONDITIONAL_DIRECTIVE)) { expressions.push(Object.create(IfExpr).init(dom, this$1, attr)); return false } if (attr = getAttr(dom, IS_DIRECTIVE)) { if (tmpl.hasExpr(attr)) { expressions.push({ isRtag: true, expr: attr, dom: dom, attrs: [].slice.call(dom.attributes) }); return false } } // if this is a tag, stop traversing here. // we ignore the root, since parseExpressions is called while we're mounting that root tagImpl = getTag(dom); if(isVirtual) { if(getAttr(dom, 'virtualized')) {dom.parentElement.removeChild(dom); } // tag created, remove from dom if(!tagImpl && !getAttr(dom, 'virtualized') && !getAttr(dom, 'loopVirtual')) // ok to create virtual tag { tagImpl = { tmpl: dom.outerHTML }; } } if (tagImpl && (dom !== root || mustIncludeRoot)) { if(isVirtual) { // handled in update if (getAttr(dom, IS_DIRECTIVE)) { warn(("Virtual tags shouldn't be used together with the \"" + IS_DIRECTIVE + "\" attribute - https://github.com/riot/riot/issues/2511")); } // can not remove attribute like directives // so flag for removal after creation to prevent maximum stack error setAttr(dom, 'virtualized', true); var tag = createTag( {tmpl: dom.outerHTML}, {root: dom, parent: this$1}, dom.innerHTML ); expressions.push(tag); // no return, anonymous tag, keep parsing } else { expressions.push( initChildTag( tagImpl, { root: dom, parent: this$1 }, dom.innerHTML, this$1 ) ); return false } } // attribute expressions parseAttributes.apply(this$1, [dom, dom.attributes, function (attr, expr) { if (!expr) { return } expressions.push(expr); }]); }); return expressions } /** * Calls `fn` for every attribute on an element. If that attr has an expression, * it is also passed to fn. * @this Tag * @param { HTMLElement } dom - dom node to parse * @param { Array } attrs - array of attributes * @param { Function } fn - callback to exec on any iteration */ function parseAttributes(dom, attrs, fn) { var this$1 = this; each(attrs, function (attr) { if (!attr) { return false } var name = attr.name; var bool = isBoolAttr(name); var expr; if (contains(REF_DIRECTIVES, name) && dom.tagName.toLowerCase() !== YIELD_TAG) { expr = Object.create(RefExpr).init(dom, this$1, name, attr.value); } else if (tmpl.hasExpr(attr.value)) { expr = {dom: dom, expr: attr.value, attr: name, bool: bool}; } fn(attr, expr); }); } /* Includes hacks needed for the Internet Explorer version 9 and below See: http://kangax.github.io/compat-table/es5/#ie8 http://codeplanet.io/dropping-ie8/ */ var reHasYield = /<yield\b/i; var reYieldAll = /<yield\s*(?:\/>|>([\S\s]*?)<\/yield\s*>|>)/ig; var reYieldSrc = /<yield\s+to=['"]([^'">]*)['"]\s*>([\S\s]*?)<\/yield\s*>/ig; var reYieldDest = /<yield\s+from=['"]?([-\w]+)['"]?\s*(?:\/>|>([\S\s]*?)<\/yield\s*>)/ig; var rootEls = { tr: 'tbody', th: 'tr', td: 'tr', col: 'colgroup' }; var tblTags = IE_VERSION && IE_VERSION < 10 ? RE_SPECIAL_TAGS : RE_SPECIAL_TAGS_NO_OPTION; var GENERIC = 'div'; var SVG = 'svg'; /* Creates the root element for table or select child elements: tr/th/td/thead/tfoot/tbody/caption/col/colgroup/option/optgroup */ function specialTags(el, tmpl, tagName) { var select = tagName[0] === 'o', parent = select ? 'select>' : 'table>'; // trim() is important here, this ensures we don't have artifacts, // so we can check if we have only one element inside the parent el.innerHTML = '<' + parent + tmpl.trim() + '</' + parent; parent = el.firstChild; // returns the immediate parent if tr/th/td/col is the only element, if not // returns the whole tree, as this can include additional elements /* istanbul ignore next */ if (select) { parent.selectedIndex = -1; // for IE9, compatible w/current riot behavior } else { // avoids insertion of cointainer inside container (ex: tbody inside tbody) var tname = rootEls[tagName]; if (tname && parent.childElementCount === 1) { parent = $(tname, parent); } } return parent } /* Replace the yield tag from any tag template with the innerHTML of the original tag in the page */ function replaceYield(tmpl, html) { // do nothing if no yield if (!reHasYield.test(tmpl)) { return tmpl } // be careful with #1343 - string on the source having `$1` var src = {}; html = html && html.replace(reYieldSrc, function (_, ref, text) { src[ref] = src[ref] || text; // preserve first definition return '' }).trim(); return tmpl .replace(reYieldDest, function (_, ref, def) { // yield with from - to attrs return src[ref] || def || '' }) .replace(reYieldAll, function (_, def) { // yield without any "from" return html || def || '' }) } /** * Creates a DOM element to wrap the given content. Normally an `DIV`, but can be * also a `TABLE`, `SELECT`, `TBODY`, `TR`, or `COLGROUP` element. * * @param { String } tmpl - The template coming from the custom tag definition * @param { String } html - HTML content that comes from the DOM element where you * will mount the tag, mostly the original tag in the page * @param { Boolean } isSvg - true if the root node is an svg * @returns { HTMLElement } DOM element with _tmpl_ merged through `YIELD` with the _html_. */ function mkdom(tmpl, html, isSvg$$1) { var match = tmpl && tmpl.match(/^\s*<([-\w]+)/); var tagName = match && match[1].toLowerCase(); var el = mkEl(isSvg$$1 ? SVG : GENERIC); // replace all the yield tags with the tag inner html tmpl = replaceYield(tmpl, html); /* istanbul ignore next */ if (tblTags.test(tagName)) { el = specialTags(el, tmpl, tagName); } else { setInnerHTML(el, tmpl, isSvg$$1); } return el } /** * Another way to create a riot tag a bit more es6 friendly * @param { HTMLElement } el - tag DOM selector or DOM node/s * @param { Object } opts - tag logic * @returns { Tag } new riot tag instance */ function Tag$1(el, opts) { // get the tag properties from the class constructor var ref = this; var name = ref.name; var tmpl = ref.tmpl; var css = ref.css; var attrs = ref.attrs; var onCreate = ref.onCreate; // register a new tag and cache the class prototype if (!__TAG_IMPL[name]) { tag$1(name, tmpl, css, attrs, onCreate); // cache the class constructor __TAG_IMPL[name].class = this.constructor; } // mount the tag using the class instance mountTo(el, name, opts, this); // inject the component css if (css) { styleManager.inject(); } return this } /** * Create a new riot tag implementation * @param { String } name - name/id of the new riot tag * @param { String } tmpl - tag template * @param { String } css - custom tag css * @param { String } attrs - root tag attributes * @param { Function } fn - user function * @returns { String } name/id of the tag just created */ function tag$1(name, tmpl, css, attrs, fn) { if (isFunction(attrs)) { fn = attrs; if (/^[\w-]+\s?=/.test(css)) { attrs = css; css = ''; } else { attrs = ''; } } if (css) { if (isFunction(css)) { fn = css; } else { styleManager.add(css); } } name = name.toLowerCase(); __TAG_IMPL[name] = { name: name, tmpl: tmpl, attrs: attrs, fn: fn }; return name } /** * Create a new riot tag implementation (for use by the compiler) * @param { String } name - name/id of the new riot tag * @param { String } tmpl - tag template * @param { String } css - custom tag css * @param { String } attrs - root tag attributes * @param { Function } fn - user function * @returns { String } name/id of the tag just created */ function tag2$1(name, tmpl, css, attrs, fn) { if (css) { styleManager.add(css, name); } __TAG_IMPL[name] = { name: name, tmpl: tmpl, attrs: attrs, fn: fn }; return name } /** * Mount a tag using a specific tag implementation * @param { * } selector - tag DOM selector or DOM node/s * @param { String } tagName - tag implementation name * @param { Object } opts - tag logic * @returns { Array } new tags instances */ function mount$2(selector, tagName, opts) { var tags = []; var elem, allTags; function pushTagsTo(root) { if (root.tagName) { var riotTag = getAttr(root, IS_DIRECTIVE), tag; // have tagName? force riot-tag to be the same if (tagName && riotTag !== tagName) { riotTag = tagName; setAttr(root, IS_DIRECTIVE, tagName); } tag = mountTo(root, riotTag || root.tagName.toLowerCase(), opts); if (tag) { tags.push(tag); } } else if (root.length) { each(root, pushTagsTo); } // assume nodeList } // inject styles into DOM styleManager.inject(); if (isObject(tagName)) { opts = tagName; tagName = 0; } // crawl the DOM to find the tag if (isString(selector)) { selector = selector === '*' ? // select all registered tags // & tags found with the riot-tag attribute set allTags = selectTags() : // or just the ones named like the selector selector + selectTags(selector.split(/, */)); // make sure to pass always a selector // to the querySelectorAll function elem = selector ? $$(selector) : []; } else // probably you have passed already a tag or a NodeList { elem = selector; } // select all the registered and mount them inside their root elements if (tagName === '*') { // get all custom tags tagName = allTags || selectTags(); // if the root els it's just a single tag if (elem.tagName) { elem = $$(tagName, elem); } else { // select all the children for all the different root elements var nodeList = []; each(elem, function (_el) { return nodeList.push($$(tagName, _el)); }); elem = nodeList; } // get rid of the tagName tagName = 0; } pushTagsTo(elem); return tags } // Create a mixin that could be globally shared across all the tags var mixins = {}; var globals = mixins[GLOBAL_MIXIN] = {}; var mixins_id = 0; /** * Create/Return a mixin by its name * @param { String } name - mixin name (global mixin if object) * @param { Object } mix - mixin logic * @param { Boolean } g - is global? * @returns { Object } the mixin logic */ function mixin$1(name, mix, g) { // Unnamed global if (isObject(name)) { mixin$1(("__" + (mixins_id++) + "__"), name, true); return } var store = g ? globals : mixins; // Getter if (!mix) { if (isUndefined(store[name])) { throw new Error(("Unregistered mixin: " + name)) } return store[name] } // Setter store[name] = isFunction(mix) ? extend(mix.prototype, store[name] || {}) && mix : extend(store[name] || {}, mix); } /** * Update all the tags instances created * @returns { Array } all the tags instances */ function update$1() { return each(__TAGS_CACHE, function (tag) { return tag.update(); }) } function unregister$1(name) { __TAG_IMPL[name] = null; } var version$1 = 'v3.8.1'; var core = Object.freeze({ Tag: Tag$1, tag: tag$1, tag2: tag2$1, mount: mount$2, mixin: mixin$1, update: update$1, unregister: unregister$1, version: version$1 }); /** * We need to update opts for this tag. That requires updating the expressions * in any attributes on the tag, and then copying the result onto opts. * @this Tag * @param {Boolean} isLoop - is it a loop tag? * @param { Tag } parent - parent tag node * @param { Boolean } isAnonymous - is it a tag without any impl? (a tag not registered) * @param { Object } opts - tag options * @param { Array } instAttrs - tag attributes array */ function updateOpts(isLoop, parent, isAnonymous, opts, instAttrs) { // isAnonymous `each` tags treat `dom` and `root` differently. In this case // (and only this case) we don't need to do updateOpts, because the regular parse // will update those attrs. Plus, isAnonymous tags don't need opts anyway if (isLoop && isAnonymous) { return } var ctx = isLoop ? inheritParentProps.call(this) : parent || this; each(instAttrs, function (attr) { if (attr.expr) { updateExpression.call(ctx, attr.expr); } // normalize the attribute names opts[toCamel(attr.name).replace(ATTRS_PREFIX, '')] = attr.expr ? attr.expr.value : attr.value; }); } /** * Manage the mount state of a tag triggering also the observable events * @this Tag * @param { Boolean } value - ..of the isMounted flag */ function setMountState(value) { var ref = this.__; var isAnonymous = ref.isAnonymous; defineProperty(this, 'isMounted', value); if (!isAnonymous) { if (value) { this.trigger('mount'); } else { this.trigger('unmount'); this.off('*'); this.__.wasCreated = false; } } } /** * Tag creation factory function * @constructor * @param { Object } impl - it contains the tag template, and logic * @param { Object } conf - tag options * @param { String } innerHTML - html that eventually we need to inject in the tag */ function createTag(impl, conf, innerHTML) { if ( impl === void 0 ) impl = {}; if ( conf === void 0 ) conf = {}; var tag = conf.context || {}; var opts = extend({}, conf.opts); var parent = conf.parent; var isLoop = conf.isLoop; var isAnonymous = !!conf.isAnonymous; var skipAnonymous = settings$1.skipAnonymousTags && isAnonymous; var item = conf.item; // available only for the looped nodes var index = conf.index; // All attributes on the Tag when it's first parsed var instAttrs = []; // expressions on this type of Tag var implAttrs = []; var expressions = []; var root = conf.root; var tagName = conf.tagName || getTagName(root); var isVirtual = tagName === 'virtual'; var isInline = !isVirtual && !impl.tmpl; var dom; // make this tag observable if (!skipAnonymous) { observable$1(tag); } // only call unmount if we have a valid __TAG_IMPL (has name property) if (impl.name && root._tag) { root._tag.unmount(true); } // not yet mounted defineProperty(tag, 'isMounted', false); defineProperty(tag, '__', { isAnonymous: isAnonymous, instAttrs: instAttrs, innerHTML: innerHTML, tagName: tagName, index: index, isLoop: isLoop, isInline: isInline, // tags having event listeners // it would be better to use weak maps here but we can not introduce breaking changes now listeners: [], // these vars will be needed only for the virtual tags virts: [], wasCreated: false, tail: null, head: null, parent: null, item: null }); // create a unique id to this tag // it could be handy to use it also to improve the virtual dom rendering speed defineProperty(tag, '_riot_id', uid()); // base 1 allows test !t._riot_id defineProperty(tag, 'root', root); extend(tag, { opts: opts }, item); // protect the "tags" and "refs" property from being overridden defineProperty(tag, 'parent', parent || null); defineProperty(tag, 'tags', {}); defineProperty(tag, 'refs', {}); if (isInline || isLoop && isAnonymous) { dom = root; } else { if (!isVirtual) { root.innerHTML = ''; } dom = mkdom(impl.tmpl, innerHTML, isSvg(root)); } /** * Update the tag expressions and options * @param { * } data - data we want to use to extend the tag properties * @returns { Tag } the current tag instance */ defineProperty(tag, 'update', function tagUpdate(data) { var nextOpts = {}; var canTrigger = tag.isMounted && !skipAnonymous; // inherit properties from the parent tag if (isAnonymous && parent) { extend(tag, parent); } extend(tag, data); updateOpts.apply(tag, [isLoop, parent, isAnonymous, nextOpts, instAttrs]); if ( canTrigger && tag.isMounted && isFunction(tag.shouldUpdate) && !tag.shouldUpdate(data, nextOpts) ) { return tag } extend(opts, nextOpts); if (canTrigger) { tag.trigger('update', data); } updateAllExpressions.call(tag, expressions); if (canTrigger) { tag.trigger('updated'); } return tag }); /** * Add a mixin to this tag * @returns { Tag } the current tag instance */ defineProperty(tag, 'mixin', function tagMixin() { each(arguments, function (mix) { var instance; var obj; var props = []; // properties blacklisted and will not be bound to the tag instance var propsBlacklist = ['init', '__proto__']; mix = isString(mix) ? mixin$1(mix) : mix; // check if the mixin is a function if (isFunction(mix)) { // create the new mixin instance instance = new mix(); } else { instance = mix; } var proto = Object.getPrototypeOf(instance); // build multilevel prototype inheritance chain property list do { props = props.concat(Object.getOwnPropertyNames(obj || instance)); } while (obj = Object.getPrototypeOf(obj || instance)) // loop the keys in the function prototype or the all object keys each(props, function (key) { // bind methods to tag // allow mixins to override other properties/parent mixins if (!contains(propsBlacklist, key)) { // check for getters/setters var descriptor = getPropDescriptor(instance, key) || getPropDescriptor(proto, key); var hasGetterSetter = descriptor && (descriptor.get || descriptor.set); // apply method only if it does not already exist on the instance if (!tag.hasOwnProperty(key) && hasGetterSetter) { Object.defineProperty(tag, key, descriptor); } else { tag[key] = isFunction(instance[key]) ? instance[key].bind(tag) : instance[key]; } } }); // init method will be called automatically if (instance.init) { instance.init.bind(tag)(opts); } }); return tag }); /** * Mount the current tag instance * @returns { Tag } the current tag instance */ defineProperty(tag, 'mount', function tagMount() { root._tag = tag; // keep a reference to the tag just created // Read all the attrs on this instance. This give us the info we need for updateOpts parseAttributes.apply(parent, [root, root.attributes, function (attr, expr) { if (!isAnonymous && RefExpr.isPrototypeOf(expr)) { expr.tag = tag; } attr.expr = expr; instAttrs.push(attr); }]); // update the root adding custom attributes coming from the compiler walkAttrs(impl.attrs, function (k, v) { implAttrs.push({name: k, value: v}); }); parseAttributes.apply(tag, [root, implAttrs, function (attr, expr) { if (expr) { expressions.push(expr); } else { setAttr(root, attr.name, attr.value); } }]); // initialiation updateOpts.apply(tag, [isLoop, parent, isAnonymous, opts, instAttrs]); // add global mixins var globalMixin = mixin$1(GLOBAL_MIXIN); if (globalMixin && !skipAnonymous) { for (var i in globalMixin) { if (globalMixin.hasOwnProperty(i)) { tag.mixin(globalMixin[i]); } } } if (impl.fn) { impl.fn.call(tag, opts); } if (!skipAnonymous) { tag.trigger('before-mount'); } // parse layout after init. fn may calculate args for nested custom tags each(parseExpressions.apply(tag, [dom, isAnonymous]), function (e) { return expressions.push(e); }); tag.update(item); if (!isAnonymous && !isInline) { while (dom.firstChild) { root.appendChild(dom.firstChild); } } defineProperty(tag, 'root', root); // if we need to wait that the parent "mount" or "updated" event gets triggered if (!skipAnonymous && tag.parent) { var p = getImmediateCustomParentTag(tag.parent); p.one(!p.isMounted ? 'mount' : 'updated', function () { setMountState.call(tag, true); }); } else { // otherwise it's not a child tag we can trigger its mount event setMountState.call(tag, true); } tag.__.wasCreated = true; return tag }); /** * Unmount the tag instance * @param { Boolean } mustKeepRoot - if it's true the root node will not be removed * @returns { Tag } the current tag instance */ defineProperty(tag, 'unmount', function tagUnmount(mustKeepRoot) { var el = tag.root; var p = el.parentNode; var tagIndex = __TAGS_CACHE.indexOf(tag); if (!skipAnonymous) { tag.trigger('before-unmount'); } // clear all attributes coming from the mounted tag walkAttrs(impl.attrs, function (name) { if (startsWith(name, ATTRS_PREFIX)) { name = name.slice(ATTRS_PREFIX.length); } remAttr(root, name); }); // remove all the event listeners tag.__.listeners.forEach(function (dom) { Object.keys(dom[RIOT_EVENTS_KEY]).forEach(function (eventName) { dom.removeEventListener(eventName, dom[RIOT_EVENTS_KEY][eventName]); }); }); // remove tag instance from the global tags cache collection if (tagIndex !== -1) { __TAGS_CACHE.splice(tagIndex, 1); } // clean up the parent tags object if (parent && !isAnonymous) { var ptag = getImmediateCustomParentTag(parent); if (isVirtual) { Object .keys(tag.tags) .forEach(function (tagName) { return arrayishRemove(ptag.tags, tagName, tag.tags[tagName]); }); } else { arrayishRemove(ptag.tags, tagName, tag); } } // unmount all the virtual directives if (tag.__.virts) { each(tag.__.virts, function (v) { if (v.parentNode) { v.parentNode.removeChild(v); } }); } // allow expressions to unmount themselves unmountAll(expressions); each(instAttrs, function (a) { return a.expr && a.expr.unmount && a.expr.unmount(); }); // clear the tag html if it's necessary if (mustKeepRoot) { setInnerHTML(el, ''); } // otherwise detach the root tag from the DOM else if (p) { p.removeChild(el); } // custom internal unmount function to avoid relying on the observable if (tag.__.onUnmount) { tag.__.onUnmount(); } // weird fix for a weird edge case #2409 and #2436 // some users might use your software not as you've expected // so I need to add these dirty hacks to mitigate unexpected issues if (!tag.isMounted) { setMountState.call(tag, true); } setMountState.call(tag, false); delete tag.root._tag; return tag }); return tag } /** * Detect the tag implementation by a DOM node * @param { Object } dom - DOM node we need to parse to get its tag implementation * @returns { Object } it returns an object containing the implementation of a custom tag (template and boot function) */ function getTag(dom) { return dom.tagName && __TAG_IMPL[getAttr(dom, IS_DIRECTIVE) || getAttr(dom, IS_DIRECTIVE) || dom.tagName.toLowerCase()] } /** * Move the position of a custom tag in its parent tag * @this Tag * @param { String } tagName - key where the tag was stored * @param { Number } newPos - index where the new tag will be stored */ function moveChildTag(tagName, newPos) { var parent = this.parent; var tags; // no parent no move if (!parent) { return } tags = parent.tags[tagName]; if (isArray(tags)) { tags.splice(newPos, 0, tags.splice(tags.indexOf(this), 1)[0]); } else { arrayishAdd(parent.tags, tagName, this); } } /** * Create a new child tag including it correctly into its parent * @param { Object } child - child tag implementation * @param { Object } opts - tag options containing the DOM node where the tag will be mounted * @param { String } innerHTML - inner html of the child node * @param { Object } parent - instance of the parent tag including the child custom tag * @returns { Object } instance of the new child tag just created */ function initChildTag(child, opts, innerHTML, parent) { var tag = createTag(child, opts, innerHTML); var tagName = opts.tagName || getTagName(opts.root, true); var ptag = getImmediateCustomParentTag(parent); // fix for the parent attribute in the looped elements defineProperty(tag, 'parent', ptag); // store the real parent tag // in some cases this could be different from the custom parent tag // for example in nested loops tag.__.parent = parent; // add this tag to the custom parent tag arrayishAdd(ptag.tags, tagName, tag); // and also to the real parent tag if (ptag !== parent) { arrayishAdd(parent.tags, tagName, tag); } return tag } /** * Loop backward all the parents tree to detect the first custom parent tag * @param { Object } tag - a Tag instance * @returns { Object } the instance of the first custom parent tag found */ function getImmediateCustomParentTag(tag) { var ptag = tag; while (ptag.__.isAnonymous) { if (!ptag.parent) { break } ptag = ptag.parent; } return ptag } /** * Trigger the unmount method on all the expressions * @param { Array } expressions - DOM expressions */ function unmountAll(expressions) { each(expressions, function (expr) { if (expr.unmount) { expr.unmount(true); } else if (expr.tagName) { expr.tag.unmount(true); } else if (expr.unmount) { expr.unmount(); } }); } /** * Get the tag name of any DOM node * @param { Object } dom - DOM node we want to parse * @param { Boolean } skipDataIs - hack to ignore the data-is attribute when attaching to parent * @returns { String } name to identify this dom node in riot */ function getTagName(dom, skipDataIs) { var child = getTag(dom); var namedTag = !skipDataIs && getAttr(dom, IS_DIRECTIVE); return namedTag && !tmpl.hasExpr(namedTag) ? namedTag : child ? child.name : dom.tagName.toLowerCase() } /** * Set the property of an object for a given key. If something already * exists there, then it becomes an array containing both the old and new value. * @param { Object } obj - object on which to set the property * @param { String } key - property name * @param { Object } value - the value of the property to be set * @param { Boolean } ensureArray - ensure that the property remains an array * @param { Number } index - add the new item in a certain array position */ function arrayishAdd(obj, key, value, ensureArray, index) { var dest = obj[key]; var isArr = isArray(dest); var hasIndex = !isUndefined(index); if (dest && dest === value) { return } // if the key was never set, set it once if (!dest && ensureArray) { obj[key] = [value]; } else if (!dest) { obj[key] = value; } // if it was an array and not yet set else { if (isArr) { var oldIndex = dest.indexOf(value); // this item never changed its position if (oldIndex === index) { return } // remove the item from its old position if (oldIndex !== -1) { dest.splice(oldIndex, 1); } // move or add the item if (hasIndex) { dest.splice(index, 0, value); } else { dest.push(value); } } else { obj[key] = [dest, value]; } } } /** * Removes an item from an object at a given key. If the key points to an array, * then the item is just removed from the array. * @param { Object } obj - object on which to remove the property * @param { String } key - property name * @param { Object } value - the value of the property to be removed * @param { Boolean } ensureArray - ensure that the property remains an array */ function arrayishRemove(obj, key, value, ensureArray) { if (isArray(obj[key])) { var index = obj[key].indexOf(value); if (index !== -1) { obj[key].splice(index, 1); } if (!obj[key].length) { delete obj[key]; } else if (obj[key].length === 1 && !ensureArray) { obj[key] = obj[key][0]; } } else if (obj[key] === value) { delete obj[key]; } // otherwise just delete the key } /** * Mount a tag creating new Tag instance * @param { Object } root - dom node where the tag will be mounted * @param { String } tagName - name of the riot tag we want to mount * @param { Object } opts - options to pass to the Tag instance * @param { Object } ctx - optional context that will be used to extend an existing class ( used in riot.Tag ) * @returns { Tag } a new Tag instance */ function mountTo(root, tagName, opts, ctx) { var impl = __TAG_IMPL[tagName]; var implClass = __TAG_IMPL[tagName].class; var context = ctx || (implClass ? Object.create(implClass.prototype) : {}); // cache the inner HTML to fix #855 var innerHTML = root._innerHTML = root._innerHTML || root.innerHTML; var conf = extend({ root: root, opts: opts, context: context }, { parent: opts ? opts.parent : null }); var tag; if (impl && root) { tag = createTag(impl, conf, innerHTML); } if (tag && tag.mount) { tag.mount(true); // add this tag to the virtualDom variable if (!contains(__TAGS_CACHE, tag)) { __TAGS_CACHE.push(tag); } } return tag } /** * makes a tag virtual and replaces a reference in the dom * @this Tag * @param { tag } the tag to make virtual * @param { ref } the dom reference location */ function makeReplaceVirtual(tag, ref) { var frag = createFrag(); makeVirtual.call(tag, frag); ref.parentNode.replaceChild(frag, ref); } /** * Adds the elements for a virtual tag * @this Tag * @param { Node } src - the node that will do the inserting or appending * @param { Tag } target - only if inserting, insert before this tag's first child */ function makeVirtual(src, target) { var this$1 = this; var head = createDOMPlaceholder(); var tail = createDOMPlaceholder(); var frag = createFrag(); var sib; var el; this.root.insertBefore(head, this.root.firstChild); this.root.appendChild(tail); this.__.head = el = head; this.__.tail = tail; while (el) { sib = el.nextSibling; frag.appendChild(el); this$1.__.virts.push(el); // hold for unmounting el = sib; } if (target) { src.insertBefore(frag, target.__.head); } else { src.appendChild(frag); } } /** * Return a temporary context containing also the parent properties * @this Tag * @param { Tag } - temporary tag context containing all the parent properties */ function inheritParentProps() { if (this.parent) { return extend(Object.create(this), this.parent) } return this } /** * Move virtual tag and all child nodes * @this Tag * @param { Node } src - the node that will do the inserting * @param { Tag } target - insert before this tag's first child */ function moveVirtual(src, target) { var this$1 = this; var el = this.__.head; var sib; var frag = createFrag(); while (el) { sib = el.nextSibling; frag.appendChild(el); el = sib; if (el === this$1.__.tail) { frag.appendChild(el); src.insertBefore(frag, target.__.head); break } } } /** * Get selectors for tags * @param { Array } tags - tag names to select * @returns { String } selector */ function selectTags(tags) { // select all tags if (!tags) { var keys = Object.keys(__TAG_IMPL); return keys + selectTags(keys) } return tags .filter(function (t) { return !/[^-\w]/.test(t); }) .reduce(function (list, t) { var name = t.trim().toLowerCase(); return list + ",[" + IS_DIRECTIVE + "=\"" + name + "\"]" }, '') } var tags = Object.freeze({ getTag: getTag, moveChildTag: moveChildTag, initChildTag: initChildTag, getImmediateCustomParentTag: getImmediateCustomParentTag, unmountAll: unmountAll, getTagName: getTagName, arrayishAdd: arrayishAdd, arrayishRemove: arrayishRemove, mountTo: mountTo, makeReplaceVirtual: makeReplaceVirtual, makeVirtual: makeVirtual, inheritParentProps: inheritParentProps, moveVirtual: moveVirtual, selectTags: selectTags }); /** * Riot public api */ var settings = settings$1; var util = { tmpl: tmpl, brackets: brackets, styleManager: styleManager, vdom: __TAGS_CACHE, styleNode: styleManager.styleNode, // export the riot internal utils as well dom: dom, check: check, misc: misc, tags: tags }; // export the core props/methods var Tag = Tag$1; var tag = tag$1; var tag2 = tag2$1; var mount$1 = mount$2; var mixin = mixin$1; var update = update$1; var unregister = unregister$1; var version = version$1; var observable = observable$1; var riot$1 = extend({}, core, { observable: observable$1, settings: settings, util: util, }); var riot$2 = Object.freeze({ settings: settings, util: util, Tag: Tag, tag: tag, tag2: tag2, mount: mount$1, mixin: mixin, update: update, unregister: unregister, version: version, observable: observable, default: riot$1 }); /** * Compiler for riot custom tags * @version v3.4.0 */ // istanbul ignore next function safeRegex (re) { var arguments$1 = arguments; var src = re.source; var opt = re.global ? 'g' : ''; if (re.ignoreCase) { opt += 'i'; } if (re.multiline) { opt += 'm'; } for (var i = 1; i < arguments.length; i++) { src = src.replace('@', '\\' + arguments$1[i]); } return new RegExp(src, opt) } /** * @module parsers */ var parsers$1 = (function (win) { var _p = {}; function _r (name) { var parser = win[name]; if (parser) { return parser } throw new Error('Parser "' + name + '" not loaded.') } function _req (name) { var parts = name.split('.'); if (parts.length !== 2) { throw new Error('Bad format for parsers._req') } var parser = _p[parts[0]][parts[1]]; if (parser) { return parser } throw new Error('Parser "' + name + '" not found.') } function extend (obj, props) { if (props) { for (var prop in props) { /* istanbul ignore next */ if (props.hasOwnProperty(prop)) { obj[prop] = props[prop]; } } } return obj } function renderPug (compilerName, html, opts, url) { opts = extend({ pretty: true, filename: url, doctype: 'html' }, opts); return _r(compilerName).render(html, opts) } _p.html = { jade: function (html, opts, url) { /* eslint-disable */ console.log('DEPRECATION WARNING: jade was renamed "pug" - The jade parser will be removed in riot@3.0.0!'); /* eslint-enable */ return renderPug('jade', html, opts, url) }, pug: function (html, opts, url) { return renderPug('pug', html, opts, url) } }; _p.css = { less: function (tag, css, opts, url) { var ret; opts = extend({ sync: true, syncImport: true, filename: url }, opts); _r('less').render(css, opts, function (err, result) { // istanbul ignore next if (err) { throw err } ret = result.css; }); return ret } }; _p.js = { es6: function (js, opts, url) { // eslint-disable-line no-unused-vars return _r('Babel').transform( // eslint-disable-line js, extend({ plugins: [ ['transform-es2015-template-literals', { loose: true }], 'transform-es2015-literals', 'transform-es2015-function-name', 'transform-es2015-arrow-functions', 'transform-es2015-block-scoped-functions', ['transform-es2015-classes', { loose: true }], 'transform-es2015-object-super', 'transform-es2015-shorthand-properties', 'transform-es2015-duplicate-keys', ['transform-es2015-computed-properties', { loose: true }], ['transform-es2015-for-of', { loose: true }], 'transform-es2015-sticky-regex', 'transform-es2015-unicode-regex', 'check-es2015-constants', ['transform-es2015-spread', { loose: true }], 'transform-es2015-parameters', ['transform-es2015-destructuring', { loose: true }], 'transform-es2015-block-scoping', 'transform-es2015-typeof-symbol', ['transform-es2015-modules-commonjs', { allowTopLevelThis: true }], ['transform-regenerator', { async: false, asyncGenerators: false }] ] }, opts )).code }, buble: function (js, opts, url) { opts = extend({ source: url, modules: false }, opts); return _r('buble').transform(js, opts).code }, coffee: function (js, opts) { return _r('CoffeeScript').compile(js, extend({ bare: true }, opts)) }, livescript: function (js, opts) { return _r('livescript').compile(js, extend({ bare: true, header: false }, opts)) }, typescript: function (js, opts) { return _r('typescript')(js, opts) }, none: function (js) { return js } }; _p.js.javascript = _p.js.none; _p.js.coffeescript = _p.js.coffee; _p._req = _req; _p.utils = { extend: extend }; return _p })(window || global); var S_SQ_STR = /'[^'\n\r\\]*(?:\\(?:\r\n?|[\S\s])[^'\n\r\\]*)*'/.source; var S_R_SRC1 = [ /\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//.source, '//.*', S_SQ_STR, S_SQ_STR.replace(/'/g, '"'), '([/`])' ].join('|'); var S_R_SRC2 = (S_R_SRC1.slice(0, -2)) + "{}])"; function skipES6str (code, start, stack) { var re = /[`$\\]/g; re.lastIndex = start; while (re.exec(code)) { var end = re.lastIndex; var c = code[end - 1]; if (c === '`') { return end } if (c === '$' && code[end] === '{') { stack.push('`', '}'); return end + 1 } re.lastIndex++; } throw new Error('Unclosed ES6 template') } function jsSplitter (code, start) { var re1 = new RegExp(S_R_SRC1, 'g'); var re2; var skipRegex = brackets.skipRegex; var offset = start | 0; var result = [[]]; var stack = []; var re = re1; var lastPos = re.lastIndex = offset; var str, ch, idx, end, match; while ((match = re.exec(code))) { idx = match.index; end = re.lastIndex; str = ''; ch = match[1]; if (ch) { if (ch === '{') { stack.push('}'); } else if (ch === '}') { if (stack.pop() !== ch) { throw new Error("Unexpected '}'") } else if (stack[stack.length - 1] === '`') { ch = stack.pop(); } } else if (ch === '/') { end = skipRegex(code, idx); if (end > idx + 1) { str = code.slice(idx, end); } } if (ch === '`') { end = skipES6str(code, end, stack); str = code.slice(idx, end); if (stack.length) { re = re2 || (re2 = new RegExp(S_R_SRC2, 'g')); } else { re = re1; } } } else { str = match[0]; if (str[0] === '/') { str = str[1] === '*' ? ' ' : ''; code = code.slice(offset, idx) + str + code.slice(end); end = idx + str.length; str = ''; } else if (str.length === 2) { str = ''; } } if (str) { result[0].push(code.slice(lastPos, idx)); result.push(str); lastPos = end; } re.lastIndex = end; } result[0].push(code.slice(lastPos)); return result } /** * @module compiler */ var extend$1 = parsers$1.utils.extend; /* eslint-enable */ var S_LINESTR = /"[^"\n\\]*(?:\\[\S\s][^"\n\\]*)*"|'[^'\n\\]*(?:\\[\S\s][^'\n\\]*)*'/.source; var S_STRINGS = brackets.R_STRINGS.source; var HTML_ATTRS = / *([-\w:\xA0-\xFF]+) ?(?:= ?('[^']*'|"[^"]*"|\S+))?/g; var HTML_COMMS = RegExp(/<!--(?!>)[\S\s]*?-->/.source + '|' + S_LINESTR, 'g'); var HTML_TAGS = /<(-?[A-Za-z][-\w\xA0-\xFF]*)(?:\s+([^"'/>]*(?:(?:"[^"]*"|'[^']*'|\/[^>])[^'"/>]*)*)|\s*)(\/?)>/g; var HTML_PACK = />[ \t]+<(-?[A-Za-z]|\/[-A-Za-z])/g; var RIOT_ATTRS = ['style', 'src', 'd', 'value']; var VOID_TAGS = /^(?:input|img|br|wbr|hr|area|base|col|embed|keygen|link|meta|param|source|track)$/; var PRE_TAGS = /<pre(?:\s+(?:[^">]*|"[^"]*")*)?>([\S\s]+?)<\/pre\s*>/gi; var SPEC_TYPES = /^"(?:number|date(?:time)?|time|month|email|color)\b/i; var IMPORT_STATEMENT = /^\s*import(?!\w)(?:(?:\s|[^\s'"])*)['|"].*\n?/gm; var TRIM_TRAIL = /[ \t]+$/gm; var RE_HASEXPR = safeRegex(/@#\d/, 'x01'); var RE_REPEXPR = safeRegex(/@#(\d+)/g, 'x01'); var CH_IDEXPR = '\x01#'; var CH_DQCODE = '\u2057'; var DQ = '"'; var SQ = "'"; function cleanSource (src) { var mm, re = HTML_COMMS; if (src.indexOf('\r') !== 1) { src = src.replace(/\r\n?/g, '\n'); } re.lastIndex = 0; while ((mm = re.exec(src))) { if (mm[0][0] === '<') { src = RegExp.leftContext + RegExp.rightContext; re.lastIndex = mm[3] + 1; } } return src } function parseAttribs (str, pcex) { var list = [], match, type, vexp; HTML_ATTRS.lastIndex = 0; str = str.replace(/\s+/g, ' '); while ((match = HTML_ATTRS.exec(str))) { var k = match[1].toLowerCase(), v = match[2]; if (!v) { list.push(k); } else { if (v[0] !== DQ) { v = DQ + (v[0] === SQ ? v.slice(1, -1) : v) + DQ; } if (k === 'type' && SPEC_TYPES.test(v)) { type = v; } else { if (RE_HASEXPR.test(v)) { if (k === 'value') { vexp = 1; } if (RIOT_ATTRS.indexOf(k) !== -1) { k = 'riot-' + k; } } list.push(k + '=' + v); } } } if (type) { if (vexp) { type = DQ + pcex._bp[0] + SQ + type.slice(1, -1) + SQ + pcex._bp[1] + DQ; } list.push('type=' + type); } return list.join(' ') } function splitHtml (html, opts, pcex) { var _bp = pcex._bp; if (html && _bp[4].test(html)) { var jsfn = opts.expr && (opts.parser || opts.type) ? _compileJS : 0, list = brackets.split(html, 0, _bp), expr; for (var i = 1; i < list.length; i += 2) { expr = list[i]; if (expr[0] === '^') { expr = expr.slice(1); } else if (jsfn) { expr = jsfn(expr, opts).trim(); if (expr.slice(-1) === ';') { expr = expr.slice(0, -1); } } list[i] = CH_IDEXPR + (pcex.push(expr) - 1) + _bp[1]; } html = list.join(''); } return html } function restoreExpr (html, pcex) { if (pcex.length) { html = html.replace(RE_REPEXPR, function (_, d) { return pcex._bp[0] + pcex[d].trim().replace(/[\r\n]+/g, ' ').replace(/"/g, CH_DQCODE) }); } return html } function _compileHTML (html, opts, pcex) { if (!/\S/.test(html)) { return '' } html = splitHtml(html, opts, pcex) .replace(HTML_TAGS, function (_, name, attr, ends) { name = name.toLowerCase(); ends = ends && !VOID_TAGS.test(name) ? '></' + name : ''; if (attr) { name += ' ' + parseAttribs(attr, pcex); } return '<' + name + ends + '>' }); if (!opts.whitespace) { var p = []; if (/<pre[\s>]/.test(html)) { html = html.replace(PRE_TAGS, function (q) { p.push(q); return '\u0002' }); } html = html.trim().replace(/\s+/g, ' '); if (p.length) { html = html.replace(/\u0002/g, function () { return p.shift() }); } } if (opts.compact) { html = html.replace(HTML_PACK, '><$1'); } return restoreExpr(html, pcex).replace(TRIM_TRAIL, '') } function compileHTML (html, opts, pcex) { if (Array.isArray(opts)) { pcex = opts; opts = {}; } else { if (!pcex) { pcex = []; } if (!opts) { opts = {}; } } pcex._bp = brackets.array(opts.brackets); return _compileHTML(cleanSource(html), opts, pcex) } var JS_ES6SIGN = /^[ \t]*(((?:async|\*)\s*)?([$_A-Za-z][$\w]*))\s*\([^()]*\)\s*{/m; function riotjs (js) { var parts = [], match, toes5, pos, method, prefix, name, RE = RegExp; var src = jsSplitter(js); js = src.shift().join('<%>'); while ((match = js.match(JS_ES6SIGN))) { parts.push(RE.leftContext); js = RE.rightContext; pos = skipBody(js); method = match[1]; prefix = match[2] || ''; name = match[3]; toes5 = !/^(?:if|while|for|switch|catch|function)$/.test(name); if (toes5) { name = match[0].replace(method, 'this.' + name + ' =' + prefix + ' function'); } else { name = match[0]; } parts.push(name, js.slice(0, pos)); js = js.slice(pos); if (toes5 && !/^\s*.\s*bind\b/.test(js)) { parts.push('.bind(this)'); } } if (parts.length) { js = parts.join('') + js; } if (src.length) { js = js.replace(/<%>/g, function () { return src.shift() }); } return js function skipBody (s) { var r = /[{}]/g; var i = 1; while (i && r.exec(s)) { if (s[r.lastIndex - 1] === '{') { ++i; } else { --i; } } return i ? s.length : r.lastIndex } } function _compileJS (js, opts, type, parserOpts, url) { if (!/\S/.test(js)) { return '' } if (!type) { type = opts.type; } var parser = opts.parser || type && parsers$1._req('js.' + type, true) || riotjs; return parser(js, parserOpts, url).replace(/\r\n?/g, '\n').replace(TRIM_TRAIL, '') } function compileJS (js, opts, type, userOpts) { if (typeof opts === 'string') { userOpts = type; type = opts; opts = {}; } if (type && typeof type === 'object') { userOpts = type; type = ''; } if (!userOpts) { userOpts = {}; } return _compileJS(js, opts || {}, type, userOpts.parserOptions, userOpts.url) } var CSS_SELECTOR = RegExp('([{}]|^)[; ]*((?:[^@ ;{}][^{}]*)?[^@ ;{}:] ?)(?={)|' + S_LINESTR, 'g'); function scopedCSS (tag, css) { var scope = ':scope'; return css.replace(CSS_SELECTOR, function (m, p1, p2) { if (!p2) { return m } p2 = p2.replace(/[^,]+/g, function (sel) { var s = sel.trim(); if (s.indexOf(tag) === 0) { return sel } if (!s || s === 'from' || s === 'to' || s.slice(-1) === '%') { return sel } if (s.indexOf(scope) < 0) { s = tag + ' ' + s + ',[data-is="' + tag + '"] ' + s; } else { s = s.replace(scope, tag) + ',' + s.replace(scope, '[data-is="' + tag + '"]'); } return s }); return p1 ? p1 + ' ' + p2 : p2 }) } function _compileCSS (css, tag, type, opts) { opts = opts || {}; if (type) { if (type !== 'css') { var parser = parsers$1._req('css.' + type, true); css = parser(tag, css, opts.parserOpts || {}, opts.url); } } css = css.replace(brackets.R_MLCOMMS, '').replace(/\s+/g, ' ').trim(); if (tag) { css = scopedCSS(tag, css); } return css } function compileCSS (css, type, opts) { if (type && typeof type === 'object') { opts = type; type = ''; } else if (!opts) { opts = {}; } return _compileCSS(css, opts.tagName, type, opts) } var TYPE_ATTR = /\stype\s*=\s*(?:(['"])(.+?)\1|(\S+))/i; var MISC_ATTR = '\\s*=\\s*(' + S_STRINGS + '|{[^}]+}|\\S+)'; var END_TAGS = /\/>\n|^<(?:\/?-?[A-Za-z][-\w\xA0-\xFF]*\s*|-?[A-Za-z][-\w\xA0-\xFF]*\s+[-\w:\xA0-\xFF][\S\s]*?)>\n/; function _q (s, r) { if (!s) { return "''" } s = SQ + s.replace(/\\/g, '\\\\').replace(/'/g, "\\'") + SQ; return r && s.indexOf('\n') !== -1 ? s.replace(/\n/g, '\\n') : s } function mktag (name, html, css, attr, js, imports, opts) { var c = opts.debug ? ',\n ' : ', ', s = '});'; if (js && js.slice(-1) !== '\n') { s = '\n' + s; } return imports + 'riot.tag2(\'' + name + SQ + c + _q(html, 1) + c + _q(css) + c + _q(attr) + ', function(opts) {\n' + js + s } function splitBlocks (str) { if (/<[-\w]/.test(str)) { var m, k = str.lastIndexOf('<'), n = str.length; while (k !== -1) { m = str.slice(k, n).match(END_TAGS); if (m) { k += m.index + m[0].length; m = str.slice(0, k); if (m.slice(-5) === '<-/>\n') { m = m.slice(0, -5); } return [m, str.slice(k)] } n = k; k = str.lastIndexOf('<', k - 1); } } return ['', str] } function getType (attribs) { if (attribs) { var match = attribs.match(TYPE_ATTR); match = match && (match[2] || match[3]); if (match) { return match.replace('text/', '') } } return '' } function getAttrib (attribs, name) { if (attribs) { var match = attribs.match(RegExp('\\s' + name + MISC_ATTR, 'i')); match = match && match[1]; if (match) { return (/^['"]/).test(match) ? match.slice(1, -1) : match } } return '' } function unescapeHTML (str) { return str .replace(/&amp;/g, '&') .replace(/&lt;/g, '<') .replace(/&gt;/g, '>') .replace(/&quot;/g, '"') .replace(/&#039;/g, '\'') } function getParserOptions (attribs) { var opts = unescapeHTML(getAttrib(attribs, 'options')); return opts ? JSON.parse(opts) : null } function getCode (code, opts, attribs, base) { var type = getType(attribs), src = getAttrib(attribs, 'src'), jsParserOptions = extend$1({}, opts.parserOptions.js); if (src) { return false } return _compileJS( code, opts, type, extend$1(jsParserOptions, getParserOptions(attribs)), base ) } function cssCode (code, opts, attribs, url, tag) { var parserStyleOptions = extend$1({}, opts.parserOptions.style), extraOpts = { parserOpts: extend$1(parserStyleOptions, getParserOptions(attribs)), url: url }; return _compileCSS(code, tag, getType(attribs) || opts.style, extraOpts) } function compileTemplate (html, url, lang, opts) { var parser = parsers$1._req('html.' + lang, true); return parser(html, opts, url) } var CUST_TAG = RegExp(/^([ \t]*)<(-?[A-Za-z][-\w\xA0-\xFF]*)(?:\s+([^'"/>]+(?:(?:@|\/[^>])[^'"/>]*)*)|\s*)?(?:\/>|>[ \t]*\n?([\S\s]*)^\1<\/\2\s*>|>(.*)<\/\2\s*>)/ .source.replace('@', S_STRINGS), 'gim'); var SCRIPTS = /<script(\s+[^>]*)?>\n?([\S\s]*?)<\/script\s*>/gi; var STYLES = /<style(\s+[^>]*)?>\n?([\S\s]*?)<\/style\s*>/gi; function compile$1 (src, opts, url) { var parts = [], included, output = src, defaultParserptions = { template: {}, js: {}, style: {} }; if (!opts) { opts = {}; } opts.parserOptions = extend$1(defaultParserptions, opts.parserOptions || {}); included = opts.exclude ? function (s) { return opts.exclude.indexOf(s) < 0 } : function () { return 1 }; if (!url) { url = ''; } var _bp = brackets.array(opts.brackets); if (opts.template) { output = compileTemplate(output, url, opts.template, opts.parserOptions.template); } output = cleanSource(output) .replace(CUST_TAG, function (_, indent, tagName, attribs, body, body2) { var jscode = '', styles = '', html = '', imports = '', pcex = []; pcex._bp = _bp; tagName = tagName.toLowerCase(); attribs = attribs && included('attribs') ? restoreExpr( parseAttribs( splitHtml(attribs, opts, pcex), pcex), pcex) : ''; if ((body || (body = body2)) && /\S/.test(body)) { if (body2) { if (included('html')) { html = _compileHTML(body2, opts, pcex); } } else { body = body.replace(RegExp('^' + indent, 'gm'), ''); body = body.replace(SCRIPTS, function (_m, _attrs, _script) { if (included('js')) { var code = getCode(_script, opts, _attrs, url); if (code) { jscode += (jscode ? '\n' : '') + code; } } return '' }); body = body.replace(STYLES, function (_m, _attrs, _style) { if (included('css')) { styles += (styles ? ' ' : '') + cssCode(_style, opts, _attrs, url, tagName); } return '' }); var blocks = splitBlocks(body.replace(TRIM_TRAIL, '')); if (included('html')) { html = _compileHTML(blocks[0], opts, pcex); } if (included('js')) { body = _compileJS(blocks[1], opts, null, null, url); if (body) { jscode += (jscode ? '\n' : '') + body; } jscode = jscode.replace(IMPORT_STATEMENT, function (s) { imports += s.trim() + '\n'; return '' }); } } } jscode = /\S/.test(jscode) ? jscode.replace(/\n{3,}/g, '\n\n') : ''; if (opts.entities) { parts.push({ tagName: tagName, html: html, css: styles, attribs: attribs, js: jscode, imports: imports }); return '' } return mktag(tagName, html, styles, attribs, jscode, imports, opts) }); if (opts.entities) { return parts } return output } var version$2 = 'v3.4.0'; var compiler = { compile: compile$1, compileHTML: compileHTML, compileCSS: compileCSS, compileJS: compileJS, parsers: parsers$1, version: version$2 }; var promise; var ready; // all the scripts were compiled? // gets the source of an external tag with an async call function GET (url, fn, opts) { var req = new XMLHttpRequest(); req.onreadystatechange = function () { if (req.readyState === 4) { if (req.status === 200 || !req.status && req.responseText.length) { fn(req.responseText, opts, url); } else { compile.error(("\"" + url + "\" not found")); } } }; req.onerror = function (e) { return compile.error(e); }; req.open('GET', url, true); req.send(''); } // evaluates a compiled tag within the global context function globalEval (js, url) { if (typeof js === T_STRING) { var node = mkEl('script'), root = document.documentElement; // make the source available in the "(no domain)" tab // of Chrome DevTools, with a .js extension if (url) { js += '\n//# sourceURL=' + url + '.js'; } node.text = js; root.appendChild(node); root.removeChild(node); } } // compiles all the internal and external tags on the page function compileScripts (fn, xopt) { var scripts = $$('script[type="riot/tag"]'), scriptsAmount = scripts.length; function done() { promise.trigger('ready'); ready = true; if (fn) { fn(); } } function compileTag (src, opts, url) { var code = compiler.compile(src, opts, url); globalEval(code, url); if (!--scriptsAmount) { done(); } } if (!scriptsAmount) { done(); } else { for (var i = 0; i < scripts.length; ++i) { var script = scripts[i], opts = extend({template: getAttr(script, 'template')}, xopt), url = getAttr(script, 'src') || getAttr(script, 'data-src'); url ? GET(url, compileTag, opts) : compileTag(script.innerHTML, opts); } } } var parsers = compiler.parsers; /* Compilation for the browser */ function compile (arg, fn, opts) { if (typeof arg === T_STRING) { // 2nd parameter is optional, but can be null if (isObject(fn)) { opts = fn; fn = false; } // `riot.compile(tag [, callback | true][, options])` if (/^\s*</m.test(arg)) { var js = compiler.compile(arg, opts); if (fn !== true) { globalEval(js); } if (isFunction(fn)) { fn(js, arg, opts); } return js } // `riot.compile(url [, callback][, options])` GET(arg, function (str, opts, url) { var js = compiler.compile(str, opts, url); globalEval(js, url); if (fn) { fn(js, str, opts); } }, opts); } else if (isArray(arg)) { var i = arg.length; // `riot.compile([urlsList] [, callback][, options])` arg.forEach(function(str) { GET(str, function (str, opts, url) { var js = compiler.compile(str, opts, url); globalEval(js, url); i --; if (!i && fn) { fn(js, str, opts); } }, opts); }); } else { // `riot.compile([callback][, options])` if (isFunction(arg)) { opts = fn; fn = arg; } else { opts = arg; fn = undefined; } if (ready) { return fn && fn() } if (promise) { if (fn) { promise.on('ready', fn); } } else { promise = observable$1(); compileScripts(fn, opts); } } } // it can be rewritten by the user to handle all the compiler errors compile.error = function (e) { throw new Error(e) }; function mount() { var args = [], len = arguments.length; while ( len-- ) args[ len ] = arguments[ len ]; var ret; compile(function () { ret = mount$1.apply(riot$2, args); }); return ret } var riot_compiler = extend({}, riot$2, { mount: mount, compile: compile, parsers: parsers }); return riot_compiler; })));
!function(o){function r(t){if(e[t])return e[t].exports;var n=e[t]={exports:{},id:t,loaded:!1};return o[t].call(n.exports,n,n.exports,r),n.loaded=!0,n.exports}var e={};return r.m=o,r.c=e,r.p="",r(0)}([function(o,r){o.exports={el:"#info",data:{info:window.$info}},Vue.ready(o.exports)}]);
var env; var SuperVillain, HomePlanet, EvilMinion; var run = Ember.run; module("integration/multiple_stores - Multiple Stores Tests", { setup: function() { SuperVillain = DS.Model.extend({ firstName: DS.attr('string'), lastName: DS.attr('string'), homePlanet: DS.belongsTo('home-planet', { inverse: 'villains', async: false }), evilMinions: DS.hasMany('evil-minion', { async: false }) }); HomePlanet = DS.Model.extend({ name: DS.attr('string'), villains: DS.hasMany('super-villain', { inverse: 'homePlanet', async: false }) }); EvilMinion = DS.Model.extend({ superVillain: DS.belongsTo('super-villain', { async: false }), name: DS.attr('string') }); env = setupStore({ superVillain: SuperVillain, homePlanet: HomePlanet, evilMinion: EvilMinion }); env.registry.register('adapter:application', DS.RESTAdapter); env.registry.register('serializer:application', DS.RESTSerializer); env.registry.register('store:store-a', DS.Store); env.registry.register('store:store-b', DS.Store); env.store_a = env.container.lookup('store:store-a'); env.store_b = env.container.lookup('store:store-b'); }, teardown: function() { run(env.store, 'destroy'); } }); test("should be able to push into multiple stores", function() { var home_planet_main = { id: '1', name: 'Earth' }; var home_planet_a = { id: '1', name: 'Mars' }; var home_planet_b = { id: '1', name: 'Saturn' }; run(function() { env.store.push(env.store.normalize('home-planet', home_planet_main)); env.store_a.push(env.store_a.normalize('home-planet', home_planet_a)); env.store_b.push(env.store_b.normalize('home-planet', home_planet_b)); }); run(env.store, 'find', 'home-planet', 1).then(async(function(homePlanet) { equal(homePlanet.get('name'), "Earth"); })); run(env.store_a, 'find', 'home-planet', 1).then(async(function(homePlanet) { equal(homePlanet.get('name'), "Mars"); })); run(env.store_b, 'find', 'home-planet', 1).then(async(function(homePlanet) { equal(homePlanet.get('name'), "Saturn"); })); }); test("embedded records should be created in multiple stores", function() { env.registry.register('serializer:home-planet', DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, { attrs: { villains: { embedded: 'always' } } })); var serializer_main = env.store.serializerFor('home-planet'); var serializer_a = env.store_a.serializerFor('home-planet'); var serializer_b = env.store_b.serializerFor('home-planet'); var json_hash_main = { homePlanet: { id: "1", name: "Earth", villains: [{ id: "1", firstName: "Tom", lastName: "Dale" }] } }; var json_hash_a = { homePlanet: { id: "1", name: "Mars", villains: [{ id: "1", firstName: "James", lastName: "Murphy" }] } }; var json_hash_b = { homePlanet: { id: "1", name: "Saturn", villains: [{ id: "1", firstName: "Jade", lastName: "John" }] } }; var json_main, json_a, json_b; run(function() { json_main = serializer_main.normalizeResponse(env.store, env.store.modelFor('home-planet'), json_hash_main, 1, 'findRecord'); env.store.push(json_main); equal(env.store.hasRecordForId('super-villain', "1"), true, "superVillain should exist in service:store"); }); run(function() { json_a = serializer_a.normalizeResponse(env.store_a, env.store_a.modelFor('home-planet'), json_hash_a, 1, 'findRecord'); env.store_a.push(json_a); equal(env.store_a.hasRecordForId("super-villain", "1"), true, "superVillain should exist in store:store-a"); }); run(function() { json_b = serializer_b.normalizeResponse(env.store_b, env.store_a.modelFor('home-planet'), json_hash_b, 1, 'findRecord'); env.store_b.push(json_b); equal(env.store_b.hasRecordForId("super-villain", "1"), true, "superVillain should exist in store:store-b"); }); });
/* Poke-Anagrams */ var Anagrams = require('./constructors.js').Anagrams; var RandomGenerator = require('./pokerand.js'); function send (room, str) { Bot.say(room, str); } function trans (data, room) { var lang = Config.language || 'english'; if (Settings.settings['language'] && Settings.settings['language'][room]) lang = Settings.settings['language'][room]; return Tools.translateGlobal('games', 'pokeanagrams', lang)[data]; } function parseWinners (winners, room) { var res = { type: 'win', text: "**" + winners[0] + "**" }; if (winners.length < 2) return res; res.type = 'tie'; for (var i = 1; i < winners.length - 1; i++) { res.text += ", **" + winners[i] + "**"; } res.text += " " + trans('and', room) + " **" + winners[winners.length - 1] + "**"; return res; } exports.id = 'pokeanagrams'; exports.title = 'Poke-Anagrams'; exports.aliases = ['pa', 'pokemonanagrams']; var parser = function (type, data) { var txt; switch (type) { case 'start': txt = trans('start', this.room); if (this.maxGames) txt += ". " + trans('maxgames1', this.room) + " __" + this.maxGames + " " + trans('maxgames2', this.room) + "__"; if (this.maxPoints) txt += ". " + trans('maxpoints1', this.room) + " __" + this.maxPoints + " " + trans('maxpoints2', this.room) + "__"; txt += ". " + trans('timer1', this.room) + " __" + Math.floor(this.answerTime / 1000).toString() + " " + trans('timer2', this.room) + "__"; txt += ". " + trans('help', this.room).replace("$TOKEN", CommandParser.commandTokens[0]); send(this.room, txt); break; case 'show': send(this.room, "**" + exports.title + ": [" + this.clue + "]** " + this.randomizedChars.join(', ')); break; case 'point': send(this.room, trans('grats1', this.room) + " **" + data.user + "** " + trans('point2', this.room) + " __" + this.word + "__. " + trans('point3', this.room) + ": " + data.points + " " + trans('points', this.room)); break; case 'timeout': send(this.room, trans('timeout', this.room) + " __" + this.word.trim() + "__"); break; case 'end': send(this.room, trans('lose', this.room)); break; case 'win': var t = parseWinners(data.winners, this.room); txt = "**" + trans('end', this.room) + "** "; switch (t.type) { case 'win': txt += trans('grats1', this.room) + " " + t.text + " " + trans('grats2', this.room) + " __" + data.points + " " + trans('points', this.room) + "__!"; break; case 'tie': txt += trans('tie1', this.room) + " __" + data.points + " " + trans('points', this.room) + "__ " + trans('tie2', this.room) + " " + t.text; break; } send(this.room, txt); break; case 'forceend': send(this.room, trans('forceend1', this.room) + (this.status === 2 ? (" " + trans('forceend2', this.room) + " __" + this.word.trim() + "__") : '')); break; case 'error': send(this.room, "**" + exports.title + ": Error (could not fetch a word)"); this.end(true); break; } if (type in {win: 1, end: 1, forceend: 1}) { Features.games.deleteGame(this.room); } }; var wordGenerator = function (arr, lang) { return RandomGenerator.randomNoRepeat(arr, lang); }; exports.newGame = function (room, opts) { if (!RandomGenerator.random()) return null; var generatorOpts = { room: room, title: exports.title, maxGames: 5, maxPoints: 0, waitTime: 2 * 1000, answerTime: 30 * 1000, wordGenerator: wordGenerator }; var temp; for (var i in opts) { switch (i) { case 'ngames': case 'maxgames': case 'games': temp = parseInt(opts[i]) || 0; if (temp && temp < 0) return "games ( >= 0 ), maxpoints, time, lang"; generatorOpts.maxGames = temp; break; case 'points': case 'maxpoints': temp = parseInt(opts[i]) || 0; if (temp && temp < 0) return "games, maxpoints ( >= 0 ), time, lang"; generatorOpts.maxPoints = temp; break; case 'answertime': case 'anstime': case 'time': temp = parseFloat(opts[i]) || 0; if (temp) temp *= 1000; if (temp && temp < (5 * 1000)) return "games, maxpoints, time ( seconds, >= 5 ), lang"; generatorOpts.answerTime = temp; break; case 'lang': case 'language': var langAliases = { 'en': 'english', 'es': 'spanish', 'de': 'german', 'fr': 'french', 'it': 'italian' }; if (typeof opts[i] !== "string") return "games, maxpoints, time, lang (" + Object.keys(Tools.translations).join('/') + ")"; var lng = langAliases[toId(opts[i])] || toId(opts[i]); if (!Tools.translations[lng]) return "games, maxpoints, time, lang (" + Object.keys(Tools.translations).join('/') + ")"; generatorOpts.language = lng; break; default: return "games, maxpoints, time, lang"; } } if (!generatorOpts.maxGames && !generatorOpts.maxPoints) generatorOpts.maxGames = 5; var game = new Anagrams(generatorOpts, parser); if (!game) return null; game.generator = exports.id; return game; }; exports.commands = { gword: 'g', guess: 'g', g: function (arg, by, room, cmd, game) { game.guess(by.substr(1), arg); }, view: function (arg, by, room, cmd, game) { if (game.status < 2) return; this.restrictReply("**" + exports.title + ": [" + game.clue + "]** " + game.randomizedChars.join(', '), 'games'); }, end: 'endanagrams', endanagrams: function (arg, by, room, cmd, game) { if (!this.can('games')) return; game.end(true); } };
import { get } from '@ember/-internals/metal'; import { AbstractTestCase, runLoopSettled } from 'internal-test-helpers'; import { runArrayTests, newFixture } from '../helpers/array'; class RemoveObjectTests extends AbstractTestCase { '@test should return receiver'() { let before = newFixture(3); let obj = this.newObject(before); this.assert.equal(obj.removeObject(before[1]), obj, 'should return receiver'); obj.destroy(); } async '@test [A,B,C].removeObject(B) => [A,C] + notify'() { let before = newFixture(3); let after = [before[0], before[2]]; let obj = this.newObject(before); let observer = this.newObserver(obj, '[]', '@each', 'length', 'firstObject', 'lastObject'); obj.getProperties('firstObject', 'lastObject'); /* Prime the cache */ obj.removeObject(before[1]); // flush observers await runLoopSettled(); this.assert.deepEqual(this.toArray(obj), after, 'post item results'); this.assert.equal(get(obj, 'length'), after.length, 'length'); if (observer.isEnabled) { this.assert.equal(observer.timesCalled('[]'), 1, 'should have notified [] once'); this.assert.equal(observer.timesCalled('@each'), 0, 'should not have notified @each once'); this.assert.equal(observer.timesCalled('length'), 1, 'should have notified length once'); this.assert.equal( observer.validate('firstObject'), false, 'should NOT have notified firstObject once' ); this.assert.equal( observer.validate('lastObject'), false, 'should NOT have notified lastObject once' ); } obj.destroy(); } async '@test [A,B,C].removeObject(D) => [A,B,C]'() { let before = newFixture(3); let after = before; let item = newFixture(1)[0]; let obj = this.newObject(before); let observer = this.newObserver(obj, '[]', '@each', 'length', 'firstObject', 'lastObject'); obj.getProperties('firstObject', 'lastObject'); /* Prime the cache */ obj.removeObject(item); // note: item not in set // flush observers await runLoopSettled(); this.assert.deepEqual(this.toArray(obj), after, 'post item results'); this.assert.equal(get(obj, 'length'), after.length, 'length'); if (observer.isEnabled) { this.assert.equal(observer.validate('[]'), false, 'should NOT have notified []'); this.assert.equal(observer.validate('@each'), false, 'should NOT have notified @each'); this.assert.equal(observer.validate('length'), false, 'should NOT have notified length'); this.assert.equal( observer.validate('firstObject'), false, 'should NOT have notified firstObject once' ); this.assert.equal( observer.validate('lastObject'), false, 'should NOT have notified lastObject once' ); } obj.destroy(); } } runArrayTests('removeObject', RemoveObjectTests, 'MutableArray', 'NativeArray', 'ArrayProxy');
angular.module('typicms').directive('highlighter', ['$timeout', function ($timeout) { return { restrict: 'A', link: function (scope, element, attrs) { scope.$watch(attrs.highlighter, function (nv, ov) { if (nv !== ov) { // apply class element.addClass('highlight'); // auto remove after some delay $timeout(function () { element.removeClass('highlight'); }, 1000); } }); } }; }]);
/** * @fileoverview Rule to flag the use of redundant constructors in classes. * @author Alberto Rodrรญguez * @copyright 2015 Alberto Rodrรญguez. All rights reserved. * See LICENSE file in root directory for full license. */ "use strict"; //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ /** * Checks whether a given array of statements is a single call of `super`. * * @param {ASTNode[]} body - An array of statements to check. * @returns {boolean} `true` if the body is a single call of `super`. */ function isSingleSuperCall(body) { return ( body.length === 1 && body[0].type === "ExpressionStatement" && body[0].expression.type === "CallExpression" && body[0].expression.callee.type === "Super" ); } /** * Checks whether a given node is a pattern which doesn't have any side effects. * Default parameters and Destructuring parameters can have side effects. * * @param {ASTNode} node - A pattern node. * @returns {boolean} `true` if the node doesn't have any side effects. */ function isSimple(node) { return node.type === "Identifier" || node.type === "RestElement"; } /** * Checks whether a given array of expressions is `...arguments` or not. * `super(...arguments)` passes all arguments through. * * @param {ASTNode[]} superArgs - An array of expressions to check. * @returns {boolean} `true` if the superArgs is `...arguments`. */ function isSpreadArguments(superArgs) { return ( superArgs.length === 1 && superArgs[0].type === "SpreadElement" && superArgs[0].argument.type === "Identifier" && superArgs[0].argument.name === "arguments" ); } /** * Checks whether given 2 nodes are identifiers which have the same name or not. * * @param {ASTNode} ctorParam - A node to check. * @param {ASTNode} superArg - A node to check. * @returns {boolean} `true` if the nodes are identifiers which have the same * name. */ function isValidIdentifierPair(ctorParam, superArg) { return ( ctorParam.type === "Identifier" && superArg.type === "Identifier" && ctorParam.name === superArg.name ); } /** * Checks whether given 2 nodes are a rest/spread pair which has the same values. * * @param {ASTNode} ctorParam - A node to check. * @param {ASTNode} superArg - A node to check. * @returns {boolean} `true` if the nodes are a rest/spread pair which has the * same values. */ function isValidRestSpreadPair(ctorParam, superArg) { return ( ctorParam.type === "RestElement" && superArg.type === "SpreadElement" && isValidIdentifierPair(ctorParam.argument, superArg.argument) ); } /** * Checks whether given 2 nodes have the same value or not. * * @param {ASTNode} ctorParam - A node to check. * @param {ASTNode} superArg - A node to check. * @returns {boolean} `true` if the nodes have the same value or not. */ function isValidPair(ctorParam, superArg) { return ( isValidIdentifierPair(ctorParam, superArg) || isValidRestSpreadPair(ctorParam, superArg) ); } /** * Checks whether the parameters of a constructor and the arguments of `super()` * have the same values or not. * * @param {ASTNode} ctorParams - The parameters of a constructor to check. * @param {ASTNode} superArgs - The arguments of `super()` to check. * @returns {boolean} `true` if those have the same values. */ function isPassingThrough(ctorParams, superArgs) { if (ctorParams.length !== superArgs.length) { return false; } for (var i = 0; i < ctorParams.length; ++i) { if (!isValidPair(ctorParams[i], superArgs[i])) { return false; } } return true; } /** * Checks whether the constructor body is a redundant super call. * * @param {Array} body - constructor body content. * @param {Array} ctorParams - The params to check against super call. * @returns {boolean} true if the construtor body is redundant */ function isRedundantSuperCall(body, ctorParams) { return ( isSingleSuperCall(body) && ctorParams.every(isSimple) && ( isSpreadArguments(body[0].expression.arguments) || isPassingThrough(ctorParams, body[0].expression.arguments) ) ); } //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ module.exports = function(context) { /** * Checks whether a node is a redundant constructor * @param {ASTNode} node - node to check * @returns {void} */ function checkForConstructor(node) { if (node.kind !== "constructor") { return; } var body = node.value.body.body; var ctorParams = node.value.params; var superClass = node.parent.parent.superClass; if (superClass ? isRedundantSuperCall(body, ctorParams) : (body.length === 0)) { context.report({ node: node, message: "Useless constructor." }); } } return { "MethodDefinition": checkForConstructor }; }; module.exports.schema = [];
'use strict'; /* global jqLiteRemove */ var ngOptionsMinErr = minErr('ngOptions'); /** * @ngdoc directive * @name ngOptions * @restrict A * * @description * * The `ngOptions` attribute can be used to dynamically generate a list of `<option>` * elements for the `<select>` element using the array or object obtained by evaluating the * `ngOptions` comprehension expression. * * In many cases, `ngRepeat` can be used on `<option>` elements instead of `ngOptions` to achieve a * similar result. However, `ngOptions` provides some benefits such as reducing memory and * increasing speed by not creating a new scope for each repeated instance, as well as providing * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the * comprehension expression. `ngOptions` should be used when the `<select>` model needs to be bound * to a non-string value. This is because an option element can only be bound to string values at * present. * * When an item in the `<select>` menu is selected, the array element or object property * represented by the selected option will be bound to the model identified by the `ngModel` * directive. * * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can * be nested into the `<select>` element. This element will then represent the `null` or "not selected" * option. See example below for demonstration. * * <div class="alert alert-warning"> * **Note:** `ngModel` compares by reference, not value. This is important when binding to an * array of objects. See an example [in this jsfiddle](http://jsfiddle.net/qWzTb/). * </div> * * ## `select` **`as`** * * Using `select` **`as`** will bind the result of the `select` expression to the model, but * the value of the `<select>` and `<option>` html elements will be either the index (for array data sources) * or property name (for object data sources) of the value within the collection. If a **`track by`** expression * is used, the result of that expression will be set as the value of the `option` and `select` elements. * * * ### `select` **`as`** and **`track by`** * * <div class="alert alert-warning"> * Do not use `select` **`as`** and **`track by`** in the same expression. They are not designed to work together. * </div> * * Consider the following example: * * ```html * <select ng-options="item.subItem as item.label for item in values track by item.id" ng-model="selected"> * ``` * * ```js * $scope.values = [{ * id: 1, * label: 'aLabel', * subItem: { name: 'aSubItem' } * }, { * id: 2, * label: 'bLabel', * subItem: { name: 'bSubItem' } * }]; * * $scope.selected = { name: 'aSubItem' }; * ``` * * With the purpose of preserving the selection, the **`track by`** expression is always applied to the element * of the data source (to `item` in this example). To calculate whether an element is selected, we do the * following: * * 1. Apply **`track by`** to the elements in the array. In the example: `[1, 2]` * 2. Apply **`track by`** to the already selected value in `ngModel`. * In the example: this is not possible as **`track by`** refers to `item.id`, but the selected * value from `ngModel` is `{name: 'aSubItem'}`, so the **`track by`** expression is applied to * a wrong object, the selected element can't be found, `<select>` is always reset to the "not * selected" option. * * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} required The control is considered valid only if value is entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of * `required` when you want to data-bind to the `required` attribute. * @param {comprehension_expression=} ngOptions in one of the following forms: * * * for array data sources: * * `label` **`for`** `value` **`in`** `array` * * `select` **`as`** `label` **`for`** `value` **`in`** `array` * * `label` **`group by`** `group` **`for`** `value` **`in`** `array` * * `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr` * * `label` **`for`** `value` **`in`** `array` | orderBy:`orderexpr` **`track by`** `trackexpr` * (for including a filter with `track by`) * * for object data sources: * * `label` **`for (`**`key` **`,`** `value`**`) in`** `object` * * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object` * * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object` * * `select` **`as`** `label` **`group by`** `group` * **`for` `(`**`key`**`,`** `value`**`) in`** `object` * * Where: * * * `array` / `object`: an expression which evaluates to an array / object to iterate over. * * `value`: local variable which will refer to each item in the `array` or each property value * of `object` during iteration. * * `key`: local variable which will refer to a property name in `object` during iteration. * * `label`: The result of this expression will be the label for `<option>` element. The * `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`). * * `select`: The result of this expression will be bound to the model of the parent `<select>` * element. If not specified, `select` expression will default to `value`. * * `group`: The result of this expression will be used to group options using the `<optgroup>` * DOM element. * * `trackexpr`: Used when working with an array of objects. The result of this expression will be * used to identify the objects in the array. The `trackexpr` will most likely refer to the * `value` variable (e.g. `value.propertyName`). With this the selection is preserved * even when the options are recreated (e.g. reloaded from the server). * * @example <example module="selectExample"> <file name="index.html"> <script> angular.module('selectExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.colors = [ {name:'black', shade:'dark'}, {name:'white', shade:'light'}, {name:'red', shade:'dark'}, {name:'blue', shade:'dark'}, {name:'yellow', shade:'light'} ]; $scope.myColor = $scope.colors[2]; // red }]); </script> <div ng-controller="ExampleController"> <ul> <li ng-repeat="color in colors"> Name: <input ng-model="color.name"> [<a href ng-click="colors.splice($index, 1)">X</a>] </li> <li> [<a href ng-click="colors.push({})">add</a>] </li> </ul> <hr/> Color (null not allowed): <select ng-model="myColor" ng-options="color.name for color in colors"></select><br> Color (null allowed): <span class="nullable"> <select ng-model="myColor" ng-options="color.name for color in colors"> <option value="">-- choose color --</option> </select> </span><br/> Color grouped by shade: <select ng-model="myColor" ng-options="color.name group by color.shade for color in colors"> </select><br/> Select <a href ng-click="myColor = { name:'not in list', shade: 'other' }">bogus</a>.<br> <hr/> Currently selected: {{ {selected_color:myColor} }} <div style="border:solid 1px black; height:20px" ng-style="{'background-color':myColor.name}"> </div> </div> </file> <file name="protractor.js" type="protractor"> it('should check ng-options', function() { expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('red'); element.all(by.model('myColor')).first().click(); element.all(by.css('select[ng-model="myColor"] option')).first().click(); expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black'); element(by.css('.nullable select[ng-model="myColor"]')).click(); element.all(by.css('.nullable select[ng-model="myColor"] option')).first().click(); expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('null'); }); </file> </example> */ // jshint maxlen: false //000011111111110000000000022222222220000000000000000000003333333333000000000000004444444444444440000000005555555555555550000000666666666666666000000000000000777777777700000000000000000008888888888 var NG_OPTIONS_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/; // 1: value expression (valueFn) // 2: label expression (displayFn) // 3: group by expression (groupByFn) // 4: array item variable name // 5: object item key variable name // 6: object item value variable name // 7: collection expression // 8: track by expression // jshint maxlen: 100 var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) { function parseOptionsExpression(optionsExp, selectElement, scope) { var match = optionsExp.match(NG_OPTIONS_REGEXP); if (!(match)) { throw ngOptionsMinErr('iexp', "Expected expression in form of " + "'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" + " but got '{0}'. Element: {1}", optionsExp, startingTag(selectElement)); } // Extract the parts from the ngOptions expression // The variable name for the value of the item in the collection var valueName = match[4] || match[6]; // The variable name for the key of the item in the collection var keyName = match[5]; // An expression that generates the viewValue for an option if there is a label expression var selectAs = / as /.test(match[0]) && match[1]; // An expression that is used to track the id of each object in the options collection var trackBy = match[8]; // An expression that generates the viewValue for an option if there is no label expression var valueFn = $parse(match[2] ? match[1] : valueName); var selectAsFn = selectAs && $parse(selectAs); var viewValueFn = selectAsFn || valueFn; var trackByFn = trackBy && $parse(trackBy); // Get the value by which we are going to track the option // if we have a trackFn then use that (passing scope and locals) // otherwise just hash the given viewValue var getTrackByValue = trackBy ? function(viewValue, locals) { return trackByFn(scope, locals); } : function getHashOfValue(viewValue) { return hashKey(viewValue); }; var displayFn = $parse(match[2] || match[1]); var groupByFn = $parse(match[3] || ''); var valuesFn = $parse(match[7]); var locals = {}; var getLocals = keyName ? function(value, key) { locals[keyName] = key; locals[valueName] = value; return locals; } : function(value) { locals[valueName] = value; return locals; }; function Option(selectValue, viewValue, label, group) { this.selectValue = selectValue; this.viewValue = viewValue; this.label = label; this.group = group; } return { getWatchables: $parse(valuesFn, function(values) { // Create a collection of things that we would like to watch (watchedArray) // so that they can all be watched using a single $watchCollection // that only runs the handler once if anything changes var watchedArray = []; values = values || []; Object.keys(values).forEach(function getWatchable(key) { var locals = getLocals(values[key], key); var label = displayFn(scope, locals); var selectValue = getTrackByValue(values[key], locals); watchedArray.push(selectValue); watchedArray.push(label); }); return watchedArray; }), getOptions: function() { var optionItems = []; var selectValueMap = {}; // The option values were already computed in the `getWatchables` fn, // which must have been called to trigger `getOptions` var optionValues = valuesFn(scope) || []; var keys = Object.keys(optionValues); keys.forEach(function getOption(key) { // Ignore "angular" properties that start with $ or $$ if (key.charAt(0) === '$') return; var value = optionValues[key]; var locals = getLocals(value, key); var viewValue = viewValueFn(scope, locals); var selectValue = getTrackByValue(viewValue, locals); var label = displayFn(scope, locals); var group = groupByFn(scope, locals); var optionItem = new Option(selectValue, viewValue, label, group); optionItems.push(optionItem); selectValueMap[selectValue] = optionItem; }); return { items: optionItems, selectValueMap: selectValueMap, getOptionFromViewValue: function(value) { return selectValueMap[getTrackByValue(value, getLocals(value))]; } }; } }; } // we can't just jqLite('<option>') since jqLite is not smart enough // to create it in <select> and IE barfs otherwise. var optionTemplate = document.createElement('option'), optGroupTemplate = document.createElement('optgroup'); return { restrict: 'A', terminal: true, require: ['select', '?ngModel'], link: function(scope, selectElement, attr, ctrls) { // if ngModel is not defined, we don't need to do anything var ngModelCtrl = ctrls[1]; if (!ngModelCtrl) return; var selectCtrl = ctrls[0]; var multiple = attr.multiple; var emptyOption = selectCtrl.emptyOption; var providedEmptyOption = !!emptyOption; var unknownOption = jqLite(optionTemplate.cloneNode(false)); unknownOption.val('?'); var options; var ngOptions = parseOptionsExpression(attr.ngOptions, selectElement, scope); var renderEmptyOption = function() { if (!providedEmptyOption) { selectElement.prepend(emptyOption); } selectElement.val(''); emptyOption.prop('selected', true); // needed for IE emptyOption.attr('selected', true); }; var removeEmptyOption = function() { if (!providedEmptyOption) { emptyOption.remove(); } }; var renderUnknownOption = function() { selectElement.prepend(unknownOption); selectElement.val('?'); unknownOption.prop('selected', true); // needed for IE unknownOption.attr('selected', true); }; var removeUnknownOption = function() { unknownOption.remove(); }; selectCtrl.writeValue = function writeNgOptionsValue(value) { var option = options.getOptionFromViewValue(value); if (option) { if (selectElement[0].value !== option.selectValue) { removeUnknownOption(); removeEmptyOption(); selectElement[0].value = option.selectValue; option.element.selected = true; option.element.setAttribute('selected', 'selected'); } } else { if (value === null || providedEmptyOption) { removeUnknownOption(); renderEmptyOption(); } else { removeEmptyOption(); renderUnknownOption(); } } }; selectCtrl.readValue = function readNgOptionsValue() { var selectedOption = options.selectValueMap[selectElement.val()]; if (selectedOption) { removeEmptyOption(); removeUnknownOption(); return selectedOption.viewValue; } return null; }; // Update the controller methods for multiple selectable options if (multiple) { ngModelCtrl.$isEmpty = function(value) { return !value || value.length === 0; }; selectCtrl.writeValue = function writeNgOptionsMultiple(value) { options.items.forEach(function(option) { option.element.selected = false; }); if (value) { value.forEach(function(item) { var option = options.getOptionFromViewValue(item); if (option) option.element.selected = true; }); } }; selectCtrl.readValue = function readNgOptionsMultiple() { var selectedValues = selectElement.val() || []; return selectedValues.map(function(selectedKey) { var option = options.selectValueMap[selectedKey]; return option.viewValue; }); }; } if (providedEmptyOption) { // we need to remove it before calling selectElement.empty() because otherwise IE will // remove the label from the element. wtf? emptyOption.remove(); // compile the element since there might be bindings in it $compile(emptyOption)(scope); // remove the class, which is added automatically because we recompile the element and it // becomes the compilation root emptyOption.removeClass('ng-scope'); } else { emptyOption = jqLite(optionTemplate.cloneNode(false)); } // We need to do this here to ensure that the options object is defined // when we first hit it in writeNgOptionsValue updateOptions(); // We will re-render the option elements if the option values or labels change scope.$watchCollection(ngOptions.getWatchables, updateOptions); // ------------------------------------------------------------------ // function updateOptionElement(option, element) { option.element = element; if (option.value !== element.value) element.value = option.selectValue; if (option.label !== element.label) { element.label = option.label; element.textContent = option.label; } } function addOrReuseElement(parent, current, type, templateElement) { var element; // Check whether we can reuse the next element if (current && lowercase(current.nodeName) === type) { // The next element is the right type so reuse it element = current; } else { // The next element is not the right type so create a new one element = templateElement.cloneNode(false); if (!current) { // There are no more elements so just append it to the select parent.appendChild(element); } else { // The next element is not a group so insert the new one parent.insertBefore(element, current); } } return element; } function removeExcessElements(current) { var next; while (current) { next = current.nextSibling; jqLiteRemove(current); current = next; } } function skipEmptyAndUnknownOptions(current) { var emptyOption_ = emptyOption && emptyOption[0]; var unknownOption_ = unknownOption && unknownOption[0]; if (emptyOption_ || unknownOption_) { while (current && (current === emptyOption_ || current === unknownOption_)) { current = current.nextSibling; } } return current; } function updateOptions() { var previousValue = options && selectCtrl.readValue(); options = ngOptions.getOptions(); var groupMap = {}; var currentElement = selectElement[0].firstChild; // Ensure that the empty option is always there if it was explicitly provided if (providedEmptyOption) { selectElement.prepend(emptyOption); } currentElement = skipEmptyAndUnknownOptions(currentElement); options.items.forEach(function updateOption(option) { var group; var groupElement; var optionElement; if (option.group) { // This option is to live in a group // See if we have already created this group group = groupMap[option.group]; if (!group) { // We have not already created this group groupElement = addOrReuseElement(selectElement[0], currentElement, 'optgroup', optGroupTemplate); // Move to the next element currentElement = groupElement.nextSibling; // Update the label on the group element groupElement.label = option.group; // Store it for use later group = groupMap[option.group] = { groupElement: groupElement, currentOptionElement: groupElement.firstChild }; } // So now we have a group for this option we add the option to the group optionElement = addOrReuseElement(group.groupElement, group.currentOptionElement, 'option', optionTemplate); updateOptionElement(option, optionElement); // Move to the next element group.currentOptionElement = optionElement.nextSibling; } else { // This option is not in a group optionElement = addOrReuseElement(selectElement[0], currentElement, 'option', optionTemplate); updateOptionElement(option, optionElement); // Move to the next element currentElement = optionElement.nextSibling; } }); // Now remove all excess options and group Object.keys(groupMap).forEach(function(key) { removeExcessElements(groupMap[key].currentOptionElement); }); removeExcessElements(currentElement); ngModelCtrl.$render(); // Check to see if the value has changed due to the update to the options if (!ngModelCtrl.$isEmpty(previousValue)) { var nextValue = selectCtrl.readValue(); if (!equals(previousValue, nextValue)) { ngModelCtrl.$setViewValue(nextValue); } } } } }; }];
!function(n){n(function(){n(document).trigger("enhance.tablesaw")})}(shoestring||jQuery);
#!/usr/bin/env node var args = process.argv; var SDC = require('../lib/statsd-client'), sdc = new SDC({ host: 'localhost', prefix: args[2] || 'data.generator' }), rand, time = new Date(), iterations = 0; function sendSomeData() { iterations += 1; if (iterations % 10 === 0) { process.stdout.write('\r' + ['โ—’', 'โ—', 'โ—“', 'โ—‘'][iterations/10 % 4]); iterations = iterations >= 40 ? 0 : iterations; } rand = Math.round(Math.random() * 10); sdc.gauge('gauge' + rand, rand); sdc.counter('counter' + rand, rand); sdc.set('set' + rand, rand); sdc.timing('timer' + rand, time); time = new Date(); setTimeout(sendSomeData, rand); } sendSomeData();
'use strict'; var agents = require('caniuse-db/data.json').agents; module.exports = { formatBrowserName: function formatBrowserName(browserKey, versions) { var browserName = (agents[browserKey] || {}).browser; if (!versions) { return browserName; } return browserName + ' (' + versions.join(',') + ')'; } };
/*! * Justified Gallery - v3.6.5 * http://miromannino.github.io/Justified-Gallery/ * Copyright (c) 2018 Miro Mannino * Licensed under the MIT license. */ (function($) { function hasScrollBar() { return $("body").height() > $(window).height(); } /** * Justified Gallery controller constructor * * @param $gallery the gallery to build * @param settings the settings (the defaults are in $.fn.justifiedGallery.defaults) * @constructor */ var JustifiedGallery = function ($gallery, settings) { this.settings = settings; this.checkSettings(); this.imgAnalyzerTimeout = null; this.entries = null; this.buildingRow = { entriesBuff : [], width : 0, height : 0, aspectRatio : 0 }; this.lastFetchedEntry = null; this.lastAnalyzedIndex = -1; this.yield = { every : 2, // do a flush every n flushes (must be greater than 1) flushed : 0 // flushed rows without a yield }; this.border = settings.border >= 0 ? settings.border : settings.margins; this.maxRowHeight = this.retrieveMaxRowHeight(); this.suffixRanges = this.retrieveSuffixRanges(); this.offY = this.border; this.rows = 0; this.spinner = { phase : 0, timeSlot : 150, $el : $('<div class="spinner"><span></span><span></span><span></span></div>'), intervalId : null }; this.checkWidthIntervalId = null; this.galleryWidth = $gallery.width(); this.$gallery = $gallery; }; /** @returns {String} the best suffix given the width and the height */ JustifiedGallery.prototype.getSuffix = function (width, height) { var longestSide, i; longestSide = (width > height) ? width : height; for (i = 0; i < this.suffixRanges.length; i++) { if (longestSide <= this.suffixRanges[i]) { return this.settings.sizeRangeSuffixes[this.suffixRanges[i]]; } } return this.settings.sizeRangeSuffixes[this.suffixRanges[i - 1]]; }; /** * Remove the suffix from the string * * @returns {string} a new string without the suffix */ JustifiedGallery.prototype.removeSuffix = function (str, suffix) { return str.substring(0, str.length - suffix.length); }; /** * @returns {boolean} a boolean to say if the suffix is contained in the str or not */ JustifiedGallery.prototype.endsWith = function (str, suffix) { return str.indexOf(suffix, str.length - suffix.length) !== -1; }; /** * Get the used suffix of a particular url * * @param str * @returns {String} return the used suffix */ JustifiedGallery.prototype.getUsedSuffix = function (str) { for (var si in this.settings.sizeRangeSuffixes) { if (this.settings.sizeRangeSuffixes.hasOwnProperty(si)) { if (this.settings.sizeRangeSuffixes[si].length === 0) continue; if (this.endsWith(str, this.settings.sizeRangeSuffixes[si])) return this.settings.sizeRangeSuffixes[si]; } } return ''; }; /** * Given an image src, with the width and the height, returns the new image src with the * best suffix to show the best quality thumbnail. * * @returns {String} the suffix to use */ JustifiedGallery.prototype.newSrc = function (imageSrc, imgWidth, imgHeight, image) { var newImageSrc; if (this.settings.thumbnailPath) { newImageSrc = this.settings.thumbnailPath(imageSrc, imgWidth, imgHeight, image); } else { var matchRes = imageSrc.match(this.settings.extension); var ext = (matchRes !== null) ? matchRes[0] : ''; newImageSrc = imageSrc.replace(this.settings.extension, ''); newImageSrc = this.removeSuffix(newImageSrc, this.getUsedSuffix(newImageSrc)); newImageSrc += this.getSuffix(imgWidth, imgHeight) + ext; } return newImageSrc; }; /** * Shows the images that is in the given entry * * @param $entry the entry * @param callback the callback that is called when the show animation is finished */ JustifiedGallery.prototype.showImg = function ($entry, callback) { if (this.settings.cssAnimation) { $entry.addClass('entry-visible'); if (callback) callback(); } else { $entry.stop().fadeTo(this.settings.imagesAnimationDuration, 1.0, callback); $entry.find(this.settings.imgSelector).stop().fadeTo(this.settings.imagesAnimationDuration, 1.0, callback); } }; /** * Extract the image src form the image, looking from the 'safe-src', and if it can't be found, from the * 'src' attribute. It saves in the image data the 'jg.originalSrc' field, with the extracted src. * * @param $image the image to analyze * @returns {String} the extracted src */ JustifiedGallery.prototype.extractImgSrcFromImage = function ($image) { var imageSrc = (typeof $image.data('safe-src') !== 'undefined') ? $image.data('safe-src') : $image.attr('src'); $image.data('jg.originalSrc', imageSrc); return imageSrc; }; /** @returns {jQuery} the image in the given entry */ JustifiedGallery.prototype.imgFromEntry = function ($entry) { var $img = $entry.find(this.settings.imgSelector); return $img.length === 0 ? null : $img; }; /** @returns {jQuery} the caption in the given entry */ JustifiedGallery.prototype.captionFromEntry = function ($entry) { var $caption = $entry.find('> .caption'); return $caption.length === 0 ? null : $caption; }; /** * Display the entry * * @param {jQuery} $entry the entry to display * @param {int} x the x position where the entry must be positioned * @param y the y position where the entry must be positioned * @param imgWidth the image width * @param imgHeight the image height * @param rowHeight the row height of the row that owns the entry */ JustifiedGallery.prototype.displayEntry = function ($entry, x, y, imgWidth, imgHeight, rowHeight) { $entry.width(imgWidth); $entry.height(rowHeight); $entry.css('top', y); $entry.css('left', x); var $image = this.imgFromEntry($entry); if ($image !== null) { $image.css('width', imgWidth); $image.css('height', imgHeight); $image.css('margin-left', - imgWidth / 2); $image.css('margin-top', - imgHeight / 2); // Image reloading for an high quality of thumbnails var imageSrc = $image.attr('src'); var newImageSrc = this.newSrc(imageSrc, imgWidth, imgHeight, $image[0]); $image.one('error', function () { $image.attr('src', $image.data('jg.originalSrc')); //revert to the original thumbnail, we got it. }); var loadNewImage = function () { if (imageSrc !== newImageSrc) { //load the new image after the fadeIn $image.attr('src', newImageSrc); } }; if ($entry.data('jg.loaded') === 'skipped') { this.onImageEvent(imageSrc, $.proxy(function() { this.showImg($entry, loadNewImage); $entry.data('jg.loaded', true); }, this)); } else { this.showImg($entry, loadNewImage); } } else { this.showImg($entry); } this.displayEntryCaption($entry); }; /** * Display the entry caption. If the caption element doesn't exists, it creates the caption using the 'alt' * or the 'title' attributes. * * @param {jQuery} $entry the entry to process */ JustifiedGallery.prototype.displayEntryCaption = function ($entry) { var $image = this.imgFromEntry($entry); if ($image !== null && this.settings.captions) { var $imgCaption = this.captionFromEntry($entry); // Create it if it doesn't exists if ($imgCaption === null) { var caption = $image.attr('alt'); if (!this.isValidCaption(caption)) caption = $entry.attr('title'); if (this.isValidCaption(caption)) { // Create only we found something $imgCaption = $('<div class="caption">' + caption + '</div>'); $entry.append($imgCaption); $entry.data('jg.createdCaption', true); } } // Create events (we check again the $imgCaption because it can be still inexistent) if ($imgCaption !== null) { if (!this.settings.cssAnimation) $imgCaption.stop().fadeTo(0, this.settings.captionSettings.nonVisibleOpacity); this.addCaptionEventsHandlers($entry); } } else { this.removeCaptionEventsHandlers($entry); } }; /** * Validates the caption * * @param caption The caption that should be validated * @return {boolean} Validation result */ JustifiedGallery.prototype.isValidCaption = function (caption) { return (typeof caption !== 'undefined' && caption.length > 0); }; /** * The callback for the event 'mouseenter'. It assumes that the event currentTarget is an entry. * It shows the caption using jQuery (or using CSS if it is configured so) * * @param {Event} eventObject the event object */ JustifiedGallery.prototype.onEntryMouseEnterForCaption = function (eventObject) { var $caption = this.captionFromEntry($(eventObject.currentTarget)); if (this.settings.cssAnimation) { $caption.addClass('caption-visible').removeClass('caption-hidden'); } else { $caption.stop().fadeTo(this.settings.captionSettings.animationDuration, this.settings.captionSettings.visibleOpacity); } }; /** * The callback for the event 'mouseleave'. It assumes that the event currentTarget is an entry. * It hides the caption using jQuery (or using CSS if it is configured so) * * @param {Event} eventObject the event object */ JustifiedGallery.prototype.onEntryMouseLeaveForCaption = function (eventObject) { var $caption = this.captionFromEntry($(eventObject.currentTarget)); if (this.settings.cssAnimation) { $caption.removeClass('caption-visible').removeClass('caption-hidden'); } else { $caption.stop().fadeTo(this.settings.captionSettings.animationDuration, this.settings.captionSettings.nonVisibleOpacity); } }; /** * Add the handlers of the entry for the caption * * @param $entry the entry to modify */ JustifiedGallery.prototype.addCaptionEventsHandlers = function ($entry) { var captionMouseEvents = $entry.data('jg.captionMouseEvents'); if (typeof captionMouseEvents === 'undefined') { captionMouseEvents = { mouseenter: $.proxy(this.onEntryMouseEnterForCaption, this), mouseleave: $.proxy(this.onEntryMouseLeaveForCaption, this) }; $entry.on('mouseenter', undefined, undefined, captionMouseEvents.mouseenter); $entry.on('mouseleave', undefined, undefined, captionMouseEvents.mouseleave); $entry.data('jg.captionMouseEvents', captionMouseEvents); } }; /** * Remove the handlers of the entry for the caption * * @param $entry the entry to modify */ JustifiedGallery.prototype.removeCaptionEventsHandlers = function ($entry) { var captionMouseEvents = $entry.data('jg.captionMouseEvents'); if (typeof captionMouseEvents !== 'undefined') { $entry.off('mouseenter', undefined, captionMouseEvents.mouseenter); $entry.off('mouseleave', undefined, captionMouseEvents.mouseleave); $entry.removeData('jg.captionMouseEvents'); } }; /** * Clear the building row data to be used for a new row */ JustifiedGallery.prototype.clearBuildingRow = function () { this.buildingRow.entriesBuff = []; this.buildingRow.aspectRatio = 0; this.buildingRow.width = 0; }; /** * Justify the building row, preparing it to * * @param isLastRow * @returns a boolean to know if the row has been justified or not */ JustifiedGallery.prototype.prepareBuildingRow = function (isLastRow) { var i, $entry, imgAspectRatio, newImgW, newImgH, justify = true; var minHeight = 0; var availableWidth = this.galleryWidth - 2 * this.border - ( (this.buildingRow.entriesBuff.length - 1) * this.settings.margins); var rowHeight = availableWidth / this.buildingRow.aspectRatio; var defaultRowHeight = this.settings.rowHeight; var justifiable = this.buildingRow.width / availableWidth > this.settings.justifyThreshold; //Skip the last row if we can't justify it and the lastRow == 'hide' if (isLastRow && this.settings.lastRow === 'hide' && !justifiable) { for (i = 0; i < this.buildingRow.entriesBuff.length; i++) { $entry = this.buildingRow.entriesBuff[i]; if (this.settings.cssAnimation) $entry.removeClass('entry-visible'); else { $entry.stop().fadeTo(0, 0.1); $entry.find('> img, > a > img').fadeTo(0, 0); } } return -1; } // With lastRow = nojustify, justify if is justificable (the images will not become too big) if (isLastRow && !justifiable && this.settings.lastRow !== 'justify' && this.settings.lastRow !== 'hide') { justify = false; if (this.rows > 0) { defaultRowHeight = (this.offY - this.border - this.settings.margins * this.rows) / this.rows; justify = defaultRowHeight * this.buildingRow.aspectRatio / availableWidth > this.settings.justifyThreshold; } } for (i = 0; i < this.buildingRow.entriesBuff.length; i++) { $entry = this.buildingRow.entriesBuff[i]; imgAspectRatio = $entry.data('jg.width') / $entry.data('jg.height'); if (justify) { newImgW = (i === this.buildingRow.entriesBuff.length - 1) ? availableWidth : rowHeight * imgAspectRatio; newImgH = rowHeight; } else { newImgW = defaultRowHeight * imgAspectRatio; newImgH = defaultRowHeight; } availableWidth -= Math.round(newImgW); $entry.data('jg.jwidth', Math.round(newImgW)); $entry.data('jg.jheight', Math.ceil(newImgH)); if (i === 0 || minHeight > newImgH) minHeight = newImgH; } this.buildingRow.height = minHeight; return justify; }; /** * Flush a row: justify it, modify the gallery height accordingly to the row height * * @param isLastRow */ JustifiedGallery.prototype.flushRow = function (isLastRow) { var settings = this.settings; var $entry, buildingRowRes, offX = this.border, i; buildingRowRes = this.prepareBuildingRow(isLastRow); if (isLastRow && settings.lastRow === 'hide' && buildingRowRes === -1) { this.clearBuildingRow(); return; } if(this.maxRowHeight) { if(this.maxRowHeight < this.buildingRow.height) this.buildingRow.height = this.maxRowHeight; } //Align last (unjustified) row if (isLastRow && (settings.lastRow === 'center' || settings.lastRow === 'right')) { var availableWidth = this.galleryWidth - 2 * this.border - (this.buildingRow.entriesBuff.length - 1) * settings.margins; for (i = 0; i < this.buildingRow.entriesBuff.length; i++) { $entry = this.buildingRow.entriesBuff[i]; availableWidth -= $entry.data('jg.jwidth'); } if (settings.lastRow === 'center') offX += availableWidth / 2; else if (settings.lastRow === 'right') offX += availableWidth; } var lastEntryIdx = this.buildingRow.entriesBuff.length - 1; for (i = 0; i <= lastEntryIdx; i++) { $entry = this.buildingRow.entriesBuff[ this.settings.rtl ? lastEntryIdx - i : i ]; this.displayEntry($entry, offX, this.offY, $entry.data('jg.jwidth'), $entry.data('jg.jheight'), this.buildingRow.height); offX += $entry.data('jg.jwidth') + settings.margins; } //Gallery Height this.galleryHeightToSet = this.offY + this.buildingRow.height + this.border; this.setGalleryTempHeight(this.galleryHeightToSet + this.getSpinnerHeight()); if (!isLastRow || (this.buildingRow.height <= settings.rowHeight && buildingRowRes)) { //Ready for a new row this.offY += this.buildingRow.height + settings.margins; this.rows += 1; this.clearBuildingRow(); this.$gallery.trigger('jg.rowflush'); } }; // Scroll position not restoring: https://github.com/miromannino/Justified-Gallery/issues/221 var galleryPrevStaticHeight = 0; JustifiedGallery.prototype.rememberGalleryHeight = function () { galleryPrevStaticHeight = this.$gallery.height(); this.$gallery.height(galleryPrevStaticHeight); }; // grow only JustifiedGallery.prototype.setGalleryTempHeight = function (height) { galleryPrevStaticHeight = Math.max(height, galleryPrevStaticHeight); this.$gallery.height(galleryPrevStaticHeight); }; JustifiedGallery.prototype.setGalleryFinalHeight = function (height) { galleryPrevStaticHeight = height; this.$gallery.height(height); }; /** * Checks the width of the gallery container, to know if a new justification is needed */ var scrollBarOn = false; JustifiedGallery.prototype.checkWidth = function () { this.checkWidthIntervalId = setInterval($.proxy(function () { // if the gallery is not currently visible, abort. if (!this.$gallery.is(":visible")) return; var galleryWidth = parseFloat(this.$gallery.width()); if (hasScrollBar() === scrollBarOn) { if (Math.abs(galleryWidth - this.galleryWidth) > this.settings.refreshSensitivity) { this.galleryWidth = galleryWidth; this.rewind(); this.rememberGalleryHeight(); // Restart to analyze this.startImgAnalyzer(true); } } else { scrollBarOn = hasScrollBar(); this.galleryWidth = galleryWidth; } }, this), this.settings.refreshTime); }; /** * @returns {boolean} a boolean saying if the spinner is active or not */ JustifiedGallery.prototype.isSpinnerActive = function () { return this.spinner.intervalId !== null; }; /** * @returns {int} the spinner height */ JustifiedGallery.prototype.getSpinnerHeight = function () { return this.spinner.$el.innerHeight(); }; /** * Stops the spinner animation and modify the gallery height to exclude the spinner */ JustifiedGallery.prototype.stopLoadingSpinnerAnimation = function () { clearInterval(this.spinner.intervalId); this.spinner.intervalId = null; this.setGalleryTempHeight(this.$gallery.height() - this.getSpinnerHeight()); this.spinner.$el.detach(); }; /** * Starts the spinner animation */ JustifiedGallery.prototype.startLoadingSpinnerAnimation = function () { var spinnerContext = this.spinner; var $spinnerPoints = spinnerContext.$el.find('span'); clearInterval(spinnerContext.intervalId); this.$gallery.append(spinnerContext.$el); this.setGalleryTempHeight(this.offY + this.buildingRow.height + this.getSpinnerHeight()); spinnerContext.intervalId = setInterval(function () { if (spinnerContext.phase < $spinnerPoints.length) { $spinnerPoints.eq(spinnerContext.phase).fadeTo(spinnerContext.timeSlot, 1); } else { $spinnerPoints.eq(spinnerContext.phase - $spinnerPoints.length).fadeTo(spinnerContext.timeSlot, 0); } spinnerContext.phase = (spinnerContext.phase + 1) % ($spinnerPoints.length * 2); }, spinnerContext.timeSlot); }; /** * Rewind the image analysis to start from the first entry. */ JustifiedGallery.prototype.rewind = function () { this.lastFetchedEntry = null; this.lastAnalyzedIndex = -1; this.offY = this.border; this.rows = 0; this.clearBuildingRow(); }; /** * Update the entries searching it from the justified gallery HTML element * * @param norewind if norewind only the new entries will be changed (i.e. randomized, sorted or filtered) * @returns {boolean} true if some entries has been founded */ JustifiedGallery.prototype.updateEntries = function (norewind) { var newEntries; if (norewind && this.lastFetchedEntry != null) { newEntries = $(this.lastFetchedEntry).nextAll(this.settings.selector).toArray(); } else { this.entries = []; newEntries = this.$gallery.children(this.settings.selector).toArray(); } if (newEntries.length > 0) { // Sort or randomize if ($.isFunction(this.settings.sort)) { newEntries = this.sortArray(newEntries); } else if (this.settings.randomize) { newEntries = this.shuffleArray(newEntries); } this.lastFetchedEntry = newEntries[newEntries.length - 1]; // Filter if (this.settings.filter) { newEntries = this.filterArray(newEntries); } else { this.resetFilters(newEntries); } } this.entries = this.entries.concat(newEntries); return true; }; /** * Apply the entries order to the DOM, iterating the entries and appending the images * * @param entries the entries that has been modified and that must be re-ordered in the DOM */ JustifiedGallery.prototype.insertToGallery = function (entries) { var that = this; $.each(entries, function () { $(this).appendTo(that.$gallery); }); }; /** * Shuffle the array using the Fisher-Yates shuffle algorithm * * @param a the array to shuffle * @return the shuffled array */ JustifiedGallery.prototype.shuffleArray = function (a) { var i, j, temp; for (i = a.length - 1; i > 0; i--) { j = Math.floor(Math.random() * (i + 1)); temp = a[i]; a[i] = a[j]; a[j] = temp; } this.insertToGallery(a); return a; }; /** * Sort the array using settings.comparator as comparator * * @param a the array to sort (it is sorted) * @return the sorted array */ JustifiedGallery.prototype.sortArray = function (a) { a.sort(this.settings.sort); this.insertToGallery(a); return a; }; /** * Reset the filters removing the 'jg-filtered' class from all the entries * * @param a the array to reset */ JustifiedGallery.prototype.resetFilters = function (a) { for (var i = 0; i < a.length; i++) $(a[i]).removeClass('jg-filtered'); }; /** * Filter the entries considering theirs classes (if a string has been passed) or using a function for filtering. * * @param a the array to filter * @return the filtered array */ JustifiedGallery.prototype.filterArray = function (a) { var settings = this.settings; if ($.type(settings.filter) === 'string') { // Filter only keeping the entries passed in the string return a.filter(function (el) { var $el = $(el); if ($el.is(settings.filter)) { $el.removeClass('jg-filtered'); return true; } else { $el.addClass('jg-filtered').removeClass('jg-visible'); return false; } }); } else if ($.isFunction(settings.filter)) { // Filter using the passed function var filteredArr = a.filter(settings.filter); for (var i = 0; i < a.length; i++) { if (filteredArr.indexOf(a[i]) === -1) { $(a[i]).addClass('jg-filtered').removeClass('jg-visible'); } else { $(a[i]).removeClass('jg-filtered'); } } return filteredArr; } }; /** * Destroy the Justified Gallery instance. * * It clears all the css properties added in the style attributes. We doesn't backup the original * values for those css attributes, because it costs (performance) and because in general one * shouldn't use the style attribute for an uniform set of images (where we suppose the use of * classes). Creating a backup is also difficult because JG could be called multiple times and * with different style attributes. */ JustifiedGallery.prototype.destroy = function () { clearInterval(this.checkWidthIntervalId); $.each(this.entries, $.proxy(function(_, entry) { var $entry = $(entry); // Reset entry style $entry.css('width', ''); $entry.css('height', ''); $entry.css('top', ''); $entry.css('left', ''); $entry.data('jg.loaded', undefined); $entry.removeClass('jg-entry'); // Reset image style var $img = this.imgFromEntry($entry); $img.css('width', ''); $img.css('height', ''); $img.css('margin-left', ''); $img.css('margin-top', ''); $img.attr('src', $img.data('jg.originalSrc')); $img.data('jg.originalSrc', undefined); // Remove caption this.removeCaptionEventsHandlers($entry); var $caption = this.captionFromEntry($entry); if ($entry.data('jg.createdCaption')) { // remove also the caption element (if created by jg) $entry.data('jg.createdCaption', undefined); if ($caption !== null) $caption.remove(); } else { if ($caption !== null) $caption.fadeTo(0, 1); } }, this)); this.$gallery.css('height', ''); this.$gallery.removeClass('justified-gallery'); this.$gallery.data('jg.controller', undefined); }; /** * Analyze the images and builds the rows. It returns if it found an image that is not loaded. * * @param isForResize if the image analyzer is called for resizing or not, to call a different callback at the end */ JustifiedGallery.prototype.analyzeImages = function (isForResize) { for (var i = this.lastAnalyzedIndex + 1; i < this.entries.length; i++) { var $entry = $(this.entries[i]); if ($entry.data('jg.loaded') === true || $entry.data('jg.loaded') === 'skipped') { var availableWidth = this.galleryWidth - 2 * this.border - ( (this.buildingRow.entriesBuff.length - 1) * this.settings.margins); var imgAspectRatio = $entry.data('jg.width') / $entry.data('jg.height'); if (availableWidth / (this.buildingRow.aspectRatio + imgAspectRatio) < this.settings.rowHeight) { this.flushRow(false); if(++this.yield.flushed >= this.yield.every) { this.startImgAnalyzer(isForResize); return; } } this.buildingRow.entriesBuff.push($entry); this.buildingRow.aspectRatio += imgAspectRatio; this.buildingRow.width += imgAspectRatio * this.settings.rowHeight; this.lastAnalyzedIndex = i; } else if ($entry.data('jg.loaded') !== 'error') { return; } } // Last row flush (the row is not full) if (this.buildingRow.entriesBuff.length > 0) this.flushRow(true); if (this.isSpinnerActive()) { this.stopLoadingSpinnerAnimation(); } /* Stop, if there is, the timeout to start the analyzeImages. This is because an image can be set loaded, and the timeout can be set, but this image can be analyzed yet. */ this.stopImgAnalyzerStarter(); //On complete callback this.$gallery.trigger(isForResize ? 'jg.resize' : 'jg.complete'); this.setGalleryFinalHeight(this.galleryHeightToSet); }; /** * Stops any ImgAnalyzer starter (that has an assigned timeout) */ JustifiedGallery.prototype.stopImgAnalyzerStarter = function () { this.yield.flushed = 0; if (this.imgAnalyzerTimeout !== null) { clearTimeout(this.imgAnalyzerTimeout); this.imgAnalyzerTimeout = null; } }; /** * Starts the image analyzer. It is not immediately called to let the browser to update the view * * @param isForResize specifies if the image analyzer must be called for resizing or not */ JustifiedGallery.prototype.startImgAnalyzer = function (isForResize) { var that = this; this.stopImgAnalyzerStarter(); this.imgAnalyzerTimeout = setTimeout(function () { that.analyzeImages(isForResize); }, 0.001); // we can't start it immediately due to a IE different behaviour }; /** * Checks if the image is loaded or not using another image object. We cannot use the 'complete' image property, * because some browsers, with a 404 set complete = true. * * @param imageSrc the image src to load * @param onLoad callback that is called when the image has been loaded * @param onError callback that is called in case of an error */ JustifiedGallery.prototype.onImageEvent = function (imageSrc, onLoad, onError) { if (!onLoad && !onError) return; var memImage = new Image(); var $memImage = $(memImage); if (onLoad) { $memImage.one('load', function () { $memImage.off('load error'); onLoad(memImage); }); } if (onError) { $memImage.one('error', function() { $memImage.off('load error'); onError(memImage); }); } memImage.src = imageSrc; }; /** * Init of Justified Gallery controlled * It analyzes all the entries starting theirs loading and calling the image analyzer (that works with loaded images) */ JustifiedGallery.prototype.init = function () { var imagesToLoad = false, skippedImages = false, that = this; $.each(this.entries, function (index, entry) { var $entry = $(entry); var $image = that.imgFromEntry($entry); $entry.addClass('jg-entry'); if ($entry.data('jg.loaded') !== true && $entry.data('jg.loaded') !== 'skipped') { // Link Rel global overwrite if (that.settings.rel !== null) $entry.attr('rel', that.settings.rel); // Link Target global overwrite if (that.settings.target !== null) $entry.attr('target', that.settings.target); if ($image !== null) { // Image src var imageSrc = that.extractImgSrcFromImage($image); $image.attr('src', imageSrc); /* If we have the height and the width, we don't wait that the image is loaded, but we start directly * with the justification */ if (that.settings.waitThumbnailsLoad === false) { var width = parseFloat($image.prop('width')); var height = parseFloat($image.prop('height')); if (!isNaN(width) && !isNaN(height)) { $entry.data('jg.width', width); $entry.data('jg.height', height); $entry.data('jg.loaded', 'skipped'); skippedImages = true; that.startImgAnalyzer(false); return true; // continue } } $entry.data('jg.loaded', false); imagesToLoad = true; // Spinner start if (!that.isSpinnerActive()) that.startLoadingSpinnerAnimation(); that.onImageEvent(imageSrc, function (loadImg) { // image loaded $entry.data('jg.width', loadImg.width); $entry.data('jg.height', loadImg.height); $entry.data('jg.loaded', true); that.startImgAnalyzer(false); }, function () { // image load error $entry.data('jg.loaded', 'error'); that.startImgAnalyzer(false); }); } else { $entry.data('jg.loaded', true); $entry.data('jg.width', $entry.width() | parseFloat($entry.css('width')) | 1); $entry.data('jg.height', $entry.height() | parseFloat($entry.css('height')) | 1); } } }); if (!imagesToLoad && !skippedImages) this.startImgAnalyzer(false); this.checkWidth(); }; /** * Checks that it is a valid number. If a string is passed it is converted to a number * * @param settingContainer the object that contains the setting (to allow the conversion) * @param settingName the setting name */ JustifiedGallery.prototype.checkOrConvertNumber = function (settingContainer, settingName) { if ($.type(settingContainer[settingName]) === 'string') { settingContainer[settingName] = parseFloat(settingContainer[settingName]); } if ($.type(settingContainer[settingName]) === 'number') { if (isNaN(settingContainer[settingName])) throw 'invalid number for ' + settingName; } else { throw settingName + ' must be a number'; } }; /** * Checks the sizeRangeSuffixes and, if necessary, converts * its keys from string (e.g. old settings with 'lt100') to int. */ JustifiedGallery.prototype.checkSizeRangesSuffixes = function () { if ($.type(this.settings.sizeRangeSuffixes) !== 'object') { throw 'sizeRangeSuffixes must be defined and must be an object'; } var suffixRanges = []; for (var rangeIdx in this.settings.sizeRangeSuffixes) { if (this.settings.sizeRangeSuffixes.hasOwnProperty(rangeIdx)) suffixRanges.push(rangeIdx); } var newSizeRngSuffixes = {0: ''}; for (var i = 0; i < suffixRanges.length; i++) { if ($.type(suffixRanges[i]) === 'string') { try { var numIdx = parseInt(suffixRanges[i].replace(/^[a-z]+/, ''), 10); newSizeRngSuffixes[numIdx] = this.settings.sizeRangeSuffixes[suffixRanges[i]]; } catch (e) { throw 'sizeRangeSuffixes keys must contains correct numbers (' + e + ')'; } } else { newSizeRngSuffixes[suffixRanges[i]] = this.settings.sizeRangeSuffixes[suffixRanges[i]]; } } this.settings.sizeRangeSuffixes = newSizeRngSuffixes; }; /** * check and convert the maxRowHeight setting * requires rowHeight to be already set * TODO: should be always called when only rowHeight is changed * @return number or null */ JustifiedGallery.prototype.retrieveMaxRowHeight = function () { var newMaxRowHeight = null; var rowHeight = this.settings.rowHeight; if ($.type(this.settings.maxRowHeight) === 'string') { if (this.settings.maxRowHeight.match(/^[0-9]+%$/)) { newMaxRowHeight = rowHeight * parseFloat(this.settings.maxRowHeight.match(/^([0-9]+)%$/)[1]) / 100; } else { newMaxRowHeight = parseFloat(this.settings.maxRowHeight); } } else if ($.type(this.settings.maxRowHeight) === 'number') { newMaxRowHeight = this.settings.maxRowHeight; } else if (this.settings.maxRowHeight === false || this.settings.maxRowHeight == null) { return null; } else { throw 'maxRowHeight must be a number or a percentage'; } // check if the converted value is not a number if (isNaN(newMaxRowHeight)) throw 'invalid number for maxRowHeight'; // check values, maxRowHeight must be >= rowHeight if (newMaxRowHeight < rowHeight) newMaxRowHeight = rowHeight; return newMaxRowHeight; }; /** * Checks the settings */ JustifiedGallery.prototype.checkSettings = function () { this.checkSizeRangesSuffixes(); this.checkOrConvertNumber(this.settings, 'rowHeight'); this.checkOrConvertNumber(this.settings, 'margins'); this.checkOrConvertNumber(this.settings, 'border'); var lastRowModes = [ 'justify', 'nojustify', 'left', 'center', 'right', 'hide' ]; if (lastRowModes.indexOf(this.settings.lastRow) === -1) { throw 'lastRow must be one of: ' + lastRowModes.join(', '); } this.checkOrConvertNumber(this.settings, 'justifyThreshold'); if (this.settings.justifyThreshold < 0 || this.settings.justifyThreshold > 1) { throw 'justifyThreshold must be in the interval [0,1]'; } if ($.type(this.settings.cssAnimation) !== 'boolean') { throw 'cssAnimation must be a boolean'; } if ($.type(this.settings.captions) !== 'boolean') throw 'captions must be a boolean'; this.checkOrConvertNumber(this.settings.captionSettings, 'animationDuration'); this.checkOrConvertNumber(this.settings.captionSettings, 'visibleOpacity'); if (this.settings.captionSettings.visibleOpacity < 0 || this.settings.captionSettings.visibleOpacity > 1) { throw 'captionSettings.visibleOpacity must be in the interval [0, 1]'; } this.checkOrConvertNumber(this.settings.captionSettings, 'nonVisibleOpacity'); if (this.settings.captionSettings.nonVisibleOpacity < 0 || this.settings.captionSettings.nonVisibleOpacity > 1) { throw 'captionSettings.nonVisibleOpacity must be in the interval [0, 1]'; } this.checkOrConvertNumber(this.settings, 'imagesAnimationDuration'); this.checkOrConvertNumber(this.settings, 'refreshTime'); this.checkOrConvertNumber(this.settings, 'refreshSensitivity'); if ($.type(this.settings.randomize) !== 'boolean') throw 'randomize must be a boolean'; if ($.type(this.settings.selector) !== 'string') throw 'selector must be a string'; if (this.settings.sort !== false && !$.isFunction(this.settings.sort)) { throw 'sort must be false or a comparison function'; } if (this.settings.filter !== false && !$.isFunction(this.settings.filter) && $.type(this.settings.filter) !== 'string') { throw 'filter must be false, a string or a filter function'; } }; /** * It brings all the indexes from the sizeRangeSuffixes and it orders them. They are then sorted and returned. * @returns {Array} sorted suffix ranges */ JustifiedGallery.prototype.retrieveSuffixRanges = function () { var suffixRanges = []; for (var rangeIdx in this.settings.sizeRangeSuffixes) { if (this.settings.sizeRangeSuffixes.hasOwnProperty(rangeIdx)) suffixRanges.push(parseInt(rangeIdx, 10)); } suffixRanges.sort(function (a, b) { return a > b ? 1 : a < b ? -1 : 0; }); return suffixRanges; }; /** * Update the existing settings only changing some of them * * @param newSettings the new settings (or a subgroup of them) */ JustifiedGallery.prototype.updateSettings = function (newSettings) { // In this case Justified Gallery has been called again changing only some options this.settings = $.extend({}, this.settings, newSettings); this.checkSettings(); // As reported in the settings: negative value = same as margins, 0 = disabled this.border = this.settings.border >= 0 ? this.settings.border : this.settings.margins; this.maxRowHeight = this.retrieveMaxRowHeight(); this.suffixRanges = this.retrieveSuffixRanges(); }; /** * Justified Gallery plugin for jQuery * * Events * - jg.complete : called when all the gallery has been created * - jg.resize : called when the gallery has been resized * - jg.rowflush : when a new row appears * * @param arg the action (or the settings) passed when the plugin is called * @returns {*} the object itself */ $.fn.justifiedGallery = function (arg) { return this.each(function (index, gallery) { var $gallery = $(gallery); $gallery.addClass('justified-gallery'); var controller = $gallery.data('jg.controller'); if (typeof controller === 'undefined') { // Create controller and assign it to the object data if (typeof arg !== 'undefined' && arg !== null && $.type(arg) !== 'object') { if (arg === 'destroy') return; // Just a call to an unexisting object throw 'The argument must be an object'; } controller = new JustifiedGallery($gallery, $.extend({}, $.fn.justifiedGallery.defaults, arg)); $gallery.data('jg.controller', controller); } else if (arg === 'norewind') { // In this case we don't rewind: we analyze only the latest images (e.g. to complete the last unfinished row // ... left to be more readable } else if (arg === 'destroy') { controller.destroy(); return; } else { // In this case Justified Gallery has been called again changing only some options controller.updateSettings(arg); controller.rewind(); } // Update the entries list if (!controller.updateEntries(arg === 'norewind')) return; // Init justified gallery controller.init(); }); }; // Default options $.fn.justifiedGallery.defaults = { sizeRangeSuffixes: { }, /* e.g. Flickr configuration { 100: '_t', // used when longest is less than 100px 240: '_m', // used when longest is between 101px and 240px 320: '_n', // ... 500: '', 640: '_z', 1024: '_b' // used as else case because it is the last } */ thumbnailPath: undefined, /* If defined, sizeRangeSuffixes is not used, and this function is used to determine the path relative to a specific thumbnail size. The function should accept respectively three arguments: current path, width and height */ rowHeight: 120, // required? required to be > 0? maxRowHeight: false, // false or negative value to deactivate. Positive number to express the value in pixels, // A string '[0-9]+%' to express in percentage (e.g. 300% means that the row height // can't exceed 3 * rowHeight) margins: 1, border: -1, // negative value = same as margins, 0 = disabled, any other value to set the border lastRow: 'nojustify', // โ€ฆ which is the same as 'left', or can be 'justify', 'center', 'right' or 'hide' justifyThreshold: 0.90, /* if row width / available space > 0.90 it will be always justified * (i.e. lastRow setting is not considered) */ waitThumbnailsLoad: true, captions: true, cssAnimation: true, imagesAnimationDuration: 500, // ignored with css animations captionSettings: { // ignored with css animations animationDuration: 500, visibleOpacity: 0.7, nonVisibleOpacity: 0.0 }, rel: null, // rewrite the rel of each analyzed links target: null, // rewrite the target of all links extension: /\.[^.\\/]+$/, // regexp to capture the extension of an image refreshTime: 200, // time interval (in ms) to check if the page changes its width refreshSensitivity: 0, // change in width allowed (in px) without re-building the gallery randomize: false, rtl: false, // right-to-left mode sort: false, /* - false: to do not sort - function: to sort them using the function as comparator (see Array.prototype.sort()) */ filter: false, /* - false, null or undefined: for a disabled filter - a string: an entry is kept if entry.is(filter string) returns true see jQuery's .is() function for further information - a function: invoked with arguments (entry, index, array). Return true to keep the entry, false otherwise. It follows the specifications of the Array.prototype.filter() function of JavaScript. */ selector: 'a, div:not(.spinner)', // The selector that is used to know what are the entries of the gallery imgSelector: '> img, > a > img' // The selector that is used to know what are the images of each entry }; }(jQuery));
/*! * Ext JS Library 3.2.1 * Copyright(c) 2006-2010 Ext JS, Inc. * licensing@extjs.com * http://www.extjs.com/license */ Ext.lib.Point = function(x, y) { if (Ext.isArray(x)) { y = x[1]; x = x[0]; } var me = this; me.x = me.right = me.left = me[0] = x; me.y = me.top = me.bottom = me[1] = y; }; Ext.lib.Point.prototype = new Ext.lib.Region();
/* globals RSVP:true */ import Ember from 'ember-metal/core'; import { assert } from 'ember-metal/debug'; import Logger from 'ember-metal/logger'; import run from 'ember-metal/run_loop'; import * as RSVP from 'rsvp'; var testModuleName = 'ember-testing/test'; var Test; var asyncStart = function() { if (Ember.Test && Ember.Test.adapter) { Ember.Test.adapter.asyncStart(); } }; var asyncEnd = function() { if (Ember.Test && Ember.Test.adapter) { Ember.Test.adapter.asyncEnd(); } }; RSVP.configure('async', function(callback, promise) { var async = !run.currentRunLoop; if (Ember.testing && async) { asyncStart(); } run.backburner.schedule('actions', function() { if (Ember.testing && async) { asyncEnd(); } callback(promise); }); }); export function onerrorDefault(e) { var error; if (e && e.errorThrown) { // jqXHR provides this error = e.errorThrown; if (typeof error === 'string') { error = new Error(error); } error.__reason_with_error_thrown__ = e; } else { error = e; } if (error && error.name === "UnrecognizedURLError") { assert("The URL '" + error.message + "' did not match any routes in your application", false); return; } if (error && error.name !== 'TransitionAborted') { if (Ember.testing) { // ES6TODO: remove when possible if (!Test && Ember.__loader.registry[testModuleName]) { Test = requireModule(testModuleName)['default']; } if (Test && Test.adapter) { Test.adapter.exception(error); Logger.error(error.stack); } else { throw error; } } else if (Ember.onerror) { Ember.onerror(error); } else { Logger.error(error.stack); } } } export function after (cb) { Ember.run.schedule(Ember.run.queues[Ember.run.queues.length - 1], cb); } RSVP.on('error', onerrorDefault); RSVP.configure('after', after); export default RSVP;
// I18N constants // LANG: "en", ENCODING: UTF-8 | ISO-8859-1 // Author: Mihai Bazon, http://dynarch.com/mishoo // FOR TRANSLATORS: // // 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE // (at least a valid email address) // // 2. PLEASE TRY TO USE UTF-8 FOR ENCODING; // (if this is not possible, please include a comment // that states what encoding is necessary.) ListType.I18N = { "Decimal" : "Decimal numbers", "Lower roman" : "Lower roman numbers", "Upper roman" : "Upper roman numbers", "Lower latin" : "Lower latin letters", "Upper latin" : "Upper latin letters", "Lower greek" : "Lower greek letters", "ListStyleTooltip" : "Choose list style type (for ordered lists)" };
/* * ------------------------------------------ * ๆธ…้™คๆ ทๅผๅ‘ฝไปคๅฐ่ฃ…ๅฎž็Žฐๆ–‡ไปถ * @version 1.0 * @author cheng-lin(cheng-lin@corp.netease.com) * ------------------------------------------ */ /** util/editor/command/format */ NEJ.define([ 'base/global', 'base/klass', 'util/editor/command' ],function(NEJ,_k,_t0,_p,_o,_f,_r){ /** * ๆธ…้™คๆ ทๅผๅ‘ฝไปคๅฐ่ฃ… * * @class module:util/editor/command/format._$$Format * @extends module:util/editor/command._$$EditorCommand * @param {Object} ๅฏ้€‰้…็ฝฎๅ‚ๆ•ฐ */ _p._$$Format = _k._$klass(); _pro = _p._$$Format._$extend(_t0._$$EditorCommand); /** * ๅ‘ฝไปคๅ็งฐ * @const {String} module:util/editor/command/format._$$Format.command */ _p._$$Format.command = 'format'; /** * ๆ‰ง่กŒๅ‘ฝไปค * * @method module:util/editor/command/format._$$Format#_$execute * @return {Void} */ _pro._$execute = function(){ this.__editor._$setContentNoStyle(); }; // regist command implemention _p._$$Format._$regist(); if (CMPT){ NEJ.copy(NEJ.P('nej.ut.cmd'),_p); } return _p; });
(function (tree) { tree.sourceMapOutput = function (options) { this._css = []; this._rootNode = options.rootNode; this._writeSourceMap = options.writeSourceMap; this._contentsMap = options.contentsMap; this._sourceMapFilename = options.sourceMapFilename; this._outputFilename = options.outputFilename; this._sourceMapBasepath = options.sourceMapBasepath; this._sourceMapRootpath = options.sourceMapRootpath; this._outputSourceFiles = options.outputSourceFiles; this._sourceMapGeneratorConstructor = options.sourceMapGenerator || require("source-map").SourceMapGenerator; if (this._sourceMapRootpath && this._sourceMapRootpath.charAt(this._sourceMapRootpath.length-1) !== '/') { this._sourceMapRootpath += '/'; } this._lineNumber = 0; this._column = 0; }; tree.sourceMapOutput.prototype.normalizeFilename = function(filename) { if (this._sourceMapBasepath && filename.indexOf(this._sourceMapBasepath) === 0) { filename = filename.substring(this._sourceMapBasepath.length); if (filename.charAt(0) === '\\' || filename.charAt(0) === '/') { filename = filename.substring(1); } } return (this._sourceMapRootpath || "") + filename.replace(/\\/g, '/'); }; tree.sourceMapOutput.prototype.add = function(chunk, fileInfo, index, mapLines) { //ignore adding empty strings if (!chunk) { return; } var lines, sourceLines, columns, sourceColumns, i; if (fileInfo) { var inputSource = this._contentsMap[fileInfo.filename].substring(0, index); sourceLines = inputSource.split("\n"); sourceColumns = sourceLines[sourceLines.length-1]; } lines = chunk.split("\n"); columns = lines[lines.length-1]; if (fileInfo) { if (!mapLines) { this._sourceMapGenerator.addMapping({ generated: { line: this._lineNumber + 1, column: this._column}, original: { line: sourceLines.length, column: sourceColumns.length}, source: this.normalizeFilename(fileInfo.filename)}); } else { for(i = 0; i < lines.length; i++) { this._sourceMapGenerator.addMapping({ generated: { line: this._lineNumber + i + 1, column: i === 0 ? this._column : 0}, original: { line: sourceLines.length + i, column: i === 0 ? sourceColumns.length : 0}, source: this.normalizeFilename(fileInfo.filename)}); } } } if (lines.length === 1) { this._column += columns.length; } else { this._lineNumber += lines.length - 1; this._column = columns.length; } this._css.push(chunk); }; tree.sourceMapOutput.prototype.isEmpty = function() { return this._css.length === 0; }; tree.sourceMapOutput.prototype.toCSS = function(env) { this._sourceMapGenerator = new this._sourceMapGeneratorConstructor({ file: this._outputFilename, sourceRoot: null }); if (this._outputSourceFiles) { for(var filename in this._contentsMap) { this._sourceMapGenerator.setSourceContent(this.normalizeFilename(filename), this._contentsMap[filename]); } } this._rootNode.genCSS(env, this); if (this._css.length > 0) { var sourceMapFilename, sourceMapContent = JSON.stringify(this._sourceMapGenerator.toJSON()); if (this._sourceMapFilename) { sourceMapFilename = this.normalizeFilename(this._sourceMapFilename); } if (this._writeSourceMap) { this._writeSourceMap(sourceMapContent); } else { sourceMapFilename = "data:application/json," + encodeURIComponent(sourceMapContent); } if (sourceMapFilename) { this._css.push("/*# sourceMappingURL=" + sourceMapFilename + " */"); } } return this._css.join(''); }; })(require('./tree'));
/**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011 Zynga Inc. http://www.cocos2d-x.org 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 TAG_ANIMATION_DANCE = 1; var schedulerTestSceneIdx = -1; /* Base Layer */ var SchedulerTestLayer = BaseTestLayer.extend({ title:function () { return "No title"; }, subtitle:function () { return ""; }, onBackCallback:function (sender) { var scene = new SchedulerTestScene(); var layer = previousSchedulerTest(); scene.addChild(layer); director.replaceScene(scene); }, onNextCallback:function (sender) { var scene = new SchedulerTestScene(); var layer = nextSchedulerTest(); scene.addChild(layer); director.replaceScene(scene); }, onRestartCallback:function (sender) { var scene = new SchedulerTestScene(); var layer = restartSchedulerTest(); scene.addChild(layer); director.replaceScene(scene); }, // automation numberOfPendingTests:function() { return ( (arrayOfSchedulerTest.length-1) - schedulerTestSceneIdx ); }, getTestNumber:function() { return schedulerTestSceneIdx; } }); /* SchedulerAutoremove */ var SchedulerAutoremove = SchedulerTestLayer.extend({ _accum:0, onEnter:function () { this._super(); this.schedule(this.onAutoremove, 0.5); this.schedule(this.onTick, 0.5); this._accum = 0; }, title:function () { return "Self-remove an scheduler"; }, subtitle:function () { return "1 scheduler will be autoremoved in 3 seconds. See console"; }, onAutoremove:function (dt) { this._accum += dt; cc.log("Time: " + this._accum); if (this._accum > 3) { this.unschedule(this.onAutoremove); cc.log("scheduler removed"); } }, onTick:function (dt) { cc.log("This scheduler should not be removed"); } }); /* SchedulerPauseResume */ var SchedulerPauseResume = SchedulerTestLayer.extend({ onEnter:function () { this._super(); this.schedule(this.onTick1, 0.5); this.schedule(this.onTick2, 0.5); this.schedule(this.onPause, 3); }, title:function () { return "Pause / Resume"; }, subtitle:function () { return "Scheduler should be paused after 3 seconds. See console"; }, onTick1:function (dt) { cc.log("tick1"); }, onTick2:function (dt) { cc.log("tick2"); }, onPause:function (dt) { director.getScheduler().pauseTarget(this); } }); /* SchedulerUnscheduleAll */ var SchedulerUnscheduleAll = SchedulerTestLayer.extend({ onEnter:function () { this._super(); this.schedule(this.onTick1, 0.5); this.schedule(this.onTick2, 1.0); this.schedule(this.onTick3, 1.5); this.schedule(this.onTick4, 1.5); this.schedule(this.onUnscheduleAll, 4); }, title:function () { return "Unschedule All callbacks"; }, subtitle:function () { return "All scheduled callbacks will be unscheduled in 4 seconds. See console"; }, onTick1:function (dt) { cc.log("tick1"); }, onTick2:function (dt) { cc.log("tick2"); }, onTick3:function (dt) { cc.log("tick3"); }, onTick4:function (dt) { cc.log("tick4"); }, onUnscheduleAll:function (dt) { this.unscheduleAllCallbacks(); } }); /* SchedulerUnscheduleAllHard */ var SchedulerUnscheduleAllHard = SchedulerTestLayer.extend({ onEnter:function () { this._super(); this.schedule(this.onTick1, 0.5); this.schedule(this.onTick2, 1.0); this.schedule(this.onTick3, 1.5); this.schedule(this.onTick4, 1.5); this.schedule(this.onUnscheduleAll, 4); }, title:function () { return "Unschedule All callbacks #2"; }, subtitle:function () { return "Unschedules all callbacks after 4s. Uses CCScheduler. See console"; }, onTick1:function (dt) { cc.log("tick1"); }, onTick2:function (dt) { cc.log("tick2"); }, onTick3:function (dt) { cc.log("tick3"); }, onTick4:function (dt) { cc.log("tick4"); }, onUnscheduleAll:function (dt) { director.getScheduler().unscheduleAllCallbacks(); } }); /* SchedulerSchedulesAndRemove */ var SchedulerSchedulesAndRemove = SchedulerTestLayer.extend({ onEnter:function () { this._super(); this.schedule(this.onTick1, 0.5); this.schedule(this.onTick2, 1.0); this.schedule(this.onScheduleAndUnschedule, 4.0); }, title:function () { return "Schedule from Schedule"; }, subtitle:function () { return "Will unschedule and schedule callbacks in 4s. See console"; }, onTick1:function (dt) { cc.log("tick1"); }, onTick2:function (dt) { cc.log("tick2"); }, onTick3:function (dt) { cc.log("tick3"); }, onTick4:function (dt) { cc.log("tick4"); }, onScheduleAndUnschedule:function (dt) { this.unschedule(this.onTick1); this.unschedule(this.onTick2); this.unschedule(this.onScheduleAndUnschedule); this.schedule(this.onTick3, 1.0); this.schedule(this.onTick4, 1.0); } }); /* SchedulerUpdate */ var TestNode = cc.Node.extend({ _pString:"", ctor:function (str, priority) { this._super(); this.init(); this._pString = str; this.scheduleUpdateWithPriority(priority); }, update:function(dt) { cc.log( this._pString ); } }); var SchedulerUpdate = SchedulerTestLayer.extend({ onEnter:function () { this._super(); var str = "---"; var d = new TestNode(str,50); this.addChild(d); str = "3rd"; var b = new TestNode(str,0); this.addChild(b); str = "1st"; var a = new TestNode(str, -10); this.addChild(a); str = "4th"; var c = new TestNode(str,10); this.addChild(c); str = "5th"; var e = new TestNode(str,20); this.addChild(e); str = "2nd"; var f = new TestNode(str,-5); this.addChild(f); this.schedule(this.onRemoveUpdates, 4.0); }, title:function () { return "Schedule update with priority"; }, subtitle:function () { return "3 scheduled updates. Priority should work. Stops in 4s. See console"; }, onRemoveUpdates:function (dt) { var children = this.getChildren(); for (var i = 0; i < children.length; i++) { var node = children[i]; if (node) { node.unscheduleAllCallbacks(); } } } }); /* SchedulerUpdateAndCustom */ var SchedulerUpdateAndCustom = SchedulerTestLayer.extend({ onEnter:function () { this._super(); this.scheduleUpdate(); this.schedule(this.onTick); this.schedule(this.onStopCallbacks, 4); }, title:function () { return "Schedule Update + custom callback"; }, subtitle:function () { return "Update + custom callback at the same time. Stops in 4s. See console"; }, update:function (dt) { cc.log("update called:" + dt); }, onTick:function (dt) { cc.log("custom callback called:" + dt); }, onStopCallbacks:function (dt) { this.unscheduleAllCallbacks(); } }); /* SchedulerUpdateFromCustom */ var SchedulerUpdateFromCustom = SchedulerTestLayer.extend({ onEnter:function () { this._super(); this.schedule(this.onSchedUpdate, 2.0); }, title:function () { return "Schedule Update in 2 sec"; }, subtitle:function () { return "Update schedules in 2 secs. Stops 2 sec later. See console"; }, update:function (dt) { cc.log("update called:" + dt); }, onSchedUpdate:function (dt) { this.unschedule(this.onSchedUpdate); this.scheduleUpdate(); this.schedule(this.onStopUpdate, 2.0); }, onStopUpdate:function (dt) { this.unscheduleUpdate(); this.unschedule(this.onStopUpdate); } }); /* RescheduleCallback */ var RescheduleCallback = SchedulerTestLayer.extend({ _interval:1.0, _ticks:0, onEnter:function () { this._super(); this._interval = 1.0; this._ticks = 0; this.schedule(this.onSchedUpdate, this._interval); }, title:function () { return "Reschedule Callback"; }, subtitle:function () { return "Interval is 1 second, then 2, then 3..."; }, onSchedUpdate:function (dt) { this._ticks++; cc.log("schedUpdate: " + dt.toFixed(2)); if (this._ticks > 3) { this._interval += 1.0; this.schedule(this.onSchedUpdate, this._interval); this._ticks = 0; } } }); /* ScheduleUsingSchedulerTest */ var ScheduleUsingSchedulerTest = SchedulerTestLayer.extend({ _accum:0, onEnter:function () { this._super(); this._accum = 0; var scheduler = director.getScheduler(); var priority = 0; // priority 0. default. var paused = false; // not paused, queue it now. scheduler.scheduleUpdateForTarget(this, priority, paused); var interval = 0.25; // every 1/4 of second var repeat = cc.REPEAT_FOREVER; // how many repeats. cc.REPEAT_FOREVER means forever var delay = 2; // start after 2 seconds; paused = false; // not paused. queue it now. scheduler.scheduleCallbackForTarget(this, this.onSchedUpdate, interval, repeat, delay, paused); }, title:function () { return "Schedule / Unschedule using Scheduler"; }, subtitle:function () { return "After 5 seconds all callbacks should be removed"; }, // callbacks update:function(dt) { cc.log("update: " + dt); }, onSchedUpdate:function (dt) { cc.log("onSchedUpdate delta: " + dt); this._accum += dt; if( this._accum > 3 ) { var scheduler = director.getScheduler(); scheduler.unscheduleAllCallbacksForTarget(this); } cc.log("onSchedUpdate accum: " + this._accum); } }); /* main entry */ var SchedulerTestScene = TestScene.extend({ runThisTest:function () { schedulerTestSceneIdx = -1; var layer = nextSchedulerTest(); this.addChild(layer); director.replaceScene(this); } }); // // Flow control // var arrayOfSchedulerTest = [ SchedulerAutoremove, SchedulerPauseResume, SchedulerUnscheduleAll, SchedulerUnscheduleAllHard, SchedulerSchedulesAndRemove, SchedulerUpdate, SchedulerUpdateAndCustom, SchedulerUpdateFromCustom, RescheduleCallback, ScheduleUsingSchedulerTest ]; var nextSchedulerTest = function () { schedulerTestSceneIdx++; schedulerTestSceneIdx = schedulerTestSceneIdx % arrayOfSchedulerTest.length; return new arrayOfSchedulerTest[schedulerTestSceneIdx](); }; var previousSchedulerTest = function () { schedulerTestSceneIdx--; if (schedulerTestSceneIdx < 0) schedulerTestSceneIdx += arrayOfSchedulerTest.length; return new arrayOfSchedulerTest[schedulerTestSceneIdx](); }; var restartSchedulerTest = function () { return new arrayOfSchedulerTest[schedulerTestSceneIdx](); };
class Kind { set "a"(x) {} }
YUI.add("dd-drop-plugin",function(e,t){var n=function(e){e.node=e.host,n.superclass.constructor.apply(this,arguments)};n.NAME="dd-drop-plugin",n.NS="drop",e.extend(n,e.DD.Drop),e.namespace("Plugin"),e.Plugin.Drop=n},"3.18.1",{requires:["dd-drop"]});
(function(wysihtml5) { // List of supported color format parsing methods // If radix is not defined 10 is expected as default var colorParseMethods = { rgba : { regex: /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([\d\.]+)\s*\)/i, name: "rgba" }, rgb : { regex: /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/i, name: "rgb" }, hex6 : { regex: /^#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])/i, name: "hex", radix: 16 }, hex3 : { regex: /^#([0-9a-f])([0-9a-f])([0-9a-f])/i, name: "hex", radix: 16 } }, // Takes a style key name as an argument and makes a regex that can be used to the match key:value pair from style string makeParamRegExp = function (p) { return new RegExp("(^|\\s|;)" + p + "\\s*:\\s*[^;$]+", "gi"); }; // Takes color string value ("#abc", "rgb(1,2,3)", ...) as an argument and returns suitable parsing method for it function getColorParseMethod (colorStr) { var prop, colorTypeConf; for (prop in colorParseMethods) { if (!colorParseMethods.hasOwnProperty(prop)) { continue; } colorTypeConf = colorParseMethods[prop]; if (colorTypeConf.regex.test(colorStr)) { return colorTypeConf; } } } // Takes color string value ("#abc", "rgb(1,2,3)", ...) as an argument and returns the type of that color format "hex", "rgb", "rgba". function getColorFormat (colorStr) { var type = getColorParseMethod(colorStr); return type ? type.name : undefined; } // Public API functions for styleParser wysihtml5.quirks.styleParser = { // Takes color string value as an argument and returns suitable parsing method for it getColorParseMethod : getColorParseMethod, // Takes color string value as an argument and returns the type of that color format "hex", "rgb", "rgba". getColorFormat : getColorFormat, /* Parses a color string to and array of [red, green, blue, alpha]. * paramName: optional argument to parse color value directly from style string parameter * * Examples: * var colorArray = wysihtml5.quirks.styleParser.parseColor("#ABC"); // [170, 187, 204, 1] * var colorArray = wysihtml5.quirks.styleParser.parseColor("#AABBCC"); // [170, 187, 204, 1] * var colorArray = wysihtml5.quirks.styleParser.parseColor("rgb(1,2,3)"); // [1, 2, 3, 1] * var colorArray = wysihtml5.quirks.styleParser.parseColor("rgba(1,2,3,0.5)"); // [1, 2, 3, 0.5] * * var colorArray = wysihtml5.quirks.styleParser.parseColor("background-color: #ABC; color: #000;", "background-color"); // [170, 187, 204, 1] * var colorArray = wysihtml5.quirks.styleParser.parseColor("background-color: #ABC; color: #000;", "color"); // [0, 0, 0, 1] */ parseColor : function (stylesStr, paramName) { var paramsRegex, params, colorType, colorMatch, radix, colorStr = stylesStr; if (paramName) { paramsRegex = makeParamRegExp(paramName); if (!(params = stylesStr.match(paramsRegex))) { return false; } params = params.pop().split(":")[1]; colorStr = wysihtml5.lang.string(params).trim(); } if (!(colorType = getColorParseMethod(colorStr))) { return false; } if (!(colorMatch = colorStr.match(colorType.regex))) { return false; } radix = colorType.radix || 10; if (colorType === colorParseMethods.hex3) { colorMatch.shift(); colorMatch.push(1); return wysihtml5.lang.array(colorMatch).map(function(d, idx) { return (idx < 3) ? (parseInt(d, radix) * radix) + parseInt(d, radix): parseFloat(d); }); } colorMatch.shift(); if (!colorMatch[3]) { colorMatch.push(1); } return wysihtml5.lang.array(colorMatch).map(function(d, idx) { return (idx < 3) ? parseInt(d, radix): parseFloat(d); }); }, /* Takes rgba color array [r,g,b,a] as a value and formats it to color string with given format type * If no format is given, rgba/rgb is returned based on alpha value * * Example: * var colorStr = wysihtml5.quirks.styleParser.unparseColor([170, 187, 204, 1], "hash"); // "#AABBCC" * var colorStr = wysihtml5.quirks.styleParser.unparseColor([170, 187, 204, 1], "hex"); // "AABBCC" * var colorStr = wysihtml5.quirks.styleParser.unparseColor([170, 187, 204, 1], "csv"); // "170, 187, 204, 1" * var colorStr = wysihtml5.quirks.styleParser.unparseColor([170, 187, 204, 1], "rgba"); // "rgba(170,187,204,1)" * var colorStr = wysihtml5.quirks.styleParser.unparseColor([170, 187, 204, 1], "rgb"); // "rgb(170,187,204)" * * var colorStr = wysihtml5.quirks.styleParser.unparseColor([170, 187, 204, 0.5]); // "rgba(170,187,204,0.5)" * var colorStr = wysihtml5.quirks.styleParser.unparseColor([170, 187, 204, 1]); // "rgb(170,187,204)" */ unparseColor: function(val, colorFormat) { var hexRadix = 16; if (colorFormat === "hex") { return (val[0].toString(hexRadix) + val[1].toString(hexRadix) + val[2].toString(hexRadix)).toUpperCase(); } else if (colorFormat === "hash") { return "#" + (val[0].toString(hexRadix) + val[1].toString(hexRadix) + val[2].toString(hexRadix)).toUpperCase(); } else if (colorFormat === "rgb") { return "rgb(" + val[0] + "," + val[1] + "," + val[2] + ")"; } else if (colorFormat === "rgba") { return "rgba(" + val[0] + "," + val[1] + "," + val[2] + "," + val[3] + ")"; } else if (colorFormat === "csv") { return val[0] + "," + val[1] + "," + val[2] + "," + val[3]; } if (val[3] && val[3] !== 1) { return "rgba(" + val[0] + "," + val[1] + "," + val[2] + "," + val[3] + ")"; } else { return "rgb(" + val[0] + "," + val[1] + "," + val[2] + ")"; } }, // Parses font size value from style string parseFontSize: function(stylesStr) { var params = stylesStr.match(makeParamRegExp("font-size")); if (params) { return wysihtml5.lang.string(params[params.length - 1].split(":")[1]).trim(); } return false; } }; })(wysihtml5);
/* json-schema-faker library v0.4.5 http://json-schema-faker.js.org @preserve Copyright (c) 2014-2016 Alvaro Cabrera & Tomasz Ducin Released under the MIT license Date: 2017-10-15 21:00:53.301Z ***************************************************************************** Copyright (c) Microsoft Corporation. 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 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. **************************************************************************** @description Recursive object extending @author Viacheslav Lotsmanov <lotsmanov89@gmail.com> @license MIT The MIT License (MIT) Copyright (c) 2013-2015 Viacheslav Lotsmanov 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. */ (function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):global.JSONSchemaFaker=factory()})(this,function(){function createCommonjsModule(fn,module){return module={exports:{}},fn(module,module.exports),module.exports}var types={ROOT:0,GROUP:1,POSITION:2,SET:3,RANGE:4,REPETITION:5,REFERENCE:6,CHAR:7};var INTS=function(){return[{type:types.RANGE,from:48,to:57}]};var WORDS=function(){return[{type:types.CHAR, value:95},{type:types.RANGE,from:97,to:122},{type:types.RANGE,from:65,to:90}].concat(INTS())};var WHITESPACE=function(){return[{type:types.CHAR,value:9},{type:types.CHAR,value:10},{type:types.CHAR,value:11},{type:types.CHAR,value:12},{type:types.CHAR,value:13},{type:types.CHAR,value:32},{type:types.CHAR,value:160},{type:types.CHAR,value:5760},{type:types.CHAR,value:6158},{type:types.CHAR,value:8192},{type:types.CHAR,value:8193},{type:types.CHAR,value:8194},{type:types.CHAR,value:8195},{type:types.CHAR, value:8196},{type:types.CHAR,value:8197},{type:types.CHAR,value:8198},{type:types.CHAR,value:8199},{type:types.CHAR,value:8200},{type:types.CHAR,value:8201},{type:types.CHAR,value:8202},{type:types.CHAR,value:8232},{type:types.CHAR,value:8233},{type:types.CHAR,value:8239},{type:types.CHAR,value:8287},{type:types.CHAR,value:12288},{type:types.CHAR,value:65279}]};var NOTANYCHAR=function(){return[{type:types.CHAR,value:10},{type:types.CHAR,value:13},{type:types.CHAR,value:8232},{type:types.CHAR,value:8233}]}; var words=function(){return{type:types.SET,set:WORDS(),not:false}};var notWords=function(){return{type:types.SET,set:WORDS(),not:true}};var ints=function(){return{type:types.SET,set:INTS(),not:false}};var notInts=function(){return{type:types.SET,set:INTS(),not:true}};var whitespace=function(){return{type:types.SET,set:WHITESPACE(),not:false}};var notWhitespace=function(){return{type:types.SET,set:WHITESPACE(),not:true}};var anyChar=function(){return{type:types.SET,set:NOTANYCHAR(),not:true}};var sets= {words:words,notWords:notWords,ints:ints,notInts:notInts,whitespace:whitespace,notWhitespace:notWhitespace,anyChar:anyChar};var util=createCommonjsModule(function(module,exports){var CTRL="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?";var SLSH={0:0,"t":9,"n":10,"v":11,"f":12,"r":13};exports.strToChars=function(str){var chars_regex=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z\[\\\]\^?])|([0tnvfr]))/g;str=str.replace(chars_regex,function(s,b,lbs,a16,b16,c8,dctrl,eslsh){if(lbs)return s; var code=b?8:a16?parseInt(a16,16):b16?parseInt(b16,16):c8?parseInt(c8,8):dctrl?CTRL.indexOf(dctrl):SLSH[eslsh];var c=String.fromCharCode(code);if(/[\[\]{}\^$.|?*+()]/.test(c))c="\\"+c;return c});return str};exports.tokenizeClass=function(str,regexpStr){var tokens=[];var regexp=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?(.)/g;var rs,c;while((rs=regexp.exec(str))!=null)if(rs[1])tokens.push(sets.words());else if(rs[2])tokens.push(sets.ints());else if(rs[3])tokens.push(sets.whitespace()); else if(rs[4])tokens.push(sets.notWords());else if(rs[5])tokens.push(sets.notInts());else if(rs[6])tokens.push(sets.notWhitespace());else if(rs[7])tokens.push({type:types.RANGE,from:(rs[8]||rs[9]).charCodeAt(0),to:rs[10].charCodeAt(0)});else if(c=rs[12])tokens.push({type:types.CHAR,value:c.charCodeAt(0)});else return[tokens,regexp.lastIndex];exports.error(regexpStr,"Unterminated character class")};exports.error=function(regexp,msg){throw new SyntaxError("Invalid regular expression: /"+regexp+"/: "+ msg);}});var wordBoundary=function(){return{type:types.POSITION,value:"b"}};var nonWordBoundary=function(){return{type:types.POSITION,value:"B"}};var begin=function(){return{type:types.POSITION,value:"^"}};var end=function(){return{type:types.POSITION,value:"$"}};var positions={wordBoundary:wordBoundary,nonWordBoundary:nonWordBoundary,begin:begin,end:end};var lib$2=function(regexpStr){var i=0,l,c,start={type:types.ROOT,stack:[]},lastGroup=start,last=start.stack,groupStack=[];var repeatErr=function(i){util.error(regexpStr, "Nothing to repeat at column "+(i-1))};var str=util.strToChars(regexpStr);l=str.length;while(i<l){c=str[i++];switch(c){case "\\":c=str[i++];switch(c){case "b":last.push(positions.wordBoundary());break;case "B":last.push(positions.nonWordBoundary());break;case "w":last.push(sets.words());break;case "W":last.push(sets.notWords());break;case "d":last.push(sets.ints());break;case "D":last.push(sets.notInts());break;case "s":last.push(sets.whitespace());break;case "S":last.push(sets.notWhitespace());break; default:if(/\d/.test(c))last.push({type:types.REFERENCE,value:parseInt(c,10)});else last.push({type:types.CHAR,value:c.charCodeAt(0)})}break;case "^":last.push(positions.begin());break;case "$":last.push(positions.end());break;case "[":var not;if(str[i]==="^"){not=true;i++}else not=false;var classTokens=util.tokenizeClass(str.slice(i),regexpStr);i+=classTokens[1];last.push({type:types.SET,set:classTokens[0],not:not});break;case ".":last.push(sets.anyChar());break;case "(":var group={type:types.GROUP, stack:[],remember:true};c=str[i];if(c==="?"){c=str[i+1];i+=2;if(c==="\x3d")group.followedBy=true;else if(c==="!")group.notFollowedBy=true;else if(c!==":")util.error(regexpStr,"Invalid group, character '"+c+"' after '?' at column "+(i-1));group.remember=false}last.push(group);groupStack.push(lastGroup);lastGroup=group;last=group.stack;break;case ")":if(groupStack.length===0)util.error(regexpStr,"Unmatched ) at column "+(i-1));lastGroup=groupStack.pop();last=lastGroup.options?lastGroup.options[lastGroup.options.length- 1]:lastGroup.stack;break;case "|":if(!lastGroup.options){lastGroup.options=[lastGroup.stack];delete lastGroup.stack}var stack=[];lastGroup.options.push(stack);last=stack;break;case "{":var rs=/^(\d+)(,(\d+)?)?\}/.exec(str.slice(i)),min,max;if(rs!==null){if(last.length===0)repeatErr(i);min=parseInt(rs[1],10);max=rs[2]?rs[3]?parseInt(rs[3],10):Infinity:min;i+=rs[0].length;last.push({type:types.REPETITION,min:min,max:max,value:last.pop()})}else last.push({type:types.CHAR,value:123});break;case "?":if(last.length=== 0)repeatErr(i);last.push({type:types.REPETITION,min:0,max:1,value:last.pop()});break;case "+":if(last.length===0)repeatErr(i);last.push({type:types.REPETITION,min:1,max:Infinity,value:last.pop()});break;case "*":if(last.length===0)repeatErr(i);last.push({type:types.REPETITION,min:0,max:Infinity,value:last.pop()});break;default:last.push({type:types.CHAR,value:c.charCodeAt(0)})}}if(groupStack.length!==0)util.error(regexpStr,"Unterminated group");return start};var types_1=types;lib$2.types=types_1; function _SubRange(low,high){this.low=low;this.high=high;this.length=1+high-low}_SubRange.prototype.overlaps=function(range){return!(this.high<range.low||this.low>range.high)};_SubRange.prototype.touches=function(range){return!(this.high+1<range.low||this.low-1>range.high)};_SubRange.prototype.add=function(range){return this.touches(range)&&new _SubRange(Math.min(this.low,range.low),Math.max(this.high,range.high))};_SubRange.prototype.subtract=function(range){if(!this.overlaps(range))return false; if(range.low<=this.low&&range.high>=this.high)return[];if(range.low>this.low&&range.high<this.high)return[new _SubRange(this.low,range.low-1),new _SubRange(range.high+1,this.high)];if(range.low<=this.low)return[new _SubRange(range.high+1,this.high)];return[new _SubRange(this.low,range.low-1)]};_SubRange.prototype.toString=function(){if(this.low==this.high)return this.low.toString();return this.low+"-"+this.high};_SubRange.prototype.clone=function(){return new _SubRange(this.low,this.high)};function DiscontinuousRange(a, b){if(this instanceof DiscontinuousRange){this.ranges=[];this.length=0;if(a!==undefined)this.add(a,b)}else return new DiscontinuousRange(a,b)}function _update_length(self){self.length=self.ranges.reduce(function(previous,range){return previous+range.length},0)}DiscontinuousRange.prototype.add=function(a,b){var self=this;function _add(subrange){var new_ranges=[];var i=0;while(i<self.ranges.length&&!subrange.touches(self.ranges[i])){new_ranges.push(self.ranges[i].clone());i++}while(i<self.ranges.length&& subrange.touches(self.ranges[i])){subrange=subrange.add(self.ranges[i]);i++}new_ranges.push(subrange);while(i<self.ranges.length){new_ranges.push(self.ranges[i].clone());i++}self.ranges=new_ranges;_update_length(self)}if(a instanceof DiscontinuousRange)a.ranges.forEach(_add);else if(a instanceof _SubRange)_add(a);else{if(b===undefined)b=a;_add(new _SubRange(a,b))}return this};DiscontinuousRange.prototype.subtract=function(a,b){var self=this;function _subtract(subrange){var new_ranges=[];var i=0;while(i< self.ranges.length&&!subrange.overlaps(self.ranges[i])){new_ranges.push(self.ranges[i].clone());i++}while(i<self.ranges.length&&subrange.overlaps(self.ranges[i])){new_ranges=new_ranges.concat(self.ranges[i].subtract(subrange));i++}while(i<self.ranges.length){new_ranges.push(self.ranges[i].clone());i++}self.ranges=new_ranges;_update_length(self)}if(a instanceof DiscontinuousRange)a.ranges.forEach(_subtract);else if(a instanceof _SubRange)_subtract(a);else{if(b===undefined)b=a;_subtract(new _SubRange(a, b))}return this};DiscontinuousRange.prototype.index=function(index){var i=0;while(i<this.ranges.length&&this.ranges[i].length<=index){index-=this.ranges[i].length;i++}if(i>=this.ranges.length)return null;return this.ranges[i].low+index};DiscontinuousRange.prototype.toString=function(){return"[ "+this.ranges.join(", ")+" ]"};DiscontinuousRange.prototype.clone=function(){return new DiscontinuousRange(this)};var discontinuousRange=DiscontinuousRange;var randexp$1$1=createCommonjsModule(function(module){var types= lib$2.types;function toOtherCase(code){return code+(97<=code&&code<=122?-32:65<=code&&code<=90?32:0)}function randBool(){return!this.randInt(0,1)}function randSelect(arr){if(arr instanceof discontinuousRange)return arr.index(this.randInt(0,arr.length-1));return arr[this.randInt(0,arr.length-1)]}function expand(token){if(token.type===lib$2.types.CHAR)return new discontinuousRange(token.value);else if(token.type===lib$2.types.RANGE)return new discontinuousRange(token.from,token.to);else{var drange= new discontinuousRange;for(var i=0;i<token.set.length;i++){var subrange=expand.call(this,token.set[i]);drange.add(subrange);if(this.ignoreCase)for(var j=0;j<subrange.length;j++){var code=subrange.index(j);var otherCaseCode=toOtherCase(code);if(code!==otherCaseCode)drange.add(otherCaseCode)}}if(token.not)return this.defaultRange.clone().subtract(drange);else return drange}}function checkCustom(randexp,regexp){if(typeof regexp.max==="number")randexp.max=regexp.max;if(regexp.defaultRange instanceof discontinuousRange)randexp.defaultRange= regexp.defaultRange;if(typeof regexp.randInt==="function")randexp.randInt=regexp.randInt}var RandExp=module.exports=function(regexp,m){this.defaultRange=this.defaultRange.clone();if(regexp instanceof RegExp){this.ignoreCase=regexp.ignoreCase;this.multiline=regexp.multiline;checkCustom(this,regexp);regexp=regexp.source}else if(typeof regexp==="string"){this.ignoreCase=m&&m.indexOf("i")!==-1;this.multiline=m&&m.indexOf("m")!==-1}else throw new Error("Expected a regexp or string");this.tokens=lib$2(regexp)}; RandExp.prototype.max=100;RandExp.prototype.gen=function(){return gen.call(this,this.tokens,[])};RandExp.randexp=function(regexp,m){var randexp;if(regexp._randexp===undefined){randexp=new RandExp(regexp,m);regexp._randexp=randexp}else randexp=regexp._randexp;checkCustom(randexp,regexp);return randexp.gen()};RandExp.sugar=function(){RegExp.prototype.gen=function(){return RandExp.randexp(this)}};RandExp.prototype.defaultRange=new discontinuousRange(32,126);RandExp.prototype.randInt=function(a,b){return a+ Math.floor(Math.random()*(1+b-a))};function gen(token,groups){var stack,str,n,i,l;switch(token.type){case types.ROOT:case types.GROUP:if(token.followedBy||token.notFollowedBy)return"";if(token.remember&&token.groupNumber===undefined)token.groupNumber=groups.push(null)-1;stack=token.options?randSelect.call(this,token.options):token.stack;str="";for(i=0,l=stack.length;i<l;i++)str+=gen.call(this,stack[i],groups);if(token.remember)groups[token.groupNumber]=str;return str;case types.POSITION:return""; case types.SET:var expandedSet=expand.call(this,token);if(!expandedSet.length)return"";return String.fromCharCode(randSelect.call(this,expandedSet));case types.REPETITION:n=this.randInt(token.min,token.max===Infinity?token.min+this.max:token.max);str="";for(i=0;i<n;i++)str+=gen.call(this,token.value,groups);return str;case types.REFERENCE:return groups[token.value-1]||"";case types.CHAR:var code=this.ignoreCase&&randBool.call(this)?toOtherCase(token.value):token.value;return String.fromCharCode(code)}} });var extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};function __extends(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}var __assign=Object.assign||function __assign(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t}; function __rest(s,e){var t={};for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0)t[p]=s[p];if(s!=null&&typeof Object.getOwnPropertySymbols==="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)if(e.indexOf(p[i])<0)t[p[i]]=s[p[i]];return t}function __decorate(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")r= Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)if(d=decorators[i])r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r;return c>3&&r&&Object.defineProperty(target,key,r),r}function __param(paramIndex,decorator){return function(target,key){decorator(target,key,paramIndex)}}function __metadata(metadataKey,metadataValue){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(metadataKey,metadataValue)}function __awaiter(thisArg, _arguments,P,generator){return new (P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):(new P(function(resolve){resolve(result.value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})}function __generator(thisArg,body){var _={label:0,sent:function(){if(t[0]& 1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=y[op[0]&2?"return":op[0]?"throw":"next"])&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[0,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1], done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]: void 0,done:true}}}function __exportStar(m,exports){for(var p in m)if(!exports.hasOwnProperty(p))exports[p]=m[p]}function __values(o){var m=typeof Symbol==="function"&&o[Symbol.iterator],i=0;if(m)return m.call(o);return{next:function(){if(o&&i>=o.length)o=void 0;return{value:o&&o[i++],done:!o}}}}function __read(o,n){var m=typeof Symbol==="function"&&o[Symbol.iterator];if(!m)return o;var i=m.call(o),r,ar=[],e;try{while((n===void 0||n-- >0)&&!(r=i.next()).done)ar.push(r.value)}catch(error){e={error:error}}finally{try{if(r&& !r.done&&(m=i["return"]))m.call(i)}finally{if(e)throw e.error;}}return ar}function __spread(){for(var ar=[],i=0;i<arguments.length;i++)ar=ar.concat(__read(arguments[i]));return ar}function __await(v){return this instanceof __await?(this.v=v,this):new __await(v)}function __asyncGenerator(thisArg,_arguments,generator){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var g=generator.apply(thisArg,_arguments||[]),i,q=[];return i={},verb("next"),verb("throw"),verb("return"), i[Symbol.asyncIterator]=function(){return this},i;function verb(n){if(g[n])i[n]=function(v){return new Promise(function(a,b){q.push([n,v,a,b])>1||resume(n,v)})}}function resume(n,v){try{step(g[n](v))}catch(e){settle(q[0][3],e)}}function step(r){r.value instanceof __await?Promise.resolve(r.value.v).then(fulfill,reject):settle(q[0][2],r)}function fulfill(value){resume("next",value)}function reject(value){resume("throw",value)}function settle(f,v){if(f(v),q.shift(),q.length)resume(q[0][0],q[0][1])}} function __asyncDelegator(o){var i,p;return i={},verb("next"),verb("throw",function(e){throw e;}),verb("return"),i[Symbol.iterator]=function(){return this},i;function verb(n,f){if(o[n])i[n]=function(v){return(p=!p)?{value:__await(o[n](v)),done:n==="return"}:f?f(v):v}}}function __asyncValues(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var m=o[Symbol.asyncIterator];return m?m.call(o):typeof __values==="function"?__values(o):o[Symbol.iterator]()}function __makeTemplateObject(cooked, raw){if(Object.defineProperty)Object.defineProperty(cooked,"raw",{value:raw});else cooked.raw=raw;return cooked}var tslib_es6=Object.freeze({__extends:__extends,__assign:__assign,__rest:__rest,__decorate:__decorate,__param:__param,__metadata:__metadata,__awaiter:__awaiter,__generator:__generator,__exportStar:__exportStar,__values:__values,__read:__read,__spread:__spread,__await:__await,__asyncGenerator:__asyncGenerator,__asyncDelegator:__asyncDelegator,__asyncValues:__asyncValues,__makeTemplateObject:__makeTemplateObject}); ;function URLUtils(url,baseURL){url=url.replace(/^\.\//,"");var m=String(url).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@]*)(?::([^:@]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);if(!m)throw new RangeError;var href=m[0]||"";var protocol=m[1]||"";var username=m[2]||"";var password=m[3]||"";var host=m[4]||"";var hostname=m[5]||"";var port=m[6]||"";var pathname=m[7]||"";var search=m[8]||"";var hash=m[9]||"";if(baseURL!==undefined){var base= new URLUtils(baseURL);var flag=protocol===""&&host===""&&username==="";if(flag&&pathname===""&&search==="")search=base.search;if(flag&&pathname.charAt(0)!=="/")pathname=pathname!==""?base.pathname.slice(0,base.pathname.lastIndexOf("/")+1)+pathname:base.pathname;var output=[];pathname.replace(/\/?[^\/]+/g,function(p){if(p==="/..")output.pop();else output.push(p)});pathname=output.join("")||"/";if(flag){port=base.port;hostname=base.hostname;host=base.host;password=base.password;username=base.username}if(protocol=== "")protocol=base.protocol;href=protocol+(host!==""?"//":"")+(username!==""?username+(password!==""?":"+password:"")+"@":"")+host+pathname+search+hash}this.href=href;this.origin=protocol+(host!==""?"//"+host:"");this.protocol=protocol;this.username=username;this.password=password;this.host=host;this.hostname=hostname;this.port=port;this.pathname=pathname;this.search=search;this.hash=hash}function isURL(path){if(typeof path==="string"&&/^\w+:\/\//.test(path))return true}function parseURI(href,base){return new URLUtils(href, base)}function resolveURL(base,href){base=base||"http://json-schema.org/schema#";href=parseURI(href,base);base=parseURI(base);if(base.hash&&!href.hash)return href.href+base.hash;return href.href}function getDocumentURI(uri){return typeof uri==="string"&&uri.split("#")[0]}function isKeyword(prop){return prop==="enum"||prop==="default"||prop==="required"}var helpers={isURL:isURL,parseURI:parseURI,isKeyword:isKeyword,resolveURL:resolveURL,getDocumentURI:getDocumentURI};var findReference=createCommonjsModule(function(module){function get(obj, path){var hash=path.split("#")[1];var parts=hash.split("/").slice(1);while(parts.length){var key=decodeURIComponent(parts.shift()).replace(/~1/g,"/").replace(/~0/g,"~");if(typeof obj[key]==="undefined")throw new Error("JSON pointer not found: "+path);obj=obj[key]}return obj}var find=module.exports=function(id,refs){var target=refs[id]||refs[id.split("#")[1]]||refs[helpers.getDocumentURI(id)];if(target)target=id.indexOf("#/")>-1?get(target,id):target;else for(var key in refs)if(helpers.resolveURL(refs[key].id, id)===refs[key].id){target=refs[key];break}if(!target)throw new Error("Reference not found: "+id);while(target.$ref)target=find(target.$ref,refs);return target}});var deepExtend_1=createCommonjsModule(function(module){function isSpecificValue(val){return val instanceof Buffer||val instanceof Date||val instanceof RegExp?true:false}function cloneSpecificValue(val){if(val instanceof Buffer){var x=new Buffer(val.length);val.copy(x);return x}else if(val instanceof Date)return new Date(val.getTime());else if(val instanceof RegExp)return new RegExp(val);else throw new Error("Unexpected situation");}function deepCloneArray(arr){var clone=[];arr.forEach(function(item,index){if(typeof item==="object"&&item!==null)if(Array.isArray(item))clone[index]=deepCloneArray(item);else if(isSpecificValue(item))clone[index]=cloneSpecificValue(item);else clone[index]=deepExtend({},item);else clone[index]=item});return clone}var deepExtend=module.exports=function(){if(arguments.length<1||typeof arguments[0]!=="object")return false;if(arguments.length< 2)return arguments[0];var target=arguments[0];var args=Array.prototype.slice.call(arguments,1);var val,src;args.forEach(function(obj){if(typeof obj!=="object"||obj===null||Array.isArray(obj))return;Object.keys(obj).forEach(function(key){src=target[key];val=obj[key];if(val===target)return;else if(typeof val!=="object"||val===null){target[key]=val;return}else if(Array.isArray(val)){target[key]=deepCloneArray(val);return}else if(isSpecificValue(val)){target[key]=cloneSpecificValue(val);return}else if(typeof src!== "object"||src===null||Array.isArray(src)){target[key]=deepExtend({},val);return}else{target[key]=deepExtend(src,val);return}})});return target}});;function copy(_,obj,refs,parent,resolve){var target=Array.isArray(obj)?[]:{};if(typeof obj.$ref==="string"){var id=obj.$ref;var base=helpers.getDocumentURI(id);var local=id.indexOf("#/")>-1;if(local||resolve&&base!==parent){var fixed=findReference(id,refs);deepExtend_1(obj,fixed);delete obj.$ref;delete obj.id}if(_[id])return obj; _[id]=1}for(var prop in obj)if(typeof obj[prop]==="object"&&obj[prop]!==null&&!helpers.isKeyword(prop))target[prop]=copy(_,obj[prop],refs,parent,resolve);else target[prop]=obj[prop];return target}var resolveSchema=function(obj,refs,resolve){var fixedId=helpers.resolveURL(obj.$schema,obj.id),parent=helpers.getDocumentURI(fixedId);return copy({},obj,refs,parent,resolve)};var cloneObj=createCommonjsModule(function(module){var clone=module.exports=function(obj,seen){seen=seen||[];if(seen.indexOf(obj)> -1)throw new Error("unable dereference circular structures");if(!obj||typeof obj!=="object")return obj;seen=seen.concat([obj]);var target=Array.isArray(obj)?[]:{};function copy(key,value){target[key]=clone(value,seen)}if(Array.isArray(target))obj.forEach(function(value,key){copy(key,value)});else if(Object.prototype.toString.call(obj)==="[object Object]")Object.keys(obj).forEach(function(key){copy(key,obj[key])});return target}});;var SCHEMA_URI=["http://json-schema.org/schema#", "http://json-schema.org/draft-04/schema#"];function expand(obj,parent,callback){if(obj){var id=typeof obj.id==="string"?obj.id:"#";if(!helpers.isURL(id))id=helpers.resolveURL(parent===id?null:parent,id);if(typeof obj.$ref==="string"&&!helpers.isURL(obj.$ref))obj.$ref=helpers.resolveURL(id,obj.$ref);if(typeof obj.id==="string")obj.id=parent=id}for(var key in obj){var value=obj[key];if(typeof value==="object"&&value!==null&&!helpers.isKeyword(key))expand(value,parent,callback)}if(typeof callback=== "function")callback(obj)}var normalizeSchema=function(fakeroot,schema,push){if(typeof fakeroot==="object"){push=schema;schema=fakeroot;fakeroot=null}var base=fakeroot||"",copy=cloneObj(schema);if(copy.$schema&&SCHEMA_URI.indexOf(copy.$schema)===-1)throw new Error("Unsupported schema version (v4 only)");base=helpers.resolveURL(copy.$schema||SCHEMA_URI[0],base);expand(copy,helpers.resolveURL(copy.id||"#",base),push);copy.id=copy.id||base;return copy};var lib$4=createCommonjsModule(function(module){helpers.findByRef= findReference;helpers.resolveSchema=resolveSchema;helpers.normalizeSchema=normalizeSchema;var instance=module.exports=function(){function $ref(fakeroot,schema,refs,ex){if(typeof fakeroot==="object"){ex=refs;refs=schema;schema=fakeroot;fakeroot=undefined}if(typeof schema!=="object")throw new Error("schema must be an object");if(typeof refs==="object"&&refs!==null){var aux=refs;refs=[];for(var k in aux){aux[k].id=aux[k].id||k;refs.push(aux[k])}}if(typeof refs!=="undefined"&&!Array.isArray(refs)){ex= !!refs;refs=[]}function push(ref){if(typeof ref.id==="string"){var id=helpers.resolveURL(fakeroot,ref.id).replace(/\/#?$/,"");if(id.indexOf("#")>-1){var parts=id.split("#");if(parts[1].charAt()==="/")id=parts[0];else id=parts[1]||parts[0]}if(!$ref.refs[id])$ref.refs[id]=ref}}(refs||[]).concat([schema]).forEach(function(ref){schema=helpers.normalizeSchema(fakeroot,ref,push);push(schema)});return helpers.resolveSchema(schema,$ref.refs,ex)}$ref.refs={};$ref.util=helpers;return $ref};instance.util=helpers}); var tslib_1=tslib_es6&&undefined||tslib_es6;function _interopDefault$1(ex){return ex&&typeof ex==="object"&&"default"in ex?ex["default"]:ex}var RandExp=_interopDefault$1(randexp$1$1);var deref=_interopDefault$1(lib$4);var Registry=function(){function Registry(){this.data={}}Registry.prototype.register=function(name,callback){this.data[name]=callback};Registry.prototype.registerMany=function(formats){for(var name in formats)this.data[name]=formats[name]};Registry.prototype.get=function(name){var format= this.data[name];if(typeof format==="undefined")throw new Error("unknown registry key "+JSON.stringify(name));return format};Registry.prototype.list=function(){return this.data};return Registry}();var OptionRegistry=function(_super){tslib_1.__extends(OptionRegistry,_super);function OptionRegistry(){var _this=_super.call(this)||this;_this.data["failOnInvalidTypes"]=true;_this.data["defaultInvalidTypeProduct"]=null;_this.data["useDefaultValue"]=false;_this.data["requiredOnly"]=false;_this.data["maxItems"]= null;_this.data["maxLength"]=null;_this.data["defaultMinItems"]=0;_this.data["defaultRandExpMax"]=10;_this.data["alwaysFakeOptionals"]=false;_this.data["random"]=Math.random;return _this}return OptionRegistry}(Registry);var registry=new OptionRegistry;function optionAPI(nameOrOptionMap){if(typeof nameOrOptionMap==="string")return registry.get(nameOrOptionMap);else return registry.registerMany(nameOrOptionMap)}RandExp.prototype.max=10;RandExp.prototype.randInt=function(a,b){return a+Math.floor(optionAPI("random")()* (1+b-a))};var Container=function(){function Container(){this.registry={faker:null,chance:null,casual:null,randexp:RandExp}}Container.prototype.extend=function(name,callback){if(typeof this.registry[name]==="undefined")throw new ReferenceError('"'+name+'" dependency is not allowed.');this.registry[name]=callback(this.registry[name])};Container.prototype.get=function(name){if(typeof this.registry[name]==="undefined")throw new ReferenceError('"'+name+"\" dependency doesn't exist.");else if(name==="randexp"){var RandExp_= this.registry["randexp"];return function(pattern){var re=new RandExp_(pattern);re.max=optionAPI("defaultRandExpMax");return re.gen()}}return this.registry[name]};Container.prototype.getAll=function(){return{faker:this.get("faker"),chance:this.get("chance"),randexp:this.get("randexp"),casual:this.get("casual")}};return Container}();var container=new Container;var registry$1=new Registry;function formatAPI(nameOrFormatMap,callback){if(typeof nameOrFormatMap==="undefined")return registry$1.list();else if(typeof nameOrFormatMap=== "string")if(typeof callback==="function")registry$1.register(nameOrFormatMap,callback);else return registry$1.get(nameOrFormatMap);else registry$1.registerMany(nameOrFormatMap)}function pick(collection){return collection[Math.floor(optionAPI("random")()*collection.length)]}function shuffle(collection){var tmp,key,copy=collection.slice(),length=collection.length;for(;length>0;){key=Math.floor(optionAPI("random")()*length);tmp=copy[--length];copy[length]=copy[key];copy[key]=tmp}return copy}var MIN_NUMBER= -100;var MAX_NUMBER=100;function getRandomInt(min,max){return Math.floor(optionAPI("random")()*(max-min+1))+min}function number(min,max,defMin,defMax,hasPrecision){if(hasPrecision===void 0)hasPrecision=false;defMin=typeof defMin==="undefined"?MIN_NUMBER:defMin;defMax=typeof defMax==="undefined"?MAX_NUMBER:defMax;min=typeof min==="undefined"?defMin:min;max=typeof max==="undefined"?defMax:max;if(max<min)max+=min;var result=getRandomInt(min,max);if(!hasPrecision)return parseInt(result+"",10);return result} var random={pick:pick,shuffle:shuffle,number:number};var ParseError=function(_super){tslib_1.__extends(ParseError,_super);function ParseError(message,path){var _this=_super.call(this)||this;_this.path=path;Error.captureStackTrace(_this,_this.constructor);_this.name="ParseError";_this.message=message;_this.path=path;return _this}return ParseError}(Error);var inferredProperties={array:["additionalItems","items","maxItems","minItems","uniqueItems"],integer:["exclusiveMaximum","exclusiveMinimum","maximum", "minimum","multipleOf"],object:["additionalProperties","dependencies","maxProperties","minProperties","patternProperties","properties","required"],string:["maxLength","minLength","pattern"]};inferredProperties.number=inferredProperties.integer;var subschemaProperties=["additionalItems","items","additionalProperties","dependencies","patternProperties","properties"];function matchesType(obj,lastElementInPath,inferredTypeProperties){return Object.keys(obj).filter(function(prop){var isSubschema=subschemaProperties.indexOf(lastElementInPath)> -1,inferredPropertyFound=inferredTypeProperties.indexOf(prop)>-1;if(inferredPropertyFound&&!isSubschema)return true}).length>0}function inferType(obj,schemaPath){for(var typeName in inferredProperties){var lastElementInPath=schemaPath[schemaPath.length-1];if(matchesType(obj,lastElementInPath,inferredProperties[typeName]))return typeName}}function booleanGenerator(){return optionAPI("random")()>.5}var booleanType=booleanGenerator;function nullGenerator(){return null}var nullType=nullGenerator;function getSubAttribute(obj, dotSeparatedKey){var keyElements=dotSeparatedKey.split(".");while(keyElements.length){var prop=keyElements.shift();if(!obj[prop])break;obj=obj[prop]}return obj}function hasProperties(obj){var properties=[];for(var _i=1;_i<arguments.length;_i++)properties[_i-1]=arguments[_i];return properties.filter(function(key){return typeof obj[key]!=="undefined"}).length>0}function typecast(value,targetType){switch(targetType){case "integer":return parseInt(value,10);case "number":return parseFloat(value);case "string":return""+ value;case "boolean":return!!value;default:return value}}function clone(arr){var out=[];arr.forEach(function(item,index){if(typeof item==="object"&&item!==null)out[index]=Array.isArray(item)?clone(item):merge({},item);else out[index]=item});return out}function merge(a,b){for(var key in b)if(typeof b[key]!=="object"||b[key]===null)a[key]=b[key];else if(Array.isArray(b[key]))a[key]=(a[key]||[]).concat(clone(b[key]));else if(typeof a[key]!=="object"||a[key]===null||Array.isArray(a[key]))a[key]=merge({}, b[key]);else a[key]=merge(a[key],b[key]);return a}var utils={getSubAttribute:getSubAttribute,hasProperties:hasProperties,typecast:typecast,clone:clone,merge:merge};function unique(path,items,value,sample,resolve,traverseCallback){var tmp=[],seen=[];function walk(obj){var json=JSON.stringify(obj);if(seen.indexOf(json)===-1){seen.push(json);tmp.push(obj)}}items.forEach(walk);var limit=100;while(tmp.length!==items.length){walk(traverseCallback(value.items||sample,path,resolve));if(!limit--)break}return tmp} var arrayType=function arrayType(value,path,resolve,traverseCallback){var items=[];if(!(value.items||value.additionalItems)){if(utils.hasProperties(value,"minItems","maxItems","uniqueItems"))throw new ParseError("missing items for "+JSON.stringify(value),path);return items}var tmpItems=value.items;if(tmpItems instanceof Array)return Array.prototype.concat.apply(items,tmpItems.map(function(item,key){var itemSubpath=path.concat(["items",key+""]);return traverseCallback(item,itemSubpath,resolve)})); var minItems=value.minItems;var maxItems=value.maxItems;if(optionAPI("defaultMinItems")&&minItems===undefined)minItems=!maxItems?optionAPI("defaultMinItems"):Math.min(optionAPI("defaultMinItems"),maxItems);if(optionAPI("maxItems")){if(maxItems&&maxItems>optionAPI("maxItems"))maxItems=optionAPI("maxItems");if(minItems&&minItems>optionAPI("maxItems"))minItems=maxItems}var length=random.number(minItems,maxItems,1,5),sample=typeof value.additionalItems==="object"?value.additionalItems:{};for(var current= items.length;current<length;current++){var itemSubpath=path.concat(["items",current+""]);var element=traverseCallback(value.items||sample,itemSubpath,resolve);items.push(element)}if(value.uniqueItems)return unique(path.concat(["items"]),items,value,sample,resolve,traverseCallback);return items};var MIN_INTEGER=-1E8;var MAX_INTEGER=1E8;var numberType=function numberType(value){var min=typeof value.minimum==="undefined"?MIN_INTEGER:value.minimum,max=typeof value.maximum==="undefined"?MAX_INTEGER:value.maximum, multipleOf=value.multipleOf;if(multipleOf){max=Math.floor(max/multipleOf)*multipleOf;min=Math.ceil(min/multipleOf)*multipleOf}if(value.exclusiveMinimum&&value.minimum&&min===value.minimum)min+=multipleOf||1;if(value.exclusiveMaximum&&value.maximum&&max===value.maximum)max-=multipleOf||1;if(min>max)return NaN;if(multipleOf)return Math.floor(random.number(min,max)/multipleOf)*multipleOf;return random.number(min,max,undefined,undefined,true)};var integerType=function integerType(value){var generated= numberType(value);return generated>0?Math.floor(generated):Math.ceil(generated)};var LIPSUM_WORDS=("Lorem ipsum dolor sit amet consectetur adipisicing elit sed do eiusmod tempor incididunt ut labore"+" et dolore magna aliqua Ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea"+" commodo consequat Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla"+" pariatur Excepteur sint occaecat cupidatat non proident sunt in culpa qui officia deserunt mollit anim id est"+ " laborum").split(" ");function wordsGenerator(length){var words=random.shuffle(LIPSUM_WORDS);return words.slice(0,length)}function isArray(obj){return obj&&Array.isArray(obj)}function isObject(obj){return obj&&obj!==null&&typeof obj==="object"}function hasNothing(obj){if(isArray(obj))return obj.length===0;if(isObject(obj))return Object.keys(obj).length===0;return typeof obj==="undefined"||obj===null}function removeProps(obj,key,parent,required){var i,value,isFullyEmpty=true;if(isArray(obj))for(i= 0;i<obj.length;++i){value=obj[i];if(isObject(value))removeProps(value,i,obj);if(hasNothing(value))obj.splice(i--,1);else isFullyEmpty=false}else for(i in obj){value=obj[i];if(required&&required.indexOf(i)>-1){isFullyEmpty=false;removeProps(value);continue}if(isObject(value))removeProps(value,i,obj);if(hasNothing(value))delete obj[i];else isFullyEmpty=false}if(typeof key!=="undefined"&&isFullyEmpty){delete parent[key];removeProps(obj)}}var clean=function(obj,required){removeProps(obj,undefined,undefined, required);return obj};var randexp=container.get("randexp");var anyType={type:["string","number","integer","boolean"]};var objectType=function objectType(value,path,resolve,traverseCallback){var props={};var properties=value.properties||{};var patternProperties=value.patternProperties||{};var requiredProperties=(value.required||[]).slice();var allowsAdditional=value.additionalProperties===false?false:true;var propertyKeys=Object.keys(properties);var patternPropertyKeys=Object.keys(patternProperties); var additionalProperties=allowsAdditional?value.additionalProperties===true?{}:value.additionalProperties:null;if(!allowsAdditional&&propertyKeys.length===0&&patternPropertyKeys.length===0&&utils.hasProperties(value,"minProperties","maxProperties","dependencies","required"))throw new ParseError("missing properties for:\n"+JSON.stringify(value,null," "),path);if(optionAPI("requiredOnly")===true){requiredProperties.forEach(function(key){if(properties[key])props[key]=properties[key]});return clean(traverseCallback(props, path.concat(["properties"]),resolve),value.required)}var min=Math.max(value.minProperties||0,requiredProperties.length);var max=Math.max(value.maxProperties||random.number(min,min+5));random.shuffle(patternPropertyKeys.concat(propertyKeys)).forEach(function(_key){if(requiredProperties.indexOf(_key)===-1)requiredProperties.push(_key)});var _props=optionAPI("alwaysFakeOptionals")?requiredProperties:requiredProperties.slice(0,random.number(min,max));_props.forEach(function(key){if(properties[key])props[key]= properties[key];else{var found;patternPropertyKeys.forEach(function(_key){if(key.match(new RegExp(_key))){found=true;props[randexp(key)]=patternProperties[_key]}});if(!found){var subschema=patternProperties[key]||additionalProperties;if(subschema)props[patternProperties[key]?randexp(key):key]=subschema}}});var current=Object.keys(props).length;while(true){if(!(patternPropertyKeys.length||allowsAdditional))break;if(current>=min)break;if(allowsAdditional){var word=wordsGenerator(1)+randexp("[a-f\\d]{1,3}"); if(!props[word]){props[word]=additionalProperties||anyType;current+=1}}patternPropertyKeys.forEach(function(_key){var word=randexp(_key);if(!props[word]){props[word]=patternProperties[_key];current+=1}})}if(!allowsAdditional&&current<min)throw new ParseError("properties constraints were too strong to successfully generate a valid object for:\n"+JSON.stringify(value,null," "),path);return clean(traverseCallback(props,path.concat(["properties"]),resolve),value.required)};function produce(){var length= random.number(1,5);return wordsGenerator(length).join(" ")}function thunkGenerator(min,max){if(min===void 0)min=0;if(max===void 0)max=140;var min=Math.max(0,min),max=random.number(min,max),result=produce();while(result.length<min)result+=produce();if(result.length>max)result=result.substr(0,max);return result}function ipv4Generator(){return[0,0,0,0].map(function(){return random.number(0,255)}).join(".")}function dateTimeGenerator(){return(new Date(random.number(0,1E14))).toISOString()}var randexp$2= container.get("randexp");var regexps={email:"[a-zA-Z\\d][a-zA-Z\\d-]{1,13}[a-zA-Z\\d]@{hostname}",hostname:"[a-zA-Z]{1,33}\\.[a-z]{2,4}",ipv6:"[a-f\\d]{4}(:[a-f\\d]{4}){7}",uri:"[a-zA-Z][a-zA-Z0-9+-.]*"};function coreFormatGenerator(coreFormat){return randexp$2(regexps[coreFormat]).replace(/\{(\w+)\}/,function(match,key){return randexp$2(regexps[key])})}var randexp$1=container.get("randexp");function generateFormat(value){switch(value.format){case "date-time":return dateTimeGenerator();case "ipv4":return ipv4Generator(); case "regex":return".+?";case "email":case "hostname":case "ipv6":case "uri":return coreFormatGenerator(value.format);default:var callback=formatAPI(value.format);return callback(container.getAll(),value)}}var stringType=function stringType(value){var output;var minLength=value.minLength;var maxLength=value.maxLength;if(optionAPI("maxLength")){if(maxLength&&maxLength>optionAPI("maxLength"))maxLength=optionAPI("maxLength");if(minLength&&minLength>optionAPI("maxLength"))minLength=optionAPI("maxLength")}if(value.format)output= generateFormat(value);else if(value.pattern)output=randexp$1(value.pattern);else output=thunkGenerator(minLength,maxLength);while(output.length<minLength)output+=optionAPI("random")()>.7?thunkGenerator():randexp$1(".+");if(output.length>maxLength)output=output.substr(0,maxLength);return output};var externalType=function externalType(value,path){var libraryName=value.faker?"faker":value.chance?"chance":"casual",libraryModule=container.get(libraryName),key=value.faker||value.chance||value.casual,path= key,args=[];if(typeof path==="object"){path=Object.keys(path)[0];if(Array.isArray(key[path]))args=key[path];else args.push(key[path])}var genFunction=utils.getSubAttribute(libraryModule,path);try{var contextObject=libraryModule;if(libraryName==="faker"){var parts=path.split(".");while(parts.length>1)contextObject=libraryModule[parts.shift()];genFunction=contextObject[parts[0]]}}catch(e){throw new Error("cannot resolve "+libraryName+"-generator for "+JSON.stringify(key));}if(typeof genFunction!=="function"){if(libraryName=== "casual")return utils.typecast(genFunction,value.type);throw new Error("unknown "+libraryName+"-generator for "+JSON.stringify(key));}var result=genFunction.apply(contextObject,args);return utils.typecast(result,value.type)};var typeMap={boolean:booleanType,null:nullType,array:arrayType,integer:integerType,number:numberType,object:objectType,string:stringType,external:externalType};function isExternal(schema){return schema.faker||schema.chance||schema.casual}function reduceExternal(schema,path){if(schema["x-faker"])schema.faker= schema["x-faker"];if(schema["x-chance"])schema.chance=schema["x-chance"];if(schema["x-casual"])schema.casual=schema["x-casual"];var count=(schema.faker!==undefined?1:0)+(schema.chance!==undefined?1:0)+(schema.casual!==undefined?1:0);if(count>1)throw new ParseError("ambiguous generator mixing faker, chance or casual: "+JSON.stringify(schema),path);return schema}function traverse(schema,path,resolve){resolve(schema);if(Array.isArray(schema.enum))return random.pick(schema.enum);if(optionAPI("useDefaultValue")&& "default"in schema)return schema.default;var type=schema.type;if(Array.isArray(type))type=random.pick(type);else if(typeof type==="undefined")type=inferType(schema,path)||type;schema=reduceExternal(schema,path);if(isExternal(schema))type="external";if(typeof type==="string")if(!typeMap[type])if(optionAPI("failOnInvalidTypes"))throw new ParseError("unknown primitive "+JSON.stringify(type),path.concat(["type"]));else return optionAPI("defaultInvalidTypeProduct");else try{return typeMap[type](schema, path,resolve,traverse)}catch(e){if(typeof e.path==="undefined")throw new ParseError(e.message,path);throw e;}var copy={};if(Array.isArray(schema))copy=[];for(var prop in schema)if(typeof schema[prop]==="object"&&prop!=="definitions")copy[prop]=traverse(schema[prop],path.concat([prop]),resolve);else copy[prop]=schema[prop];return copy}function isKey(prop){return prop==="enum"||prop==="default"||prop==="required"||prop==="definitions"}function run(schema,refs,ex){var $=deref();var _={};try{return traverse($(schema, refs,ex),[],function reduce(sub,maxReduceDepth){if(typeof maxReduceDepth==="undefined")maxReduceDepth=random.number(1,3);if(!sub)return null;if(typeof sub.$ref==="string"){var id=sub.$ref;if(!_[id])_[id]=0;_[id]+=1;delete sub.$ref;if(_[id]>maxReduceDepth){delete sub.oneOf;delete sub.anyOf;delete sub.allOf;return sub}utils.merge(sub,$.util.findByRef(id,$.refs))}if(Array.isArray(sub.allOf)){var schemas=sub.allOf;delete sub.allOf;schemas.forEach(function(schema){utils.merge(sub,reduce(schema,maxReduceDepth+ 1))})}if(Array.isArray(sub.oneOf||sub.anyOf)){var mix=sub.oneOf||sub.anyOf;delete sub.anyOf;delete sub.oneOf;utils.merge(sub,random.pick(mix))}for(var prop in sub)if((Array.isArray(sub[prop])||typeof sub[prop]==="object")&&!isKey(prop))sub[prop]=reduce(sub[prop],maxReduceDepth);return sub})}catch(e){if(e.path)throw new Error(e.message+" in "+"/"+e.path.join("/"));else throw e;}}var jsf=function(schema,refs){return run(schema,refs)};jsf.format=formatAPI;jsf.option=optionAPI;jsf.extend=function(name, cb){container.extend(name,cb);return jsf};var VERSION="0.4.5";jsf.version=VERSION;var lib=jsf;var fake=createCommonjsModule(function(module){function Fake(faker){this.fake=function fake(str){var res="";if(typeof str!=="string"||str.length===0){res="string parameter is required!";return res}var start=str.search("{{");var end=str.search("}}");if(start===-1&&end===-1)return str;var token=str.substr(start+2,end-start-2);var method=token.replace("}}","").replace("{{","");var regExp=/\(([^)]+)\)/;var matches= regExp.exec(method);var parameters="";if(matches){method=method.replace(regExp,"");parameters=matches[1]}var parts=method.split(".");if(typeof faker[parts[0]]==="undefined")throw new Error("Invalid module: "+parts[0]);if(typeof faker[parts[0]][parts[1]]==="undefined")throw new Error("Invalid method: "+parts[0]+"."+parts[1]);var fn=faker[parts[0]][parts[1]];var params;try{params=JSON.parse(parameters)}catch(err){params=parameters}var result;if(typeof params==="string"&&params.length===0)result=fn.call(this); else result=fn.call(this,params);res=str.replace("{{"+token+"}}",result);return fake(res)};return this}module["exports"]=Fake});function MersenneTwister19937(){var N,M,MATRIX_A,UPPER_MASK,LOWER_MASK;N=624;M=397;MATRIX_A=2567483615;UPPER_MASK=2147483648;LOWER_MASK=2147483647;var mt=new Array(N);var mti=N+1;function unsigned32(n1){return n1<0?(n1^UPPER_MASK)+UPPER_MASK:n1}function subtraction32(n1,n2){return n1<n2?unsigned32(4294967296-(n2-n1)&4294967295):n1-n2}function addition32(n1,n2){return unsigned32(n1+ n2&4294967295)}function multiplication32(n1,n2){var sum=0;for(var i=0;i<32;++i)if(n1>>>i&1)sum=addition32(sum,unsigned32(n2<<i));return sum}this.init_genrand=function(s){mt[0]=unsigned32(s&4294967295);for(mti=1;mti<N;mti++){mt[mti]=addition32(multiplication32(1812433253,unsigned32(mt[mti-1]^mt[mti-1]>>>30)),mti);mt[mti]=unsigned32(mt[mti]&4294967295)}};this.init_by_array=function(init_key,key_length){var i,j,k;this.init_genrand(19650218);i=1;j=0;k=N>key_length?N:key_length;for(;k;k--){mt[i]=addition32(addition32(unsigned32(mt[i]^ multiplication32(unsigned32(mt[i-1]^mt[i-1]>>>30),1664525)),init_key[j]),j);mt[i]=unsigned32(mt[i]&4294967295);i++;j++;if(i>=N){mt[0]=mt[N-1];i=1}if(j>=key_length)j=0}for(k=N-1;k;k--){mt[i]=subtraction32(unsigned32((dbg=mt[i])^multiplication32(unsigned32(mt[i-1]^mt[i-1]>>>30),1566083941)),i);mt[i]=unsigned32(mt[i]&4294967295);i++;if(i>=N){mt[0]=mt[N-1];i=1}}mt[0]=2147483648};var mag01=[0,MATRIX_A];this.genrand_int32=function(){var y;if(mti>=N){var kk;if(mti==N+1)this.init_genrand(5489);for(kk=0;kk< N-M;kk++){y=unsigned32(mt[kk]&UPPER_MASK|mt[kk+1]&LOWER_MASK);mt[kk]=unsigned32(mt[kk+M]^y>>>1^mag01[y&1])}for(;kk<N-1;kk++){y=unsigned32(mt[kk]&UPPER_MASK|mt[kk+1]&LOWER_MASK);mt[kk]=unsigned32(mt[kk+(M-N)]^y>>>1^mag01[y&1])}y=unsigned32(mt[N-1]&UPPER_MASK|mt[0]&LOWER_MASK);mt[N-1]=unsigned32(mt[M-1]^y>>>1^mag01[y&1]);mti=0}y=mt[mti++];y=unsigned32(y^y>>>11);y=unsigned32(y^y<<7&2636928640);y=unsigned32(y^y<<15&4022730752);y=unsigned32(y^y>>>18);return y};this.genrand_int31=function(){return this.genrand_int32()>>> 1};this.genrand_real1=function(){return this.genrand_int32()*(1/4294967295)};this.genrand_real2=function(){return this.genrand_int32()*(1/4294967296)};this.genrand_real3=function(){return(this.genrand_int32()+.5)*(1/4294967296)};this.genrand_res53=function(){var a=this.genrand_int32()>>>5,b=this.genrand_int32()>>>6;return(a*67108864+b)*(1/9007199254740992)}}var MersenneTwister19937_1=MersenneTwister19937;var gen=new MersenneTwister19937;gen.init_genrand((new Date).getTime()%1E9);var rand=function(max, min){if(max===undefined){min=0;max=32768}return Math.floor(gen.genrand_real2()*(max-min)+min)};var seed=function(S){if(typeof S!="number")throw new Error("seed(S) must take numeric argument; is "+typeof S);gen.init_genrand(S)};var seed_array=function(A){if(typeof A!="object")throw new Error("seed_array(A) must take array of numbers; is "+typeof A);gen.init_by_array(A)};var mersenne={MersenneTwister19937:MersenneTwister19937_1,rand:rand,seed:seed,seed_array:seed_array};var random$1=createCommonjsModule(function(module){function Random(faker, seed){if(seed)if(Array.isArray(seed)&&seed.length)mersenne.seed_array(seed);else mersenne.seed(seed);this.number=function(options){if(typeof options==="number")options={max:options};options=options||{};if(typeof options.min==="undefined")options.min=0;if(typeof options.max==="undefined")options.max=99999;if(typeof options.precision==="undefined")options.precision=1;var max=options.max;if(max>=0)max+=options.precision;var randomNumber=options.precision*Math.floor(mersenne.rand(max/options.precision, options.min/options.precision));return randomNumber};this.arrayElement=function(array){array=array||["a","b","c"];var r=faker.random.number({max:array.length-1});return array[r]};this.objectElement=function(object,field){object=object||{"foo":"bar","too":"car"};var array=Object.keys(object);var key=faker.random.arrayElement(array);return field==="key"?key:object[key]};this.uuid=function(){var self=this;var RFC4122_TEMPLATE="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";var replacePlaceholders=function(placeholder){var random= self.number({min:0,max:15});var value=placeholder=="x"?random:random&3|8;return value.toString(16)};return RFC4122_TEMPLATE.replace(/[xy]/g,replacePlaceholders)};this.boolean=function(){return!!faker.random.number(1)};this.word=function randomWord(type){var wordMethods=["commerce.department","commerce.productName","commerce.productAdjective","commerce.productMaterial","commerce.product","commerce.color","company.catchPhraseAdjective","company.catchPhraseDescriptor","company.catchPhraseNoun","company.bsAdjective", "company.bsBuzz","company.bsNoun","address.streetSuffix","address.county","address.country","address.state","finance.accountName","finance.transactionType","finance.currencyName","hacker.noun","hacker.verb","hacker.adjective","hacker.ingverb","hacker.abbreviation","name.jobDescriptor","name.jobArea","name.jobType"];var randomWordMethod=faker.random.arrayElement(wordMethods);return faker.fake("{{"+randomWordMethod+"}}")};this.words=function randomWords(count){var words=[];if(typeof count==="undefined")count= faker.random.number({min:1,max:3});for(var i=0;i<count;i++)words.push(faker.random.word());return words.join(" ")};this.image=function randomImage(){return faker.image.image()};this.locale=function randomLocale(){return faker.random.arrayElement(Object.keys(faker.locales))};this.alphaNumeric=function alphaNumeric(count){if(typeof count==="undefined")count=1;var wholeString="";for(var i=0;i<count;i++)wholeString+=faker.random.arrayElement(["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e", "f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]);return wholeString};return this}module["exports"]=Random});var helpers$2=createCommonjsModule(function(module){var Helpers=function(faker){var self=this;self.randomize=function(array){array=array||["a","b","c"];return faker.random.arrayElement(array)};self.slugify=function(string){string=string||"";return string.replace(/ /g,"-").replace(/[^\w\.\-]+/g,"")};self.replaceSymbolWithNumber=function(string,symbol){string= string||"";if(symbol===undefined)symbol="#";var str="";for(var i=0;i<string.length;i++)if(string.charAt(i)==symbol)str+=faker.random.number(9);else str+=string.charAt(i);return str};self.replaceSymbols=function(string){string=string||"";var alpha=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];var str="";for(var i=0;i<string.length;i++)if(string.charAt(i)=="#")str+=faker.random.number(9);else if(string.charAt(i)=="?")str+=faker.random.arrayElement(alpha); else str+=string.charAt(i);return str};self.shuffle=function(o){if(typeof o==="undefined"||o.length===0)return[];o=o||["a","b","c"];for(var j,x,i=o.length-1;i;j=faker.random.number(i),x=o[--i],o[i]=o[j],o[j]=x);return o};self.mustache=function(str,data){if(typeof str==="undefined")return"";for(var p in data){var re=new RegExp("{{"+p+"}}","g");str=str.replace(re,data[p])}return str};self.createCard=function(){return{"name":faker.name.findName(),"username":faker.internet.userName(),"email":faker.internet.email(), "address":{"streetA":faker.address.streetName(),"streetB":faker.address.streetAddress(),"streetC":faker.address.streetAddress(true),"streetD":faker.address.secondaryAddress(),"city":faker.address.city(),"state":faker.address.state(),"country":faker.address.country(),"zipcode":faker.address.zipCode(),"geo":{"lat":faker.address.latitude(),"lng":faker.address.longitude()}},"phone":faker.phone.phoneNumber(),"website":faker.internet.domainName(),"company":{"name":faker.company.companyName(),"catchPhrase":faker.company.catchPhrase(), "bs":faker.company.bs()},"posts":[{"words":faker.lorem.words(),"sentence":faker.lorem.sentence(),"sentences":faker.lorem.sentences(),"paragraph":faker.lorem.paragraph()},{"words":faker.lorem.words(),"sentence":faker.lorem.sentence(),"sentences":faker.lorem.sentences(),"paragraph":faker.lorem.paragraph()},{"words":faker.lorem.words(),"sentence":faker.lorem.sentence(),"sentences":faker.lorem.sentences(),"paragraph":faker.lorem.paragraph()}],"accountHistory":[faker.helpers.createTransaction(),faker.helpers.createTransaction(), faker.helpers.createTransaction()]}};self.contextualCard=function(){var name=faker.name.firstName(),userName=faker.internet.userName(name);return{"name":name,"username":userName,"avatar":faker.internet.avatar(),"email":faker.internet.email(userName),"dob":faker.date.past(50,new Date("Sat Sep 20 1992 21:35:02 GMT+0200 (CEST)")),"phone":faker.phone.phoneNumber(),"address":{"street":faker.address.streetName(true),"suite":faker.address.secondaryAddress(),"city":faker.address.city(),"zipcode":faker.address.zipCode(), "geo":{"lat":faker.address.latitude(),"lng":faker.address.longitude()}},"website":faker.internet.domainName(),"company":{"name":faker.company.companyName(),"catchPhrase":faker.company.catchPhrase(),"bs":faker.company.bs()}}};self.userCard=function(){return{"name":faker.name.findName(),"username":faker.internet.userName(),"email":faker.internet.email(),"address":{"street":faker.address.streetName(true),"suite":faker.address.secondaryAddress(),"city":faker.address.city(),"zipcode":faker.address.zipCode(), "geo":{"lat":faker.address.latitude(),"lng":faker.address.longitude()}},"phone":faker.phone.phoneNumber(),"website":faker.internet.domainName(),"company":{"name":faker.company.companyName(),"catchPhrase":faker.company.catchPhrase(),"bs":faker.company.bs()}}};self.createTransaction=function(){return{"amount":faker.finance.amount(),"date":new Date(2012,1,2),"business":faker.company.companyName(),"name":[faker.finance.accountName(),faker.finance.mask()].join(" "),"type":self.randomize(faker.definitions.finance.transaction_type), "account":faker.finance.account()}};return self};module["exports"]=Helpers});var name=createCommonjsModule(function(module){function Name(faker){this.firstName=function(gender){if(typeof faker.definitions.name.male_first_name!=="undefined"&&typeof faker.definitions.name.female_first_name!=="undefined"){if(typeof gender!=="number")gender=faker.random.number(1);if(gender===0)return faker.random.arrayElement(faker.locales[faker.locale].name.male_first_name);else return faker.random.arrayElement(faker.locales[faker.locale].name.female_first_name)}return faker.random.arrayElement(faker.definitions.name.first_name)}; this.lastName=function(gender){if(typeof faker.definitions.name.male_last_name!=="undefined"&&typeof faker.definitions.name.female_last_name!=="undefined"){if(typeof gender!=="number")gender=faker.random.number(1);if(gender===0)return faker.random.arrayElement(faker.locales[faker.locale].name.male_last_name);else return faker.random.arrayElement(faker.locales[faker.locale].name.female_last_name)}return faker.random.arrayElement(faker.definitions.name.last_name)};this.findName=function(firstName,lastName, gender){var r=faker.random.number(8);var prefix,suffix;if(typeof gender!=="number")gender=faker.random.number(1);firstName=firstName||faker.name.firstName(gender);lastName=lastName||faker.name.lastName(gender);switch(r){case 0:prefix=faker.name.prefix(gender);if(prefix)return prefix+" "+firstName+" "+lastName;case 1:suffix=faker.name.suffix(gender);if(suffix)return firstName+" "+lastName+" "+suffix}return firstName+" "+lastName};this.jobTitle=function(){return faker.name.jobDescriptor()+" "+faker.name.jobArea()+ " "+faker.name.jobType()};this.prefix=function(gender){if(typeof faker.definitions.name.male_prefix!=="undefined"&&typeof faker.definitions.name.female_prefix!=="undefined"){if(typeof gender!=="number")gender=faker.random.number(1);if(gender===0)return faker.random.arrayElement(faker.locales[faker.locale].name.male_prefix);else return faker.random.arrayElement(faker.locales[faker.locale].name.female_prefix)}return faker.random.arrayElement(faker.definitions.name.prefix)};this.suffix=function(){return faker.random.arrayElement(faker.definitions.name.suffix)}; this.title=function(){var descriptor=faker.random.arrayElement(faker.definitions.name.title.descriptor),level=faker.random.arrayElement(faker.definitions.name.title.level),job=faker.random.arrayElement(faker.definitions.name.title.job);return descriptor+" "+level+" "+job};this.jobDescriptor=function(){return faker.random.arrayElement(faker.definitions.name.title.descriptor)};this.jobArea=function(){return faker.random.arrayElement(faker.definitions.name.title.level)};this.jobType=function(){return faker.random.arrayElement(faker.definitions.name.title.job)}} module["exports"]=Name});function Address(faker){var f=faker.fake,Helpers=faker.helpers;this.zipCode=function(format){if(typeof format==="undefined"){var localeFormat=faker.definitions.address.postcode;if(typeof localeFormat==="string")format=localeFormat;else format=faker.random.arrayElement(localeFormat)}return Helpers.replaceSymbols(format)};this.city=function(format){var formats=["{{address.cityPrefix}} {{name.firstName}}{{address.citySuffix}}","{{address.cityPrefix}} {{name.firstName}}","{{name.firstName}}{{address.citySuffix}}", "{{name.lastName}}{{address.citySuffix}}"];if(typeof format!=="number")format=faker.random.number(formats.length-1);return f(formats[format])};this.cityPrefix=function(){return faker.random.arrayElement(faker.definitions.address.city_prefix)};this.citySuffix=function(){return faker.random.arrayElement(faker.definitions.address.city_suffix)};this.streetName=function(){var result;var suffix=faker.address.streetSuffix();if(suffix!=="")suffix=" "+suffix;switch(faker.random.number(1)){case 0:result=faker.name.lastName()+ suffix;break;case 1:result=faker.name.firstName()+suffix;break}return result};this.streetAddress=function(useFullAddress){if(useFullAddress===undefined)useFullAddress=false;var address="";switch(faker.random.number(2)){case 0:address=Helpers.replaceSymbolWithNumber("#####")+" "+faker.address.streetName();break;case 1:address=Helpers.replaceSymbolWithNumber("####")+" "+faker.address.streetName();break;case 2:address=Helpers.replaceSymbolWithNumber("###")+" "+faker.address.streetName();break}return useFullAddress? address+" "+faker.address.secondaryAddress():address};this.streetSuffix=function(){return faker.random.arrayElement(faker.definitions.address.street_suffix)};this.streetPrefix=function(){return faker.random.arrayElement(faker.definitions.address.street_prefix)};this.secondaryAddress=function(){return Helpers.replaceSymbolWithNumber(faker.random.arrayElement(["Apt. ###","Suite ###"]))};this.county=function(){return faker.random.arrayElement(faker.definitions.address.county)};this.country=function(){return faker.random.arrayElement(faker.definitions.address.country)}; this.countryCode=function(){return faker.random.arrayElement(faker.definitions.address.country_code)};this.state=function(useAbbr){return faker.random.arrayElement(faker.definitions.address.state)};this.stateAbbr=function(){return faker.random.arrayElement(faker.definitions.address.state_abbr)};this.latitude=function(){return(faker.random.number(180*1E4)/1E4-90).toFixed(4)};this.longitude=function(){return(faker.random.number(360*1E4)/1E4-180).toFixed(4)};return this}var address=Address;var company= createCommonjsModule(function(module){var Company=function(faker){var f=faker.fake;this.suffixes=function(){return faker.definitions.company.suffix.slice(0)};this.companyName=function(format){var formats=["{{name.lastName}} {{company.companySuffix}}","{{name.lastName}} - {{name.lastName}}","{{name.lastName}}, {{name.lastName}} and {{name.lastName}}"];if(typeof format!=="number")format=faker.random.number(formats.length-1);return f(formats[format])};this.companySuffix=function(){return faker.random.arrayElement(faker.company.suffixes())}; this.catchPhrase=function(){return f("{{company.catchPhraseAdjective}} {{company.catchPhraseDescriptor}} {{company.catchPhraseNoun}}")};this.bs=function(){return f("{{company.bsAdjective}} {{company.bsBuzz}} {{company.bsNoun}}")};this.catchPhraseAdjective=function(){return faker.random.arrayElement(faker.definitions.company.adjective)};this.catchPhraseDescriptor=function(){return faker.random.arrayElement(faker.definitions.company.descriptor)};this.catchPhraseNoun=function(){return faker.random.arrayElement(faker.definitions.company.noun)}; this.bsAdjective=function(){return faker.random.arrayElement(faker.definitions.company.bs_adjective)};this.bsBuzz=function(){return faker.random.arrayElement(faker.definitions.company.bs_verb)};this.bsNoun=function(){return faker.random.arrayElement(faker.definitions.company.bs_noun)}};module["exports"]=Company});var iban=createCommonjsModule(function(module){module["exports"]={alpha:["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],pattern10:["01", "02","03","04","05","06","07","08","09"],pattern100:["001","002","003","004","005","006","007","008","009"],toDigitString:function(str){return str.replace(/[A-Z]/gi,function(match){return match.toUpperCase().charCodeAt(0)-55})},mod97:function(digitStr){var m=0;for(var i=0;i<digitStr.length;i++)m=(m*10+(digitStr[i]|0))%97;return m},formats:[{country:"AL",total:28,bban:[{type:"n",count:8},{type:"c",count:16}],format:"ALkk bbbs sssx cccc cccc cccc cccc"},{country:"AD",total:24,bban:[{type:"n",count:8}, {type:"c",count:12}],format:"ADkk bbbb ssss cccc cccc cccc"},{country:"AT",total:20,bban:[{type:"n",count:5},{type:"n",count:11}],format:"ATkk bbbb bccc cccc cccc"},{country:"AZ",total:28,bban:[{type:"c",count:4},{type:"n",count:20}],format:"AZkk bbbb cccc cccc cccc cccc cccc"},{country:"BH",total:22,bban:[{type:"a",count:4},{type:"c",count:14}],format:"BHkk bbbb cccc cccc cccc cc"},{country:"BE",total:16,bban:[{type:"n",count:3},{type:"n",count:9}],format:"BEkk bbbc cccc ccxx"},{country:"BA",total:20, bban:[{type:"n",count:6},{type:"n",count:10}],format:"BAkk bbbs sscc cccc ccxx"},{country:"BR",total:29,bban:[{type:"n",count:13},{type:"n",count:10},{type:"a",count:1},{type:"c",count:1}],format:"BRkk bbbb bbbb ssss sccc cccc ccct n"},{country:"BG",total:22,bban:[{type:"a",count:4},{type:"n",count:6},{type:"c",count:8}],format:"BGkk bbbb ssss ddcc cccc cc"},{country:"CR",total:21,bban:[{type:"n",count:3},{type:"n",count:14}],format:"CRkk bbbc cccc cccc cccc c"},{country:"HR",total:21,bban:[{type:"n", count:7},{type:"n",count:10}],format:"HRkk bbbb bbbc cccc cccc c"},{country:"CY",total:28,bban:[{type:"n",count:8},{type:"c",count:16}],format:"CYkk bbbs ssss cccc cccc cccc cccc"},{country:"CZ",total:24,bban:[{type:"n",count:10},{type:"n",count:10}],format:"CZkk bbbb ssss sscc cccc cccc"},{country:"DK",total:18,bban:[{type:"n",count:4},{type:"n",count:10}],format:"DKkk bbbb cccc cccc cc"},{country:"DO",total:28,bban:[{type:"a",count:4},{type:"n",count:20}],format:"DOkk bbbb cccc cccc cccc cccc cccc"}, {country:"TL",total:23,bban:[{type:"n",count:3},{type:"n",count:16}],format:"TLkk bbbc cccc cccc cccc cxx"},{country:"EE",total:20,bban:[{type:"n",count:4},{type:"n",count:12}],format:"EEkk bbss cccc cccc cccx"},{country:"FO",total:18,bban:[{type:"n",count:4},{type:"n",count:10}],format:"FOkk bbbb cccc cccc cx"},{country:"FI",total:18,bban:[{type:"n",count:6},{type:"n",count:8}],format:"FIkk bbbb bbcc cccc cx"},{country:"FR",total:27,bban:[{type:"n",count:10},{type:"c",count:11},{type:"n",count:2}], format:"FRkk bbbb bggg ggcc cccc cccc cxx"},{country:"GE",total:22,bban:[{type:"c",count:2},{type:"n",count:16}],format:"GEkk bbcc cccc cccc cccc cc"},{country:"DE",total:22,bban:[{type:"n",count:8},{type:"n",count:10}],format:"DEkk bbbb bbbb cccc cccc cc"},{country:"GI",total:23,bban:[{type:"a",count:4},{type:"c",count:15}],format:"GIkk bbbb cccc cccc cccc ccc"},{country:"GR",total:27,bban:[{type:"n",count:7},{type:"c",count:16}],format:"GRkk bbbs sssc cccc cccc cccc ccc"},{country:"GL",total:18, bban:[{type:"n",count:4},{type:"n",count:10}],format:"GLkk bbbb cccc cccc cc"},{country:"GT",total:28,bban:[{type:"c",count:4},{type:"c",count:4},{type:"c",count:16}],format:"GTkk bbbb mmtt cccc cccc cccc cccc"},{country:"HU",total:28,bban:[{type:"n",count:8},{type:"n",count:16}],format:"HUkk bbbs sssk cccc cccc cccc cccx"},{country:"IS",total:26,bban:[{type:"n",count:6},{type:"n",count:16}],format:"ISkk bbbb sscc cccc iiii iiii ii"},{country:"IE",total:22,bban:[{type:"c",count:4},{type:"n",count:6}, {type:"n",count:8}],format:"IEkk aaaa bbbb bbcc cccc cc"},{country:"IL",total:23,bban:[{type:"n",count:6},{type:"n",count:13}],format:"ILkk bbbn nncc cccc cccc ccc"},{country:"IT",total:27,bban:[{type:"a",count:1},{type:"n",count:10},{type:"c",count:12}],format:"ITkk xaaa aabb bbbc cccc cccc ccc"},{country:"JO",total:30,bban:[{type:"a",count:4},{type:"n",count:4},{type:"n",count:18}],format:"JOkk bbbb nnnn cccc cccc cccc cccc cc"},{country:"KZ",total:20,bban:[{type:"n",count:3},{type:"c",count:13}], format:"KZkk bbbc cccc cccc cccc"},{country:"XK",total:20,bban:[{type:"n",count:4},{type:"n",count:12}],format:"XKkk bbbb cccc cccc cccc"},{country:"KW",total:30,bban:[{type:"a",count:4},{type:"c",count:22}],format:"KWkk bbbb cccc cccc cccc cccc cccc cc"},{country:"LV",total:21,bban:[{type:"a",count:4},{type:"c",count:13}],format:"LVkk bbbb cccc cccc cccc c"},{country:"LB",total:28,bban:[{type:"n",count:4},{type:"c",count:20}],format:"LBkk bbbb cccc cccc cccc cccc cccc"},{country:"LI",total:21,bban:[{type:"n", count:5},{type:"c",count:12}],format:"LIkk bbbb bccc cccc cccc c"},{country:"LT",total:20,bban:[{type:"n",count:5},{type:"n",count:11}],format:"LTkk bbbb bccc cccc cccc"},{country:"LU",total:20,bban:[{type:"n",count:3},{type:"c",count:13}],format:"LUkk bbbc cccc cccc cccc"},{country:"MK",total:19,bban:[{type:"n",count:3},{type:"c",count:10},{type:"n",count:2}],format:"MKkk bbbc cccc cccc cxx"},{country:"MT",total:31,bban:[{type:"a",count:4},{type:"n",count:5},{type:"c",count:18}],format:"MTkk bbbb ssss sccc cccc cccc cccc ccc"}, {country:"MR",total:27,bban:[{type:"n",count:10},{type:"n",count:13}],format:"MRkk bbbb bsss sscc cccc cccc cxx"},{country:"MU",total:30,bban:[{type:"a",count:4},{type:"n",count:4},{type:"n",count:15},{type:"a",count:3}],format:"MUkk bbbb bbss cccc cccc cccc 000d dd"},{country:"MC",total:27,bban:[{type:"n",count:10},{type:"c",count:11},{type:"n",count:2}],format:"MCkk bbbb bsss sscc cccc cccc cxx"},{country:"MD",total:24,bban:[{type:"c",count:2},{type:"c",count:18}],format:"MDkk bbcc cccc cccc cccc cccc"}, {country:"ME",total:22,bban:[{type:"n",count:3},{type:"n",count:15}],format:"MEkk bbbc cccc cccc cccc xx"},{country:"NL",total:18,bban:[{type:"a",count:4},{type:"n",count:10}],format:"NLkk bbbb cccc cccc cc"},{country:"NO",total:15,bban:[{type:"n",count:4},{type:"n",count:7}],format:"NOkk bbbb cccc ccx"},{country:"PK",total:24,bban:[{type:"c",count:4},{type:"n",count:16}],format:"PKkk bbbb cccc cccc cccc cccc"},{country:"PS",total:29,bban:[{type:"c",count:4},{type:"n",count:9},{type:"n",count:12}], format:"PSkk bbbb xxxx xxxx xccc cccc cccc c"},{country:"PL",total:28,bban:[{type:"n",count:8},{type:"n",count:16}],format:"PLkk bbbs sssx cccc cccc cccc cccc"},{country:"PT",total:25,bban:[{type:"n",count:8},{type:"n",count:13}],format:"PTkk bbbb ssss cccc cccc cccx x"},{country:"QA",total:29,bban:[{type:"a",count:4},{type:"c",count:21}],format:"QAkk bbbb cccc cccc cccc cccc cccc c"},{country:"RO",total:24,bban:[{type:"a",count:4},{type:"c",count:16}],format:"ROkk bbbb cccc cccc cccc cccc"},{country:"SM", total:27,bban:[{type:"a",count:1},{type:"n",count:10},{type:"c",count:12}],format:"SMkk xaaa aabb bbbc cccc cccc ccc"},{country:"SA",total:24,bban:[{type:"n",count:2},{type:"c",count:18}],format:"SAkk bbcc cccc cccc cccc cccc"},{country:"RS",total:22,bban:[{type:"n",count:3},{type:"n",count:15}],format:"RSkk bbbc cccc cccc cccc xx"},{country:"SK",total:24,bban:[{type:"n",count:10},{type:"n",count:10}],format:"SKkk bbbb ssss sscc cccc cccc"},{country:"SI",total:19,bban:[{type:"n",count:5},{type:"n", count:10}],format:"SIkk bbss sccc cccc cxx"},{country:"ES",total:24,bban:[{type:"n",count:10},{type:"n",count:10}],format:"ESkk bbbb gggg xxcc cccc cccc"},{country:"SE",total:24,bban:[{type:"n",count:3},{type:"n",count:17}],format:"SEkk bbbc cccc cccc cccc cccc"},{country:"CH",total:21,bban:[{type:"n",count:5},{type:"c",count:12}],format:"CHkk bbbb bccc cccc cccc c"},{country:"TN",total:24,bban:[{type:"n",count:5},{type:"n",count:15}],format:"TNkk bbss sccc cccc cccc cccc"},{country:"TR",total:26, bban:[{type:"n",count:5},{type:"c",count:1},{type:"c",count:16}],format:"TRkk bbbb bxcc cccc cccc cccc cc"},{country:"AE",total:23,bban:[{type:"n",count:3},{type:"n",count:16}],format:"AEkk bbbc cccc cccc cccc ccc"},{country:"GB",total:22,bban:[{type:"a",count:4},{type:"n",count:6},{type:"n",count:8}],format:"GBkk bbbb ssss sscc cccc cc"},{country:"VG",total:24,bban:[{type:"c",count:4},{type:"n",count:16}],format:"VGkk bbbb cccc cccc cccc cccc"}],iso3166:["AC","AD","AE","AF","AG","AI","AL","AM","AN", "AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BU","BV","BW","BY","BZ","CA","CC","CD","CE","CF","CG","CH","CI","CK","CL","CM","CN","CO","CP","CR","CS","CS","CU","CV","CW","CX","CY","CZ","DD","DE","DG","DJ","DK","DM","DO","DZ","EA","EC","EE","EG","EH","ER","ES","ET","EU","FI","FJ","FK","FM","FO","FR","FX","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR", "HT","HU","IC","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NT","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE", "SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SU","SV","SX","SY","SZ","TA","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","YU","ZA","ZM","ZR","ZW"]}});var finance=createCommonjsModule(function(module){var Finance=function(faker){var ibanLib=iban;var Helpers=faker.helpers,self=this;self.account=function(length){length=length||8;var template="";for(var i=0;i<length;i++)template= template+"#";length=null;return Helpers.replaceSymbolWithNumber(template)};self.accountName=function(){return[Helpers.randomize(faker.definitions.finance.account_type),"Account"].join(" ")};self.mask=function(length,parens,ellipsis){length=length==0||!length||typeof length=="undefined"?4:length;parens=parens===null?true:parens;ellipsis=ellipsis===null?true:ellipsis;var template="";for(var i=0;i<length;i++)template=template+"#";template=ellipsis?["...",template].join(""):template;template=parens?["(", template,")"].join(""):template;template=Helpers.replaceSymbolWithNumber(template);return template};self.amount=function(min,max,dec,symbol){min=min||0;max=max||1E3;dec=dec===undefined?2:dec;symbol=symbol||"";var randValue=faker.random.number({max:max,min:min,precision:Math.pow(10,-dec)});return symbol+randValue.toFixed(dec)};self.transactionType=function(){return Helpers.randomize(faker.definitions.finance.transaction_type)};self.currencyCode=function(){return faker.random.objectElement(faker.definitions.finance.currency)["code"]}; self.currencyName=function(){return faker.random.objectElement(faker.definitions.finance.currency,"key")};self.currencySymbol=function(){var symbol;while(!symbol)symbol=faker.random.objectElement(faker.definitions.finance.currency)["symbol"];return symbol};self.bitcoinAddress=function(){var addressLength=faker.random.number({min:27,max:34});var address=faker.random.arrayElement(["1","3"]);for(var i=0;i<addressLength-1;i++)address+=faker.random.alphaNumeric().toUpperCase();return address};self.iban= function(formatted){var ibanFormat=faker.random.arrayElement(ibanLib.formats);var s="";var count=0;for(var b=0;b<ibanFormat.bban.length;b++){var bban=ibanFormat.bban[b];var c=bban.count;count+=bban.count;while(c>0){if(bban.type=="a")s+=faker.random.arrayElement(ibanLib.alpha);else if(bban.type=="c")if(faker.random.number(100)<80)s+=faker.random.number(9);else s+=faker.random.arrayElement(ibanLib.alpha);else if(c>=3&&faker.random.number(100)<30)if(faker.random.boolean()){s+=faker.random.arrayElement(ibanLib.pattern100); c-=2}else{s+=faker.random.arrayElement(ibanLib.pattern10);c--}else s+=faker.random.number(9);c--}s=s.substring(0,count)}var checksum=98-ibanLib.mod97(ibanLib.toDigitString(s+ibanFormat.country+"00"));if(checksum<10)checksum="0"+checksum;var iban$$1=ibanFormat.country+checksum+s;return formatted?iban$$1.match(/.{1,4}/g).join(" "):iban$$1};self.bic=function(){var vowels=["A","E","I","O","U"];var prob=faker.random.number(100);return Helpers.replaceSymbols("???")+faker.random.arrayElement(vowels)+faker.random.arrayElement(ibanLib.iso3166)+ Helpers.replaceSymbols("?")+"1"+(prob<10?Helpers.replaceSymbols("?"+faker.random.arrayElement(vowels)+"?"):prob<40?Helpers.replaceSymbols("###"):"")}};module["exports"]=Finance});var image=createCommonjsModule(function(module){var Image=function(faker){var self=this;self.image=function(width,height,randomize){var categories=["abstract","animals","business","cats","city","food","nightlife","fashion","people","nature","sports","technics","transport"];return self[faker.random.arrayElement(categories)](width, height,randomize)};self.avatar=function(){return faker.internet.avatar()};self.imageUrl=function(width,height,category,randomize,https){var width=width||640;var height=height||480;var protocol="http://";if(typeof https!=="undefined"&&https===true)protocol="https://";var url=protocol+"lorempixel.com/"+width+"/"+height;if(typeof category!=="undefined")url+="/"+category;if(randomize)url+="?"+faker.random.number();return url};self.abstract=function(width,height,randomize){return faker.image.imageUrl(width, height,"abstract",randomize)};self.animals=function(width,height,randomize){return faker.image.imageUrl(width,height,"animals",randomize)};self.business=function(width,height,randomize){return faker.image.imageUrl(width,height,"business",randomize)};self.cats=function(width,height,randomize){return faker.image.imageUrl(width,height,"cats",randomize)};self.city=function(width,height,randomize){return faker.image.imageUrl(width,height,"city",randomize)};self.food=function(width,height,randomize){return faker.image.imageUrl(width, height,"food",randomize)};self.nightlife=function(width,height,randomize){return faker.image.imageUrl(width,height,"nightlife",randomize)};self.fashion=function(width,height,randomize){return faker.image.imageUrl(width,height,"fashion",randomize)};self.people=function(width,height,randomize){return faker.image.imageUrl(width,height,"people",randomize)};self.nature=function(width,height,randomize){return faker.image.imageUrl(width,height,"nature",randomize)};self.sports=function(width,height,randomize){return faker.image.imageUrl(width, height,"sports",randomize)};self.technics=function(width,height,randomize){return faker.image.imageUrl(width,height,"technics",randomize)};self.transport=function(width,height,randomize){return faker.image.imageUrl(width,height,"transport",randomize)};self.dataUri=function(width,height){var rawPrefix="data:image/svg+xml;charset\x3dUTF-8,";var svgString='\x3csvg xmlns\x3d"http://www.w3.org/2000/svg" version\x3d"1.1" baseProfile\x3d"full" width\x3d"'+width+'" height\x3d"'+height+'"\x3e \x3crect width\x3d"100%" height\x3d"100%" fill\x3d"grey"/\x3e \x3ctext x\x3d"0" y\x3d"20" font-size\x3d"20" text-anchor\x3d"start" fill\x3d"white"\x3e'+ width+"x"+height+"\x3c/text\x3e \x3c/svg\x3e";return rawPrefix+encodeURIComponent(svgString)}};module["exports"]=Image});var lorem=createCommonjsModule(function(module){var Lorem=function(faker){var self=this;var Helpers=faker.helpers;self.word=function(num){return faker.random.arrayElement(faker.definitions.lorem.words)};self.words=function(num){if(typeof num=="undefined")num=3;var words=[];for(var i=0;i<num;i++)words.push(faker.lorem.word());return words.join(" ")};self.sentence=function(wordCount, range){if(typeof wordCount=="undefined")wordCount=faker.random.number({min:3,max:10});var sentence=faker.lorem.words(wordCount);return sentence.charAt(0).toUpperCase()+sentence.slice(1)+"."};self.slug=function(wordCount){var words=faker.lorem.words(wordCount);return Helpers.slugify(words)};self.sentences=function(sentenceCount,separator){if(typeof sentenceCount==="undefined")sentenceCount=faker.random.number({min:2,max:6});if(typeof separator=="undefined")separator=" ";var sentences=[];for(;sentenceCount> 0;sentenceCount--)sentences.push(faker.lorem.sentence());return sentences.join(separator)};self.paragraph=function(sentenceCount){if(typeof sentenceCount=="undefined")sentenceCount=3;return faker.lorem.sentences(sentenceCount+faker.random.number(3))};self.paragraphs=function(paragraphCount,separator){if(typeof separator==="undefined")separator="\n \r";if(typeof paragraphCount=="undefined")paragraphCount=3;var paragraphs=[];for(;paragraphCount>0;paragraphCount--)paragraphs.push(faker.lorem.paragraph()); return paragraphs.join(separator)};self.text=function loremText(times){var loremMethods=["lorem.word","lorem.words","lorem.sentence","lorem.sentences","lorem.paragraph","lorem.paragraphs","lorem.lines"];var randomLoremMethod=faker.random.arrayElement(loremMethods);return faker.fake("{{"+randomLoremMethod+"}}")};self.lines=function lines(lineCount){if(typeof lineCount==="undefined")lineCount=faker.random.number({min:1,max:5});return faker.lorem.sentences(lineCount,"\n")};return self};module["exports"]= Lorem});var hacker=createCommonjsModule(function(module){var Hacker=function(faker){var self=this;self.abbreviation=function(){return faker.random.arrayElement(faker.definitions.hacker.abbreviation)};self.adjective=function(){return faker.random.arrayElement(faker.definitions.hacker.adjective)};self.noun=function(){return faker.random.arrayElement(faker.definitions.hacker.noun)};self.verb=function(){return faker.random.arrayElement(faker.definitions.hacker.verb)};self.ingverb=function(){return faker.random.arrayElement(faker.definitions.hacker.ingverb)}; self.phrase=function(){var data={abbreviation:self.abbreviation,adjective:self.adjective,ingverb:self.ingverb,noun:self.noun,verb:self.verb};var phrase=faker.random.arrayElement(["If we {{verb}} the {{noun}}, we can get to the {{abbreviation}} {{noun}} through the {{adjective}} {{abbreviation}} {{noun}}!","We need to {{verb}} the {{adjective}} {{abbreviation}} {{noun}}!","Try to {{verb}} the {{abbreviation}} {{noun}}, maybe it will {{verb}} the {{adjective}} {{noun}}!","You can't {{verb}} the {{noun}} without {{ingverb}} the {{adjective}} {{abbreviation}} {{noun}}!", "Use the {{adjective}} {{abbreviation}} {{noun}}, then you can {{verb}} the {{adjective}} {{noun}}!","The {{abbreviation}} {{noun}} is down, {{verb}} the {{adjective}} {{noun}} so we can {{verb}} the {{abbreviation}} {{noun}}!","{{ingverb}} the {{noun}} won't do anything, we need to {{verb}} the {{adjective}} {{abbreviation}} {{noun}}!","I'll {{verb}} the {{adjective}} {{abbreviation}} {{noun}}, that should {{noun}} the {{abbreviation}} {{noun}}!"]);return faker.helpers.mustache(phrase,data)};return self}; module["exports"]=Hacker});function rnd(a,b){a=a||0;b=b||100;if(typeof b==="number"&&typeof a==="number")return function(min,max){if(min>max)throw new RangeError("expected min \x3c\x3d max; got min \x3d "+min+", max \x3d "+max);return Math.floor(Math.random()*(max-min+1))+min}(a,b);if(Object.prototype.toString.call(a)==="[object Array]")return a[Math.floor(Math.random()*a.length)];if(a&&typeof a==="object")return function(obj){var rand=rnd(0,100)/100,min=0,max=0,key,return_val;for(key in obj)if(obj.hasOwnProperty(key)){max= obj[key]+min;return_val=key;if(rand>=min&&rand<=max)break;min=min+obj[key]}return return_val}(a);throw new TypeError("Invalid arguments passed to rnd. ("+(b?a+", "+b:a)+")");}function randomLang(){return rnd(["AB","AF","AN","AR","AS","AZ","BE","BG","BN","BO","BR","BS","CA","CE","CO","CS","CU","CY","DA","DE","EL","EN","EO","ES","ET","EU","FA","FI","FJ","FO","FR","FY","GA","GD","GL","GV","HE","HI","HR","HT","HU","HY","ID","IS","IT","JA","JV","KA","KG","KO","KU","KW","KY","LA","LB","LI","LN","LT","LV", "MG","MK","MN","MO","MS","MT","MY","NB","NE","NL","NN","NO","OC","PL","PT","RM","RO","RU","SC","SE","SK","SL","SO","SQ","SR","SV","SW","TK","TR","TY","UK","UR","UZ","VI","VO","YI","ZH"])}function randomBrowserAndOS(){var browser=rnd({chrome:.45132810566,iexplorer:.27477061836,firefox:.19384170608,safari:.06186781118,opera:.01574236955}),os={chrome:{win:.89,mac:.09,lin:.02},firefox:{win:.83,mac:.16,lin:.01},opera:{win:.91,mac:.03,lin:.06},safari:{win:.04,mac:.96},iexplorer:["win"]};return[browser, rnd(os[browser])]}function randomProc(arch){var procs={lin:["i686","x86_64"],mac:{"Intel":.48,"PPC":.01,"U; Intel":.48,"U; PPC":.01},win:["","WOW64","Win64; x64"]};return rnd(procs[arch])}function randomRevision(dots){var return_val="";for(var x=0;x<dots;x++)return_val+="."+rnd(0,9);return return_val}var version_string={net:function(){return[rnd(1,4),rnd(0,9),rnd(1E4,99999),rnd(0,9)].join(".")},nt:function(){return rnd(5,6)+"."+rnd(0,3)},ie:function(){return rnd(7,11)},trident:function(){return rnd(3, 7)+"."+rnd(0,1)},osx:function(delim){return[10,rnd(5,10),rnd(0,9)].join(delim||".")},chrome:function(){return[rnd(13,39),0,rnd(800,899),0].join(".")},presto:function(){return"2.9."+rnd(160,190)},presto2:function(){return rnd(10,12)+".00"},safari:function(){return rnd(531,538)+"."+rnd(0,2)+"."+rnd(0,2)}};var browser={firefox:function firefox(arch){var firefox_ver=rnd(5,15)+randomRevision(2),gecko_ver="Gecko/20100101 Firefox/"+firefox_ver,proc=randomProc(arch),os_ver=arch==="win"?"(Windows NT "+version_string.nt()+ (proc?"; "+proc:""):arch==="mac"?"(Macintosh; "+proc+" Mac OS X "+version_string.osx():"(X11; Linux "+proc;return"Mozilla/5.0 "+os_ver+"; rv:"+firefox_ver.slice(0,-2)+") "+gecko_ver},iexplorer:function iexplorer(){var ver=version_string.ie();if(ver>=11)return"Mozilla/5.0 (Windows NT 6."+rnd(1,3)+"; Trident/7.0; "+rnd(["Touch; ",""])+"rv:11.0) like Gecko";return"Mozilla/5.0 (compatible; MSIE "+ver+".0; Windows NT "+version_string.nt()+"; Trident/"+version_string.trident()+(rnd(0,1)===1?"; .NET CLR "+ version_string.net():"")+")"},opera:function opera(arch){var presto_ver=" Presto/"+version_string.presto()+" Version/"+version_string.presto2()+")",os_ver=arch==="win"?"(Windows NT "+version_string.nt()+"; U; "+randomLang()+presto_ver:arch==="lin"?"(X11; Linux "+randomProc(arch)+"; U; "+randomLang()+presto_ver:"(Macintosh; Intel Mac OS X "+version_string.osx()+" U; "+randomLang()+" Presto/"+version_string.presto()+" Version/"+version_string.presto2()+")";return"Opera/"+rnd(9,14)+"."+rnd(0,99)+" "+ os_ver},safari:function safari(arch){var safari=version_string.safari(),ver=rnd(4,7)+"."+rnd(0,1)+"."+rnd(0,10),os_ver=arch==="mac"?"(Macintosh; "+randomProc("mac")+" Mac OS X "+version_string.osx("_")+" rv:"+rnd(2,6)+".0; "+randomLang()+") ":"(Windows; U; Windows NT "+version_string.nt()+")";return"Mozilla/5.0 "+os_ver+"AppleWebKit/"+safari+" (KHTML, like Gecko) Version/"+ver+" Safari/"+safari},chrome:function chrome(arch){var safari=version_string.safari(),os_ver=arch==="mac"?"(Macintosh; "+randomProc("mac")+ " Mac OS X "+version_string.osx("_")+") ":arch==="win"?"(Windows; U; Windows NT "+version_string.nt()+")":"(X11; Linux "+randomProc(arch);return"Mozilla/5.0 "+os_ver+" AppleWebKit/"+safari+" (KHTML, like Gecko) Chrome/"+version_string.chrome()+" Safari/"+safari}};var generate=function generate(){var random=randomBrowserAndOS();return browser[random[0]](random[1])};var userAgent={generate:generate};var internet=createCommonjsModule(function(module){var Internet=function(faker){var self=this;self.avatar= function(){return faker.random.arrayElement(faker.definitions.internet.avatar_uri)};self.avatar.schema={"description":"Generates a URL for an avatar.","sampleResults":["https://s3.amazonaws.com/uifaces/faces/twitter/igorgarybaldi/128.jpg"]};self.email=function(firstName,lastName,provider){provider=provider||faker.random.arrayElement(faker.definitions.internet.free_email);return faker.helpers.slugify(faker.internet.userName(firstName,lastName))+"@"+provider};self.email.schema={"description":"Generates a valid email address based on optional input criteria", "sampleResults":["foo.bar@gmail.com"],"properties":{"firstName":{"type":"string","required":false,"description":"The first name of the user"},"lastName":{"type":"string","required":false,"description":"The last name of the user"},"provider":{"type":"string","required":false,"description":"The domain of the user"}}};self.exampleEmail=function(firstName,lastName){var provider=faker.random.arrayElement(faker.definitions.internet.example_email);return self.email(firstName,lastName,provider)};self.userName= function(firstName,lastName){var result;firstName=firstName||faker.name.firstName();lastName=lastName||faker.name.lastName();switch(faker.random.number(2)){case 0:result=firstName+faker.random.number(99);break;case 1:result=firstName+faker.random.arrayElement([".","_"])+lastName;break;case 2:result=firstName+faker.random.arrayElement([".","_"])+lastName+faker.random.number(99);break}result=result.toString().replace(/'/g,"");result=result.replace(/ /g,"");return result};self.userName.schema={"description":"Generates a username based on one of several patterns. The pattern is chosen randomly.", "sampleResults":["Kirstin39","Kirstin.Smith","Kirstin.Smith39","KirstinSmith","KirstinSmith39"],"properties":{"firstName":{"type":"string","required":false,"description":"The first name of the user"},"lastName":{"type":"string","required":false,"description":"The last name of the user"}}};self.protocol=function(){var protocols=["http","https"];return faker.random.arrayElement(protocols)};self.protocol.schema={"description":"Randomly generates http or https","sampleResults":["https","http"]};self.url= function(){return faker.internet.protocol()+"://"+faker.internet.domainName()};self.url.schema={"description":"Generates a random URL. The URL could be secure or insecure.","sampleResults":["http://rashawn.name","https://rashawn.name"]};self.domainName=function(){return faker.internet.domainWord()+"."+faker.internet.domainSuffix()};self.domainName.schema={"description":"Generates a random domain name.","sampleResults":["marvin.org"]};self.domainSuffix=function(){return faker.random.arrayElement(faker.definitions.internet.domain_suffix)}; self.domainSuffix.schema={"description":"Generates a random domain suffix.","sampleResults":["net"]};self.domainWord=function(){return faker.name.firstName().replace(/([\\~#&*{}/:<>?|\"'])/ig,"").toLowerCase()};self.domainWord.schema={"description":"Generates a random domain word.","sampleResults":["alyce"]};self.ip=function(){var randNum=function(){return faker.random.number(255).toFixed(0)};var result=[];for(var i=0;i<4;i++)result[i]=randNum();return result.join(".")};self.ip.schema={"description":"Generates a random IP.", "sampleResults":["97.238.241.11"]};self.ipv6=function(){var randHash=function(){var result="";for(var i=0;i<4;i++)result+=faker.random.arrayElement(["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"]);return result};var result=[];for(var i=0;i<8;i++)result[i]=randHash();return result.join(":")};self.ipv6.schema={"description":"Generates a random IPv6 address.","sampleResults":["2001:0db8:6276:b1a7:5213:22f1:25df:c8a0"]};self.userAgent=function(){return userAgent.generate()};self.userAgent.schema= {"description":"Generates a random user agent.","sampleResults":["Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_7_5 rv:6.0; SL) AppleWebKit/532.0.1 (KHTML, like Gecko) Version/7.1.6 Safari/532.0.1"]};self.color=function(baseRed255,baseGreen255,baseBlue255){baseRed255=baseRed255||0;baseGreen255=baseGreen255||0;baseBlue255=baseBlue255||0;var red=Math.floor((faker.random.number(256)+baseRed255)/2);var green=Math.floor((faker.random.number(256)+baseGreen255)/2);var blue=Math.floor((faker.random.number(256)+ baseBlue255)/2);var redStr=red.toString(16);var greenStr=green.toString(16);var blueStr=blue.toString(16);return"#"+(redStr.length===1?"0":"")+redStr+(greenStr.length===1?"0":"")+greenStr+(blueStr.length===1?"0":"")+blueStr};self.color.schema={"description":"Generates a random hexadecimal color.","sampleResults":["#06267f"],"properties":{"baseRed255":{"type":"number","required":false,"description":"The red value. Valid values are 0 - 255."},"baseGreen255":{"type":"number","required":false,"description":"The green value. Valid values are 0 - 255."}, "baseBlue255":{"type":"number","required":false,"description":"The blue value. Valid values are 0 - 255."}}};self.mac=function(){var i,mac="";for(i=0;i<12;i++){mac+=faker.random.number(15).toString(16);if(i%2==1&&i!=11)mac+=":"}return mac};self.mac.schema={"description":"Generates a random mac address.","sampleResults":["78:06:cc:ae:b3:81"]};self.password=function(len,memorable,pattern,prefix){len=len||15;if(typeof memorable==="undefined")memorable=false;var consonant,letter,password,vowel;vowel= /[aeiouAEIOU]$/;consonant=/[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]$/;var _password=function(length,memorable,pattern,prefix){var char,n;if(length==null)length=10;if(memorable==null)memorable=true;if(pattern==null)pattern=/\w/;if(prefix==null)prefix="";if(prefix.length>=length)return prefix;if(memorable)if(prefix.match(consonant))pattern=vowel;else pattern=consonant;n=faker.random.number(94)+33;char=String.fromCharCode(n);if(memorable)char=char.toLowerCase();if(!char.match(pattern))return _password(length, memorable,pattern,prefix);return _password(length,memorable,pattern,""+prefix+char)};return _password(len,memorable,pattern,prefix)};self.password.schema={"description":"Generates a random password.","sampleResults":["AM7zl6Mg","susejofe"],"properties":{"length":{"type":"number","required":false,"description":"The number of characters in the password."},"memorable":{"type":"boolean","required":false,"description":"Whether a password should be easy to remember."},"pattern":{"type":"regex","required":false, "description":"A regex to match each character of the password against. This parameter will be negated if the memorable setting is turned on."},"prefix":{"type":"string","required":false,"description":"A value to prepend to the generated password. The prefix counts towards the length of the password."}}}};module["exports"]=Internet});var database=createCommonjsModule(function(module){var Database=function(faker){var self=this;self.column=function(){return faker.random.arrayElement(faker.definitions.database.column)}; self.column.schema={"description":"Generates a column name.","sampleResults":["id","title","createdAt"]};self.type=function(){return faker.random.arrayElement(faker.definitions.database.type)};self.type.schema={"description":"Generates a column type.","sampleResults":["byte","int","varchar","timestamp"]};self.collation=function(){return faker.random.arrayElement(faker.definitions.database.collation)};self.collation.schema={"description":"Generates a collation.","sampleResults":["utf8_unicode_ci", "utf8_bin"]};self.engine=function(){return faker.random.arrayElement(faker.definitions.database.engine)};self.engine.schema={"description":"Generates a storage engine.","sampleResults":["MyISAM","InnoDB"]}};module["exports"]=Database});var phone_number=createCommonjsModule(function(module){var Phone=function(faker){var self=this;self.phoneNumber=function(format){format=format||faker.phone.phoneFormats();return faker.helpers.replaceSymbolWithNumber(format)};self.phoneNumberFormat=function(phoneFormatsArrayIndex){phoneFormatsArrayIndex= phoneFormatsArrayIndex||0;return faker.helpers.replaceSymbolWithNumber(faker.definitions.phone_number.formats[phoneFormatsArrayIndex])};self.phoneFormats=function(){return faker.random.arrayElement(faker.definitions.phone_number.formats)};return self};module["exports"]=Phone});var date=createCommonjsModule(function(module){var _Date=function(faker){var self=this;self.past=function(years,refDate){var date=refDate?new Date(Date.parse(refDate)):new Date;var range={min:1E3,max:(years||1)*365*24*3600* 1E3};var past=date.getTime();past-=faker.random.number(range);date.setTime(past);return date};self.future=function(years,refDate){var date=refDate?new Date(Date.parse(refDate)):new Date;var range={min:1E3,max:(years||1)*365*24*3600*1E3};var future=date.getTime();future+=faker.random.number(range);date.setTime(future);return date};self.between=function(from,to){var fromMilli=Date.parse(from);var dateOffset=faker.random.number(Date.parse(to)-fromMilli);var newDate=new Date(fromMilli+dateOffset);return newDate}; self.recent=function(days){var date=new Date;var range={min:1E3,max:(days||1)*24*3600*1E3};var future=date.getTime();future-=faker.random.number(range);date.setTime(future);return date};self.month=function(options){options=options||{};var type="wide";if(options.abbr)type="abbr";if(options.context&&typeof faker.definitions.date.month[type+"_context"]!=="undefined")type+="_context";var source=faker.definitions.date.month[type];return faker.random.arrayElement(source)};self.weekday=function(options){options= options||{};var type="wide";if(options.abbr)type="abbr";if(options.context&&typeof faker.definitions.date.weekday[type+"_context"]!=="undefined")type+="_context";var source=faker.definitions.date.weekday[type];return faker.random.arrayElement(source)};return self};module["exports"]=_Date});var commerce=createCommonjsModule(function(module){var Commerce=function(faker){var self=this;self.color=function(){return faker.random.arrayElement(faker.definitions.commerce.color)};self.department=function(){return faker.random.arrayElement(faker.definitions.commerce.department)}; self.productName=function(){return faker.commerce.productAdjective()+" "+faker.commerce.productMaterial()+" "+faker.commerce.product()};self.price=function(min,max,dec,symbol){min=min||0;max=max||1E3;dec=dec===undefined?2:dec;symbol=symbol||"";if(min<0||max<0)return symbol+0;var randValue=faker.random.number({max:max,min:min});return symbol+(Math.round(randValue*Math.pow(10,dec))/Math.pow(10,dec)).toFixed(dec)};self.productAdjective=function(){return faker.random.arrayElement(faker.definitions.commerce.product_name.adjective)}; self.productMaterial=function(){return faker.random.arrayElement(faker.definitions.commerce.product_name.material)};self.product=function(){return faker.random.arrayElement(faker.definitions.commerce.product_name.product)};return self};module["exports"]=Commerce});var system=createCommonjsModule(function(module){function System(faker){this.fileName=function(ext,type){var str=faker.fake("{{random.words}}.{{system.fileExt}}");str=str.replace(/ /g,"_");str=str.replace(/\,/g,"_");str=str.replace(/\-/g, "_");str=str.replace(/\\/g,"_");str=str.replace(/\//g,"_");str=str.toLowerCase();return str};this.commonFileName=function(ext,type){var str=faker.random.words()+"."+(ext||faker.system.commonFileExt());str=str.replace(/ /g,"_");str=str.replace(/\,/g,"_");str=str.replace(/\-/g,"_");str=str.replace(/\\/g,"_");str=str.replace(/\//g,"_");str=str.toLowerCase();return str};this.mimeType=function(){return faker.random.arrayElement(Object.keys(faker.definitions.system.mimeTypes))};this.commonFileType=function(){var types= ["video","audio","image","text","application"];return faker.random.arrayElement(types)};this.commonFileExt=function(type){var types=["application/pdf","audio/mpeg","audio/wav","image/png","image/jpeg","image/gif","video/mp4","video/mpeg","text/html"];return faker.system.fileExt(faker.random.arrayElement(types))};this.fileType=function(){var types=[];var mimes=faker.definitions.system.mimeTypes;Object.keys(mimes).forEach(function(m){var parts=m.split("/");if(types.indexOf(parts[0])===-1)types.push(parts[0])}); return faker.random.arrayElement(types)};this.fileExt=function(mimeType){var exts=[];var mimes=faker.definitions.system.mimeTypes;if(typeof mimes[mimeType]==="object")return faker.random.arrayElement(mimes[mimeType].extensions);Object.keys(mimes).forEach(function(m){if(mimes[m].extensions instanceof Array)mimes[m].extensions.forEach(function(ext){exts.push(ext)})});return faker.random.arrayElement(exts)};this.directoryPath=function(){};this.filePath=function(){};this.semver=function(){return[faker.random.number(9), faker.random.number(9),faker.random.number(9)].join(".")}}module["exports"]=System});var lib$6=createCommonjsModule(function(module){function Faker(opts){var self=this;opts=opts||{};var locales=self.locales||opts.locales||{};var locale=self.locale||opts.locale||"en";var localeFallback=self.localeFallback||opts.localeFallback||"en";self.locales=locales;self.locale=locale;self.localeFallback=localeFallback;self.definitions={};function bindAll(obj){Object.keys(obj).forEach(function(meth){if(typeof obj[meth]=== "function")obj[meth]=obj[meth].bind(obj)});return obj}var Fake=fake;self.fake=(new Fake(self)).fake;var Random=random$1;self.random=bindAll(new Random(self));var Helpers=helpers$2;self.helpers=new Helpers(self);var Name=name;self.name=bindAll(new Name(self));var Address=address;self.address=bindAll(new Address(self));var Company=company;self.company=bindAll(new Company(self));var Finance=finance;self.finance=bindAll(new Finance(self));var Image=image;self.image=bindAll(new Image(self));var Lorem= lorem;self.lorem=bindAll(new Lorem(self));var Hacker=hacker;self.hacker=bindAll(new Hacker(self));var Internet=internet;self.internet=bindAll(new Internet(self));var Database=database;self.database=bindAll(new Database(self));var Phone=phone_number;self.phone=bindAll(new Phone(self));var _Date=date;self.date=bindAll(new _Date(self));var Commerce=commerce;self.commerce=bindAll(new Commerce(self));var System=system;self.system=bindAll(new System(self));var _definitions={"name":["first_name","last_name", "prefix","suffix","title","male_first_name","female_first_name","male_middle_name","female_middle_name","male_last_name","female_last_name"],"address":["city_prefix","city_suffix","street_suffix","county","country","country_code","state","state_abbr","street_prefix","postcode"],"company":["adjective","noun","descriptor","bs_adjective","bs_noun","bs_verb","suffix"],"lorem":["words"],"hacker":["abbreviation","adjective","noun","verb","ingverb"],"phone_number":["formats"],"finance":["account_type","transaction_type", "currency","iban"],"internet":["avatar_uri","domain_suffix","free_email","example_email","password"],"commerce":["color","department","product_name","price","categories"],"database":["collation","column","engine","type"],"system":["mimeTypes"],"date":["month","weekday"],"title":"","separator":""};Object.keys(_definitions).forEach(function(d){if(typeof self.definitions[d]==="undefined")self.definitions[d]={};if(typeof _definitions[d]==="string"){self.definitions[d]=_definitions[d];return}_definitions[d].forEach(function(p){Object.defineProperty(self.definitions[d], p,{get:function(){if(typeof self.locales[self.locale][d]==="undefined"||typeof self.locales[self.locale][d][p]==="undefined")return self.locales[localeFallback][d][p];else return self.locales[self.locale][d][p]}})})})}Faker.prototype.seed=function(value){var Random=random$1;this.seedValue=value;this.random=new Random(this,this.seedValue)};module["exports"]=Faker});var postcode=createCommonjsModule(function(module){module["exports"]=["###-####"]});var state=createCommonjsModule(function(module){module["exports"]= ["\u5317\u6d77\u9053","\u9752\u68ee\u770c","\u5ca9\u624b\u770c","\u5bae\u57ce\u770c","\u79cb\u7530\u770c","\u5c71\u5f62\u770c","\u798f\u5cf6\u770c","\u8328\u57ce\u770c","\u6803\u6728\u770c","\u7fa4\u99ac\u770c","\u57fc\u7389\u770c","\u5343\u8449\u770c","\u6771\u4eac\u90fd","\u795e\u5948\u5ddd\u770c","\u65b0\u6f5f\u770c","\u5bcc\u5c71\u770c","\u77f3\u5ddd\u770c","\u798f\u4e95\u770c","\u5c71\u68a8\u770c","\u9577\u91ce\u770c","\u5c90\u961c\u770c","\u9759\u5ca1\u770c","\u611b\u77e5\u770c","\u4e09\u91cd\u770c", "\u6ecb\u8cc0\u770c","\u4eac\u90fd\u5e9c","\u5927\u962a\u5e9c","\u5175\u5eab\u770c","\u5948\u826f\u770c","\u548c\u6b4c\u5c71\u770c","\u9ce5\u53d6\u770c","\u5cf6\u6839\u770c","\u5ca1\u5c71\u770c","\u5e83\u5cf6\u770c","\u5c71\u53e3\u770c","\u5fb3\u5cf6\u770c","\u9999\u5ddd\u770c","\u611b\u5a9b\u770c","\u9ad8\u77e5\u770c","\u798f\u5ca1\u770c","\u4f50\u8cc0\u770c","\u9577\u5d0e\u770c","\u718a\u672c\u770c","\u5927\u5206\u770c","\u5bae\u5d0e\u770c","\u9e7f\u5150\u5cf6\u770c","\u6c96\u7e04\u770c"]});var state_abbr= createCommonjsModule(function(module){module["exports"]=["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47"]});var city_prefix=createCommonjsModule(function(module){module["exports"]=["\u5317","\u6771","\u897f","\u5357","\u65b0","\u6e56","\u6e2f"]});var city_suffix=createCommonjsModule(function(module){module["exports"]=["\u5e02", "\u533a","\u753a","\u6751"]});var city=createCommonjsModule(function(module){module["exports"]=["#{city_prefix}#{Name.first_name}#{city_suffix}","#{Name.first_name}#{city_suffix}","#{city_prefix}#{Name.last_name}#{city_suffix}","#{Name.last_name}#{city_suffix}"]});var street_name=createCommonjsModule(function(module){module["exports"]=["#{Name.first_name}#{street_suffix}","#{Name.last_name}#{street_suffix}"]});var address_1=createCommonjsModule(function(module){var address={};module["exports"]=address; address.postcode=postcode;address.state=state;address.state_abbr=state_abbr;address.city_prefix=city_prefix;address.city_suffix=city_suffix;address.city=city;address.street_name=street_name});var formats=createCommonjsModule(function(module){module["exports"]=["0####-#-####","0###-##-####","0##-###-####","0#-####-####"]});var phone_number_1=createCommonjsModule(function(module){var phone_number={};module["exports"]=phone_number;phone_number.formats=formats});var formats$2=createCommonjsModule(function(module){module["exports"]= ["090-####-####","080-####-####","070-####-####"]});var cell_phone_1=createCommonjsModule(function(module){var cell_phone={};module["exports"]=cell_phone;cell_phone.formats=formats$2});var last_name=createCommonjsModule(function(module){module["exports"]=["\u4f50\u85e4","\u9234\u6728","\u9ad8\u6a4b","\u7530\u4e2d","\u6e21\u8fba","\u4f0a\u85e4","\u5c71\u672c","\u4e2d\u6751","\u5c0f\u6797","\u52a0\u85e4","\u5409\u7530","\u5c71\u7530","\u4f50\u3005\u6728","\u5c71\u53e3","\u658e\u85e4","\u677e\u672c", "\u4e95\u4e0a","\u6728\u6751","\u6797","\u6e05\u6c34"]});var first_name=createCommonjsModule(function(module){module["exports"]=["\u5927\u7fd4","\u84ee","\u98af\u592a","\u6a39","\u5927\u548c","\u967d\u7fd4","\u9678\u6597","\u592a\u4e00","\u6d77\u7fd4","\u84bc\u7a7a","\u7ffc","\u967d\u83dc","\u7d50\u611b","\u7d50\u8863","\u674f","\u8389\u5b50","\u7f8e\u7fbd","\u7d50\u83dc","\u5fc3\u611b","\u611b\u83dc","\u7f8e\u54b2"]});var name$2=createCommonjsModule(function(module){module["exports"]=["#{last_name} #{first_name}"]}); var name_1=createCommonjsModule(function(module){var name={};module["exports"]=name;name.last_name=last_name;name.first_name=first_name;name.name=name$2});var ja_1=createCommonjsModule(function(module){var ja={};module["exports"]=ja;ja.title="Japanese";ja.address=address_1;ja.phone_number=phone_number_1;ja.cell_phone=cell_phone_1;ja.name=name_1});var city_prefix$2=createCommonjsModule(function(module){module["exports"]=["North","East","West","South","New","Lake","Port"]});var city_suffix$2=createCommonjsModule(function(module){module["exports"]= ["town","ton","land","ville","berg","burgh","borough","bury","view","port","mouth","stad","furt","chester","mouth","fort","haven","side","shire"]});var county=createCommonjsModule(function(module){module["exports"]=["Avon","Bedfordshire","Berkshire","Borders","Buckinghamshire","Cambridgeshire"]});var country=createCommonjsModule(function(module){module["exports"]=["Afghanistan","Albania","Algeria","American Samoa","Andorra","Angola","Anguilla","Antarctica (the territory South of 60 deg S)","Antigua and Barbuda", "Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia and Herzegovina","Botswana","Bouvet Island (Bouvetoya)","Brazil","British Indian Ocean Territory (Chagos Archipelago)","Brunei Darussalam","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Canada","Cape Verde","Cayman Islands","Central African Republic","Chad","Chile","China","Christmas Island","Cocos (Keeling) Islands", "Colombia","Comoros","Congo","Cook Islands","Costa Rica","Cote d'Ivoire","Croatia","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Ethiopia","Faroe Islands","Falkland Islands (Malvinas)","Fiji","Finland","France","French Guiana","French Polynesia","French Southern Territories","Gabon","Gambia","Georgia","Germany","Ghana","Gibraltar","Greece","Greenland","Grenada","Guadeloupe","Guam","Guatemala", "Guernsey","Guinea","Guinea-Bissau","Guyana","Haiti","Heard Island and McDonald Islands","Holy See (Vatican City State)","Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Isle of Man","Israel","Italy","Jamaica","Japan","Jersey","Jordan","Kazakhstan","Kenya","Kiribati","Democratic People's Republic of Korea","Republic of Korea","Kuwait","Kyrgyz Republic","Lao People's Democratic Republic","Latvia","Lebanon","Lesotho","Liberia","Libyan Arab Jamahiriya","Liechtenstein", "Lithuania","Luxembourg","Macao","Macedonia","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Martinique","Mauritania","Mauritius","Mayotte","Mexico","Micronesia","Moldova","Monaco","Mongolia","Montenegro","Montserrat","Morocco","Mozambique","Myanmar","Namibia","Nauru","Nepal","Netherlands Antilles","Netherlands","New Caledonia","New Zealand","Nicaragua","Niger","Nigeria","Niue","Norfolk Island","Northern Mariana Islands","Norway","Oman","Pakistan","Palau","Palestinian Territory", "Panama","Papua New Guinea","Paraguay","Peru","Philippines","Pitcairn Islands","Poland","Portugal","Puerto Rico","Qatar","Reunion","Romania","Russian Federation","Rwanda","Saint Barthelemy","Saint Helena","Saint Kitts and Nevis","Saint Lucia","Saint Martin","Saint Pierre and Miquelon","Saint Vincent and the Grenadines","Samoa","San Marino","Sao Tome and Principe","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Slovakia (Slovak Republic)","Slovenia","Solomon Islands","Somalia", "South Africa","South Georgia and the South Sandwich Islands","Spain","Sri Lanka","Sudan","Suriname","Svalbard \x26 Jan Mayen Islands","Swaziland","Sweden","Switzerland","Syrian Arab Republic","Taiwan","Tajikistan","Tanzania","Thailand","Timor-Leste","Togo","Tokelau","Tonga","Trinidad and Tobago","Tunisia","Turkey","Turkmenistan","Turks and Caicos Islands","Tuvalu","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States of America","United States Minor Outlying Islands","Uruguay", "Uzbekistan","Vanuatu","Venezuela","Vietnam","Virgin Islands, British","Virgin Islands, U.S.","Wallis and Futuna","Western Sahara","Yemen","Zambia","Zimbabwe"]});var country_code=createCommonjsModule(function(module){module["exports"]=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV", "CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT", "MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"]});var building_number= createCommonjsModule(function(module){module["exports"]=["#####","####","###"]});var street_suffix=createCommonjsModule(function(module){module["exports"]=["Alley","Avenue","Branch","Bridge","Brook","Brooks","Burg","Burgs","Bypass","Camp","Canyon","Cape","Causeway","Center","Centers","Circle","Circles","Cliff","Cliffs","Club","Common","Corner","Corners","Course","Court","Courts","Cove","Coves","Creek","Crescent","Crest","Crossing","Crossroad","Curve","Dale","Dam","Divide","Drive","Drive","Drives", "Estate","Estates","Expressway","Extension","Extensions","Fall","Falls","Ferry","Field","Fields","Flat","Flats","Ford","Fords","Forest","Forge","Forges","Fork","Forks","Fort","Freeway","Garden","Gardens","Gateway","Glen","Glens","Green","Greens","Grove","Groves","Harbor","Harbors","Haven","Heights","Highway","Hill","Hills","Hollow","Inlet","Inlet","Island","Island","Islands","Islands","Isle","Isle","Junction","Junctions","Key","Keys","Knoll","Knolls","Lake","Lakes","Land","Landing","Lane","Light", "Lights","Loaf","Lock","Locks","Locks","Lodge","Lodge","Loop","Mall","Manor","Manors","Meadow","Meadows","Mews","Mill","Mills","Mission","Mission","Motorway","Mount","Mountain","Mountain","Mountains","Mountains","Neck","Orchard","Oval","Overpass","Park","Parks","Parkway","Parkways","Pass","Passage","Path","Pike","Pine","Pines","Place","Plain","Plains","Plains","Plaza","Plaza","Point","Points","Port","Port","Ports","Ports","Prairie","Prairie","Radial","Ramp","Ranch","Rapid","Rapids","Rest","Ridge", "Ridges","River","Road","Road","Roads","Roads","Route","Row","Rue","Run","Shoal","Shoals","Shore","Shores","Skyway","Spring","Springs","Springs","Spur","Spurs","Square","Square","Squares","Squares","Station","Station","Stravenue","Stravenue","Stream","Stream","Street","Street","Streets","Summit","Summit","Terrace","Throughway","Trace","Track","Trafficway","Trail","Trail","Tunnel","Tunnel","Turnpike","Turnpike","Underpass","Union","Unions","Valley","Valleys","Via","Viaduct","View","Views","Village", "Village","Villages","Ville","Vista","Vista","Walk","Walks","Wall","Way","Ways","Well","Wells"]});var secondary_address=createCommonjsModule(function(module){module["exports"]=["Apt. ###","Suite ###"]});var postcode$2=createCommonjsModule(function(module){module["exports"]=["#####","#####-####"]});var postcode_by_state=createCommonjsModule(function(module){module["exports"]=["#####","#####-####"]});var state$2=createCommonjsModule(function(module){module["exports"]=["Alabama","Alaska","Arizona","Arkansas", "California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia", "Wisconsin","Wyoming"]});var state_abbr$2=createCommonjsModule(function(module){module["exports"]=["AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"]});var time_zone=createCommonjsModule(function(module){module["exports"]=["Pacific/Midway","Pacific/Pago_Pago","Pacific/Honolulu","America/Juneau","America/Los_Angeles", "America/Tijuana","America/Denver","America/Phoenix","America/Chihuahua","America/Mazatlan","America/Chicago","America/Regina","America/Mexico_City","America/Mexico_City","America/Monterrey","America/Guatemala","America/New_York","America/Indiana/Indianapolis","America/Bogota","America/Lima","America/Lima","America/Halifax","America/Caracas","America/La_Paz","America/Santiago","America/St_Johns","America/Sao_Paulo","America/Argentina/Buenos_Aires","America/Guyana","America/Godthab","Atlantic/South_Georgia", "Atlantic/Azores","Atlantic/Cape_Verde","Europe/Dublin","Europe/London","Europe/Lisbon","Europe/London","Africa/Casablanca","Africa/Monrovia","Etc/UTC","Europe/Belgrade","Europe/Bratislava","Europe/Budapest","Europe/Ljubljana","Europe/Prague","Europe/Sarajevo","Europe/Skopje","Europe/Warsaw","Europe/Zagreb","Europe/Brussels","Europe/Copenhagen","Europe/Madrid","Europe/Paris","Europe/Amsterdam","Europe/Berlin","Europe/Berlin","Europe/Rome","Europe/Stockholm","Europe/Vienna","Africa/Algiers","Europe/Bucharest", "Africa/Cairo","Europe/Helsinki","Europe/Kiev","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Vilnius","Europe/Athens","Europe/Istanbul","Europe/Minsk","Asia/Jerusalem","Africa/Harare","Africa/Johannesburg","Europe/Moscow","Europe/Moscow","Europe/Moscow","Asia/Kuwait","Asia/Riyadh","Africa/Nairobi","Asia/Baghdad","Asia/Tehran","Asia/Muscat","Asia/Muscat","Asia/Baku","Asia/Tbilisi","Asia/Yerevan","Asia/Kabul","Asia/Yekaterinburg","Asia/Karachi","Asia/Karachi","Asia/Tashkent","Asia/Kolkata", "Asia/Kolkata","Asia/Kolkata","Asia/Kolkata","Asia/Kathmandu","Asia/Dhaka","Asia/Dhaka","Asia/Colombo","Asia/Almaty","Asia/Novosibirsk","Asia/Rangoon","Asia/Bangkok","Asia/Bangkok","Asia/Jakarta","Asia/Krasnoyarsk","Asia/Shanghai","Asia/Chongqing","Asia/Hong_Kong","Asia/Urumqi","Asia/Kuala_Lumpur","Asia/Singapore","Asia/Taipei","Australia/Perth","Asia/Irkutsk","Asia/Ulaanbaatar","Asia/Seoul","Asia/Tokyo","Asia/Tokyo","Asia/Tokyo","Asia/Yakutsk","Australia/Darwin","Australia/Adelaide","Australia/Melbourne", "Australia/Melbourne","Australia/Sydney","Australia/Brisbane","Australia/Hobart","Asia/Vladivostok","Pacific/Guam","Pacific/Port_Moresby","Asia/Magadan","Asia/Magadan","Pacific/Noumea","Pacific/Fiji","Asia/Kamchatka","Pacific/Majuro","Pacific/Auckland","Pacific/Auckland","Pacific/Tongatapu","Pacific/Fakaofo","Pacific/Apia"]});var city$2=createCommonjsModule(function(module){module["exports"]=["#{city_prefix} #{Name.first_name}#{city_suffix}","#{city_prefix} #{Name.first_name}","#{Name.first_name}#{city_suffix}", "#{Name.last_name}#{city_suffix}"]});var street_name$2=createCommonjsModule(function(module){module["exports"]=["#{Name.first_name} #{street_suffix}","#{Name.last_name} #{street_suffix}"]});var street_address=createCommonjsModule(function(module){module["exports"]=["#{building_number} #{street_name}"]});var default_country=createCommonjsModule(function(module){module["exports"]=["United States of America"]});var address_1$2=createCommonjsModule(function(module){var address={};module["exports"]=address; address.city_prefix=city_prefix$2;address.city_suffix=city_suffix$2;address.county=county;address.country=country;address.country_code=country_code;address.building_number=building_number;address.street_suffix=street_suffix;address.secondary_address=secondary_address;address.postcode=postcode$2;address.postcode_by_state=postcode_by_state;address.state=state$2;address.state_abbr=state_abbr$2;address.time_zone=time_zone;address.city=city$2;address.street_name=street_name$2;address.street_address=street_address; address.default_country=default_country});var visa=createCommonjsModule(function(module){module["exports"]=["/4###########L/","/4###-####-####-###L/"]});var mastercard=createCommonjsModule(function(module){module["exports"]=["/5[1-5]##-####-####-###L/","/6771-89##-####-###L/"]});var discover=createCommonjsModule(function(module){module["exports"]=["/6011-####-####-###L/","/65##-####-####-###L/","/64[4-9]#-####-####-###L/","/6011-62##-####-####-###L/","/65##-62##-####-####-###L/","/64[4-9]#-62##-####-####-###L/"]}); var american_express=createCommonjsModule(function(module){module["exports"]=["/34##-######-####L/","/37##-######-####L/"]});var diners_club=createCommonjsModule(function(module){module["exports"]=["/30[0-5]#-######-###L/","/368#-######-###L/"]});var jcb=createCommonjsModule(function(module){module["exports"]=["/3528-####-####-###L/","/3529-####-####-###L/","/35[3-8]#-####-####-###L/"]});var _switch=createCommonjsModule(function(module){module["exports"]=["/6759-####-####-###L/","/6759-####-####-####-#L/", "/6759-####-####-####-##L/"]});var solo=createCommonjsModule(function(module){module["exports"]=["/6767-####-####-###L/","/6767-####-####-####-#L/","/6767-####-####-####-##L/"]});var maestro=createCommonjsModule(function(module){module["exports"]=["/50#{9,16}L/","/5[6-8]#{9,16}L/","/56##{9,16}L/"]});var laser=createCommonjsModule(function(module){module["exports"]=["/6304###########L/","/6706###########L/","/6771###########L/","/6709###########L/","/6304#########{5,6}L/","/6706#########{5,6}L/","/6771#########{5,6}L/", "/6709#########{5,6}L/"]});var credit_card_1=createCommonjsModule(function(module){var credit_card={};module["exports"]=credit_card;credit_card.visa=visa;credit_card.mastercard=mastercard;credit_card.discover=discover;credit_card.american_express=american_express;credit_card.diners_club=diners_club;credit_card.jcb=jcb;credit_card.switch=_switch;credit_card.solo=solo;credit_card.maestro=maestro;credit_card.laser=laser});var suffix=createCommonjsModule(function(module){module["exports"]=["Inc","and Sons", "LLC","Group"]});var adjective=createCommonjsModule(function(module){module["exports"]=["Adaptive","Advanced","Ameliorated","Assimilated","Automated","Balanced","Business-focused","Centralized","Cloned","Compatible","Configurable","Cross-group","Cross-platform","Customer-focused","Customizable","Decentralized","De-engineered","Devolved","Digitized","Distributed","Diverse","Down-sized","Enhanced","Enterprise-wide","Ergonomic","Exclusive","Expanded","Extended","Face to face","Focused","Front-line", "Fully-configurable","Function-based","Fundamental","Future-proofed","Grass-roots","Horizontal","Implemented","Innovative","Integrated","Intuitive","Inverse","Managed","Mandatory","Monitored","Multi-channelled","Multi-lateral","Multi-layered","Multi-tiered","Networked","Object-based","Open-architected","Open-source","Operative","Optimized","Optional","Organic","Organized","Persevering","Persistent","Phased","Polarised","Pre-emptive","Proactive","Profit-focused","Profound","Programmable","Progressive", "Public-key","Quality-focused","Reactive","Realigned","Re-contextualized","Re-engineered","Reduced","Reverse-engineered","Right-sized","Robust","Seamless","Secured","Self-enabling","Sharable","Stand-alone","Streamlined","Switchable","Synchronised","Synergistic","Synergized","Team-oriented","Total","Triple-buffered","Universal","Up-sized","Upgradable","User-centric","User-friendly","Versatile","Virtual","Visionary","Vision-oriented"]});var descriptor=createCommonjsModule(function(module){module["exports"]= ["24 hour","24/7","3rd generation","4th generation","5th generation","6th generation","actuating","analyzing","asymmetric","asynchronous","attitude-oriented","background","bandwidth-monitored","bi-directional","bifurcated","bottom-line","clear-thinking","client-driven","client-server","coherent","cohesive","composite","context-sensitive","contextually-based","content-based","dedicated","demand-driven","didactic","directional","discrete","disintermediate","dynamic","eco-centric","empowering","encompassing", "even-keeled","executive","explicit","exuding","fault-tolerant","foreground","fresh-thinking","full-range","global","grid-enabled","heuristic","high-level","holistic","homogeneous","human-resource","hybrid","impactful","incremental","intangible","interactive","intermediate","leading edge","local","logistical","maximized","methodical","mission-critical","mobile","modular","motivating","multimedia","multi-state","multi-tasking","national","needs-based","neutral","next generation","non-volatile","object-oriented", "optimal","optimizing","radical","real-time","reciprocal","regional","responsive","scalable","secondary","solution-oriented","stable","static","systematic","systemic","system-worthy","tangible","tertiary","transitional","uniform","upward-trending","user-facing","value-added","web-enabled","well-modulated","zero administration","zero defect","zero tolerance"]});var noun=createCommonjsModule(function(module){module["exports"]=["ability","access","adapter","algorithm","alliance","analyzer","application", "approach","architecture","archive","artificial intelligence","array","attitude","benchmark","budgetary management","capability","capacity","challenge","circuit","collaboration","complexity","concept","conglomeration","contingency","core","customer loyalty","database","data-warehouse","definition","emulation","encoding","encryption","extranet","firmware","flexibility","focus group","forecast","frame","framework","function","functionalities","Graphic Interface","groupware","Graphical User Interface", "hardware","help-desk","hierarchy","hub","implementation","info-mediaries","infrastructure","initiative","installation","instruction set","interface","internet solution","intranet","knowledge user","knowledge base","local area network","leverage","matrices","matrix","methodology","middleware","migration","model","moderator","monitoring","moratorium","neural-net","open architecture","open system","orchestration","paradigm","parallelism","policy","portal","pricing structure","process improvement","product", "productivity","project","projection","protocol","secured line","service-desk","software","solution","standardization","strategy","structure","success","superstructure","support","synergy","system engine","task-force","throughput","time-frame","toolset","utilisation","website","workforce"]});var bs_verb=createCommonjsModule(function(module){module["exports"]=["implement","utilize","integrate","streamline","optimize","evolve","transform","embrace","enable","orchestrate","leverage","reinvent","aggregate", "architect","enhance","incentivize","morph","empower","envisioneer","monetize","harness","facilitate","seize","disintermediate","synergize","strategize","deploy","brand","grow","target","syndicate","synthesize","deliver","mesh","incubate","engage","maximize","benchmark","expedite","reintermediate","whiteboard","visualize","repurpose","innovate","scale","unleash","drive","extend","engineer","revolutionize","generate","exploit","transition","e-enable","iterate","cultivate","matrix","productize","redefine", "recontextualize"]});var bs_adjective=createCommonjsModule(function(module){module["exports"]=["clicks-and-mortar","value-added","vertical","proactive","robust","revolutionary","scalable","leading-edge","innovative","intuitive","strategic","e-business","mission-critical","sticky","one-to-one","24/7","end-to-end","global","B2B","B2C","granular","frictionless","virtual","viral","dynamic","24/365","best-of-breed","killer","magnetic","bleeding-edge","web-enabled","interactive","dot-com","sexy","back-end", "real-time","efficient","front-end","distributed","seamless","extensible","turn-key","world-class","open-source","cross-platform","cross-media","synergistic","bricks-and-clicks","out-of-the-box","enterprise","integrated","impactful","wireless","transparent","next-generation","cutting-edge","user-centric","visionary","customized","ubiquitous","plug-and-play","collaborative","compelling","holistic","rich"]});var bs_noun=createCommonjsModule(function(module){module["exports"]=["synergies","web-readiness", "paradigms","markets","partnerships","infrastructures","platforms","initiatives","channels","eyeballs","communities","ROI","solutions","e-tailers","e-services","action-items","portals","niches","technologies","content","vortals","supply-chains","convergence","relationships","architectures","interfaces","e-markets","e-commerce","systems","bandwidth","infomediaries","models","mindshare","deliverables","users","schemas","networks","applications","metrics","e-business","functionalities","experiences", "web services","methodologies"]});var name$4=createCommonjsModule(function(module){module["exports"]=["#{Name.last_name} #{suffix}","#{Name.last_name}-#{Name.last_name}","#{Name.last_name}, #{Name.last_name} and #{Name.last_name}"]});var company_1=createCommonjsModule(function(module){var company={};module["exports"]=company;company.suffix=suffix;company.adjective=adjective;company.descriptor=descriptor;company.noun=noun;company.bs_verb=bs_verb;company.bs_adjective=bs_adjective;company.bs_noun=bs_noun; company.name=name$4});var free_email=createCommonjsModule(function(module){module["exports"]=["gmail.com","yahoo.com","hotmail.com"]});var example_email=createCommonjsModule(function(module){module["exports"]=["example.org","example.com","example.net"]});var domain_suffix=createCommonjsModule(function(module){module["exports"]=["com","biz","info","name","net","org"]});var avatar_uri=createCommonjsModule(function(module){module["exports"]=["https://s3.amazonaws.com/uifaces/faces/twitter/jarjan/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/mahdif/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sprayaga/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ruzinav/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/Skyhartman/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/moscoz/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kurafire/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/91bilal/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/igorgarybaldi/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/calebogden/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/malykhinv/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/joelhelin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kushsolitary/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/coreyweb/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/snowshade/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/areus/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/holdenweb/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/heyimjuani/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/envex/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/unterdreht/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/collegeman/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/peejfancher/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/andyisonline/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ultragex/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/fuck_you_two/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/adellecharles/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ateneupopular/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ahmetalpbalkan/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/Stievius/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kerem/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/osvaldas/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/angelceballos/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/thierrykoblentz/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/peterlandt/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/catarino/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/weglov/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/brandclay/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ahmetsulek/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nicolasfolliot/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jayrobinson/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/victorerixon/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/kolage/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/michzen/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/markjenkins/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nicolai_larsen/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gt/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/noxdzine/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/alagoon/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/idiot/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/mizko/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/chadengle/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mutlu82/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/simobenso/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/vocino/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/guiiipontes/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/soyjavi/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/joshaustin/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/tomaslau/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/VinThomas/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ManikRathee/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/langate/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/cemshid/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/leemunroe/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/_shahedk/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/enda/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/BillSKenney/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/divya/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/joshhemsley/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sindresorhus/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/soffes/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/9lessons/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/linux29/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/Chakintosh/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/anaami/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/joreira/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/shadeed9/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/scottkclark/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jedbridges/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/salleedesign/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/marakasina/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ariil/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/BrianPurkiss/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/michaelmartinho/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bublienko/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/devankoshal/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ZacharyZorbas/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/timmillwood/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/joshuasortino/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/damenleeturks/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/tomas_janousek/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/herrhaase/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/RussellBishop/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/brajeshwar/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/cbracco/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bermonpainter/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/abdullindenis/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/isacosta/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/suprb/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/yalozhkin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/chandlervdw/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/iamgarth/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/_victa/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/commadelimited/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/roybarberuk/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/axel/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/vladarbatov/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ffbel/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/syropian/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ankitind/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/traneblow/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/flashmurphy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ChrisFarina78/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/baliomega/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/saschamt/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jm_denis/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/anoff/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kennyadr/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/chatyrko/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dingyi/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mds/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/terryxlife/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/aaroni/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kinday/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/prrstn/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/eduardostuart/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dhilipsiva/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/GavicoInd/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/baires/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/rohixx/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/bigmancho/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/blakesimkins/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/leeiio/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/tjrus/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/uberschizo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kylefoundry/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/claudioguglieri/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ripplemdk/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/exentrich/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jakemoore/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/joaoedumedeiros/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/poormini/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/tereshenkov/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/keryilmaz/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/haydn_woods/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/rude/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/llun/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sgaurav_baghel/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jamiebrittain/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/badlittleduck/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/pifagor/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/agromov/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/benefritz/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/erwanhesry/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/diesellaws/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jeremiaha/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/koridhandy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/chaensel/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/andrewcohen/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/smaczny/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gonzalorobaina/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nandini_m/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/sydlawrence/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/cdharrison/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/tgerken/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/lewisainslie/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/charliecwaite/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/robbschiller/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/flexrs/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mattdetails/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/raquelwilson/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/karsh/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mrmartineau/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/opnsrce/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/hgharrygo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/maximseshuk/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/uxalex/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/samihah/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/chanpory/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sharvin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/josemarques/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jefffis/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/krystalfister/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/lokesh_coder/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/thedamianhdez/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dpmachado/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/funwatercat/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/timothycd/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ivanfilipovbg/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/picard102/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/marcobarbosa/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/krasnoukhov/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/g3d/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ademilter/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/rickdt/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/operatino/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bungiwan/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/hugomano/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/logorado/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dc_user/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/horaciobella/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/SlaapMe/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/teeragit/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/iqonicd/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ilya_pestov/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/andrewarrow/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ssiskind/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/stan/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/HenryHoffman/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/rdsaunders/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/adamsxu/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/curiousoffice/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/themadray/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/michigangraham/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kohette/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nickfratter/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/runningskull/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/madysondesigns/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/brenton_clarke/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jennyshen/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bradenhamm/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kurtinc/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/amanruzaini/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/coreyhaggard/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/Karimmove/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/aaronalfred/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/wtrsld/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jitachi/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/therealmarvin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/pmeissner/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ooomz/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/chacky14/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jesseddy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/shanehudson/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/akmur/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/IsaryAmairani/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/arthurholcombe1/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/boxmodel/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ehsandiary/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/LucasPerdidao/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/shalt0ni/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/swaplord/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/kaelifa/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/plbabin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/guillemboti/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/arindam_/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/renbyrd/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/thiagovernetti/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jmillspaysbills/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mikemai2awesome/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/jervo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mekal/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sta1ex/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/robergd/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/felipecsl/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/andrea211087/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/garand/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dhooyenga/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/abovefunction/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/pcridesagain/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/randomlies/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/BryanHorsey/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/heykenneth/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dahparra/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/allthingssmitty/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/danvernon/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/beweinreich/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/increase/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/falvarad/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/alxndrustinov/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/souuf/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/orkuncaylar/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/AM_Kn2/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gearpixels/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/bassamology/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/vimarethomas/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kosmar/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/SULiik/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mrjamesnoble/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/silvanmuhlemann/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/shaneIxD/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nacho/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/yigitpinarbasi/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/buzzusborne/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/aaronkwhite/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/rmlewisuk/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/giancarlon/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nbirckel/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/d_nny_m_cher/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sdidonato/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/atariboy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/abotap/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/karalek/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/psdesignuk/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ludwiczakpawel/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nemanjaivanovic/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/baluli/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ahmadajmi/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/vovkasolovev/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/samgrover/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/derienzo777/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jonathansimmons/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nelsonjoyce/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/S0ufi4n3/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/xtopherpaul/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/oaktreemedia/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/nateschulte/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/findingjenny/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/namankreative/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/antonyzotov/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/we_social/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/leehambley/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/solid_color/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/abelcabans/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/mbilderbach/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kkusaa/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jordyvdboom/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/carlosgavina/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/pechkinator/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/vc27/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/rdbannon/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/croakx/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/suribbles/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kerihenare/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/catadeleon/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gcmorley/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/duivvv/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/saschadroste/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/victorDubugras/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/wintopia/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/mattbilotti/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/taylorling/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/megdraws/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/meln1ks/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mahmoudmetwally/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/Silveredge9/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/derekebradley/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/happypeter1983/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/travis_arnold/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/artem_kostenko/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/adobi/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/daykiine/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/alek_djuric/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/scips/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/miguelmendes/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/justinrhee/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/alsobrooks/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/fronx/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mcflydesign/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/santi_urso/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/allfordesign/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/stayuber/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bertboerland/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/marosholly/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/adamnac/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/cynthiasavard/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/muringa/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/danro/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/hiemil/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jackiesaik/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/iduuck/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/antjanus/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/aroon_sharma/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dshster/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/thehacker/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/michaelbrooksjr/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ryanmclaughlin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/clubb3rry/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/taybenlor/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/xripunov/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/myastro/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/adityasutomo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/digitalmaverick/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/hjartstrorn/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/itolmach/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/vaughanmoffitt/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/abdots/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/isnifer/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/sergeysafonov/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/maz/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/scrapdnb/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/chrismj83/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/vitorleal/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sokaniwaal/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/zaki3d/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/illyzoren/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/mocabyte/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/osmanince/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/djsherman/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/davidhemphill/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/waghner/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/necodymiconer/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/praveen_vijaya/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/fabbrucci/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/travishines/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kuldarkalvik/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/Elt_n/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/phillapier/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/okseanjay/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/id835559/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kudretkeskin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/anjhero/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/duck4fuck/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/scott_riley/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/noufalibrahim/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/h1brd/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/borges_marcos/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/devinhalladay/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ciaranr/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/stefooo/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/mikebeecham/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/tonymillion/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/joshuaraichur/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/irae/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/petrangr/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dmitriychuta/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/charliegann/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/arashmanteghi/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/adhamdannaway/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ainsleywagon/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/svenlen/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/faisalabid/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/beshur/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/carlyson/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dutchnadia/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/teddyzetterlund/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/samuelkraft/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/aoimedia/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/toddrew/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/codepoet_ru/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/artvavs/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/benoitboucart/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jomarmen/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kolmarlopez/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/creartinc/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/homka/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gaborenton/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/robinclediere/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/maximsorokin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/plasticine/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/j2deme/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/peachananr/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/kapaluccio/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/de_ascanio/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/rikas/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dawidwu/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/marcoramires/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/angelcreative/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/rpatey/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/popey/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/rehatkathuria/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/the_purplebunny/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/1markiz/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ajaxy_ru/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/brenmurrell/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dudestein/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/oskarlevinson/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/victorstuber/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/nehfy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/vicivadeline/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/leandrovaranda/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/scottgallant/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/victor_haydin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sawrb/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ryhanhassan/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/amayvs/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/a_brixen/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/karolkrakowiak_/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/herkulano/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/geran7/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/cggaurav/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/chris_witko/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/lososina/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/polarity/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/mattlat/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/brandonburke/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/constantx/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/teylorfeliz/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/craigelimeliah/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/rachelreveley/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/reabo101/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/rahmeen/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/ky/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/rickyyean/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/j04ntoh/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/spbroma/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sebashton/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jpenico/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/francis_vega/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/oktayelipek/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/kikillo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/fabbianz/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/larrygerard/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/BroumiYoussef/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/0therplanet/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mbilalsiddique1/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ionuss/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/grrr_nl/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/liminha/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/rawdiggie/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ryandownie/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sethlouey/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/pixage/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/arpitnj/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/switmer777/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/josevnclch/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/kanickairaj/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/puzik/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/tbakdesigns/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/besbujupi/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/supjoey/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/lowie/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/linkibol/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/balintorosz/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/imcoding/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/agustincruiz/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gusoto/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/thomasschrijer/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/superoutman/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kalmerrautam/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gabrielizalo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gojeanyn/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/davidbaldie/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/_vojto/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/laurengray/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jydesign/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mymyboy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nellleo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/marciotoledo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ninjad3m0/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/to_soham/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/hasslunsford/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/muridrahhal/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/levisan/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/grahamkennery/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/lepetitogre/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/antongenkin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nessoila/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/amandabuzard/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/safrankov/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/cocolero/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dss49/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/matt3224/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bluesix/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/quailandquasar/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/AlbertoCococi/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/lepinski/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sementiy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mhudobivnik/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/thibaut_re/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/olgary/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/shojberg/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mtolokonnikov/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bereto/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/naupintos/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/wegotvices/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/xadhix/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/macxim/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/rodnylobos/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/madcampos/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/madebyvadim/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bartoszdawydzik/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/supervova/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/markretzloff/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/vonachoo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/darylws/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/stevedesigner/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mylesb/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/herbigt/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/depaulawagner/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/geshan/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gizmeedevil1991/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/_scottburgess/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/lisovsky/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/davidsasda/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/artd_sign/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/YoungCutlass/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mgonto/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/itstotallyamy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/victorquinn/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/osmond/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/oksanafrewer/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/zauerkraut/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/iamkeithmason/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nitinhayaran/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/lmjabreu/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/mandalareopens/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/thinkleft/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ponchomendivil/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/juamperro/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/brunodesign1206/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/caseycavanagh/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/luxe/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dotgridline/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/spedwig/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/madewulf/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mattsapii/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/helderleal/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/chrisstumph/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jayphen/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nsamoylov/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/chrisvanderkooi/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/justme_timothyg/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/otozk/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/prinzadi/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gu5taf/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/cyril_gaillard/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/d_kobelyatsky/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/daniloc/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nwdsha/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/romanbulah/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/skkirilov/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dvdwinden/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dannol/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/thekevinjones/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jwalter14/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/timgthomas/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/buddhasource/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/uxpiper/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/thatonetommy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/diansigitp/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/adrienths/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/klimmka/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gkaam/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/derekcramer/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jennyyo/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/xalionmalik/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/edhenderson/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/keyuri85/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/roxanejammet/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kimcool/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/edkf/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/matkins/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/alessandroribe/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jacksonlatka/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/lebronjennan/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kostaspt/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/karlkanall/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/moynihan/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/danpliego/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/saulihirvi/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/wesleytrankin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/fjaguero/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bowbrick/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mashaaaaal/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/yassiryahya/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dparrelli/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/fotomagin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/aka_james/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/denisepires/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/iqbalperkasa/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/martinansty/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jarsen/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/r_oy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/justinrob/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gabrielrosser/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/malgordon/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/carlfairclough/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/michaelabehsera/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/pierrestoffe/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/enjoythetau/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/loganjlambert/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/rpeezy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/coreyginnivan/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/michalhron/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/msveet/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/lingeswaran/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kolsvein/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/peter576/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/reideiredale/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/joeymurdah/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/raphaelnikson/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mvdheuvel/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/maxlinderman/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jimmuirhead/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/begreative/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/frankiefreesbie/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/robturlinckx/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/Talbi_ConSept/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/longlivemyword/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/vanchesz/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/maiklam/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/hermanobrother/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/rez___a/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gregsqueeb/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/greenbes/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/_ragzor/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/anthonysukow/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/fluidbrush/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/dactrtr/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jehnglynn/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bergmartin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/hugocornejo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/_kkga/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dzantievm/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sawalazar/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sovesove/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/jonsgotwood/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/byryan/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/vytautas_a/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mizhgan/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/cicerobr/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nilshelmersson/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/d33pthought/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/davecraige/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/nckjrvs/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/alexandermayes/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jcubic/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/craigrcoles/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bagawarman/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/rob_thomas10/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/cofla/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/maikelk/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/rtgibbons/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/russell_baylis/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mhesslow/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/codysanfilippo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/webtanya/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/madebybrenton/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dcalonaci/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/perfectflow/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/jjsiii/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/saarabpreet/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kumarrajan12123/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/iamsteffen/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/themikenagle/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ceekaytweet/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/larrybolt/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/conspirator/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/dallasbpeters/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/n3dmax/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/terpimost/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/byrnecore/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/j_drake_/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/calebjoyce/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/russoedu/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/hoangloi/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/tobysaxon/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gofrasdesign/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dimaposnyy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/tjisousa/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/okandungel/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/billyroshan/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/oskamaya/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/motionthinks/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/knilob/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ashocka18/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/marrimo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bartjo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/omnizya/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ernestsemerda/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/andreas_pr/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/edgarchris99/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/thomasgeisen/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gseguin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/joannefournier/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/demersdesigns/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/adammarsbar/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nasirwd/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/n_tassone/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/javorszky/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/themrdave/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/yecidsm/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nicollerich/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/canapud/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nicoleglynn/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/judzhin_miles/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/designervzm/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kianoshp/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/evandrix/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/alterchuca/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dhrubo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ma_tiax/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ssbb_me/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dorphern/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mauriolg/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bruno_mart/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/mactopus/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/the_winslet/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/joemdesign/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/Shriiiiimp/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jacobbennett/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nfedoroff/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/iamglimy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/allagringaus/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/aiiaiiaii/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/olaolusoga/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/buryaknick/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/wim1k/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nicklacke/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/a1chapone/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/steynviljoen/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/strikewan/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/ryankirkman/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/andrewabogado/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/doooon/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jagan123/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ariffsetiawan/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/elenadissi/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mwarkentin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/thierrymeier_/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/r_garcia/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dmackerman/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/borantula/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/konus/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/spacewood_/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ryuchi311/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/evanshajed/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/tristanlegros/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/shoaib253/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/aislinnkelly/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/okcoker/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/timpetricola/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sunshinedgirl/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/chadami/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/aleclarsoniv/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nomidesigns/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/petebernardo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/scottiedude/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/millinet/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/imsoper/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/imammuht/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/benjamin_knight/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nepdud/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/joki4/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/lanceguyatt/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bboy1895/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/amywebbb/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/rweve/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/haruintesettden/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ricburton/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nelshd/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/batsirai/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/primozcigler/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jffgrdnr/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/8d3k/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/geneseleznev/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/al_li/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/souperphly/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mslarkina/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/2fockus/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/cdavis565/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/xiel/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/turkutuuli/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/uxward/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/lebinoclard/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gauravjassal/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/davidmerrique/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mdsisto/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/andrewofficer/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kojourin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dnirmal/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kevka/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mr_shiznit/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/aluisio_azevedo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/cloudstudio/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/danvierich/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/alexivanichkin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/fran_mchamy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/perretmagali/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/betraydan/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/cadikkara/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/matbeedotcom/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jeremyworboys/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bpartridge/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/michaelkoper/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/silv3rgvn/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/alevizio/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/johnsmithagency/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/lawlbwoy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/vitor376/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/desastrozo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/thimo_cz/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/jasonmarkjones/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/lhausermann/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/xravil/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/guischmitt/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/vigobronx/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/panghal0/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/miguelkooreman/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/surgeonist/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/christianoliff/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/caspergrl/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/iamkarna/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ipavelek/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/pierre_nel/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/y2graphic/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sterlingrules/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/elbuscainfo/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/bennyjien/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/stushona/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/estebanuribe/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/embrcecreations/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/danillos/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/elliotlewis/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/charlesrpratt/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/vladyn/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/emmeffess/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/carlosblanco_eu/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/leonfedotov/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/rangafangs/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/chris_frees/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/tgormtx/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bryan_topham/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jpscribbles/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/mighty55/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/carbontwelve/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/isaacfifth/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/iamjdeleon/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/snowwrite/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/barputro/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/drewbyreese/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sachacorazzi/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/bistrianiosip/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/magoo04/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/pehamondello/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/yayteejay/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/a_harris88/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/algunsanabria/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/zforrester/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ovall/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/carlosjgsousa/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/geobikas/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ah_lice/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/looneydoodle/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nerdgr8/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ddggccaa/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/zackeeler/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/normanbox/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/el_fuertisimo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ismail_biltagi/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/juangomezw/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jnmnrd/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/patrickcoombe/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ryanjohnson_me/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/markolschesky/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jeffgolenski/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/kvasnic/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gauchomatt/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/afusinatto/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kevinoh/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/okansurreel/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/adamawesomeface/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/emileboudeling/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/arishi_/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/juanmamartinez/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/wikiziner/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/danthms/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mkginfo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/terrorpixel/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/curiousonaut/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/prheemo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/michaelcolenso/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/foczzi/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/martip07/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/thaodang17/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/johncafazza/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/robinlayfield/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/franciscoamk/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/abdulhyeuk/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/marklamb/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/edobene/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/andresenfredrik/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mikaeljorhult/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/chrisslowik/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/vinciarts/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/meelford/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/elliotnolten/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/yehudab/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/vijaykarthik/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bfrohs/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/josep_martins/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/attacks/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sur4dye/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/tumski/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/instalox/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mangosango/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/paulfarino/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kazaky999/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kiwiupover/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nvkznemo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/tom_even/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ratbus/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/woodsman001/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/joshmedeski/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/thewillbeard/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/psaikali/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/joe_black/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/aleinadsays/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/marcusgorillius/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/hota_v/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jghyllebert/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/shinze/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/janpalounek/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jeremiespoken/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/her_ruu/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dansowter/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/felipeapiress/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/magugzbrand2d/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/posterjob/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nathalie_fs/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/bobbytwoshoes/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dreizle/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jeremymouton/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/elisabethkjaer/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/notbadart/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mohanrohith/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jlsolerdeltoro/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/itskawsar/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/slowspock/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/zvchkelly/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/wiljanslofstra/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/craighenneberry/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/trubeatto/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/juaumlol/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/samscouto/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/BenouarradeM/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/gipsy_raf/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/netonet_il/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/arkokoley/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/itsajimithing/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/smalonso/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/victordeanda/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/_dwite_/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/richardgarretts/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/gregrwilkinson/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/anatolinicolae/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/lu4sh1i/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/stefanotirloni/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ostirbu/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/darcystonge/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/naitanamoreno/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/michaelcomiskey/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/adhiardana/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/marcomano_/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/davidcazalis/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/falconerie/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gregkilian/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bcrad/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bolzanmarco/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/low_res/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/vlajki/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/petar_prog/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jonkspr/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/akmalfikri/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mfacchinello/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/atanism/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/harry_sistalam/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/murrayswift/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/bobwassermann/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gavr1l0/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/madshensel/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mr_subtle/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/deviljho_/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/salimianoff/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/joetruesdell/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/twittypork/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/airskylar/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dnezkumar/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dgajjar/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/cherif_b/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/salvafc/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/louis_currie/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/deeenright/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/cybind/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/eyronn/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/vickyshits/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sweetdelisa/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/cboller1/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/andresdjasso/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/melvindidit/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/andysolomon/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/thaisselenator_/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/lvovenok/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/giuliusa/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/belyaev_rs/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/overcloacked/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kamal_chaneman/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/incubo82/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/hellofeverrrr/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mhaligowski/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/sunlandictwin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bu7921/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/andytlaw/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jeremery/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/finchjke/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/manigm/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/umurgdk/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/scottfeltham/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/ganserene/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mutu_krish/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jodytaggart/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ntfblog/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/tanveerrao/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/hfalucas/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/alxleroydeval/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kucingbelang4/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/bargaorobalo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/colgruv/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/stalewine/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kylefrost/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/baumannzone/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/angelcolberg/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sachingawas/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jjshaw14/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/ramanathan_pdy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/johndezember/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nilshoenson/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/brandonmorreale/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nutzumi/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/brandonflatsoda/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sergeyalmone/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/klefue/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/kirangopal/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/baumann_alex/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/matthewkay_/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jay_wilburn/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/shesgared/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/apriendeau/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/johnriordan/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/wake_gs/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/aleksitappura/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/emsgulam/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/xilantra/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/imomenui/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sircalebgrove/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/newbrushes/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/hsinyo23/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/m4rio/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/katiemdaly/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/s4f1/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ecommerceil/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/marlinjayakody/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/swooshycueb/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sangdth/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/coderdiaz/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bluefx_/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/vivekprvr/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sasha_shestakov/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/eugeneeweb/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dgclegg/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/n1ght_coder/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dixchen/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/blakehawksworth/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/trueblood_33/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/hai_ninh_nguyen/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/marclgonzales/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/yesmeck/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/stephcoue/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/doronmalki/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ruehldesign/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/anasnakawa/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kijanmaharjan/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/wearesavas/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/stefvdham/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/tweetubhai/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/alecarpentier/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/fiterik/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/antonyryndya/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/d00maz/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/theonlyzeke/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/missaaamy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/carlosm/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/manekenthe/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/reetajayendra/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jeremyshimko/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/justinrgraham/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/stefanozoffoli/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/overra/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/mrebay007/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/shvelo96/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/pyronite/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/thedjpetersen/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/rtyukmaev/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/_williamguerra/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/albertaugustin/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/vikashpathak18/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/kevinjohndayy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/vj_demien/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/colirpixoil/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/goddardlewis/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/laasli/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jqiuss/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/heycamtaylor/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nastya_mane/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/mastermindesign/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ccinojasso1/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/nyancecom/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sandywoodruff/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/bighanddesign/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sbtransparent/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/aviddayentonbay/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/richwild/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/kaysix_dizzy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/tur8le/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/seyedhossein1/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/privetwagner/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/emmandenn/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dev_essentials/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jmfsocial/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/_yardenoon/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/mateaodviteza/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/weavermedia/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mufaddal_mw/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/hafeeskhan/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ashernatali/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sulaqo/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/eddiechen/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/josecarlospsh/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/vm_f/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/enricocicconi/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/danmartin70/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/gmourier/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/donjain/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mrxloka/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/_pedropinho/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/eitarafa/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/oscarowusu/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ralph_lam/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/panchajanyag/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/woodydotmx/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/jerrybai1907/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/marshallchen_/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/xamorep/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/aio___/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/chaabane_wail/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/txcx/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/akashsharma39/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/falling_soul/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sainraja/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mugukamil/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/johannesneu/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/markwienands/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/karthipanraj/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/balakayuriy/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/alan_zhang_/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/layerssss/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/kaspernordkvist/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/mirfanqureshi/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/hanna_smi/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/VMilescu/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/aeon56/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/m_kalibry/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/sreejithexp/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dicesales/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/dhoot_amit/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/smenov/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/lonesomelemon/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/vladimirdevic/128.jpg", "https://s3.amazonaws.com/uifaces/faces/twitter/joelcipriano/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/haligaliharun/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/buleswapnil/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/serefka/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/ifarafonow/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/vikasvinfotech/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/urrutimeoli/128.jpg","https://s3.amazonaws.com/uifaces/faces/twitter/areandacom/128.jpg"]}); var internet_1=createCommonjsModule(function(module){var internet={};module["exports"]=internet;internet.free_email=free_email;internet.example_email=example_email;internet.domain_suffix=domain_suffix;internet.avatar_uri=avatar_uri});var collation=createCommonjsModule(function(module){module["exports"]=["utf8_unicode_ci","utf8_general_ci","utf8_bin","ascii_bin","ascii_general_ci","cp1250_bin","cp1250_general_ci"]});var column=createCommonjsModule(function(module){module["exports"]=["id","title","name", "email","phone","token","group","category","password","comment","avatar","status","createdAt","updatedAt"]});var engine=createCommonjsModule(function(module){module["exports"]=["InnoDB","MyISAM","MEMORY","CSV","BLACKHOLE","ARCHIVE"]});var type=createCommonjsModule(function(module){module["exports"]=["int","varchar","text","date","datetime","tinyint","time","timestamp","smallint","mediumint","bigint","decimal","float","double","real","bit","boolean","serial","blob","binary","enum","set","geometry", "point"]});var database_1=createCommonjsModule(function(module){var database={};module["exports"]=database;database.collation=collation;database.column=column;database.engine=engine;database.type=type});var words$1=createCommonjsModule(function(module){module["exports"]=["alias","consequatur","aut","perferendis","sit","voluptatem","accusantium","doloremque","aperiam","eaque","ipsa","quae","ab","illo","inventore","veritatis","et","quasi","architecto","beatae","vitae","dicta","sunt","explicabo","aspernatur", "aut","odit","aut","fugit","sed","quia","consequuntur","magni","dolores","eos","qui","ratione","voluptatem","sequi","nesciunt","neque","dolorem","ipsum","quia","dolor","sit","amet","consectetur","adipisci","velit","sed","quia","non","numquam","eius","modi","tempora","incidunt","ut","labore","et","dolore","magnam","aliquam","quaerat","voluptatem","ut","enim","ad","minima","veniam","quis","nostrum","exercitationem","ullam","corporis","nemo","enim","ipsam","voluptatem","quia","voluptas","sit","suscipit", "laboriosam","nisi","ut","aliquid","ex","ea","commodi","consequatur","quis","autem","vel","eum","iure","reprehenderit","qui","in","ea","voluptate","velit","esse","quam","nihil","molestiae","et","iusto","odio","dignissimos","ducimus","qui","blanditiis","praesentium","laudantium","totam","rem","voluptatum","deleniti","atque","corrupti","quos","dolores","et","quas","molestias","excepturi","sint","occaecati","cupiditate","non","provident","sed","ut","perspiciatis","unde","omnis","iste","natus","error", "similique","sunt","in","culpa","qui","officia","deserunt","mollitia","animi","id","est","laborum","et","dolorum","fuga","et","harum","quidem","rerum","facilis","est","et","expedita","distinctio","nam","libero","tempore","cum","soluta","nobis","est","eligendi","optio","cumque","nihil","impedit","quo","porro","quisquam","est","qui","minus","id","quod","maxime","placeat","facere","possimus","omnis","voluptas","assumenda","est","omnis","dolor","repellendus","temporibus","autem","quibusdam","et","aut", "consequatur","vel","illum","qui","dolorem","eum","fugiat","quo","voluptas","nulla","pariatur","at","vero","eos","et","accusamus","officiis","debitis","aut","rerum","necessitatibus","saepe","eveniet","ut","et","voluptates","repudiandae","sint","et","molestiae","non","recusandae","itaque","earum","rerum","hic","tenetur","a","sapiente","delectus","ut","aut","reiciendis","voluptatibus","maiores","doloribus","asperiores","repellat"]});var supplemental=createCommonjsModule(function(module){module["exports"]= ["abbas","abduco","abeo","abscido","absconditus","absens","absorbeo","absque","abstergo","absum","abundans","abutor","accedo","accendo","acceptus","accipio","accommodo","accusator","acer","acerbitas","acervus","acidus","acies","acquiro","acsi","adamo","adaugeo","addo","adduco","ademptio","adeo","adeptio","adfectus","adfero","adficio","adflicto","adhaero","adhuc","adicio","adimpleo","adinventitias","adipiscor","adiuvo","administratio","admiratio","admitto","admoneo","admoveo","adnuo","adopto","adsidue", "adstringo","adsuesco","adsum","adulatio","adulescens","adultus","aduro","advenio","adversus","advoco","aedificium","aeger","aegre","aegrotatio","aegrus","aeneus","aequitas","aequus","aer","aestas","aestivus","aestus","aetas","aeternus","ager","aggero","aggredior","agnitio","agnosco","ago","ait","aiunt","alienus","alii","alioqui","aliqua","alius","allatus","alo","alter","altus","alveus","amaritudo","ambitus","ambulo","amicitia","amiculum","amissio","amita","amitto","amo","amor","amoveo","amplexus", "amplitudo","amplus","ancilla","angelus","angulus","angustus","animadverto","animi","animus","annus","anser","ante","antea","antepono","antiquus","aperio","aperte","apostolus","apparatus","appello","appono","appositus","approbo","apto","aptus","apud","aqua","ara","aranea","arbitro","arbor","arbustum","arca","arceo","arcesso","arcus","argentum","argumentum","arguo","arma","armarium","armo","aro","ars","articulus","artificiose","arto","arx","ascisco","ascit","asper","aspicio","asporto","assentator", "astrum","atavus","ater","atqui","atrocitas","atrox","attero","attollo","attonbitus","auctor","auctus","audacia","audax","audentia","audeo","audio","auditor","aufero","aureus","auris","aurum","aut","autem","autus","auxilium","avaritia","avarus","aveho","averto","avoco","baiulus","balbus","barba","bardus","basium","beatus","bellicus","bellum","bene","beneficium","benevolentia","benigne","bestia","bibo","bis","blandior","bonus","bos","brevis","cado","caecus","caelestis","caelum","calamitas","calcar", "calco","calculus","callide","campana","candidus","canis","canonicus","canto","capillus","capio","capitulus","capto","caput","carbo","carcer","careo","caries","cariosus","caritas","carmen","carpo","carus","casso","caste","casus","catena","caterva","cattus","cauda","causa","caute","caveo","cavus","cedo","celebrer","celer","celo","cena","cenaculum","ceno","censura","centum","cerno","cernuus","certe","certo","certus","cervus","cetera","charisma","chirographum","cibo","cibus","cicuta","cilicium","cimentarius", "ciminatio","cinis","circumvenio","cito","civis","civitas","clam","clamo","claro","clarus","claudeo","claustrum","clementia","clibanus","coadunatio","coaegresco","coepi","coerceo","cogito","cognatus","cognomen","cogo","cohaero","cohibeo","cohors","colligo","colloco","collum","colo","color","coma","combibo","comburo","comedo","comes","cometes","comis","comitatus","commemoro","comminor","commodo","communis","comparo","compello","complectus","compono","comprehendo","comptus","conatus","concedo","concido", "conculco","condico","conduco","confero","confido","conforto","confugo","congregatio","conicio","coniecto","conitor","coniuratio","conor","conqueror","conscendo","conservo","considero","conspergo","constans","consuasor","contabesco","contego","contigo","contra","conturbo","conventus","convoco","copia","copiose","cornu","corona","corpus","correptius","corrigo","corroboro","corrumpo","coruscus","cotidie","crapula","cras","crastinus","creator","creber","crebro","credo","creo","creptio","crepusculum", "cresco","creta","cribro","crinis","cruciamentum","crudelis","cruentus","crur","crustulum","crux","cubicularis","cubitum","cubo","cui","cuius","culpa","culpo","cultellus","cultura","cum","cunabula","cunae","cunctatio","cupiditas","cupio","cuppedia","cupressus","cur","cura","curatio","curia","curiositas","curis","curo","curriculum","currus","cursim","curso","cursus","curto","curtus","curvo","curvus","custodia","damnatio","damno","dapifer","debeo","debilito","decens","decerno","decet","decimus","decipio", "decor","decretum","decumbo","dedecor","dedico","deduco","defaeco","defendo","defero","defessus","defetiscor","deficio","defigo","defleo","defluo","defungo","degenero","degero","degusto","deinde","delectatio","delego","deleo","delibero","delicate","delinquo","deludo","demens","demergo","demitto","demo","demonstro","demoror","demulceo","demum","denego","denique","dens","denuncio","denuo","deorsum","depereo","depono","depopulo","deporto","depraedor","deprecator","deprimo","depromo","depulso","deputo", "derelinquo","derideo","deripio","desidero","desino","desipio","desolo","desparatus","despecto","despirmatio","infit","inflammatio","paens","patior","patria","patrocinor","patruus","pauci","paulatim","pauper","pax","peccatus","pecco","pecto","pectus","pecunia","pecus","peior","pel","ocer","socius","sodalitas","sol","soleo","solio","solitudo","solium","sollers","sollicito","solum","solus","solutio","solvo","somniculosus","somnus","sonitus","sono","sophismata","sopor","sordeo","sortitus","spargo","speciosus", "spectaculum","speculum","sperno","spero","spes","spiculum","spiritus","spoliatio","sponte","stabilis","statim","statua","stella","stillicidium","stipes","stips","sto","strenuus","strues","studio","stultus","suadeo","suasoria","sub","subito","subiungo","sublime","subnecto","subseco","substantia","subvenio","succedo","succurro","sufficio","suffoco","suffragium","suggero","sui","sulum","sum","summa","summisse","summopere","sumo","sumptus","supellex","super","suppellex","supplanto","suppono","supra", "surculus","surgo","sursum","suscipio","suspendo","sustineo","suus","synagoga","tabella","tabernus","tabesco","tabgo","tabula","taceo","tactus","taedium","talio","talis","talus","tam","tamdiu","tamen","tametsi","tamisium","tamquam","tandem","tantillus","tantum","tardus","tego","temeritas","temperantia","templum","temptatio","tempus","tenax","tendo","teneo","tener","tenuis","tenus","tepesco","tepidus","ter","terebro","teres","terga","tergeo","tergiversatio","tergo","tergum","termes","terminatio","tero", "terra","terreo","territo","terror","tersus","tertius","testimonium","texo","textilis","textor","textus","thalassinus","theatrum","theca","thema","theologus","thermae","thesaurus","thesis","thorax","thymbra","thymum","tibi","timidus","timor","titulus","tolero","tollo","tondeo","tonsor","torqueo","torrens","tot","totidem","toties","totus","tracto","trado","traho","trans","tredecim","tremo","trepide","tres","tribuo","tricesimus","triduana","triginta","tripudio","tristis","triumphus","trucido","truculenter", "tubineus","tui","tum","tumultus","tunc","turba","turbo","turpe","turpis","tutamen","tutis","tyrannus","uberrime","ubi","ulciscor","ullus","ulterius","ultio","ultra","umbra","umerus","umquam","una","unde","undique","universe","unus","urbanus","urbs","uredo","usitas","usque","ustilo","ustulo","usus","uter","uterque","utilis","utique","utor","utpote","utrimque","utroque","utrum","uxor","vaco","vacuus","vado","vae","valde","valens","valeo","valetudo","validus","vallum","vapulus","varietas","varius", "vehemens","vel","velociter","velum","velut","venia","venio","ventito","ventosus","ventus","venustas","ver","verbera","verbum","vere","verecundia","vereor","vergo","veritas","vero","versus","verto","verumtamen","verus","vesco","vesica","vesper","vespillo","vester","vestigium","vestrum","vetus","via","vicinus","vicissitudo","victoria","victus","videlicet","video","viduata","viduo","vigilo","vigor","vilicus","vilis","vilitas","villa","vinco","vinculum","vindico","vinitor","vinum","vir","virga","virgo", "viridis","viriliter","virtus","vis","viscus","vita","vitiosus","vitium","vito","vivo","vix","vobis","vociferor","voco","volaticus","volo","volubilis","voluntarius","volup","volutabrum","volva","vomer","vomica","vomito","vorago","vorax","voro","vos","votum","voveo","vox","vulariter","vulgaris","vulgivagus","vulgo","vulgus","vulnero","vulnus","vulpes","vulticulus","vultuosus","xiphias"]});var lorem_1=createCommonjsModule(function(module){var lorem={};module["exports"]=lorem;lorem.words=words$1;lorem.supplemental= supplemental});var first_name$2=createCommonjsModule(function(module){module["exports"]=["Aaliyah","Aaron","Abagail","Abbey","Abbie","Abbigail","Abby","Abdiel","Abdul","Abdullah","Abe","Abel","Abelardo","Abigail","Abigale","Abigayle","Abner","Abraham","Ada","Adah","Adalberto","Adaline","Adam","Adan","Addie","Addison","Adela","Adelbert","Adele","Adelia","Adeline","Adell","Adella","Adelle","Aditya","Adolf","Adolfo","Adolph","Adolphus","Adonis","Adrain","Adrian","Adriana","Adrianna","Adriel","Adrien", "Adrienne","Afton","Aglae","Agnes","Agustin","Agustina","Ahmad","Ahmed","Aida","Aidan","Aiden","Aileen","Aimee","Aisha","Aiyana","Akeem","Al","Alaina","Alan","Alana","Alanis","Alanna","Alayna","Alba","Albert","Alberta","Albertha","Alberto","Albin","Albina","Alda","Alden","Alec","Aleen","Alejandra","Alejandrin","Alek","Alena","Alene","Alessandra","Alessandro","Alessia","Aletha","Alex","Alexa","Alexander","Alexandra","Alexandre","Alexandrea","Alexandria","Alexandrine","Alexandro","Alexane","Alexanne", "Alexie","Alexis","Alexys","Alexzander","Alf","Alfonso","Alfonzo","Alford","Alfred","Alfreda","Alfredo","Ali","Alia","Alice","Alicia","Alisa","Alisha","Alison","Alivia","Aliya","Aliyah","Aliza","Alize","Allan","Allen","Allene","Allie","Allison","Ally","Alphonso","Alta","Althea","Alva","Alvah","Alvena","Alvera","Alverta","Alvina","Alvis","Alyce","Alycia","Alysa","Alysha","Alyson","Alysson","Amalia","Amanda","Amani","Amara","Amari","Amaya","Amber","Ambrose","Amelia","Amelie","Amely","America","Americo", "Amie","Amina","Amir","Amira","Amiya","Amos","Amparo","Amy","Amya","Ana","Anabel","Anabelle","Anahi","Anais","Anastacio","Anastasia","Anderson","Andre","Andreane","Andreanne","Andres","Andrew","Andy","Angel","Angela","Angelica","Angelina","Angeline","Angelita","Angelo","Angie","Angus","Anibal","Anika","Anissa","Anita","Aniya","Aniyah","Anjali","Anna","Annabel","Annabell","Annabelle","Annalise","Annamae","Annamarie","Anne","Annetta","Annette","Annie","Ansel","Ansley","Anthony","Antoinette","Antone", "Antonetta","Antonette","Antonia","Antonietta","Antonina","Antonio","Antwan","Antwon","Anya","April","Ara","Araceli","Aracely","Arch","Archibald","Ardella","Arden","Ardith","Arely","Ari","Ariane","Arianna","Aric","Ariel","Arielle","Arjun","Arlene","Arlie","Arlo","Armand","Armando","Armani","Arnaldo","Arne","Arno","Arnold","Arnoldo","Arnulfo","Aron","Art","Arthur","Arturo","Arvel","Arvid","Arvilla","Aryanna","Asa","Asha","Ashlee","Ashleigh","Ashley","Ashly","Ashlynn","Ashton","Ashtyn","Asia","Assunta", "Astrid","Athena","Aubree","Aubrey","Audie","Audra","Audreanne","Audrey","August","Augusta","Augustine","Augustus","Aurelia","Aurelie","Aurelio","Aurore","Austen","Austin","Austyn","Autumn","Ava","Avery","Avis","Axel","Ayana","Ayden","Ayla","Aylin","Baby","Bailee","Bailey","Barbara","Barney","Baron","Barrett","Barry","Bart","Bartholome","Barton","Baylee","Beatrice","Beau","Beaulah","Bell","Bella","Belle","Ben","Benedict","Benjamin","Bennett","Bennie","Benny","Benton","Berenice","Bernadette","Bernadine", "Bernard","Bernardo","Berneice","Bernhard","Bernice","Bernie","Berniece","Bernita","Berry","Bert","Berta","Bertha","Bertram","Bertrand","Beryl","Bessie","Beth","Bethany","Bethel","Betsy","Bette","Bettie","Betty","Bettye","Beulah","Beverly","Bianka","Bill","Billie","Billy","Birdie","Blair","Blaise","Blake","Blanca","Blanche","Blaze","Bo","Bobbie","Bobby","Bonita","Bonnie","Boris","Boyd","Brad","Braden","Bradford","Bradley","Bradly","Brady","Braeden","Brain","Brandi","Brando","Brandon","Brandt","Brandy", "Brandyn","Brannon","Branson","Brant","Braulio","Braxton","Brayan","Breana","Breanna","Breanne","Brenda","Brendan","Brenden","Brendon","Brenna","Brennan","Brennon","Brent","Bret","Brett","Bria","Brian","Briana","Brianne","Brice","Bridget","Bridgette","Bridie","Brielle","Brigitte","Brionna","Brisa","Britney","Brittany","Brock","Broderick","Brody","Brook","Brooke","Brooklyn","Brooks","Brown","Bruce","Bryana","Bryce","Brycen","Bryon","Buck","Bud","Buddy","Buford","Bulah","Burdette","Burley","Burnice", "Buster","Cade","Caden","Caesar","Caitlyn","Cale","Caleb","Caleigh","Cali","Calista","Callie","Camden","Cameron","Camila","Camilla","Camille","Camren","Camron","Camryn","Camylle","Candace","Candelario","Candice","Candida","Candido","Cara","Carey","Carissa","Carlee","Carleton","Carley","Carli","Carlie","Carlo","Carlos","Carlotta","Carmel","Carmela","Carmella","Carmelo","Carmen","Carmine","Carol","Carolanne","Carole","Carolina","Caroline","Carolyn","Carolyne","Carrie","Carroll","Carson","Carter","Cary", "Casandra","Casey","Casimer","Casimir","Casper","Cassandra","Cassandre","Cassidy","Cassie","Catalina","Caterina","Catharine","Catherine","Cathrine","Cathryn","Cathy","Cayla","Ceasar","Cecelia","Cecil","Cecile","Cecilia","Cedrick","Celestine","Celestino","Celia","Celine","Cesar","Chad","Chadd","Chadrick","Chaim","Chance","Chandler","Chanel","Chanelle","Charity","Charlene","Charles","Charley","Charlie","Charlotte","Chase","Chasity","Chauncey","Chaya","Chaz","Chelsea","Chelsey","Chelsie","Chesley","Chester", "Chet","Cheyanne","Cheyenne","Chloe","Chris","Christ","Christa","Christelle","Christian","Christiana","Christina","Christine","Christop","Christophe","Christopher","Christy","Chyna","Ciara","Cicero","Cielo","Cierra","Cindy","Citlalli","Clair","Claire","Clara","Clarabelle","Clare","Clarissa","Clark","Claud","Claude","Claudia","Claudie","Claudine","Clay","Clemens","Clement","Clementina","Clementine","Clemmie","Cleo","Cleora","Cleta","Cletus","Cleve","Cleveland","Clifford","Clifton","Clint","Clinton", "Clotilde","Clovis","Cloyd","Clyde","Coby","Cody","Colby","Cole","Coleman","Colin","Colleen","Collin","Colt","Colten","Colton","Columbus","Concepcion","Conner","Connie","Connor","Conor","Conrad","Constance","Constantin","Consuelo","Cooper","Cora","Coralie","Corbin","Cordelia","Cordell","Cordia","Cordie","Corene","Corine","Cornelius","Cornell","Corrine","Cortez","Cortney","Cory","Coty","Courtney","Coy","Craig","Crawford","Creola","Cristal","Cristian","Cristina","Cristobal","Cristopher","Cruz","Crystal", "Crystel","Cullen","Curt","Curtis","Cydney","Cynthia","Cyril","Cyrus","Dagmar","Dahlia","Daija","Daisha","Daisy","Dakota","Dale","Dallas","Dallin","Dalton","Damaris","Dameon","Damian","Damien","Damion","Damon","Dan","Dana","Dandre","Dane","D'angelo","Dangelo","Danial","Daniela","Daniella","Danielle","Danika","Dannie","Danny","Dante","Danyka","Daphne","Daphnee","Daphney","Darby","Daren","Darian","Dariana","Darien","Dario","Darion","Darius","Darlene","Daron","Darrel","Darrell","Darren","Darrick","Darrin", "Darrion","Darron","Darryl","Darwin","Daryl","Dashawn","Dasia","Dave","David","Davin","Davion","Davon","Davonte","Dawn","Dawson","Dax","Dayana","Dayna","Dayne","Dayton","Dean","Deangelo","Deanna","Deborah","Declan","Dedric","Dedrick","Dee","Deion","Deja","Dejah","Dejon","Dejuan","Delaney","Delbert","Delfina","Delia","Delilah","Dell","Della","Delmer","Delores","Delpha","Delphia","Delphine","Delta","Demarco","Demarcus","Demario","Demetris","Demetrius","Demond","Dena","Denis","Dennis","Deon","Deondre", "Deontae","Deonte","Dereck","Derek","Derick","Deron","Derrick","Deshaun","Deshawn","Desiree","Desmond","Dessie","Destany","Destin","Destinee","Destiney","Destini","Destiny","Devan","Devante","Deven","Devin","Devon","Devonte","Devyn","Dewayne","Dewitt","Dexter","Diamond","Diana","Dianna","Diego","Dillan","Dillon","Dimitri","Dina","Dino","Dion","Dixie","Dock","Dolly","Dolores","Domenic","Domenica","Domenick","Domenico","Domingo","Dominic","Dominique","Don","Donald","Donato","Donavon","Donna","Donnell", "Donnie","Donny","Dora","Dorcas","Dorian","Doris","Dorothea","Dorothy","Dorris","Dortha","Dorthy","Doug","Douglas","Dovie","Doyle","Drake","Drew","Duane","Dudley","Dulce","Duncan","Durward","Dustin","Dusty","Dwight","Dylan","Earl","Earlene","Earline","Earnest","Earnestine","Easter","Easton","Ebba","Ebony","Ed","Eda","Edd","Eddie","Eden","Edgar","Edgardo","Edison","Edmond","Edmund","Edna","Eduardo","Edward","Edwardo","Edwin","Edwina","Edyth","Edythe","Effie","Efrain","Efren","Eileen","Einar","Eino", "Eladio","Elaina","Elbert","Elda","Eldon","Eldora","Eldred","Eldridge","Eleanora","Eleanore","Eleazar","Electa","Elena","Elenor","Elenora","Eleonore","Elfrieda","Eli","Elian","Eliane","Elias","Eliezer","Elijah","Elinor","Elinore","Elisa","Elisabeth","Elise","Eliseo","Elisha","Elissa","Eliza","Elizabeth","Ella","Ellen","Ellie","Elliot","Elliott","Ellis","Ellsworth","Elmer","Elmira","Elmo","Elmore","Elna","Elnora","Elody","Eloisa","Eloise","Elouise","Eloy","Elroy","Elsa","Else","Elsie","Elta","Elton", "Elva","Elvera","Elvie","Elvis","Elwin","Elwyn","Elyse","Elyssa","Elza","Emanuel","Emelia","Emelie","Emely","Emerald","Emerson","Emery","Emie","Emil","Emile","Emilia","Emiliano","Emilie","Emilio","Emily","Emma","Emmalee","Emmanuel","Emmanuelle","Emmet","Emmett","Emmie","Emmitt","Emmy","Emory","Ena","Enid","Enoch","Enola","Enos","Enrico","Enrique","Ephraim","Era","Eriberto","Eric","Erica","Erich","Erick","Ericka","Erik","Erika","Erin","Erling","Erna","Ernest","Ernestina","Ernestine","Ernesto","Ernie", "Ervin","Erwin","Eryn","Esmeralda","Esperanza","Esta","Esteban","Estefania","Estel","Estell","Estella","Estelle","Estevan","Esther","Estrella","Etha","Ethan","Ethel","Ethelyn","Ethyl","Ettie","Eudora","Eugene","Eugenia","Eula","Eulah","Eulalia","Euna","Eunice","Eusebio","Eva","Evalyn","Evan","Evangeline","Evans","Eve","Eveline","Evelyn","Everardo","Everett","Everette","Evert","Evie","Ewald","Ewell","Ezekiel","Ezequiel","Ezra","Fabian","Fabiola","Fae","Fannie","Fanny","Fatima","Faustino","Fausto", "Favian","Fay","Faye","Federico","Felicia","Felicita","Felicity","Felipa","Felipe","Felix","Felton","Fermin","Fern","Fernando","Ferne","Fidel","Filiberto","Filomena","Finn","Fiona","Flavie","Flavio","Fleta","Fletcher","Flo","Florence","Florencio","Florian","Florida","Florine","Flossie","Floy","Floyd","Ford","Forest","Forrest","Foster","Frances","Francesca","Francesco","Francis","Francisca","Francisco","Franco","Frank","Frankie","Franz","Fred","Freda","Freddie","Freddy","Frederic","Frederick","Frederik", "Frederique","Fredrick","Fredy","Freeda","Freeman","Freida","Frida","Frieda","Friedrich","Fritz","Furman","Gabe","Gabriel","Gabriella","Gabrielle","Gaetano","Gage","Gail","Gardner","Garett","Garfield","Garland","Garnet","Garnett","Garret","Garrett","Garrick","Garrison","Garry","Garth","Gaston","Gavin","Gay","Gayle","Gaylord","Gene","General","Genesis","Genevieve","Gennaro","Genoveva","Geo","Geoffrey","George","Georgette","Georgiana","Georgianna","Geovanni","Geovanny","Geovany","Gerald","Geraldine", "Gerard","Gerardo","Gerda","Gerhard","Germaine","German","Gerry","Gerson","Gertrude","Gia","Gianni","Gideon","Gilbert","Gilberto","Gilda","Giles","Gillian","Gina","Gino","Giovani","Giovanna","Giovanni","Giovanny","Gisselle","Giuseppe","Gladyce","Gladys","Glen","Glenda","Glenna","Glennie","Gloria","Godfrey","Golda","Golden","Gonzalo","Gordon","Grace","Gracie","Graciela","Grady","Graham","Grant","Granville","Grayce","Grayson","Green","Greg","Gregg","Gregoria","Gregorio","Gregory","Greta","Gretchen", "Greyson","Griffin","Grover","Guadalupe","Gudrun","Guido","Guillermo","Guiseppe","Gunnar","Gunner","Gus","Gussie","Gust","Gustave","Guy","Gwen","Gwendolyn","Hadley","Hailee","Hailey","Hailie","Hal","Haleigh","Haley","Halie","Halle","Hallie","Hank","Hanna","Hannah","Hans","Hardy","Harley","Harmon","Harmony","Harold","Harrison","Harry","Harvey","Haskell","Hassan","Hassie","Hattie","Haven","Hayden","Haylee","Hayley","Haylie","Hazel","Hazle","Heath","Heather","Heaven","Heber","Hector","Heidi","Helen", "Helena","Helene","Helga","Hellen","Helmer","Heloise","Henderson","Henri","Henriette","Henry","Herbert","Herman","Hermann","Hermina","Herminia","Herminio","Hershel","Herta","Hertha","Hester","Hettie","Hilario","Hilbert","Hilda","Hildegard","Hillard","Hillary","Hilma","Hilton","Hipolito","Hiram","Hobart","Holden","Hollie","Hollis","Holly","Hope","Horace","Horacio","Hortense","Hosea","Houston","Howard","Howell","Hoyt","Hubert","Hudson","Hugh","Hulda","Humberto","Hunter","Hyman","Ian","Ibrahim","Icie", "Ida","Idell","Idella","Ignacio","Ignatius","Ike","Ila","Ilene","Iliana","Ima","Imani","Imelda","Immanuel","Imogene","Ines","Irma","Irving","Irwin","Isaac","Isabel","Isabell","Isabella","Isabelle","Isac","Isadore","Isai","Isaiah","Isaias","Isidro","Ismael","Isobel","Isom","Israel","Issac","Itzel","Iva","Ivah","Ivory","Ivy","Izabella","Izaiah","Jabari","Jace","Jacey","Jacinthe","Jacinto","Jack","Jackeline","Jackie","Jacklyn","Jackson","Jacky","Jaclyn","Jacquelyn","Jacques","Jacynthe","Jada","Jade", "Jaden","Jadon","Jadyn","Jaeden","Jaida","Jaiden","Jailyn","Jaime","Jairo","Jakayla","Jake","Jakob","Jaleel","Jalen","Jalon","Jalyn","Jamaal","Jamal","Jamar","Jamarcus","Jamel","Jameson","Jamey","Jamie","Jamil","Jamir","Jamison","Jammie","Jan","Jana","Janae","Jane","Janelle","Janessa","Janet","Janice","Janick","Janie","Janis","Janiya","Jannie","Jany","Jaquan","Jaquelin","Jaqueline","Jared","Jaren","Jarod","Jaron","Jarred","Jarrell","Jarret","Jarrett","Jarrod","Jarvis","Jasen","Jasmin","Jason","Jasper", "Jaunita","Javier","Javon","Javonte","Jay","Jayce","Jaycee","Jayda","Jayde","Jayden","Jaydon","Jaylan","Jaylen","Jaylin","Jaylon","Jayme","Jayne","Jayson","Jazlyn","Jazmin","Jazmyn","Jazmyne","Jean","Jeanette","Jeanie","Jeanne","Jed","Jedediah","Jedidiah","Jeff","Jefferey","Jeffery","Jeffrey","Jeffry","Jena","Jenifer","Jennie","Jennifer","Jennings","Jennyfer","Jensen","Jerad","Jerald","Jeramie","Jeramy","Jerel","Jeremie","Jeremy","Jermain","Jermaine","Jermey","Jerod","Jerome","Jeromy","Jerrell","Jerrod", "Jerrold","Jerry","Jess","Jesse","Jessica","Jessie","Jessika","Jessy","Jessyca","Jesus","Jett","Jettie","Jevon","Jewel","Jewell","Jillian","Jimmie","Jimmy","Jo","Joan","Joana","Joanie","Joanne","Joannie","Joanny","Joany","Joaquin","Jocelyn","Jodie","Jody","Joe","Joel","Joelle","Joesph","Joey","Johan","Johann","Johanna","Johathan","John","Johnathan","Johnathon","Johnnie","Johnny","Johnpaul","Johnson","Jolie","Jon","Jonas","Jonatan","Jonathan","Jonathon","Jordan","Jordane","Jordi","Jordon","Jordy", "Jordyn","Jorge","Jose","Josefa","Josefina","Joseph","Josephine","Josh","Joshua","Joshuah","Josiah","Josiane","Josianne","Josie","Josue","Jovan","Jovani","Jovanny","Jovany","Joy","Joyce","Juana","Juanita","Judah","Judd","Jude","Judge","Judson","Judy","Jules","Julia","Julian","Juliana","Julianne","Julie","Julien","Juliet","Julio","Julius","June","Junior","Junius","Justen","Justice","Justina","Justine","Juston","Justus","Justyn","Juvenal","Juwan","Kacey","Kaci","Kacie","Kade","Kaden","Kadin","Kaela", "Kaelyn","Kaia","Kailee","Kailey","Kailyn","Kaitlin","Kaitlyn","Kale","Kaleb","Kaleigh","Kaley","Kali","Kallie","Kameron","Kamille","Kamren","Kamron","Kamryn","Kane","Kara","Kareem","Karelle","Karen","Kari","Kariane","Karianne","Karina","Karine","Karl","Karlee","Karley","Karli","Karlie","Karolann","Karson","Kasandra","Kasey","Kassandra","Katarina","Katelin","Katelyn","Katelynn","Katharina","Katherine","Katheryn","Kathleen","Kathlyn","Kathryn","Kathryne","Katlyn","Katlynn","Katrina","Katrine","Kattie", "Kavon","Kay","Kaya","Kaycee","Kayden","Kayla","Kaylah","Kaylee","Kayleigh","Kayley","Kayli","Kaylie","Kaylin","Keagan","Keanu","Keara","Keaton","Keegan","Keeley","Keely","Keenan","Keira","Keith","Kellen","Kelley","Kelli","Kellie","Kelly","Kelsi","Kelsie","Kelton","Kelvin","Ken","Kendall","Kendra","Kendrick","Kenna","Kennedi","Kennedy","Kenneth","Kennith","Kenny","Kenton","Kenya","Kenyatta","Kenyon","Keon","Keshaun","Keshawn","Keven","Kevin","Kevon","Keyon","Keyshawn","Khalid","Khalil","Kian","Kiana", "Kianna","Kiara","Kiarra","Kiel","Kiera","Kieran","Kiley","Kim","Kimberly","King","Kip","Kira","Kirk","Kirsten","Kirstin","Kitty","Kobe","Koby","Kody","Kolby","Kole","Korbin","Korey","Kory","Kraig","Kris","Krista","Kristian","Kristin","Kristina","Kristofer","Kristoffer","Kristopher","Kristy","Krystal","Krystel","Krystina","Kurt","Kurtis","Kyla","Kyle","Kylee","Kyleigh","Kyler","Kylie","Kyra","Lacey","Lacy","Ladarius","Lafayette","Laila","Laisha","Lamar","Lambert","Lamont","Lance","Landen","Lane", "Laney","Larissa","Laron","Larry","Larue","Laura","Laurel","Lauren","Laurence","Lauretta","Lauriane","Laurianne","Laurie","Laurine","Laury","Lauryn","Lavada","Lavern","Laverna","Laverne","Lavina","Lavinia","Lavon","Lavonne","Lawrence","Lawson","Layla","Layne","Lazaro","Lea","Leann","Leanna","Leanne","Leatha","Leda","Lee","Leif","Leila","Leilani","Lela","Lelah","Leland","Lelia","Lempi","Lemuel","Lenna","Lennie","Lenny","Lenora","Lenore","Leo","Leola","Leon","Leonard","Leonardo","Leone","Leonel","Leonie", "Leonor","Leonora","Leopold","Leopoldo","Leora","Lera","Lesley","Leslie","Lesly","Lessie","Lester","Leta","Letha","Letitia","Levi","Lew","Lewis","Lexi","Lexie","Lexus","Lia","Liam","Liana","Libbie","Libby","Lila","Lilian","Liliana","Liliane","Lilla","Lillian","Lilliana","Lillie","Lilly","Lily","Lilyan","Lina","Lincoln","Linda","Lindsay","Lindsey","Linnea","Linnie","Linwood","Lionel","Lisa","Lisandro","Lisette","Litzy","Liza","Lizeth","Lizzie","Llewellyn","Lloyd","Logan","Lois","Lola","Lolita","Loma", "Lon","London","Lonie","Lonnie","Lonny","Lonzo","Lora","Loraine","Loren","Lorena","Lorenz","Lorenza","Lorenzo","Lori","Lorine","Lorna","Lottie","Lou","Louie","Louisa","Lourdes","Louvenia","Lowell","Loy","Loyal","Loyce","Lucas","Luciano","Lucie","Lucienne","Lucile","Lucinda","Lucio","Lucious","Lucius","Lucy","Ludie","Ludwig","Lue","Luella","Luigi","Luis","Luisa","Lukas","Lula","Lulu","Luna","Lupe","Lura","Lurline","Luther","Luz","Lyda","Lydia","Lyla","Lynn","Lyric","Lysanne","Mabel","Mabelle","Mable", "Mac","Macey","Maci","Macie","Mack","Mackenzie","Macy","Madaline","Madalyn","Maddison","Madeline","Madelyn","Madelynn","Madge","Madie","Madilyn","Madisen","Madison","Madisyn","Madonna","Madyson","Mae","Maegan","Maeve","Mafalda","Magali","Magdalen","Magdalena","Maggie","Magnolia","Magnus","Maia","Maida","Maiya","Major","Makayla","Makenna","Makenzie","Malachi","Malcolm","Malika","Malinda","Mallie","Mallory","Malvina","Mandy","Manley","Manuel","Manuela","Mara","Marc","Marcel","Marcelina","Marcelino", "Marcella","Marcelle","Marcellus","Marcelo","Marcia","Marco","Marcos","Marcus","Margaret","Margarete","Margarett","Margaretta","Margarette","Margarita","Marge","Margie","Margot","Margret","Marguerite","Maria","Mariah","Mariam","Marian","Mariana","Mariane","Marianna","Marianne","Mariano","Maribel","Marie","Mariela","Marielle","Marietta","Marilie","Marilou","Marilyne","Marina","Mario","Marion","Marisa","Marisol","Maritza","Marjolaine","Marjorie","Marjory","Mark","Markus","Marlee","Marlen","Marlene", "Marley","Marlin","Marlon","Marques","Marquis","Marquise","Marshall","Marta","Martin","Martina","Martine","Marty","Marvin","Mary","Maryam","Maryjane","Maryse","Mason","Mateo","Mathew","Mathias","Mathilde","Matilda","Matilde","Matt","Matteo","Mattie","Maud","Maude","Maudie","Maureen","Maurice","Mauricio","Maurine","Maverick","Mavis","Max","Maxie","Maxime","Maximilian","Maximillia","Maximillian","Maximo","Maximus","Maxine","Maxwell","May","Maya","Maybell","Maybelle","Maye","Maymie","Maynard","Mayra", "Mazie","Mckayla","Mckenna","Mckenzie","Meagan","Meaghan","Meda","Megane","Meggie","Meghan","Mekhi","Melany","Melba","Melisa","Melissa","Mellie","Melody","Melvin","Melvina","Melyna","Melyssa","Mercedes","Meredith","Merl","Merle","Merlin","Merritt","Mertie","Mervin","Meta","Mia","Micaela","Micah","Michael","Michaela","Michale","Micheal","Michel","Michele","Michelle","Miguel","Mikayla","Mike","Mikel","Milan","Miles","Milford","Miller","Millie","Milo","Milton","Mina","Minerva","Minnie","Miracle","Mireille", "Mireya","Misael","Missouri","Misty","Mitchel","Mitchell","Mittie","Modesta","Modesto","Mohamed","Mohammad","Mohammed","Moises","Mollie","Molly","Mona","Monica","Monique","Monroe","Monserrat","Monserrate","Montana","Monte","Monty","Morgan","Moriah","Morris","Mortimer","Morton","Mose","Moses","Moshe","Mossie","Mozell","Mozelle","Muhammad","Muriel","Murl","Murphy","Murray","Mustafa","Mya","Myah","Mylene","Myles","Myra","Myriam","Myrl","Myrna","Myron","Myrtice","Myrtie","Myrtis","Myrtle","Nadia","Nakia", "Name","Nannie","Naomi","Naomie","Napoleon","Narciso","Nash","Nasir","Nat","Natalia","Natalie","Natasha","Nathan","Nathanael","Nathanial","Nathaniel","Nathen","Nayeli","Neal","Ned","Nedra","Neha","Neil","Nelda","Nella","Nelle","Nellie","Nels","Nelson","Neoma","Nestor","Nettie","Neva","Newell","Newton","Nia","Nicholas","Nicholaus","Nichole","Nick","Nicklaus","Nickolas","Nico","Nicola","Nicolas","Nicole","Nicolette","Nigel","Nikita","Nikki","Nikko","Niko","Nikolas","Nils","Nina","Noah","Noble","Noe", "Noel","Noelia","Noemi","Noemie","Noemy","Nola","Nolan","Nona","Nora","Norbert","Norberto","Norene","Norma","Norris","Norval","Norwood","Nova","Novella","Nya","Nyah","Nyasia","Obie","Oceane","Ocie","Octavia","Oda","Odell","Odessa","Odie","Ofelia","Okey","Ola","Olaf","Ole","Olen","Oleta","Olga","Olin","Oliver","Ollie","Oma","Omari","Omer","Ona","Onie","Opal","Ophelia","Ora","Oral","Oran","Oren","Orie","Orin","Orion","Orland","Orlando","Orlo","Orpha","Orrin","Orval","Orville","Osbaldo","Osborne","Oscar", "Osvaldo","Oswald","Oswaldo","Otha","Otho","Otilia","Otis","Ottilie","Ottis","Otto","Ova","Owen","Ozella","Pablo","Paige","Palma","Pamela","Pansy","Paolo","Paris","Parker","Pascale","Pasquale","Pat","Patience","Patricia","Patrick","Patsy","Pattie","Paul","Paula","Pauline","Paxton","Payton","Pearl","Pearlie","Pearline","Pedro","Peggie","Penelope","Percival","Percy","Perry","Pete","Peter","Petra","Peyton","Philip","Phoebe","Phyllis","Pierce","Pierre","Pietro","Pink","Pinkie","Piper","Polly","Porter", "Precious","Presley","Preston","Price","Prince","Princess","Priscilla","Providenci","Prudence","Queen","Queenie","Quentin","Quincy","Quinn","Quinten","Quinton","Rachael","Rachel","Rachelle","Rae","Raegan","Rafael","Rafaela","Raheem","Rahsaan","Rahul","Raina","Raleigh","Ralph","Ramiro","Ramon","Ramona","Randal","Randall","Randi","Randy","Ransom","Raoul","Raphael","Raphaelle","Raquel","Rashad","Rashawn","Rasheed","Raul","Raven","Ray","Raymond","Raymundo","Reagan","Reanna","Reba","Rebeca","Rebecca", "Rebeka","Rebekah","Reece","Reed","Reese","Regan","Reggie","Reginald","Reid","Reilly","Reina","Reinhold","Remington","Rene","Renee","Ressie","Reta","Retha","Retta","Reuben","Reva","Rex","Rey","Reyes","Reymundo","Reyna","Reynold","Rhea","Rhett","Rhianna","Rhiannon","Rhoda","Ricardo","Richard","Richie","Richmond","Rick","Rickey","Rickie","Ricky","Rico","Rigoberto","Riley","Rita","River","Robb","Robbie","Robert","Roberta","Roberto","Robin","Robyn","Rocio","Rocky","Rod","Roderick","Rodger","Rodolfo", "Rodrick","Rodrigo","Roel","Rogelio","Roger","Rogers","Rolando","Rollin","Roma","Romaine","Roman","Ron","Ronaldo","Ronny","Roosevelt","Rory","Rosa","Rosalee","Rosalia","Rosalind","Rosalinda","Rosalyn","Rosamond","Rosanna","Rosario","Roscoe","Rose","Rosella","Roselyn","Rosemarie","Rosemary","Rosendo","Rosetta","Rosie","Rosina","Roslyn","Ross","Rossie","Rowan","Rowena","Rowland","Roxane","Roxanne","Roy","Royal","Royce","Rozella","Ruben","Rubie","Ruby","Rubye","Rudolph","Rudy","Rupert","Russ","Russel", "Russell","Rusty","Ruth","Ruthe","Ruthie","Ryan","Ryann","Ryder","Rylan","Rylee","Ryleigh","Ryley","Sabina","Sabrina","Sabryna","Sadie","Sadye","Sage","Saige","Sallie","Sally","Salma","Salvador","Salvatore","Sam","Samanta","Samantha","Samara","Samir","Sammie","Sammy","Samson","Sandra","Sandrine","Sandy","Sanford","Santa","Santiago","Santina","Santino","Santos","Sarah","Sarai","Sarina","Sasha","Saul","Savanah","Savanna","Savannah","Savion","Scarlett","Schuyler","Scot","Scottie","Scotty","Seamus","Sean", "Sebastian","Sedrick","Selena","Selina","Selmer","Serena","Serenity","Seth","Shad","Shaina","Shakira","Shana","Shane","Shanel","Shanelle","Shania","Shanie","Shaniya","Shanna","Shannon","Shanny","Shanon","Shany","Sharon","Shaun","Shawn","Shawna","Shaylee","Shayna","Shayne","Shea","Sheila","Sheldon","Shemar","Sheridan","Sherman","Sherwood","Shirley","Shyann","Shyanne","Sibyl","Sid","Sidney","Sienna","Sierra","Sigmund","Sigrid","Sigurd","Silas","Sim","Simeon","Simone","Sincere","Sister","Skye","Skyla", "Skylar","Sofia","Soledad","Solon","Sonia","Sonny","Sonya","Sophia","Sophie","Spencer","Stacey","Stacy","Stan","Stanford","Stanley","Stanton","Stefan","Stefanie","Stella","Stephan","Stephania","Stephanie","Stephany","Stephen","Stephon","Sterling","Steve","Stevie","Stewart","Stone","Stuart","Summer","Sunny","Susan","Susana","Susanna","Susie","Suzanne","Sven","Syble","Sydnee","Sydney","Sydni","Sydnie","Sylvan","Sylvester","Sylvia","Tabitha","Tad","Talia","Talon","Tamara","Tamia","Tania","Tanner","Tanya", "Tara","Taryn","Tate","Tatum","Tatyana","Taurean","Tavares","Taya","Taylor","Teagan","Ted","Telly","Terence","Teresa","Terrance","Terrell","Terrence","Terrill","Terry","Tess","Tessie","Tevin","Thad","Thaddeus","Thalia","Thea","Thelma","Theo","Theodora","Theodore","Theresa","Therese","Theresia","Theron","Thomas","Thora","Thurman","Tia","Tiana","Tianna","Tiara","Tierra","Tiffany","Tillman","Timmothy","Timmy","Timothy","Tina","Tito","Titus","Tobin","Toby","Tod","Tom","Tomas","Tomasa","Tommie","Toney", "Toni","Tony","Torey","Torrance","Torrey","Toy","Trace","Tracey","Tracy","Travis","Travon","Tre","Tremaine","Tremayne","Trent","Trenton","Tressa","Tressie","Treva","Trever","Trevion","Trevor","Trey","Trinity","Trisha","Tristian","Tristin","Triston","Troy","Trudie","Trycia","Trystan","Turner","Twila","Tyler","Tyra","Tyree","Tyreek","Tyrel","Tyrell","Tyrese","Tyrique","Tyshawn","Tyson","Ubaldo","Ulices","Ulises","Una","Unique","Urban","Uriah","Uriel","Ursula","Vada","Valentin","Valentina","Valentine", "Valerie","Vallie","Van","Vance","Vanessa","Vaughn","Veda","Velda","Vella","Velma","Velva","Vena","Verda","Verdie","Vergie","Verla","Verlie","Vern","Verna","Verner","Vernice","Vernie","Vernon","Verona","Veronica","Vesta","Vicenta","Vicente","Vickie","Vicky","Victor","Victoria","Vida","Vidal","Vilma","Vince","Vincent","Vincenza","Vincenzo","Vinnie","Viola","Violet","Violette","Virgie","Virgil","Virginia","Virginie","Vita","Vito","Viva","Vivian","Viviane","Vivianne","Vivien","Vivienne","Vladimir","Wade", "Waino","Waldo","Walker","Wallace","Walter","Walton","Wanda","Ward","Warren","Watson","Wava","Waylon","Wayne","Webster","Weldon","Wellington","Wendell","Wendy","Werner","Westley","Weston","Whitney","Wilber","Wilbert","Wilburn","Wiley","Wilford","Wilfred","Wilfredo","Wilfrid","Wilhelm","Wilhelmine","Will","Willa","Willard","William","Willie","Willis","Willow","Willy","Wilma","Wilmer","Wilson","Wilton","Winfield","Winifred","Winnifred","Winona","Winston","Woodrow","Wyatt","Wyman","Xander","Xavier", "Xzavier","Yadira","Yasmeen","Yasmin","Yasmine","Yazmin","Yesenia","Yessenia","Yolanda","Yoshiko","Yvette","Yvonne","Zachariah","Zachary","Zachery","Zack","Zackary","Zackery","Zakary","Zander","Zane","Zaria","Zechariah","Zelda","Zella","Zelma","Zena","Zetta","Zion","Zita","Zoe","Zoey","Zoie","Zoila","Zola","Zora","Zula"]});var last_name$2=createCommonjsModule(function(module){module["exports"]=["Abbott","Abernathy","Abshire","Adams","Altenwerth","Anderson","Ankunding","Armstrong","Auer","Aufderhar", "Bahringer","Bailey","Balistreri","Barrows","Bartell","Bartoletti","Barton","Bashirian","Batz","Bauch","Baumbach","Bayer","Beahan","Beatty","Bechtelar","Becker","Bednar","Beer","Beier","Berge","Bergnaum","Bergstrom","Bernhard","Bernier","Bins","Blanda","Blick","Block","Bode","Boehm","Bogan","Bogisich","Borer","Bosco","Botsford","Boyer","Boyle","Bradtke","Brakus","Braun","Breitenberg","Brekke","Brown","Bruen","Buckridge","Carroll","Carter","Cartwright","Casper","Cassin","Champlin","Christiansen","Cole", "Collier","Collins","Conn","Connelly","Conroy","Considine","Corkery","Cormier","Corwin","Cremin","Crist","Crona","Cronin","Crooks","Cruickshank","Cummerata","Cummings","Dach","D'Amore","Daniel","Dare","Daugherty","Davis","Deckow","Denesik","Dibbert","Dickens","Dicki","Dickinson","Dietrich","Donnelly","Dooley","Douglas","Doyle","DuBuque","Durgan","Ebert","Effertz","Eichmann","Emard","Emmerich","Erdman","Ernser","Fadel","Fahey","Farrell","Fay","Feeney","Feest","Feil","Ferry","Fisher","Flatley","Frami", "Franecki","Friesen","Fritsch","Funk","Gaylord","Gerhold","Gerlach","Gibson","Gislason","Gleason","Gleichner","Glover","Goldner","Goodwin","Gorczany","Gottlieb","Goyette","Grady","Graham","Grant","Green","Greenfelder","Greenholt","Grimes","Gulgowski","Gusikowski","Gutkowski","Gutmann","Haag","Hackett","Hagenes","Hahn","Haley","Halvorson","Hamill","Hammes","Hand","Hane","Hansen","Harber","Harris","Hartmann","Harvey","Hauck","Hayes","Heaney","Heathcote","Hegmann","Heidenreich","Heller","Herman","Hermann", "Hermiston","Herzog","Hessel","Hettinger","Hickle","Hilll","Hills","Hilpert","Hintz","Hirthe","Hodkiewicz","Hoeger","Homenick","Hoppe","Howe","Howell","Hudson","Huel","Huels","Hyatt","Jacobi","Jacobs","Jacobson","Jakubowski","Jaskolski","Jast","Jenkins","Jerde","Johns","Johnson","Johnston","Jones","Kassulke","Kautzer","Keebler","Keeling","Kemmer","Kerluke","Kertzmann","Kessler","Kiehn","Kihn","Kilback","King","Kirlin","Klein","Kling","Klocko","Koch","Koelpin","Koepp","Kohler","Konopelski","Koss", "Kovacek","Kozey","Krajcik","Kreiger","Kris","Kshlerin","Kub","Kuhic","Kuhlman","Kuhn","Kulas","Kunde","Kunze","Kuphal","Kutch","Kuvalis","Labadie","Lakin","Lang","Langosh","Langworth","Larkin","Larson","Leannon","Lebsack","Ledner","Leffler","Legros","Lehner","Lemke","Lesch","Leuschke","Lind","Lindgren","Littel","Little","Lockman","Lowe","Lubowitz","Lueilwitz","Luettgen","Lynch","Macejkovic","MacGyver","Maggio","Mann","Mante","Marks","Marquardt","Marvin","Mayer","Mayert","McClure","McCullough","McDermott", "McGlynn","McKenzie","McLaughlin","Medhurst","Mertz","Metz","Miller","Mills","Mitchell","Moen","Mohr","Monahan","Moore","Morar","Morissette","Mosciski","Mraz","Mueller","Muller","Murazik","Murphy","Murray","Nader","Nicolas","Nienow","Nikolaus","Nitzsche","Nolan","Oberbrunner","O'Connell","O'Conner","O'Hara","O'Keefe","O'Kon","Okuneva","Olson","Ondricka","O'Reilly","Orn","Ortiz","Osinski","Pacocha","Padberg","Pagac","Parisian","Parker","Paucek","Pfannerstill","Pfeffer","Pollich","Pouros","Powlowski", "Predovic","Price","Prohaska","Prosacco","Purdy","Quigley","Quitzon","Rath","Ratke","Rau","Raynor","Reichel","Reichert","Reilly","Reinger","Rempel","Renner","Reynolds","Rice","Rippin","Ritchie","Robel","Roberts","Rodriguez","Rogahn","Rohan","Rolfson","Romaguera","Roob","Rosenbaum","Rowe","Ruecker","Runolfsdottir","Runolfsson","Runte","Russel","Rutherford","Ryan","Sanford","Satterfield","Sauer","Sawayn","Schaden","Schaefer","Schamberger","Schiller","Schimmel","Schinner","Schmeler","Schmidt","Schmitt", "Schneider","Schoen","Schowalter","Schroeder","Schulist","Schultz","Schumm","Schuppe","Schuster","Senger","Shanahan","Shields","Simonis","Sipes","Skiles","Smith","Smitham","Spencer","Spinka","Sporer","Stamm","Stanton","Stark","Stehr","Steuber","Stiedemann","Stokes","Stoltenberg","Stracke","Streich","Stroman","Strosin","Swaniawski","Swift","Terry","Thiel","Thompson","Tillman","Torp","Torphy","Towne","Toy","Trantow","Tremblay","Treutel","Tromp","Turcotte","Turner","Ullrich","Upton","Vandervort","Veum", "Volkman","Von","VonRueden","Waelchi","Walker","Walsh","Walter","Ward","Waters","Watsica","Weber","Wehner","Weimann","Weissnat","Welch","West","White","Wiegand","Wilderman","Wilkinson","Will","Williamson","Willms","Windler","Wintheiser","Wisoky","Wisozk","Witting","Wiza","Wolf","Wolff","Wuckert","Wunsch","Wyman","Yost","Yundt","Zboncak","Zemlak","Ziemann","Zieme","Zulauf"]});var prefix=createCommonjsModule(function(module){module["exports"]=["Mr.","Mrs.","Ms.","Miss","Dr."]});var suffix$2=createCommonjsModule(function(module){module["exports"]= ["Jr.","Sr.","I","II","III","IV","V","MD","DDS","PhD","DVM"]});var title=createCommonjsModule(function(module){module["exports"]={"descriptor":["Lead","Senior","Direct","Corporate","Dynamic","Future","Product","National","Regional","District","Central","Global","Customer","Investor","Dynamic","International","Legacy","Forward","Internal","Human","Chief","Principal"],"level":["Solutions","Program","Brand","Security","Research","Marketing","Directives","Implementation","Integration","Functionality", "Response","Paradigm","Tactics","Identity","Markets","Group","Division","Applications","Optimization","Operations","Infrastructure","Intranet","Communications","Web","Branding","Quality","Assurance","Mobility","Accounts","Data","Creative","Configuration","Accountability","Interactions","Factors","Usability","Metrics"],"job":["Supervisor","Associate","Executive","Liaison","Officer","Manager","Engineer","Specialist","Director","Coordinator","Administrator","Architect","Analyst","Designer","Planner", "Orchestrator","Technician","Developer","Producer","Consultant","Assistant","Facilitator","Agent","Representative","Strategist"]}});var name$6=createCommonjsModule(function(module){module["exports"]=["#{prefix} #{first_name} #{last_name}","#{first_name} #{last_name} #{suffix}","#{first_name} #{last_name}","#{first_name} #{last_name}","#{first_name} #{last_name}","#{first_name} #{last_name}"]});var name_1$2=createCommonjsModule(function(module){var name={};module["exports"]=name;name.first_name=first_name$2; name.last_name=last_name$2;name.prefix=prefix;name.suffix=suffix$2;name.title=title;name.name=name$6});var formats$4=createCommonjsModule(function(module){module["exports"]=["###-###-####","(###) ###-####","1-###-###-####","###.###.####","###-###-####","(###) ###-####","1-###-###-####","###.###.####","###-###-#### x###","(###) ###-#### x###","1-###-###-#### x###","###.###.#### x###","###-###-#### x####","(###) ###-#### x####","1-###-###-#### x####","###.###.#### x####","###-###-#### x#####","(###) ###-#### x#####", "1-###-###-#### x#####","###.###.#### x#####"]});var phone_number_1$2=createCommonjsModule(function(module){var phone_number={};module["exports"]=phone_number;phone_number.formats=formats$4});var formats$6=createCommonjsModule(function(module){module["exports"]=["###-###-####","(###) ###-####","1-###-###-####","###.###.####"]});var cell_phone_1$2=createCommonjsModule(function(module){var cell_phone={};module["exports"]=cell_phone;cell_phone.formats=formats$6});var credit_card_numbers=createCommonjsModule(function(module){module["exports"]= ["1234-2121-1221-1211","1212-1221-1121-1234","1211-1221-1234-2201","1228-1221-1221-1431"]});var credit_card_expiry_dates=createCommonjsModule(function(module){module["exports"]=["2011-10-12","2012-11-12","2015-11-11","2013-9-12"]});var credit_card_types=createCommonjsModule(function(module){module["exports"]=["visa","mastercard","americanexpress","discover"]});var business_1=createCommonjsModule(function(module){var business={};module["exports"]=business;business.credit_card_numbers=credit_card_numbers; business.credit_card_expiry_dates=credit_card_expiry_dates;business.credit_card_types=credit_card_types});var color=createCommonjsModule(function(module){module["exports"]=["red","green","blue","yellow","purple","mint green","teal","white","black","orange","pink","grey","maroon","violet","turquoise","tan","sky blue","salmon","plum","orchid","olive","magenta","lime","ivory","indigo","gold","fuchsia","cyan","azure","lavender","silver"]});var department=createCommonjsModule(function(module){module["exports"]= ["Books","Movies","Music","Games","Electronics","Computers","Home","Garden","Tools","Grocery","Health","Beauty","Toys","Kids","Baby","Clothing","Shoes","Jewelery","Sports","Outdoors","Automotive","Industrial"]});var product_name=createCommonjsModule(function(module){module["exports"]={"adjective":["Small","Ergonomic","Rustic","Intelligent","Gorgeous","Incredible","Fantastic","Practical","Sleek","Awesome","Generic","Handcrafted","Handmade","Licensed","Refined","Unbranded","Tasty"],"material":["Steel", "Wooden","Concrete","Plastic","Cotton","Granite","Rubber","Metal","Soft","Fresh","Frozen"],"product":["Chair","Car","Computer","Keyboard","Mouse","Bike","Ball","Gloves","Pants","Shirt","Table","Shoes","Hat","Towels","Soap","Tuna","Chicken","Fish","Cheese","Bacon","Pizza","Salad","Sausages","Chips"]}});var commerce_1=createCommonjsModule(function(module){var commerce={};module["exports"]=commerce;commerce.color=color;commerce.department=department;commerce.product_name=product_name});var creature= createCommonjsModule(function(module){module["exports"]=["ants","bats","bears","bees","birds","buffalo","cats","chickens","cattle","dogs","dolphins","ducks","elephants","fishes","foxes","frogs","geese","goats","horses","kangaroos","lions","monkeys","owls","oxen","penguins","people","pigs","rabbits","sheep","tigers","whales","wolves","zebras","banshees","crows","black cats","chimeras","ghosts","conspirators","dragons","dwarves","elves","enchanters","exorcists","sons","foes","giants","gnomes","goblins", "gooses","griffins","lycanthropes","nemesis","ogres","oracles","prophets","sorcerors","spiders","spirits","vampires","warlocks","vixens","werewolves","witches","worshipers","zombies","druids"]});var name$8=createCommonjsModule(function(module){module["exports"]=["#{Address.state} #{creature}"]});var team_1=createCommonjsModule(function(module){var team={};module["exports"]=team;team.creature=creature;team.name=name$8});var abbreviation=createCommonjsModule(function(module){module["exports"]=["TCP", "HTTP","SDD","RAM","GB","CSS","SSL","AGP","SQL","FTP","PCI","AI","ADP","RSS","XML","EXE","COM","HDD","THX","SMTP","SMS","USB","PNG","SAS","IB","SCSI","JSON","XSS","JBOD"]});var adjective$2=createCommonjsModule(function(module){module["exports"]=["auxiliary","primary","back-end","digital","open-source","virtual","cross-platform","redundant","online","haptic","multi-byte","bluetooth","wireless","1080p","neural","optical","solid state","mobile"]});var noun$2=createCommonjsModule(function(module){module["exports"]= ["driver","protocol","bandwidth","panel","microchip","program","port","card","array","interface","system","sensor","firewall","hard drive","pixel","alarm","feed","monitor","application","transmitter","bus","circuit","capacitor","matrix"]});var verb=createCommonjsModule(function(module){module["exports"]=["back up","bypass","hack","override","compress","copy","navigate","index","connect","generate","quantify","calculate","synthesize","input","transmit","program","reboot","parse"]});var ingverb=createCommonjsModule(function(module){module["exports"]= ["backing up","bypassing","hacking","overriding","compressing","copying","navigating","indexing","connecting","generating","quantifying","calculating","synthesizing","transmitting","programming","parsing"]});var hacker_1=createCommonjsModule(function(module){var hacker={};module["exports"]=hacker;hacker.abbreviation=abbreviation;hacker.adjective=adjective$2;hacker.noun=noun$2;hacker.verb=verb;hacker.ingverb=ingverb});var name$10=createCommonjsModule(function(module){module["exports"]=["Redhold","Treeflex", "Trippledex","Kanlam","Bigtax","Daltfresh","Toughjoyfax","Mat Lam Tam","Otcom","Tres-Zap","Y-Solowarm","Tresom","Voltsillam","Biodex","Greenlam","Viva","Matsoft","Temp","Zoolab","Subin","Rank","Job","Stringtough","Tin","It","Home Ing","Zamit","Sonsing","Konklab","Alpha","Latlux","Voyatouch","Alphazap","Holdlamis","Zaam-Dox","Sub-Ex","Quo Lux","Bamity","Ventosanzap","Lotstring","Hatity","Tempsoft","Overhold","Fixflex","Konklux","Zontrax","Tampflex","Span","Namfix","Transcof","Stim","Fix San","Sonair", "Stronghold","Fintone","Y-find","Opela","Lotlux","Ronstring","Zathin","Duobam","Keylex"]});var version=createCommonjsModule(function(module){module["exports"]=["0.#.#","0.##","#.##","#.#","#.#.#"]});var author=createCommonjsModule(function(module){module["exports"]=["#{Name.name}","#{Company.name}"]});var app_1=createCommonjsModule(function(module){var app={};module["exports"]=app;app.name=name$10;app.version=version;app.author=author});var account_type=createCommonjsModule(function(module){module["exports"]= ["Checking","Savings","Money Market","Investment","Home Loan","Credit Card","Auto Loan","Personal Loan"]});var transaction_type=createCommonjsModule(function(module){module["exports"]=["deposit","withdrawal","payment","invoice"]});var currency=createCommonjsModule(function(module){module["exports"]={"UAE Dirham":{"code":"AED","symbol":""},"Afghani":{"code":"AFN","symbol":"\u060b"},"Lek":{"code":"ALL","symbol":"Lek"},"Armenian Dram":{"code":"AMD","symbol":""},"Netherlands Antillian Guilder":{"code":"ANG", "symbol":"\u0192"},"Kwanza":{"code":"AOA","symbol":""},"Argentine Peso":{"code":"ARS","symbol":"$"},"Australian Dollar":{"code":"AUD","symbol":"$"},"Aruban Guilder":{"code":"AWG","symbol":"\u0192"},"Azerbaijanian Manat":{"code":"AZN","symbol":"\u043c\u0430\u043d"},"Convertible Marks":{"code":"BAM","symbol":"KM"},"Barbados Dollar":{"code":"BBD","symbol":"$"},"Taka":{"code":"BDT","symbol":""},"Bulgarian Lev":{"code":"BGN","symbol":"\u043b\u0432"},"Bahraini Dinar":{"code":"BHD","symbol":""},"Burundi Franc":{"code":"BIF", "symbol":""},"Bermudian Dollar (customarily known as Bermuda Dollar)":{"code":"BMD","symbol":"$"},"Brunei Dollar":{"code":"BND","symbol":"$"},"Boliviano Mvdol":{"code":"BOB BOV","symbol":"$b"},"Brazilian Real":{"code":"BRL","symbol":"R$"},"Bahamian Dollar":{"code":"BSD","symbol":"$"},"Pula":{"code":"BWP","symbol":"P"},"Belarussian Ruble":{"code":"BYR","symbol":"p."},"Belize Dollar":{"code":"BZD","symbol":"BZ$"},"Canadian Dollar":{"code":"CAD","symbol":"$"},"Congolese Franc":{"code":"CDF","symbol":""}, "Swiss Franc":{"code":"CHF","symbol":"CHF"},"Chilean Peso Unidades de fomento":{"code":"CLP CLF","symbol":"$"},"Yuan Renminbi":{"code":"CNY","symbol":"\u00a5"},"Colombian Peso Unidad de Valor Real":{"code":"COP COU","symbol":"$"},"Costa Rican Colon":{"code":"CRC","symbol":"\u20a1"},"Cuban Peso Peso Convertible":{"code":"CUP CUC","symbol":"\u20b1"},"Cape Verde Escudo":{"code":"CVE","symbol":""},"Czech Koruna":{"code":"CZK","symbol":"K\u010d"},"Djibouti Franc":{"code":"DJF","symbol":""},"Danish Krone":{"code":"DKK", "symbol":"kr"},"Dominican Peso":{"code":"DOP","symbol":"RD$"},"Algerian Dinar":{"code":"DZD","symbol":""},"Kroon":{"code":"EEK","symbol":""},"Egyptian Pound":{"code":"EGP","symbol":"\u00a3"},"Nakfa":{"code":"ERN","symbol":""},"Ethiopian Birr":{"code":"ETB","symbol":""},"Euro":{"code":"EUR","symbol":"\u20ac"},"Fiji Dollar":{"code":"FJD","symbol":"$"},"Falkland Islands Pound":{"code":"FKP","symbol":"\u00a3"},"Pound Sterling":{"code":"GBP","symbol":"\u00a3"},"Lari":{"code":"GEL","symbol":""},"Cedi":{"code":"GHS", "symbol":""},"Gibraltar Pound":{"code":"GIP","symbol":"\u00a3"},"Dalasi":{"code":"GMD","symbol":""},"Guinea Franc":{"code":"GNF","symbol":""},"Quetzal":{"code":"GTQ","symbol":"Q"},"Guyana Dollar":{"code":"GYD","symbol":"$"},"Hong Kong Dollar":{"code":"HKD","symbol":"$"},"Lempira":{"code":"HNL","symbol":"L"},"Croatian Kuna":{"code":"HRK","symbol":"kn"},"Gourde US Dollar":{"code":"HTG USD","symbol":""},"Forint":{"code":"HUF","symbol":"Ft"},"Rupiah":{"code":"IDR","symbol":"Rp"},"New Israeli Sheqel":{"code":"ILS", "symbol":"\u20aa"},"Indian Rupee":{"code":"INR","symbol":""},"Indian Rupee Ngultrum":{"code":"INR BTN","symbol":""},"Iraqi Dinar":{"code":"IQD","symbol":""},"Iranian Rial":{"code":"IRR","symbol":"\ufdfc"},"Iceland Krona":{"code":"ISK","symbol":"kr"},"Jamaican Dollar":{"code":"JMD","symbol":"J$"},"Jordanian Dinar":{"code":"JOD","symbol":""},"Yen":{"code":"JPY","symbol":"\u00a5"},"Kenyan Shilling":{"code":"KES","symbol":""},"Som":{"code":"KGS","symbol":"\u043b\u0432"},"Riel":{"code":"KHR","symbol":"\u17db"}, "Comoro Franc":{"code":"KMF","symbol":""},"North Korean Won":{"code":"KPW","symbol":"\u20a9"},"Won":{"code":"KRW","symbol":"\u20a9"},"Kuwaiti Dinar":{"code":"KWD","symbol":""},"Cayman Islands Dollar":{"code":"KYD","symbol":"$"},"Tenge":{"code":"KZT","symbol":"\u043b\u0432"},"Kip":{"code":"LAK","symbol":"\u20ad"},"Lebanese Pound":{"code":"LBP","symbol":"\u00a3"},"Sri Lanka Rupee":{"code":"LKR","symbol":"\u20a8"},"Liberian Dollar":{"code":"LRD","symbol":"$"},"Lithuanian Litas":{"code":"LTL","symbol":"Lt"}, "Latvian Lats":{"code":"LVL","symbol":"Ls"},"Libyan Dinar":{"code":"LYD","symbol":""},"Moroccan Dirham":{"code":"MAD","symbol":""},"Moldovan Leu":{"code":"MDL","symbol":""},"Malagasy Ariary":{"code":"MGA","symbol":""},"Denar":{"code":"MKD","symbol":"\u0434\u0435\u043d"},"Kyat":{"code":"MMK","symbol":""},"Tugrik":{"code":"MNT","symbol":"\u20ae"},"Pataca":{"code":"MOP","symbol":""},"Ouguiya":{"code":"MRO","symbol":""},"Mauritius Rupee":{"code":"MUR","symbol":"\u20a8"},"Rufiyaa":{"code":"MVR","symbol":""}, "Kwacha":{"code":"MWK","symbol":""},"Mexican Peso Mexican Unidad de Inversion (UDI)":{"code":"MXN MXV","symbol":"$"},"Malaysian Ringgit":{"code":"MYR","symbol":"RM"},"Metical":{"code":"MZN","symbol":"MT"},"Naira":{"code":"NGN","symbol":"\u20a6"},"Cordoba Oro":{"code":"NIO","symbol":"C$"},"Norwegian Krone":{"code":"NOK","symbol":"kr"},"Nepalese Rupee":{"code":"NPR","symbol":"\u20a8"},"New Zealand Dollar":{"code":"NZD","symbol":"$"},"Rial Omani":{"code":"OMR","symbol":"\ufdfc"},"Balboa US Dollar":{"code":"PAB USD", "symbol":"B/."},"Nuevo Sol":{"code":"PEN","symbol":"S/."},"Kina":{"code":"PGK","symbol":""},"Philippine Peso":{"code":"PHP","symbol":"Php"},"Pakistan Rupee":{"code":"PKR","symbol":"\u20a8"},"Zloty":{"code":"PLN","symbol":"z\u0142"},"Guarani":{"code":"PYG","symbol":"Gs"},"Qatari Rial":{"code":"QAR","symbol":"\ufdfc"},"New Leu":{"code":"RON","symbol":"lei"},"Serbian Dinar":{"code":"RSD","symbol":"\u0414\u0438\u043d."},"Russian Ruble":{"code":"RUB","symbol":"\u0440\u0443\u0431"},"Rwanda Franc":{"code":"RWF", "symbol":""},"Saudi Riyal":{"code":"SAR","symbol":"\ufdfc"},"Solomon Islands Dollar":{"code":"SBD","symbol":"$"},"Seychelles Rupee":{"code":"SCR","symbol":"\u20a8"},"Sudanese Pound":{"code":"SDG","symbol":""},"Swedish Krona":{"code":"SEK","symbol":"kr"},"Singapore Dollar":{"code":"SGD","symbol":"$"},"Saint Helena Pound":{"code":"SHP","symbol":"\u00a3"},"Leone":{"code":"SLL","symbol":""},"Somali Shilling":{"code":"SOS","symbol":"S"},"Surinam Dollar":{"code":"SRD","symbol":"$"},"Dobra":{"code":"STD", "symbol":""},"El Salvador Colon US Dollar":{"code":"SVC USD","symbol":"$"},"Syrian Pound":{"code":"SYP","symbol":"\u00a3"},"Lilangeni":{"code":"SZL","symbol":""},"Baht":{"code":"THB","symbol":"\u0e3f"},"Somoni":{"code":"TJS","symbol":""},"Manat":{"code":"TMT","symbol":""},"Tunisian Dinar":{"code":"TND","symbol":""},"Pa'anga":{"code":"TOP","symbol":""},"Turkish Lira":{"code":"TRY","symbol":"TL"},"Trinidad and Tobago Dollar":{"code":"TTD","symbol":"TT$"},"New Taiwan Dollar":{"code":"TWD","symbol":"NT$"}, "Tanzanian Shilling":{"code":"TZS","symbol":""},"Hryvnia":{"code":"UAH","symbol":"\u20b4"},"Uganda Shilling":{"code":"UGX","symbol":""},"US Dollar":{"code":"USD","symbol":"$"},"Peso Uruguayo Uruguay Peso en Unidades Indexadas":{"code":"UYU UYI","symbol":"$U"},"Uzbekistan Sum":{"code":"UZS","symbol":"\u043b\u0432"},"Bolivar Fuerte":{"code":"VEF","symbol":"Bs"},"Dong":{"code":"VND","symbol":"\u20ab"},"Vatu":{"code":"VUV","symbol":""},"Tala":{"code":"WST","symbol":""},"CFA Franc BEAC":{"code":"XAF", "symbol":""},"Silver":{"code":"XAG","symbol":""},"Gold":{"code":"XAU","symbol":""},"Bond Markets Units European Composite Unit (EURCO)":{"code":"XBA","symbol":""},"European Monetary Unit (E.M.U.-6)":{"code":"XBB","symbol":""},"European Unit of Account 9(E.U.A.-9)":{"code":"XBC","symbol":""},"European Unit of Account 17(E.U.A.-17)":{"code":"XBD","symbol":""},"East Caribbean Dollar":{"code":"XCD","symbol":"$"},"SDR":{"code":"XDR","symbol":""},"UIC-Franc":{"code":"XFU","symbol":""},"CFA Franc BCEAO":{"code":"XOF", "symbol":""},"Palladium":{"code":"XPD","symbol":""},"CFP Franc":{"code":"XPF","symbol":""},"Platinum":{"code":"XPT","symbol":""},"Codes specifically reserved for testing purposes":{"code":"XTS","symbol":""},"Yemeni Rial":{"code":"YER","symbol":"\ufdfc"},"Rand":{"code":"ZAR","symbol":"R"},"Rand Loti":{"code":"ZAR LSL","symbol":""},"Rand Namibia Dollar":{"code":"ZAR NAD","symbol":""},"Zambian Kwacha":{"code":"ZMK","symbol":""},"Zimbabwe Dollar":{"code":"ZWL","symbol":""}}});var finance_1=createCommonjsModule(function(module){var finance= {};module["exports"]=finance;finance.account_type=account_type;finance.transaction_type=transaction_type;finance.currency=currency});var month=createCommonjsModule(function(module){module["exports"]={wide:["January","February","March","April","May","June","July","August","September","October","November","December"],wide_context:["January","February","March","April","May","June","July","August","September","October","November","December"],abbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep", "Oct","Nov","Dec"],abbr_context:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}});var weekday=createCommonjsModule(function(module){module["exports"]={wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],wide_context:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],abbr_context:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]}});var date_1=createCommonjsModule(function(module){var date= {};module["exports"]=date;date.month=month;date.weekday=weekday});var mimeTypes=createCommonjsModule(function(module){module["exports"]={"application/1d-interleaved-parityfec":{"source":"iana"},"application/3gpdash-qoe-report+xml":{"source":"iana"},"application/3gpp-ims+xml":{"source":"iana"},"application/a2l":{"source":"iana"},"application/activemessage":{"source":"iana"},"application/alto-costmap+json":{"source":"iana","compressible":true},"application/alto-costmapfilter+json":{"source":"iana", "compressible":true},"application/alto-directory+json":{"source":"iana","compressible":true},"application/alto-endpointcost+json":{"source":"iana","compressible":true},"application/alto-endpointcostparams+json":{"source":"iana","compressible":true},"application/alto-endpointprop+json":{"source":"iana","compressible":true},"application/alto-endpointpropparams+json":{"source":"iana","compressible":true},"application/alto-error+json":{"source":"iana","compressible":true},"application/alto-networkmap+json":{"source":"iana", "compressible":true},"application/alto-networkmapfilter+json":{"source":"iana","compressible":true},"application/aml":{"source":"iana"},"application/andrew-inset":{"source":"iana","extensions":["ez"]},"application/applefile":{"source":"iana"},"application/applixware":{"source":"apache","extensions":["aw"]},"application/atf":{"source":"iana"},"application/atfx":{"source":"iana"},"application/atom+xml":{"source":"iana","compressible":true,"extensions":["atom"]},"application/atomcat+xml":{"source":"iana", "extensions":["atomcat"]},"application/atomdeleted+xml":{"source":"iana"},"application/atomicmail":{"source":"iana"},"application/atomsvc+xml":{"source":"iana","extensions":["atomsvc"]},"application/atxml":{"source":"iana"},"application/auth-policy+xml":{"source":"iana"},"application/bacnet-xdd+zip":{"source":"iana"},"application/batch-smtp":{"source":"iana"},"application/bdoc":{"compressible":false,"extensions":["bdoc"]},"application/beep+xml":{"source":"iana"},"application/calendar+json":{"source":"iana", "compressible":true},"application/calendar+xml":{"source":"iana"},"application/call-completion":{"source":"iana"},"application/cals-1840":{"source":"iana"},"application/cbor":{"source":"iana"},"application/ccmp+xml":{"source":"iana"},"application/ccxml+xml":{"source":"iana","extensions":["ccxml"]},"application/cdfx+xml":{"source":"iana"},"application/cdmi-capability":{"source":"iana","extensions":["cdmia"]},"application/cdmi-container":{"source":"iana","extensions":["cdmic"]},"application/cdmi-domain":{"source":"iana", "extensions":["cdmid"]},"application/cdmi-object":{"source":"iana","extensions":["cdmio"]},"application/cdmi-queue":{"source":"iana","extensions":["cdmiq"]},"application/cdni":{"source":"iana"},"application/cea":{"source":"iana"},"application/cea-2018+xml":{"source":"iana"},"application/cellml+xml":{"source":"iana"},"application/cfw":{"source":"iana"},"application/cms":{"source":"iana"},"application/cnrp+xml":{"source":"iana"},"application/coap-group+json":{"source":"iana","compressible":true},"application/commonground":{"source":"iana"}, "application/conference-info+xml":{"source":"iana"},"application/cpl+xml":{"source":"iana"},"application/csrattrs":{"source":"iana"},"application/csta+xml":{"source":"iana"},"application/cstadata+xml":{"source":"iana"},"application/csvm+json":{"source":"iana","compressible":true},"application/cu-seeme":{"source":"apache","extensions":["cu"]},"application/cybercash":{"source":"iana"},"application/dart":{"compressible":true},"application/dash+xml":{"source":"iana","extensions":["mdp"]},"application/dashdelta":{"source":"iana"}, "application/davmount+xml":{"source":"iana","extensions":["davmount"]},"application/dca-rft":{"source":"iana"},"application/dcd":{"source":"iana"},"application/dec-dx":{"source":"iana"},"application/dialog-info+xml":{"source":"iana"},"application/dicom":{"source":"iana"},"application/dii":{"source":"iana"},"application/dit":{"source":"iana"},"application/dns":{"source":"iana"},"application/docbook+xml":{"source":"apache","extensions":["dbk"]},"application/dskpp+xml":{"source":"iana"},"application/dssc+der":{"source":"iana", "extensions":["dssc"]},"application/dssc+xml":{"source":"iana","extensions":["xdssc"]},"application/dvcs":{"source":"iana"},"application/ecmascript":{"source":"iana","compressible":true,"extensions":["ecma"]},"application/edi-consent":{"source":"iana"},"application/edi-x12":{"source":"iana","compressible":false},"application/edifact":{"source":"iana","compressible":false},"application/emergencycalldata.comment+xml":{"source":"iana"},"application/emergencycalldata.deviceinfo+xml":{"source":"iana"}, "application/emergencycalldata.providerinfo+xml":{"source":"iana"},"application/emergencycalldata.serviceinfo+xml":{"source":"iana"},"application/emergencycalldata.subscriberinfo+xml":{"source":"iana"},"application/emma+xml":{"source":"iana","extensions":["emma"]},"application/emotionml+xml":{"source":"iana"},"application/encaprtp":{"source":"iana"},"application/epp+xml":{"source":"iana"},"application/epub+zip":{"source":"iana","extensions":["epub"]},"application/eshop":{"source":"iana"},"application/exi":{"source":"iana", "extensions":["exi"]},"application/fastinfoset":{"source":"iana"},"application/fastsoap":{"source":"iana"},"application/fdt+xml":{"source":"iana"},"application/fits":{"source":"iana"},"application/font-sfnt":{"source":"iana"},"application/font-tdpfr":{"source":"iana","extensions":["pfr"]},"application/font-woff":{"source":"iana","compressible":false,"extensions":["woff"]},"application/font-woff2":{"compressible":false,"extensions":["woff2"]},"application/framework-attributes+xml":{"source":"iana"}, "application/gml+xml":{"source":"apache","extensions":["gml"]},"application/gpx+xml":{"source":"apache","extensions":["gpx"]},"application/gxf":{"source":"apache","extensions":["gxf"]},"application/gzip":{"source":"iana","compressible":false},"application/h224":{"source":"iana"},"application/held+xml":{"source":"iana"},"application/http":{"source":"iana"},"application/hyperstudio":{"source":"iana","extensions":["stk"]},"application/ibe-key-request+xml":{"source":"iana"},"application/ibe-pkg-reply+xml":{"source":"iana"}, "application/ibe-pp-data":{"source":"iana"},"application/iges":{"source":"iana"},"application/im-iscomposing+xml":{"source":"iana"},"application/index":{"source":"iana"},"application/index.cmd":{"source":"iana"},"application/index.obj":{"source":"iana"},"application/index.response":{"source":"iana"},"application/index.vnd":{"source":"iana"},"application/inkml+xml":{"source":"iana","extensions":["ink","inkml"]},"application/iotp":{"source":"iana"},"application/ipfix":{"source":"iana","extensions":["ipfix"]}, "application/ipp":{"source":"iana"},"application/isup":{"source":"iana"},"application/its+xml":{"source":"iana"},"application/java-archive":{"source":"apache","compressible":false,"extensions":["jar","war","ear"]},"application/java-serialized-object":{"source":"apache","compressible":false,"extensions":["ser"]},"application/java-vm":{"source":"apache","compressible":false,"extensions":["class"]},"application/javascript":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["js"]},"application/jose":{"source":"iana"}, "application/jose+json":{"source":"iana","compressible":true},"application/jrd+json":{"source":"iana","compressible":true},"application/json":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["json","map"]},"application/json-patch+json":{"source":"iana","compressible":true},"application/json-seq":{"source":"iana"},"application/json5":{"extensions":["json5"]},"application/jsonml+json":{"source":"apache","compressible":true,"extensions":["jsonml"]},"application/jwk+json":{"source":"iana", "compressible":true},"application/jwk-set+json":{"source":"iana","compressible":true},"application/jwt":{"source":"iana"},"application/kpml-request+xml":{"source":"iana"},"application/kpml-response+xml":{"source":"iana"},"application/ld+json":{"source":"iana","compressible":true,"extensions":["jsonld"]},"application/link-format":{"source":"iana"},"application/load-control+xml":{"source":"iana"},"application/lost+xml":{"source":"iana","extensions":["lostxml"]},"application/lostsync+xml":{"source":"iana"}, "application/lxf":{"source":"iana"},"application/mac-binhex40":{"source":"iana","extensions":["hqx"]},"application/mac-compactpro":{"source":"apache","extensions":["cpt"]},"application/macwriteii":{"source":"iana"},"application/mads+xml":{"source":"iana","extensions":["mads"]},"application/manifest+json":{"charset":"UTF-8","compressible":true,"extensions":["webmanifest"]},"application/marc":{"source":"iana","extensions":["mrc"]},"application/marcxml+xml":{"source":"iana","extensions":["mrcx"]},"application/mathematica":{"source":"iana", "extensions":["ma","nb","mb"]},"application/mathml+xml":{"source":"iana","extensions":["mathml"]},"application/mathml-content+xml":{"source":"iana"},"application/mathml-presentation+xml":{"source":"iana"},"application/mbms-associated-procedure-description+xml":{"source":"iana"},"application/mbms-deregister+xml":{"source":"iana"},"application/mbms-envelope+xml":{"source":"iana"},"application/mbms-msk+xml":{"source":"iana"},"application/mbms-msk-response+xml":{"source":"iana"},"application/mbms-protection-description+xml":{"source":"iana"}, "application/mbms-reception-report+xml":{"source":"iana"},"application/mbms-register+xml":{"source":"iana"},"application/mbms-register-response+xml":{"source":"iana"},"application/mbms-schedule+xml":{"source":"iana"},"application/mbms-user-service-description+xml":{"source":"iana"},"application/mbox":{"source":"iana","extensions":["mbox"]},"application/media-policy-dataset+xml":{"source":"iana"},"application/media_control+xml":{"source":"iana"},"application/mediaservercontrol+xml":{"source":"iana", "extensions":["mscml"]},"application/merge-patch+json":{"source":"iana","compressible":true},"application/metalink+xml":{"source":"apache","extensions":["metalink"]},"application/metalink4+xml":{"source":"iana","extensions":["meta4"]},"application/mets+xml":{"source":"iana","extensions":["mets"]},"application/mf4":{"source":"iana"},"application/mikey":{"source":"iana"},"application/mods+xml":{"source":"iana","extensions":["mods"]},"application/moss-keys":{"source":"iana"},"application/moss-signature":{"source":"iana"}, "application/mosskey-data":{"source":"iana"},"application/mosskey-request":{"source":"iana"},"application/mp21":{"source":"iana","extensions":["m21","mp21"]},"application/mp4":{"source":"iana","extensions":["mp4s","m4p"]},"application/mpeg4-generic":{"source":"iana"},"application/mpeg4-iod":{"source":"iana"},"application/mpeg4-iod-xmt":{"source":"iana"},"application/mrb-consumer+xml":{"source":"iana"},"application/mrb-publish+xml":{"source":"iana"},"application/msc-ivr+xml":{"source":"iana"},"application/msc-mixer+xml":{"source":"iana"}, "application/msword":{"source":"iana","compressible":false,"extensions":["doc","dot"]},"application/mxf":{"source":"iana","extensions":["mxf"]},"application/nasdata":{"source":"iana"},"application/news-checkgroups":{"source":"iana"},"application/news-groupinfo":{"source":"iana"},"application/news-transmission":{"source":"iana"},"application/nlsml+xml":{"source":"iana"},"application/nss":{"source":"iana"},"application/ocsp-request":{"source":"iana"},"application/ocsp-response":{"source":"iana"},"application/octet-stream":{"source":"iana", "compressible":false,"extensions":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{"source":"iana","extensions":["oda"]},"application/odx":{"source":"iana"},"application/oebps-package+xml":{"source":"iana","extensions":["opf"]},"application/ogg":{"source":"iana","compressible":false,"extensions":["ogx"]},"application/omdoc+xml":{"source":"apache","extensions":["omdoc"]},"application/onenote":{"source":"apache", "extensions":["onetoc","onetoc2","onetmp","onepkg"]},"application/oxps":{"source":"iana","extensions":["oxps"]},"application/p2p-overlay+xml":{"source":"iana"},"application/parityfec":{"source":"iana"},"application/patch-ops-error+xml":{"source":"iana","extensions":["xer"]},"application/pdf":{"source":"iana","compressible":false,"extensions":["pdf"]},"application/pdx":{"source":"iana"},"application/pgp-encrypted":{"source":"iana","compressible":false,"extensions":["pgp"]},"application/pgp-keys":{"source":"iana"}, "application/pgp-signature":{"source":"iana","extensions":["asc","sig"]},"application/pics-rules":{"source":"apache","extensions":["prf"]},"application/pidf+xml":{"source":"iana"},"application/pidf-diff+xml":{"source":"iana"},"application/pkcs10":{"source":"iana","extensions":["p10"]},"application/pkcs12":{"source":"iana"},"application/pkcs7-mime":{"source":"iana","extensions":["p7m","p7c"]},"application/pkcs7-signature":{"source":"iana","extensions":["p7s"]},"application/pkcs8":{"source":"iana", "extensions":["p8"]},"application/pkix-attr-cert":{"source":"iana","extensions":["ac"]},"application/pkix-cert":{"source":"iana","extensions":["cer"]},"application/pkix-crl":{"source":"iana","extensions":["crl"]},"application/pkix-pkipath":{"source":"iana","extensions":["pkipath"]},"application/pkixcmp":{"source":"iana","extensions":["pki"]},"application/pls+xml":{"source":"iana","extensions":["pls"]},"application/poc-settings+xml":{"source":"iana"},"application/postscript":{"source":"iana","compressible":true, "extensions":["ai","eps","ps"]},"application/provenance+xml":{"source":"iana"},"application/prs.alvestrand.titrax-sheet":{"source":"iana"},"application/prs.cww":{"source":"iana","extensions":["cww"]},"application/prs.hpub+zip":{"source":"iana"},"application/prs.nprend":{"source":"iana"},"application/prs.plucker":{"source":"iana"},"application/prs.rdf-xml-crypt":{"source":"iana"},"application/prs.xsf+xml":{"source":"iana"},"application/pskc+xml":{"source":"iana","extensions":["pskcxml"]},"application/qsig":{"source":"iana"}, "application/raptorfec":{"source":"iana"},"application/rdap+json":{"source":"iana","compressible":true},"application/rdf+xml":{"source":"iana","compressible":true,"extensions":["rdf"]},"application/reginfo+xml":{"source":"iana","extensions":["rif"]},"application/relax-ng-compact-syntax":{"source":"iana","extensions":["rnc"]},"application/remote-printing":{"source":"iana"},"application/reputon+json":{"source":"iana","compressible":true},"application/resource-lists+xml":{"source":"iana","extensions":["rl"]}, "application/resource-lists-diff+xml":{"source":"iana","extensions":["rld"]},"application/rfc+xml":{"source":"iana"},"application/riscos":{"source":"iana"},"application/rlmi+xml":{"source":"iana"},"application/rls-services+xml":{"source":"iana","extensions":["rs"]},"application/rpki-ghostbusters":{"source":"iana","extensions":["gbr"]},"application/rpki-manifest":{"source":"iana","extensions":["mft"]},"application/rpki-roa":{"source":"iana","extensions":["roa"]},"application/rpki-updown":{"source":"iana"}, "application/rsd+xml":{"source":"apache","extensions":["rsd"]},"application/rss+xml":{"source":"apache","compressible":true,"extensions":["rss"]},"application/rtf":{"source":"iana","compressible":true,"extensions":["rtf"]},"application/rtploopback":{"source":"iana"},"application/rtx":{"source":"iana"},"application/samlassertion+xml":{"source":"iana"},"application/samlmetadata+xml":{"source":"iana"},"application/sbml+xml":{"source":"iana","extensions":["sbml"]},"application/scaip+xml":{"source":"iana"}, "application/scim+json":{"source":"iana","compressible":true},"application/scvp-cv-request":{"source":"iana","extensions":["scq"]},"application/scvp-cv-response":{"source":"iana","extensions":["scs"]},"application/scvp-vp-request":{"source":"iana","extensions":["spq"]},"application/scvp-vp-response":{"source":"iana","extensions":["spp"]},"application/sdp":{"source":"iana","extensions":["sdp"]},"application/sep+xml":{"source":"iana"},"application/sep-exi":{"source":"iana"},"application/session-info":{"source":"iana"}, "application/set-payment":{"source":"iana"},"application/set-payment-initiation":{"source":"iana","extensions":["setpay"]},"application/set-registration":{"source":"iana"},"application/set-registration-initiation":{"source":"iana","extensions":["setreg"]},"application/sgml":{"source":"iana"},"application/sgml-open-catalog":{"source":"iana"},"application/shf+xml":{"source":"iana","extensions":["shf"]},"application/sieve":{"source":"iana"},"application/simple-filter+xml":{"source":"iana"},"application/simple-message-summary":{"source":"iana"}, "application/simplesymbolcontainer":{"source":"iana"},"application/slate":{"source":"iana"},"application/smil":{"source":"iana"},"application/smil+xml":{"source":"iana","extensions":["smi","smil"]},"application/smpte336m":{"source":"iana"},"application/soap+fastinfoset":{"source":"iana"},"application/soap+xml":{"source":"iana","compressible":true},"application/sparql-query":{"source":"iana","extensions":["rq"]},"application/sparql-results+xml":{"source":"iana","extensions":["srx"]},"application/spirits-event+xml":{"source":"iana"}, "application/sql":{"source":"iana"},"application/srgs":{"source":"iana","extensions":["gram"]},"application/srgs+xml":{"source":"iana","extensions":["grxml"]},"application/sru+xml":{"source":"iana","extensions":["sru"]},"application/ssdl+xml":{"source":"apache","extensions":["ssdl"]},"application/ssml+xml":{"source":"iana","extensions":["ssml"]},"application/tamp-apex-update":{"source":"iana"},"application/tamp-apex-update-confirm":{"source":"iana"},"application/tamp-community-update":{"source":"iana"}, "application/tamp-community-update-confirm":{"source":"iana"},"application/tamp-error":{"source":"iana"},"application/tamp-sequence-adjust":{"source":"iana"},"application/tamp-sequence-adjust-confirm":{"source":"iana"},"application/tamp-status-query":{"source":"iana"},"application/tamp-status-response":{"source":"iana"},"application/tamp-update":{"source":"iana"},"application/tamp-update-confirm":{"source":"iana"},"application/tar":{"compressible":true},"application/tei+xml":{"source":"iana","extensions":["tei", "teicorpus"]},"application/thraud+xml":{"source":"iana","extensions":["tfi"]},"application/timestamp-query":{"source":"iana"},"application/timestamp-reply":{"source":"iana"},"application/timestamped-data":{"source":"iana","extensions":["tsd"]},"application/ttml+xml":{"source":"iana"},"application/tve-trigger":{"source":"iana"},"application/ulpfec":{"source":"iana"},"application/urc-grpsheet+xml":{"source":"iana"},"application/urc-ressheet+xml":{"source":"iana"},"application/urc-targetdesc+xml":{"source":"iana"}, "application/urc-uisocketdesc+xml":{"source":"iana"},"application/vcard+json":{"source":"iana","compressible":true},"application/vcard+xml":{"source":"iana"},"application/vemmi":{"source":"iana"},"application/vividence.scriptfile":{"source":"apache"},"application/vnd.3gpp-prose+xml":{"source":"iana"},"application/vnd.3gpp-prose-pc3ch+xml":{"source":"iana"},"application/vnd.3gpp.access-transfer-events+xml":{"source":"iana"},"application/vnd.3gpp.bsf+xml":{"source":"iana"},"application/vnd.3gpp.mid-call+xml":{"source":"iana"}, "application/vnd.3gpp.pic-bw-large":{"source":"iana","extensions":["plb"]},"application/vnd.3gpp.pic-bw-small":{"source":"iana","extensions":["psb"]},"application/vnd.3gpp.pic-bw-var":{"source":"iana","extensions":["pvb"]},"application/vnd.3gpp.sms":{"source":"iana"},"application/vnd.3gpp.srvcc-ext+xml":{"source":"iana"},"application/vnd.3gpp.srvcc-info+xml":{"source":"iana"},"application/vnd.3gpp.state-and-event-info+xml":{"source":"iana"},"application/vnd.3gpp.ussd+xml":{"source":"iana"},"application/vnd.3gpp2.bcmcsinfo+xml":{"source":"iana"}, "application/vnd.3gpp2.sms":{"source":"iana"},"application/vnd.3gpp2.tcap":{"source":"iana","extensions":["tcap"]},"application/vnd.3m.post-it-notes":{"source":"iana","extensions":["pwn"]},"application/vnd.accpac.simply.aso":{"source":"iana","extensions":["aso"]},"application/vnd.accpac.simply.imp":{"source":"iana","extensions":["imp"]},"application/vnd.acucobol":{"source":"iana","extensions":["acu"]},"application/vnd.acucorp":{"source":"iana","extensions":["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{"source":"apache", "extensions":["air"]},"application/vnd.adobe.flash.movie":{"source":"iana"},"application/vnd.adobe.formscentral.fcdt":{"source":"iana","extensions":["fcdt"]},"application/vnd.adobe.fxp":{"source":"iana","extensions":["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{"source":"iana"},"application/vnd.adobe.xdp+xml":{"source":"iana","extensions":["xdp"]},"application/vnd.adobe.xfdf":{"source":"iana","extensions":["xfdf"]},"application/vnd.aether.imp":{"source":"iana"},"application/vnd.ah-barcode":{"source":"iana"}, "application/vnd.ahead.space":{"source":"iana","extensions":["ahead"]},"application/vnd.airzip.filesecure.azf":{"source":"iana","extensions":["azf"]},"application/vnd.airzip.filesecure.azs":{"source":"iana","extensions":["azs"]},"application/vnd.amazon.ebook":{"source":"apache","extensions":["azw"]},"application/vnd.americandynamics.acc":{"source":"iana","extensions":["acc"]},"application/vnd.amiga.ami":{"source":"iana","extensions":["ami"]},"application/vnd.amundsen.maze+xml":{"source":"iana"},"application/vnd.android.package-archive":{"source":"apache", "compressible":false,"extensions":["apk"]},"application/vnd.anki":{"source":"iana"},"application/vnd.anser-web-certificate-issue-initiation":{"source":"iana","extensions":["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{"source":"apache","extensions":["fti"]},"application/vnd.antix.game-component":{"source":"iana","extensions":["atx"]},"application/vnd.apache.thrift.binary":{"source":"iana"},"application/vnd.apache.thrift.compact":{"source":"iana"},"application/vnd.apache.thrift.json":{"source":"iana"}, "application/vnd.api+json":{"source":"iana","compressible":true},"application/vnd.apple.installer+xml":{"source":"iana","extensions":["mpkg"]},"application/vnd.apple.mpegurl":{"source":"iana","extensions":["m3u8"]},"application/vnd.apple.pkpass":{"compressible":false,"extensions":["pkpass"]},"application/vnd.arastra.swi":{"source":"iana"},"application/vnd.aristanetworks.swi":{"source":"iana","extensions":["swi"]},"application/vnd.artsquare":{"source":"iana"},"application/vnd.astraea-software.iota":{"source":"iana", "extensions":["iota"]},"application/vnd.audiograph":{"source":"iana","extensions":["aep"]},"application/vnd.autopackage":{"source":"iana"},"application/vnd.avistar+xml":{"source":"iana"},"application/vnd.balsamiq.bmml+xml":{"source":"iana"},"application/vnd.balsamiq.bmpr":{"source":"iana"},"application/vnd.bekitzur-stech+json":{"source":"iana","compressible":true},"application/vnd.biopax.rdf+xml":{"source":"iana"},"application/vnd.blueice.multipass":{"source":"iana","extensions":["mpm"]},"application/vnd.bluetooth.ep.oob":{"source":"iana"}, "application/vnd.bluetooth.le.oob":{"source":"iana"},"application/vnd.bmi":{"source":"iana","extensions":["bmi"]},"application/vnd.businessobjects":{"source":"iana","extensions":["rep"]},"application/vnd.cab-jscript":{"source":"iana"},"application/vnd.canon-cpdl":{"source":"iana"},"application/vnd.canon-lips":{"source":"iana"},"application/vnd.cendio.thinlinc.clientconf":{"source":"iana"},"application/vnd.century-systems.tcp_stream":{"source":"iana"},"application/vnd.chemdraw+xml":{"source":"iana", "extensions":["cdxml"]},"application/vnd.chipnuts.karaoke-mmd":{"source":"iana","extensions":["mmd"]},"application/vnd.cinderella":{"source":"iana","extensions":["cdy"]},"application/vnd.cirpack.isdn-ext":{"source":"iana"},"application/vnd.citationstyles.style+xml":{"source":"iana"},"application/vnd.claymore":{"source":"iana","extensions":["cla"]},"application/vnd.cloanto.rp9":{"source":"iana","extensions":["rp9"]},"application/vnd.clonk.c4group":{"source":"iana","extensions":["c4g","c4d","c4f","c4p", "c4u"]},"application/vnd.cluetrust.cartomobile-config":{"source":"iana","extensions":["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{"source":"iana","extensions":["c11amz"]},"application/vnd.coffeescript":{"source":"iana"},"application/vnd.collection+json":{"source":"iana","compressible":true},"application/vnd.collection.doc+json":{"source":"iana","compressible":true},"application/vnd.collection.next+json":{"source":"iana","compressible":true},"application/vnd.commerce-battelle":{"source":"iana"}, "application/vnd.commonspace":{"source":"iana","extensions":["csp"]},"application/vnd.contact.cmsg":{"source":"iana","extensions":["cdbcmsg"]},"application/vnd.cosmocaller":{"source":"iana","extensions":["cmc"]},"application/vnd.crick.clicker":{"source":"iana","extensions":["clkx"]},"application/vnd.crick.clicker.keyboard":{"source":"iana","extensions":["clkk"]},"application/vnd.crick.clicker.palette":{"source":"iana","extensions":["clkp"]},"application/vnd.crick.clicker.template":{"source":"iana", "extensions":["clkt"]},"application/vnd.crick.clicker.wordbank":{"source":"iana","extensions":["clkw"]},"application/vnd.criticaltools.wbs+xml":{"source":"iana","extensions":["wbs"]},"application/vnd.ctc-posml":{"source":"iana","extensions":["pml"]},"application/vnd.ctct.ws+xml":{"source":"iana"},"application/vnd.cups-pdf":{"source":"iana"},"application/vnd.cups-postscript":{"source":"iana"},"application/vnd.cups-ppd":{"source":"iana","extensions":["ppd"]},"application/vnd.cups-raster":{"source":"iana"}, "application/vnd.cups-raw":{"source":"iana"},"application/vnd.curl":{"source":"iana"},"application/vnd.curl.car":{"source":"apache","extensions":["car"]},"application/vnd.curl.pcurl":{"source":"apache","extensions":["pcurl"]},"application/vnd.cyan.dean.root+xml":{"source":"iana"},"application/vnd.cybank":{"source":"iana"},"application/vnd.dart":{"source":"iana","compressible":true,"extensions":["dart"]},"application/vnd.data-vision.rdz":{"source":"iana","extensions":["rdz"]},"application/vnd.debian.binary-package":{"source":"iana"}, "application/vnd.dece.data":{"source":"iana","extensions":["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{"source":"iana","extensions":["uvt","uvvt"]},"application/vnd.dece.unspecified":{"source":"iana","extensions":["uvx","uvvx"]},"application/vnd.dece.zip":{"source":"iana","extensions":["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{"source":"iana","extensions":["fe_launch"]},"application/vnd.desmume-movie":{"source":"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{"source":"iana"}, "application/vnd.dm.delegation+xml":{"source":"iana"},"application/vnd.dna":{"source":"iana","extensions":["dna"]},"application/vnd.document+json":{"source":"iana","compressible":true},"application/vnd.dolby.mlp":{"source":"apache","extensions":["mlp"]},"application/vnd.dolby.mobile.1":{"source":"iana"},"application/vnd.dolby.mobile.2":{"source":"iana"},"application/vnd.doremir.scorecloud-binary-document":{"source":"iana"},"application/vnd.dpgraph":{"source":"iana","extensions":["dpg"]},"application/vnd.dreamfactory":{"source":"iana", "extensions":["dfac"]},"application/vnd.drive+json":{"source":"iana","compressible":true},"application/vnd.ds-keypoint":{"source":"apache","extensions":["kpxx"]},"application/vnd.dtg.local":{"source":"iana"},"application/vnd.dtg.local.flash":{"source":"iana"},"application/vnd.dtg.local.html":{"source":"iana"},"application/vnd.dvb.ait":{"source":"iana","extensions":["ait"]},"application/vnd.dvb.dvbj":{"source":"iana"},"application/vnd.dvb.esgcontainer":{"source":"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{"source":"iana"}, "application/vnd.dvb.ipdcesgaccess":{"source":"iana"},"application/vnd.dvb.ipdcesgaccess2":{"source":"iana"},"application/vnd.dvb.ipdcesgpdd":{"source":"iana"},"application/vnd.dvb.ipdcroaming":{"source":"iana"},"application/vnd.dvb.iptv.alfec-base":{"source":"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{"source":"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{"source":"iana"},"application/vnd.dvb.notif-container+xml":{"source":"iana"},"application/vnd.dvb.notif-generic+xml":{"source":"iana"}, "application/vnd.dvb.notif-ia-msglist+xml":{"source":"iana"},"application/vnd.dvb.notif-ia-registration-request+xml":{"source":"iana"},"application/vnd.dvb.notif-ia-registration-response+xml":{"source":"iana"},"application/vnd.dvb.notif-init+xml":{"source":"iana"},"application/vnd.dvb.pfr":{"source":"iana"},"application/vnd.dvb.service":{"source":"iana","extensions":["svc"]},"application/vnd.dxr":{"source":"iana"},"application/vnd.dynageo":{"source":"iana","extensions":["geo"]},"application/vnd.dzr":{"source":"iana"}, "application/vnd.easykaraoke.cdgdownload":{"source":"iana"},"application/vnd.ecdis-update":{"source":"iana"},"application/vnd.ecowin.chart":{"source":"iana","extensions":["mag"]},"application/vnd.ecowin.filerequest":{"source":"iana"},"application/vnd.ecowin.fileupdate":{"source":"iana"},"application/vnd.ecowin.series":{"source":"iana"},"application/vnd.ecowin.seriesrequest":{"source":"iana"},"application/vnd.ecowin.seriesupdate":{"source":"iana"},"application/vnd.emclient.accessrequest+xml":{"source":"iana"}, "application/vnd.enliven":{"source":"iana","extensions":["nml"]},"application/vnd.enphase.envoy":{"source":"iana"},"application/vnd.eprints.data+xml":{"source":"iana"},"application/vnd.epson.esf":{"source":"iana","extensions":["esf"]},"application/vnd.epson.msf":{"source":"iana","extensions":["msf"]},"application/vnd.epson.quickanime":{"source":"iana","extensions":["qam"]},"application/vnd.epson.salt":{"source":"iana","extensions":["slt"]},"application/vnd.epson.ssf":{"source":"iana","extensions":["ssf"]}, "application/vnd.ericsson.quickcall":{"source":"iana"},"application/vnd.eszigno3+xml":{"source":"iana","extensions":["es3","et3"]},"application/vnd.etsi.aoc+xml":{"source":"iana"},"application/vnd.etsi.asic-e+zip":{"source":"iana"},"application/vnd.etsi.asic-s+zip":{"source":"iana"},"application/vnd.etsi.cug+xml":{"source":"iana"},"application/vnd.etsi.iptvcommand+xml":{"source":"iana"},"application/vnd.etsi.iptvdiscovery+xml":{"source":"iana"},"application/vnd.etsi.iptvprofile+xml":{"source":"iana"}, "application/vnd.etsi.iptvsad-bc+xml":{"source":"iana"},"application/vnd.etsi.iptvsad-cod+xml":{"source":"iana"},"application/vnd.etsi.iptvsad-npvr+xml":{"source":"iana"},"application/vnd.etsi.iptvservice+xml":{"source":"iana"},"application/vnd.etsi.iptvsync+xml":{"source":"iana"},"application/vnd.etsi.iptvueprofile+xml":{"source":"iana"},"application/vnd.etsi.mcid+xml":{"source":"iana"},"application/vnd.etsi.mheg5":{"source":"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{"source":"iana"}, "application/vnd.etsi.pstn+xml":{"source":"iana"},"application/vnd.etsi.sci+xml":{"source":"iana"},"application/vnd.etsi.simservs+xml":{"source":"iana"},"application/vnd.etsi.timestamp-token":{"source":"iana"},"application/vnd.etsi.tsl+xml":{"source":"iana"},"application/vnd.etsi.tsl.der":{"source":"iana"},"application/vnd.eudora.data":{"source":"iana"},"application/vnd.ezpix-album":{"source":"iana","extensions":["ez2"]},"application/vnd.ezpix-package":{"source":"iana","extensions":["ez3"]},"application/vnd.f-secure.mobile":{"source":"iana"}, "application/vnd.fastcopy-disk-image":{"source":"iana"},"application/vnd.fdf":{"source":"iana","extensions":["fdf"]},"application/vnd.fdsn.mseed":{"source":"iana","extensions":["mseed"]},"application/vnd.fdsn.seed":{"source":"iana","extensions":["seed","dataless"]},"application/vnd.ffsns":{"source":"iana"},"application/vnd.filmit.zfc":{"source":"iana"},"application/vnd.fints":{"source":"iana"},"application/vnd.firemonkeys.cloudcell":{"source":"iana"},"application/vnd.flographit":{"source":"iana", "extensions":["gph"]},"application/vnd.fluxtime.clip":{"source":"iana","extensions":["ftc"]},"application/vnd.font-fontforge-sfd":{"source":"iana"},"application/vnd.framemaker":{"source":"iana","extensions":["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{"source":"iana","extensions":["fnc"]},"application/vnd.frogans.ltf":{"source":"iana","extensions":["ltf"]},"application/vnd.fsc.weblaunch":{"source":"iana","extensions":["fsc"]},"application/vnd.fujitsu.oasys":{"source":"iana","extensions":["oas"]}, "application/vnd.fujitsu.oasys2":{"source":"iana","extensions":["oa2"]},"application/vnd.fujitsu.oasys3":{"source":"iana","extensions":["oa3"]},"application/vnd.fujitsu.oasysgp":{"source":"iana","extensions":["fg5"]},"application/vnd.fujitsu.oasysprs":{"source":"iana","extensions":["bh2"]},"application/vnd.fujixerox.art-ex":{"source":"iana"},"application/vnd.fujixerox.art4":{"source":"iana"},"application/vnd.fujixerox.ddd":{"source":"iana","extensions":["ddd"]},"application/vnd.fujixerox.docuworks":{"source":"iana", "extensions":["xdw"]},"application/vnd.fujixerox.docuworks.binder":{"source":"iana","extensions":["xbd"]},"application/vnd.fujixerox.docuworks.container":{"source":"iana"},"application/vnd.fujixerox.hbpl":{"source":"iana"},"application/vnd.fut-misnet":{"source":"iana"},"application/vnd.fuzzysheet":{"source":"iana","extensions":["fzs"]},"application/vnd.genomatix.tuxedo":{"source":"iana","extensions":["txd"]},"application/vnd.geo+json":{"source":"iana","compressible":true},"application/vnd.geocube+xml":{"source":"iana"}, "application/vnd.geogebra.file":{"source":"iana","extensions":["ggb"]},"application/vnd.geogebra.tool":{"source":"iana","extensions":["ggt"]},"application/vnd.geometry-explorer":{"source":"iana","extensions":["gex","gre"]},"application/vnd.geonext":{"source":"iana","extensions":["gxt"]},"application/vnd.geoplan":{"source":"iana","extensions":["g2w"]},"application/vnd.geospace":{"source":"iana","extensions":["g3w"]},"application/vnd.gerber":{"source":"iana"},"application/vnd.globalplatform.card-content-mgt":{"source":"iana"}, "application/vnd.globalplatform.card-content-mgt-response":{"source":"iana"},"application/vnd.gmx":{"source":"iana","extensions":["gmx"]},"application/vnd.google-apps.document":{"compressible":false,"extensions":["gdoc"]},"application/vnd.google-apps.presentation":{"compressible":false,"extensions":["gslides"]},"application/vnd.google-apps.spreadsheet":{"compressible":false,"extensions":["gsheet"]},"application/vnd.google-earth.kml+xml":{"source":"iana","compressible":true,"extensions":["kml"]},"application/vnd.google-earth.kmz":{"source":"iana", "compressible":false,"extensions":["kmz"]},"application/vnd.gov.sk.e-form+xml":{"source":"iana"},"application/vnd.gov.sk.e-form+zip":{"source":"iana"},"application/vnd.gov.sk.xmldatacontainer+xml":{"source":"iana"},"application/vnd.grafeq":{"source":"iana","extensions":["gqf","gqs"]},"application/vnd.gridmp":{"source":"iana"},"application/vnd.groove-account":{"source":"iana","extensions":["gac"]},"application/vnd.groove-help":{"source":"iana","extensions":["ghf"]},"application/vnd.groove-identity-message":{"source":"iana", "extensions":["gim"]},"application/vnd.groove-injector":{"source":"iana","extensions":["grv"]},"application/vnd.groove-tool-message":{"source":"iana","extensions":["gtm"]},"application/vnd.groove-tool-template":{"source":"iana","extensions":["tpl"]},"application/vnd.groove-vcard":{"source":"iana","extensions":["vcg"]},"application/vnd.hal+json":{"source":"iana","compressible":true},"application/vnd.hal+xml":{"source":"iana","extensions":["hal"]},"application/vnd.handheld-entertainment+xml":{"source":"iana", "extensions":["zmm"]},"application/vnd.hbci":{"source":"iana","extensions":["hbci"]},"application/vnd.hcl-bireports":{"source":"iana"},"application/vnd.heroku+json":{"source":"iana","compressible":true},"application/vnd.hhe.lesson-player":{"source":"iana","extensions":["les"]},"application/vnd.hp-hpgl":{"source":"iana","extensions":["hpgl"]},"application/vnd.hp-hpid":{"source":"iana","extensions":["hpid"]},"application/vnd.hp-hps":{"source":"iana","extensions":["hps"]},"application/vnd.hp-jlyt":{"source":"iana", "extensions":["jlt"]},"application/vnd.hp-pcl":{"source":"iana","extensions":["pcl"]},"application/vnd.hp-pclxl":{"source":"iana","extensions":["pclxl"]},"application/vnd.httphone":{"source":"iana"},"application/vnd.hydrostatix.sof-data":{"source":"iana","extensions":["sfd-hdstx"]},"application/vnd.hyperdrive+json":{"source":"iana","compressible":true},"application/vnd.hzn-3d-crossword":{"source":"iana"},"application/vnd.ibm.afplinedata":{"source":"iana"},"application/vnd.ibm.electronic-media":{"source":"iana"}, "application/vnd.ibm.minipay":{"source":"iana","extensions":["mpy"]},"application/vnd.ibm.modcap":{"source":"iana","extensions":["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{"source":"iana","extensions":["irm"]},"application/vnd.ibm.secure-container":{"source":"iana","extensions":["sc"]},"application/vnd.iccprofile":{"source":"iana","extensions":["icc","icm"]},"application/vnd.ieee.1905":{"source":"iana"},"application/vnd.igloader":{"source":"iana","extensions":["igl"]},"application/vnd.immervision-ivp":{"source":"iana", "extensions":["ivp"]},"application/vnd.immervision-ivu":{"source":"iana","extensions":["ivu"]},"application/vnd.ims.imsccv1p1":{"source":"iana"},"application/vnd.ims.imsccv1p2":{"source":"iana"},"application/vnd.ims.imsccv1p3":{"source":"iana"},"application/vnd.ims.lis.v2.result+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolproxy+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolproxy.id+json":{"source":"iana", "compressible":true},"application/vnd.ims.lti.v2.toolsettings+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolsettings.simple+json":{"source":"iana","compressible":true},"application/vnd.informedcontrol.rms+xml":{"source":"iana"},"application/vnd.informix-visionary":{"source":"iana"},"application/vnd.infotech.project":{"source":"iana"},"application/vnd.infotech.project+xml":{"source":"iana"},"application/vnd.innopath.wamp.notification":{"source":"iana"},"application/vnd.insors.igm":{"source":"iana", "extensions":["igm"]},"application/vnd.intercon.formnet":{"source":"iana","extensions":["xpw","xpx"]},"application/vnd.intergeo":{"source":"iana","extensions":["i2g"]},"application/vnd.intertrust.digibox":{"source":"iana"},"application/vnd.intertrust.nncp":{"source":"iana"},"application/vnd.intu.qbo":{"source":"iana","extensions":["qbo"]},"application/vnd.intu.qfx":{"source":"iana","extensions":["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{"source":"iana"},"application/vnd.iptc.g2.conceptitem+xml":{"source":"iana"}, "application/vnd.iptc.g2.knowledgeitem+xml":{"source":"iana"},"application/vnd.iptc.g2.newsitem+xml":{"source":"iana"},"application/vnd.iptc.g2.newsmessage+xml":{"source":"iana"},"application/vnd.iptc.g2.packageitem+xml":{"source":"iana"},"application/vnd.iptc.g2.planningitem+xml":{"source":"iana"},"application/vnd.ipunplugged.rcprofile":{"source":"iana","extensions":["rcprofile"]},"application/vnd.irepository.package+xml":{"source":"iana","extensions":["irp"]},"application/vnd.is-xpr":{"source":"iana", "extensions":["xpr"]},"application/vnd.isac.fcs":{"source":"iana","extensions":["fcs"]},"application/vnd.jam":{"source":"iana","extensions":["jam"]},"application/vnd.japannet-directory-service":{"source":"iana"},"application/vnd.japannet-jpnstore-wakeup":{"source":"iana"},"application/vnd.japannet-payment-wakeup":{"source":"iana"},"application/vnd.japannet-registration":{"source":"iana"},"application/vnd.japannet-registration-wakeup":{"source":"iana"},"application/vnd.japannet-setstore-wakeup":{"source":"iana"}, "application/vnd.japannet-verification":{"source":"iana"},"application/vnd.japannet-verification-wakeup":{"source":"iana"},"application/vnd.jcp.javame.midlet-rms":{"source":"iana","extensions":["rms"]},"application/vnd.jisp":{"source":"iana","extensions":["jisp"]},"application/vnd.joost.joda-archive":{"source":"iana","extensions":["joda"]},"application/vnd.jsk.isdn-ngn":{"source":"iana"},"application/vnd.kahootz":{"source":"iana","extensions":["ktz","ktr"]},"application/vnd.kde.karbon":{"source":"iana", "extensions":["karbon"]},"application/vnd.kde.kchart":{"source":"iana","extensions":["chrt"]},"application/vnd.kde.kformula":{"source":"iana","extensions":["kfo"]},"application/vnd.kde.kivio":{"source":"iana","extensions":["flw"]},"application/vnd.kde.kontour":{"source":"iana","extensions":["kon"]},"application/vnd.kde.kpresenter":{"source":"iana","extensions":["kpr","kpt"]},"application/vnd.kde.kspread":{"source":"iana","extensions":["ksp"]},"application/vnd.kde.kword":{"source":"iana","extensions":["kwd", "kwt"]},"application/vnd.kenameaapp":{"source":"iana","extensions":["htke"]},"application/vnd.kidspiration":{"source":"iana","extensions":["kia"]},"application/vnd.kinar":{"source":"iana","extensions":["kne","knp"]},"application/vnd.koan":{"source":"iana","extensions":["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{"source":"iana","extensions":["sse"]},"application/vnd.las.las+xml":{"source":"iana","extensions":["lasxml"]},"application/vnd.liberty-request+xml":{"source":"iana"},"application/vnd.llamagraphics.life-balance.desktop":{"source":"iana", "extensions":["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{"source":"iana","extensions":["lbe"]},"application/vnd.lotus-1-2-3":{"source":"iana","extensions":["123"]},"application/vnd.lotus-approach":{"source":"iana","extensions":["apr"]},"application/vnd.lotus-freelance":{"source":"iana","extensions":["pre"]},"application/vnd.lotus-notes":{"source":"iana","extensions":["nsf"]},"application/vnd.lotus-organizer":{"source":"iana","extensions":["org"]},"application/vnd.lotus-screencam":{"source":"iana", "extensions":["scm"]},"application/vnd.lotus-wordpro":{"source":"iana","extensions":["lwp"]},"application/vnd.macports.portpkg":{"source":"iana","extensions":["portpkg"]},"application/vnd.mapbox-vector-tile":{"source":"iana"},"application/vnd.marlin.drm.actiontoken+xml":{"source":"iana"},"application/vnd.marlin.drm.conftoken+xml":{"source":"iana"},"application/vnd.marlin.drm.license+xml":{"source":"iana"},"application/vnd.marlin.drm.mdcf":{"source":"iana"},"application/vnd.mason+json":{"source":"iana", "compressible":true},"application/vnd.maxmind.maxmind-db":{"source":"iana"},"application/vnd.mcd":{"source":"iana","extensions":["mcd"]},"application/vnd.medcalcdata":{"source":"iana","extensions":["mc1"]},"application/vnd.mediastation.cdkey":{"source":"iana","extensions":["cdkey"]},"application/vnd.meridian-slingshot":{"source":"iana"},"application/vnd.mfer":{"source":"iana","extensions":["mwf"]},"application/vnd.mfmp":{"source":"iana","extensions":["mfm"]},"application/vnd.micro+json":{"source":"iana", "compressible":true},"application/vnd.micrografx.flo":{"source":"iana","extensions":["flo"]},"application/vnd.micrografx.igx":{"source":"iana","extensions":["igx"]},"application/vnd.microsoft.portable-executable":{"source":"iana"},"application/vnd.miele+json":{"source":"iana","compressible":true},"application/vnd.mif":{"source":"iana","extensions":["mif"]},"application/vnd.minisoft-hp3000-save":{"source":"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{"source":"iana"},"application/vnd.mobius.daf":{"source":"iana", "extensions":["daf"]},"application/vnd.mobius.dis":{"source":"iana","extensions":["dis"]},"application/vnd.mobius.mbk":{"source":"iana","extensions":["mbk"]},"application/vnd.mobius.mqy":{"source":"iana","extensions":["mqy"]},"application/vnd.mobius.msl":{"source":"iana","extensions":["msl"]},"application/vnd.mobius.plc":{"source":"iana","extensions":["plc"]},"application/vnd.mobius.txf":{"source":"iana","extensions":["txf"]},"application/vnd.mophun.application":{"source":"iana","extensions":["mpn"]}, "application/vnd.mophun.certificate":{"source":"iana","extensions":["mpc"]},"application/vnd.motorola.flexsuite":{"source":"iana"},"application/vnd.motorola.flexsuite.adsi":{"source":"iana"},"application/vnd.motorola.flexsuite.fis":{"source":"iana"},"application/vnd.motorola.flexsuite.gotap":{"source":"iana"},"application/vnd.motorola.flexsuite.kmr":{"source":"iana"},"application/vnd.motorola.flexsuite.ttc":{"source":"iana"},"application/vnd.motorola.flexsuite.wem":{"source":"iana"},"application/vnd.motorola.iprm":{"source":"iana"}, "application/vnd.mozilla.xul+xml":{"source":"iana","compressible":true,"extensions":["xul"]},"application/vnd.ms-3mfdocument":{"source":"iana"},"application/vnd.ms-artgalry":{"source":"iana","extensions":["cil"]},"application/vnd.ms-asf":{"source":"iana"},"application/vnd.ms-cab-compressed":{"source":"iana","extensions":["cab"]},"application/vnd.ms-color.iccprofile":{"source":"apache"},"application/vnd.ms-excel":{"source":"iana","compressible":false,"extensions":["xls","xlm","xla","xlc","xlt","xlw"]}, "application/vnd.ms-excel.addin.macroenabled.12":{"source":"iana","extensions":["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{"source":"iana","extensions":["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{"source":"iana","extensions":["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{"source":"iana","extensions":["xltm"]},"application/vnd.ms-fontobject":{"source":"iana","compressible":true,"extensions":["eot"]},"application/vnd.ms-htmlhelp":{"source":"iana", "extensions":["chm"]},"application/vnd.ms-ims":{"source":"iana","extensions":["ims"]},"application/vnd.ms-lrm":{"source":"iana","extensions":["lrm"]},"application/vnd.ms-office.activex+xml":{"source":"iana"},"application/vnd.ms-officetheme":{"source":"iana","extensions":["thmx"]},"application/vnd.ms-opentype":{"source":"apache","compressible":true},"application/vnd.ms-package.obfuscated-opentype":{"source":"apache"},"application/vnd.ms-pki.seccat":{"source":"apache","extensions":["cat"]},"application/vnd.ms-pki.stl":{"source":"apache", "extensions":["stl"]},"application/vnd.ms-playready.initiator+xml":{"source":"iana"},"application/vnd.ms-powerpoint":{"source":"iana","compressible":false,"extensions":["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{"source":"iana","extensions":["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{"source":"iana","extensions":["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{"source":"iana","extensions":["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{"source":"iana", "extensions":["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{"source":"iana","extensions":["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{"source":"iana"},"application/vnd.ms-printing.printticket+xml":{"source":"apache"},"application/vnd.ms-project":{"source":"iana","extensions":["mpp","mpt"]},"application/vnd.ms-tnef":{"source":"iana"},"application/vnd.ms-windows.devicepairing":{"source":"iana"},"application/vnd.ms-windows.nwprinting.oob":{"source":"iana"},"application/vnd.ms-windows.printerpairing":{"source":"iana"}, "application/vnd.ms-windows.wsd.oob":{"source":"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{"source":"iana"},"application/vnd.ms-wmdrm.lic-resp":{"source":"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{"source":"iana"},"application/vnd.ms-wmdrm.meter-resp":{"source":"iana"},"application/vnd.ms-word.document.macroenabled.12":{"source":"iana","extensions":["docm"]},"application/vnd.ms-word.template.macroenabled.12":{"source":"iana","extensions":["dotm"]},"application/vnd.ms-works":{"source":"iana", "extensions":["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{"source":"iana","extensions":["wpl"]},"application/vnd.ms-xpsdocument":{"source":"iana","compressible":false,"extensions":["xps"]},"application/vnd.msa-disk-image":{"source":"iana"},"application/vnd.mseq":{"source":"iana","extensions":["mseq"]},"application/vnd.msign":{"source":"iana"},"application/vnd.multiad.creator":{"source":"iana"},"application/vnd.multiad.creator.cif":{"source":"iana"},"application/vnd.music-niff":{"source":"iana"}, "application/vnd.musician":{"source":"iana","extensions":["mus"]},"application/vnd.muvee.style":{"source":"iana","extensions":["msty"]},"application/vnd.mynfc":{"source":"iana","extensions":["taglet"]},"application/vnd.ncd.control":{"source":"iana"},"application/vnd.ncd.reference":{"source":"iana"},"application/vnd.nervana":{"source":"iana"},"application/vnd.netfpx":{"source":"iana"},"application/vnd.neurolanguage.nlu":{"source":"iana","extensions":["nlu"]},"application/vnd.nintendo.nitro.rom":{"source":"iana"}, "application/vnd.nintendo.snes.rom":{"source":"iana"},"application/vnd.nitf":{"source":"iana","extensions":["ntf","nitf"]},"application/vnd.noblenet-directory":{"source":"iana","extensions":["nnd"]},"application/vnd.noblenet-sealer":{"source":"iana","extensions":["nns"]},"application/vnd.noblenet-web":{"source":"iana","extensions":["nnw"]},"application/vnd.nokia.catalogs":{"source":"iana"},"application/vnd.nokia.conml+wbxml":{"source":"iana"},"application/vnd.nokia.conml+xml":{"source":"iana"},"application/vnd.nokia.iptv.config+xml":{"source":"iana"}, "application/vnd.nokia.isds-radio-presets":{"source":"iana"},"application/vnd.nokia.landmark+wbxml":{"source":"iana"},"application/vnd.nokia.landmark+xml":{"source":"iana"},"application/vnd.nokia.landmarkcollection+xml":{"source":"iana"},"application/vnd.nokia.n-gage.ac+xml":{"source":"iana"},"application/vnd.nokia.n-gage.data":{"source":"iana","extensions":["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{"source":"iana","extensions":["n-gage"]},"application/vnd.nokia.ncd":{"source":"iana"}, "application/vnd.nokia.pcd+wbxml":{"source":"iana"},"application/vnd.nokia.pcd+xml":{"source":"iana"},"application/vnd.nokia.radio-preset":{"source":"iana","extensions":["rpst"]},"application/vnd.nokia.radio-presets":{"source":"iana","extensions":["rpss"]},"application/vnd.novadigm.edm":{"source":"iana","extensions":["edm"]},"application/vnd.novadigm.edx":{"source":"iana","extensions":["edx"]},"application/vnd.novadigm.ext":{"source":"iana","extensions":["ext"]},"application/vnd.ntt-local.content-share":{"source":"iana"}, "application/vnd.ntt-local.file-transfer":{"source":"iana"},"application/vnd.ntt-local.ogw_remote-access":{"source":"iana"},"application/vnd.ntt-local.sip-ta_remote":{"source":"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{"source":"iana"},"application/vnd.oasis.opendocument.chart":{"source":"iana","extensions":["odc"]},"application/vnd.oasis.opendocument.chart-template":{"source":"iana","extensions":["otc"]},"application/vnd.oasis.opendocument.database":{"source":"iana","extensions":["odb"]}, "application/vnd.oasis.opendocument.formula":{"source":"iana","extensions":["odf"]},"application/vnd.oasis.opendocument.formula-template":{"source":"iana","extensions":["odft"]},"application/vnd.oasis.opendocument.graphics":{"source":"iana","compressible":false,"extensions":["odg"]},"application/vnd.oasis.opendocument.graphics-template":{"source":"iana","extensions":["otg"]},"application/vnd.oasis.opendocument.image":{"source":"iana","extensions":["odi"]},"application/vnd.oasis.opendocument.image-template":{"source":"iana", "extensions":["oti"]},"application/vnd.oasis.opendocument.presentation":{"source":"iana","compressible":false,"extensions":["odp"]},"application/vnd.oasis.opendocument.presentation-template":{"source":"iana","extensions":["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{"source":"iana","compressible":false,"extensions":["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{"source":"iana","extensions":["ots"]},"application/vnd.oasis.opendocument.text":{"source":"iana","compressible":false, "extensions":["odt"]},"application/vnd.oasis.opendocument.text-master":{"source":"iana","extensions":["odm"]},"application/vnd.oasis.opendocument.text-template":{"source":"iana","extensions":["ott"]},"application/vnd.oasis.opendocument.text-web":{"source":"iana","extensions":["oth"]},"application/vnd.obn":{"source":"iana"},"application/vnd.oftn.l10n+json":{"source":"iana","compressible":true},"application/vnd.oipf.contentaccessdownload+xml":{"source":"iana"},"application/vnd.oipf.contentaccessstreaming+xml":{"source":"iana"}, "application/vnd.oipf.cspg-hexbinary":{"source":"iana"},"application/vnd.oipf.dae.svg+xml":{"source":"iana"},"application/vnd.oipf.dae.xhtml+xml":{"source":"iana"},"application/vnd.oipf.mippvcontrolmessage+xml":{"source":"iana"},"application/vnd.oipf.pae.gem":{"source":"iana"},"application/vnd.oipf.spdiscovery+xml":{"source":"iana"},"application/vnd.oipf.spdlist+xml":{"source":"iana"},"application/vnd.oipf.ueprofile+xml":{"source":"iana"},"application/vnd.oipf.userprofile+xml":{"source":"iana"},"application/vnd.olpc-sugar":{"source":"iana", "extensions":["xo"]},"application/vnd.oma-scws-config":{"source":"iana"},"application/vnd.oma-scws-http-request":{"source":"iana"},"application/vnd.oma-scws-http-response":{"source":"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{"source":"iana"},"application/vnd.oma.bcast.drm-trigger+xml":{"source":"iana"},"application/vnd.oma.bcast.imd+xml":{"source":"iana"},"application/vnd.oma.bcast.ltkm":{"source":"iana"},"application/vnd.oma.bcast.notification+xml":{"source":"iana"}, "application/vnd.oma.bcast.provisioningtrigger":{"source":"iana"},"application/vnd.oma.bcast.sgboot":{"source":"iana"},"application/vnd.oma.bcast.sgdd+xml":{"source":"iana"},"application/vnd.oma.bcast.sgdu":{"source":"iana"},"application/vnd.oma.bcast.simple-symbol-container":{"source":"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{"source":"iana"},"application/vnd.oma.bcast.sprov+xml":{"source":"iana"},"application/vnd.oma.bcast.stkm":{"source":"iana"},"application/vnd.oma.cab-address-book+xml":{"source":"iana"}, "application/vnd.oma.cab-feature-handler+xml":{"source":"iana"},"application/vnd.oma.cab-pcc+xml":{"source":"iana"},"application/vnd.oma.cab-subs-invite+xml":{"source":"iana"},"application/vnd.oma.cab-user-prefs+xml":{"source":"iana"},"application/vnd.oma.dcd":{"source":"iana"},"application/vnd.oma.dcdc":{"source":"iana"},"application/vnd.oma.dd2+xml":{"source":"iana","extensions":["dd2"]},"application/vnd.oma.drm.risd+xml":{"source":"iana"},"application/vnd.oma.group-usage-list+xml":{"source":"iana"}, "application/vnd.oma.pal+xml":{"source":"iana"},"application/vnd.oma.poc.detailed-progress-report+xml":{"source":"iana"},"application/vnd.oma.poc.final-report+xml":{"source":"iana"},"application/vnd.oma.poc.groups+xml":{"source":"iana"},"application/vnd.oma.poc.invocation-descriptor+xml":{"source":"iana"},"application/vnd.oma.poc.optimized-progress-report+xml":{"source":"iana"},"application/vnd.oma.push":{"source":"iana"},"application/vnd.oma.scidm.messages+xml":{"source":"iana"},"application/vnd.oma.xcap-directory+xml":{"source":"iana"}, "application/vnd.omads-email+xml":{"source":"iana"},"application/vnd.omads-file+xml":{"source":"iana"},"application/vnd.omads-folder+xml":{"source":"iana"},"application/vnd.omaloc-supl-init":{"source":"iana"},"application/vnd.openblox.game+xml":{"source":"iana"},"application/vnd.openblox.game-binary":{"source":"iana"},"application/vnd.openeye.oeb":{"source":"iana"},"application/vnd.openofficeorg.extension":{"source":"apache","extensions":["oxt"]},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{"source":"iana"}, "application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.drawing+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{"source":"iana"}, "application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.presentationml-template":{"source":"iana"},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{"source":"iana"}, "application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{"source":"iana","compressible":false,"extensions":["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{"source":"iana"}, "application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.presentationml.slide":{"source":"iana","extensions":["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{"source":"iana", "extensions":["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.presentationml.template":{"source":"apache", "extensions":["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml-template":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{"source":"iana"}, "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{"source":"iana"}, "application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"source":"iana","compressible":false,"extensions":["xlsx"]}, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{"source":"apache", "extensions":["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.theme+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{"source":"iana"}, "application/vnd.openxmlformats-officedocument.vmldrawing":{"source":"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml-template":{"source":"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{"source":"iana","compressible":false,"extensions":["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{"source":"iana"}, "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{"source":"iana"}, "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{"source":"apache","extensions":["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{"source":"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{"source":"iana"}, "application/vnd.openxmlformats-package.core-properties+xml":{"source":"iana"},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{"source":"iana"},"application/vnd.openxmlformats-package.relationships+xml":{"source":"iana"},"application/vnd.oracle.resource+json":{"source":"iana","compressible":true},"application/vnd.orange.indata":{"source":"iana"},"application/vnd.osa.netdeploy":{"source":"iana"},"application/vnd.osgeo.mapguide.package":{"source":"iana","extensions":["mgp"]}, "application/vnd.osgi.bundle":{"source":"iana"},"application/vnd.osgi.dp":{"source":"iana","extensions":["dp"]},"application/vnd.osgi.subsystem":{"source":"iana","extensions":["esa"]},"application/vnd.otps.ct-kip+xml":{"source":"iana"},"application/vnd.oxli.countgraph":{"source":"iana"},"application/vnd.pagerduty+json":{"source":"iana","compressible":true},"application/vnd.palm":{"source":"iana","extensions":["pdb","pqa","oprc"]},"application/vnd.panoply":{"source":"iana"},"application/vnd.paos+xml":{"source":"iana"}, "application/vnd.paos.xml":{"source":"apache"},"application/vnd.pawaafile":{"source":"iana","extensions":["paw"]},"application/vnd.pcos":{"source":"iana"},"application/vnd.pg.format":{"source":"iana","extensions":["str"]},"application/vnd.pg.osasli":{"source":"iana","extensions":["ei6"]},"application/vnd.piaccess.application-licence":{"source":"iana"},"application/vnd.picsel":{"source":"iana","extensions":["efif"]},"application/vnd.pmi.widget":{"source":"iana","extensions":["wg"]},"application/vnd.poc.group-advertisement+xml":{"source":"iana"}, "application/vnd.pocketlearn":{"source":"iana","extensions":["plf"]},"application/vnd.powerbuilder6":{"source":"iana","extensions":["pbd"]},"application/vnd.powerbuilder6-s":{"source":"iana"},"application/vnd.powerbuilder7":{"source":"iana"},"application/vnd.powerbuilder7-s":{"source":"iana"},"application/vnd.powerbuilder75":{"source":"iana"},"application/vnd.powerbuilder75-s":{"source":"iana"},"application/vnd.preminet":{"source":"iana"},"application/vnd.previewsystems.box":{"source":"iana","extensions":["box"]}, "application/vnd.proteus.magazine":{"source":"iana","extensions":["mgz"]},"application/vnd.publishare-delta-tree":{"source":"iana","extensions":["qps"]},"application/vnd.pvi.ptid1":{"source":"iana","extensions":["ptid"]},"application/vnd.pwg-multiplexed":{"source":"iana"},"application/vnd.pwg-xhtml-print+xml":{"source":"iana"},"application/vnd.qualcomm.brew-app-res":{"source":"iana"},"application/vnd.quark.quarkxpress":{"source":"iana","extensions":["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{"source":"iana"}, "application/vnd.radisys.moml+xml":{"source":"iana"},"application/vnd.radisys.msml+xml":{"source":"iana"},"application/vnd.radisys.msml-audit+xml":{"source":"iana"},"application/vnd.radisys.msml-audit-conf+xml":{"source":"iana"},"application/vnd.radisys.msml-audit-conn+xml":{"source":"iana"},"application/vnd.radisys.msml-audit-dialog+xml":{"source":"iana"},"application/vnd.radisys.msml-audit-stream+xml":{"source":"iana"},"application/vnd.radisys.msml-conf+xml":{"source":"iana"},"application/vnd.radisys.msml-dialog+xml":{"source":"iana"}, "application/vnd.radisys.msml-dialog-base+xml":{"source":"iana"},"application/vnd.radisys.msml-dialog-fax-detect+xml":{"source":"iana"},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{"source":"iana"},"application/vnd.radisys.msml-dialog-group+xml":{"source":"iana"},"application/vnd.radisys.msml-dialog-speech+xml":{"source":"iana"},"application/vnd.radisys.msml-dialog-transform+xml":{"source":"iana"},"application/vnd.rainstor.data":{"source":"iana"},"application/vnd.rapid":{"source":"iana"}, "application/vnd.realvnc.bed":{"source":"iana","extensions":["bed"]},"application/vnd.recordare.musicxml":{"source":"iana","extensions":["mxl"]},"application/vnd.recordare.musicxml+xml":{"source":"iana","extensions":["musicxml"]},"application/vnd.renlearn.rlprint":{"source":"iana"},"application/vnd.rig.cryptonote":{"source":"iana","extensions":["cryptonote"]},"application/vnd.rim.cod":{"source":"apache","extensions":["cod"]},"application/vnd.rn-realmedia":{"source":"apache","extensions":["rm"]},"application/vnd.rn-realmedia-vbr":{"source":"apache", "extensions":["rmvb"]},"application/vnd.route66.link66+xml":{"source":"iana","extensions":["link66"]},"application/vnd.rs-274x":{"source":"iana"},"application/vnd.ruckus.download":{"source":"iana"},"application/vnd.s3sms":{"source":"iana"},"application/vnd.sailingtracker.track":{"source":"iana","extensions":["st"]},"application/vnd.sbm.cid":{"source":"iana"},"application/vnd.sbm.mid2":{"source":"iana"},"application/vnd.scribus":{"source":"iana"},"application/vnd.sealed.3df":{"source":"iana"},"application/vnd.sealed.csf":{"source":"iana"}, "application/vnd.sealed.doc":{"source":"iana"},"application/vnd.sealed.eml":{"source":"iana"},"application/vnd.sealed.mht":{"source":"iana"},"application/vnd.sealed.net":{"source":"iana"},"application/vnd.sealed.ppt":{"source":"iana"},"application/vnd.sealed.tiff":{"source":"iana"},"application/vnd.sealed.xls":{"source":"iana"},"application/vnd.sealedmedia.softseal.html":{"source":"iana"},"application/vnd.sealedmedia.softseal.pdf":{"source":"iana"},"application/vnd.seemail":{"source":"iana","extensions":["see"]}, "application/vnd.sema":{"source":"iana","extensions":["sema"]},"application/vnd.semd":{"source":"iana","extensions":["semd"]},"application/vnd.semf":{"source":"iana","extensions":["semf"]},"application/vnd.shana.informed.formdata":{"source":"iana","extensions":["ifm"]},"application/vnd.shana.informed.formtemplate":{"source":"iana","extensions":["itp"]},"application/vnd.shana.informed.interchange":{"source":"iana","extensions":["iif"]},"application/vnd.shana.informed.package":{"source":"iana","extensions":["ipk"]}, "application/vnd.simtech-mindmapper":{"source":"iana","extensions":["twd","twds"]},"application/vnd.siren+json":{"source":"iana","compressible":true},"application/vnd.smaf":{"source":"iana","extensions":["mmf"]},"application/vnd.smart.notebook":{"source":"iana"},"application/vnd.smart.teacher":{"source":"iana","extensions":["teacher"]},"application/vnd.software602.filler.form+xml":{"source":"iana"},"application/vnd.software602.filler.form-xml-zip":{"source":"iana"},"application/vnd.solent.sdkm+xml":{"source":"iana", "extensions":["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{"source":"iana","extensions":["dxp"]},"application/vnd.spotfire.sfs":{"source":"iana","extensions":["sfs"]},"application/vnd.sss-cod":{"source":"iana"},"application/vnd.sss-dtf":{"source":"iana"},"application/vnd.sss-ntf":{"source":"iana"},"application/vnd.stardivision.calc":{"source":"apache","extensions":["sdc"]},"application/vnd.stardivision.draw":{"source":"apache","extensions":["sda"]},"application/vnd.stardivision.impress":{"source":"apache", "extensions":["sdd"]},"application/vnd.stardivision.math":{"source":"apache","extensions":["smf"]},"application/vnd.stardivision.writer":{"source":"apache","extensions":["sdw","vor"]},"application/vnd.stardivision.writer-global":{"source":"apache","extensions":["sgl"]},"application/vnd.stepmania.package":{"source":"iana","extensions":["smzip"]},"application/vnd.stepmania.stepchart":{"source":"iana","extensions":["sm"]},"application/vnd.street-stream":{"source":"iana"},"application/vnd.sun.wadl+xml":{"source":"iana"}, "application/vnd.sun.xml.calc":{"source":"apache","extensions":["sxc"]},"application/vnd.sun.xml.calc.template":{"source":"apache","extensions":["stc"]},"application/vnd.sun.xml.draw":{"source":"apache","extensions":["sxd"]},"application/vnd.sun.xml.draw.template":{"source":"apache","extensions":["std"]},"application/vnd.sun.xml.impress":{"source":"apache","extensions":["sxi"]},"application/vnd.sun.xml.impress.template":{"source":"apache","extensions":["sti"]},"application/vnd.sun.xml.math":{"source":"apache", "extensions":["sxm"]},"application/vnd.sun.xml.writer":{"source":"apache","extensions":["sxw"]},"application/vnd.sun.xml.writer.global":{"source":"apache","extensions":["sxg"]},"application/vnd.sun.xml.writer.template":{"source":"apache","extensions":["stw"]},"application/vnd.sus-calendar":{"source":"iana","extensions":["sus","susp"]},"application/vnd.svd":{"source":"iana","extensions":["svd"]},"application/vnd.swiftview-ics":{"source":"iana"},"application/vnd.symbian.install":{"source":"apache", "extensions":["sis","sisx"]},"application/vnd.syncml+xml":{"source":"iana","extensions":["xsm"]},"application/vnd.syncml.dm+wbxml":{"source":"iana","extensions":["bdm"]},"application/vnd.syncml.dm+xml":{"source":"iana","extensions":["xdm"]},"application/vnd.syncml.dm.notification":{"source":"iana"},"application/vnd.syncml.dmddf+wbxml":{"source":"iana"},"application/vnd.syncml.dmddf+xml":{"source":"iana"},"application/vnd.syncml.dmtnds+wbxml":{"source":"iana"},"application/vnd.syncml.dmtnds+xml":{"source":"iana"}, "application/vnd.syncml.ds.notification":{"source":"iana"},"application/vnd.tao.intent-module-archive":{"source":"iana","extensions":["tao"]},"application/vnd.tcpdump.pcap":{"source":"iana","extensions":["pcap","cap","dmp"]},"application/vnd.tmd.mediaflex.api+xml":{"source":"iana"},"application/vnd.tml":{"source":"iana"},"application/vnd.tmobile-livetv":{"source":"iana","extensions":["tmo"]},"application/vnd.trid.tpt":{"source":"iana","extensions":["tpt"]},"application/vnd.triscape.mxs":{"source":"iana", "extensions":["mxs"]},"application/vnd.trueapp":{"source":"iana","extensions":["tra"]},"application/vnd.truedoc":{"source":"iana"},"application/vnd.ubisoft.webplayer":{"source":"iana"},"application/vnd.ufdl":{"source":"iana","extensions":["ufd","ufdl"]},"application/vnd.uiq.theme":{"source":"iana","extensions":["utz"]},"application/vnd.umajin":{"source":"iana","extensions":["umj"]},"application/vnd.unity":{"source":"iana","extensions":["unityweb"]},"application/vnd.uoml+xml":{"source":"iana","extensions":["uoml"]}, "application/vnd.uplanet.alert":{"source":"iana"},"application/vnd.uplanet.alert-wbxml":{"source":"iana"},"application/vnd.uplanet.bearer-choice":{"source":"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{"source":"iana"},"application/vnd.uplanet.cacheop":{"source":"iana"},"application/vnd.uplanet.cacheop-wbxml":{"source":"iana"},"application/vnd.uplanet.channel":{"source":"iana"},"application/vnd.uplanet.channel-wbxml":{"source":"iana"},"application/vnd.uplanet.list":{"source":"iana"},"application/vnd.uplanet.list-wbxml":{"source":"iana"}, "application/vnd.uplanet.listcmd":{"source":"iana"},"application/vnd.uplanet.listcmd-wbxml":{"source":"iana"},"application/vnd.uplanet.signal":{"source":"iana"},"application/vnd.uri-map":{"source":"iana"},"application/vnd.valve.source.material":{"source":"iana"},"application/vnd.vcx":{"source":"iana","extensions":["vcx"]},"application/vnd.vd-study":{"source":"iana"},"application/vnd.vectorworks":{"source":"iana"},"application/vnd.verimatrix.vcas":{"source":"iana"},"application/vnd.vidsoft.vidconference":{"source":"iana"}, "application/vnd.visio":{"source":"iana","extensions":["vsd","vst","vss","vsw"]},"application/vnd.visionary":{"source":"iana","extensions":["vis"]},"application/vnd.vividence.scriptfile":{"source":"iana"},"application/vnd.vsf":{"source":"iana","extensions":["vsf"]},"application/vnd.wap.sic":{"source":"iana"},"application/vnd.wap.slc":{"source":"iana"},"application/vnd.wap.wbxml":{"source":"iana","extensions":["wbxml"]},"application/vnd.wap.wmlc":{"source":"iana","extensions":["wmlc"]},"application/vnd.wap.wmlscriptc":{"source":"iana", "extensions":["wmlsc"]},"application/vnd.webturbo":{"source":"iana","extensions":["wtb"]},"application/vnd.wfa.p2p":{"source":"iana"},"application/vnd.wfa.wsc":{"source":"iana"},"application/vnd.windows.devicepairing":{"source":"iana"},"application/vnd.wmc":{"source":"iana"},"application/vnd.wmf.bootstrap":{"source":"iana"},"application/vnd.wolfram.mathematica":{"source":"iana"},"application/vnd.wolfram.mathematica.package":{"source":"iana"},"application/vnd.wolfram.player":{"source":"iana","extensions":["nbp"]}, "application/vnd.wordperfect":{"source":"iana","extensions":["wpd"]},"application/vnd.wqd":{"source":"iana","extensions":["wqd"]},"application/vnd.wrq-hp3000-labelled":{"source":"iana"},"application/vnd.wt.stf":{"source":"iana","extensions":["stf"]},"application/vnd.wv.csp+wbxml":{"source":"iana"},"application/vnd.wv.csp+xml":{"source":"iana"},"application/vnd.wv.ssp+xml":{"source":"iana"},"application/vnd.xacml+json":{"source":"iana","compressible":true},"application/vnd.xara":{"source":"iana","extensions":["xar"]}, "application/vnd.xfdl":{"source":"iana","extensions":["xfdl"]},"application/vnd.xfdl.webform":{"source":"iana"},"application/vnd.xmi+xml":{"source":"iana"},"application/vnd.xmpie.cpkg":{"source":"iana"},"application/vnd.xmpie.dpkg":{"source":"iana"},"application/vnd.xmpie.plan":{"source":"iana"},"application/vnd.xmpie.ppkg":{"source":"iana"},"application/vnd.xmpie.xlim":{"source":"iana"},"application/vnd.yamaha.hv-dic":{"source":"iana","extensions":["hvd"]},"application/vnd.yamaha.hv-script":{"source":"iana", "extensions":["hvs"]},"application/vnd.yamaha.hv-voice":{"source":"iana","extensions":["hvp"]},"application/vnd.yamaha.openscoreformat":{"source":"iana","extensions":["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{"source":"iana","extensions":["osfpvg"]},"application/vnd.yamaha.remote-setup":{"source":"iana"},"application/vnd.yamaha.smaf-audio":{"source":"iana","extensions":["saf"]},"application/vnd.yamaha.smaf-phrase":{"source":"iana","extensions":["spf"]},"application/vnd.yamaha.through-ngn":{"source":"iana"}, "application/vnd.yamaha.tunnel-udpencap":{"source":"iana"},"application/vnd.yaoweme":{"source":"iana"},"application/vnd.yellowriver-custom-menu":{"source":"iana","extensions":["cmp"]},"application/vnd.zul":{"source":"iana","extensions":["zir","zirz"]},"application/vnd.zzazz.deck+xml":{"source":"iana","extensions":["zaz"]},"application/voicexml+xml":{"source":"iana","extensions":["vxml"]},"application/vq-rtcpxr":{"source":"iana"},"application/watcherinfo+xml":{"source":"iana"},"application/whoispp-query":{"source":"iana"}, "application/whoispp-response":{"source":"iana"},"application/widget":{"source":"iana","extensions":["wgt"]},"application/winhlp":{"source":"apache","extensions":["hlp"]},"application/wita":{"source":"iana"},"application/wordperfect5.1":{"source":"iana"},"application/wsdl+xml":{"source":"iana","extensions":["wsdl"]},"application/wspolicy+xml":{"source":"iana","extensions":["wspolicy"]},"application/x-7z-compressed":{"source":"apache","compressible":false,"extensions":["7z"]},"application/x-abiword":{"source":"apache", "extensions":["abw"]},"application/x-ace-compressed":{"source":"apache","extensions":["ace"]},"application/x-amf":{"source":"apache"},"application/x-apple-diskimage":{"source":"apache","extensions":["dmg"]},"application/x-authorware-bin":{"source":"apache","extensions":["aab","x32","u32","vox"]},"application/x-authorware-map":{"source":"apache","extensions":["aam"]},"application/x-authorware-seg":{"source":"apache","extensions":["aas"]},"application/x-bcpio":{"source":"apache","extensions":["bcpio"]}, "application/x-bdoc":{"compressible":false,"extensions":["bdoc"]},"application/x-bittorrent":{"source":"apache","extensions":["torrent"]},"application/x-blorb":{"source":"apache","extensions":["blb","blorb"]},"application/x-bzip":{"source":"apache","compressible":false,"extensions":["bz"]},"application/x-bzip2":{"source":"apache","compressible":false,"extensions":["bz2","boz"]},"application/x-cbr":{"source":"apache","extensions":["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{"source":"apache", "extensions":["vcd"]},"application/x-cfs-compressed":{"source":"apache","extensions":["cfs"]},"application/x-chat":{"source":"apache","extensions":["chat"]},"application/x-chess-pgn":{"source":"apache","extensions":["pgn"]},"application/x-chrome-extension":{"extensions":["crx"]},"application/x-cocoa":{"source":"nginx","extensions":["cco"]},"application/x-compress":{"source":"apache"},"application/x-conference":{"source":"apache","extensions":["nsc"]},"application/x-cpio":{"source":"apache","extensions":["cpio"]}, "application/x-csh":{"source":"apache","extensions":["csh"]},"application/x-deb":{"compressible":false},"application/x-debian-package":{"source":"apache","extensions":["deb","udeb"]},"application/x-dgc-compressed":{"source":"apache","extensions":["dgc"]},"application/x-director":{"source":"apache","extensions":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{"source":"apache","extensions":["wad"]},"application/x-dtbncx+xml":{"source":"apache","extensions":["ncx"]},"application/x-dtbook+xml":{"source":"apache", "extensions":["dtb"]},"application/x-dtbresource+xml":{"source":"apache","extensions":["res"]},"application/x-dvi":{"source":"apache","compressible":false,"extensions":["dvi"]},"application/x-envoy":{"source":"apache","extensions":["evy"]},"application/x-eva":{"source":"apache","extensions":["eva"]},"application/x-font-bdf":{"source":"apache","extensions":["bdf"]},"application/x-font-dos":{"source":"apache"},"application/x-font-framemaker":{"source":"apache"},"application/x-font-ghostscript":{"source":"apache", "extensions":["gsf"]},"application/x-font-libgrx":{"source":"apache"},"application/x-font-linux-psf":{"source":"apache","extensions":["psf"]},"application/x-font-otf":{"source":"apache","compressible":true,"extensions":["otf"]},"application/x-font-pcf":{"source":"apache","extensions":["pcf"]},"application/x-font-snf":{"source":"apache","extensions":["snf"]},"application/x-font-speedo":{"source":"apache"},"application/x-font-sunos-news":{"source":"apache"},"application/x-font-ttf":{"source":"apache", "compressible":true,"extensions":["ttf","ttc"]},"application/x-font-type1":{"source":"apache","extensions":["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{"source":"apache"},"application/x-freearc":{"source":"apache","extensions":["arc"]},"application/x-futuresplash":{"source":"apache","extensions":["spl"]},"application/x-gca-compressed":{"source":"apache","extensions":["gca"]},"application/x-glulx":{"source":"apache","extensions":["ulx"]},"application/x-gnumeric":{"source":"apache","extensions":["gnumeric"]}, "application/x-gramps-xml":{"source":"apache","extensions":["gramps"]},"application/x-gtar":{"source":"apache","extensions":["gtar"]},"application/x-gzip":{"source":"apache"},"application/x-hdf":{"source":"apache","extensions":["hdf"]},"application/x-httpd-php":{"compressible":true,"extensions":["php"]},"application/x-install-instructions":{"source":"apache","extensions":["install"]},"application/x-iso9660-image":{"source":"apache","extensions":["iso"]},"application/x-java-archive-diff":{"source":"nginx", "extensions":["jardiff"]},"application/x-java-jnlp-file":{"source":"apache","compressible":false,"extensions":["jnlp"]},"application/x-javascript":{"compressible":true},"application/x-latex":{"source":"apache","compressible":false,"extensions":["latex"]},"application/x-lua-bytecode":{"extensions":["luac"]},"application/x-lzh-compressed":{"source":"apache","extensions":["lzh","lha"]},"application/x-makeself":{"source":"nginx","extensions":["run"]},"application/x-mie":{"source":"apache","extensions":["mie"]}, "application/x-mobipocket-ebook":{"source":"apache","extensions":["prc","mobi"]},"application/x-mpegurl":{"compressible":false},"application/x-ms-application":{"source":"apache","extensions":["application"]},"application/x-ms-shortcut":{"source":"apache","extensions":["lnk"]},"application/x-ms-wmd":{"source":"apache","extensions":["wmd"]},"application/x-ms-wmz":{"source":"apache","extensions":["wmz"]},"application/x-ms-xbap":{"source":"apache","extensions":["xbap"]},"application/x-msaccess":{"source":"apache", "extensions":["mdb"]},"application/x-msbinder":{"source":"apache","extensions":["obd"]},"application/x-mscardfile":{"source":"apache","extensions":["crd"]},"application/x-msclip":{"source":"apache","extensions":["clp"]},"application/x-msdos-program":{"extensions":["exe"]},"application/x-msdownload":{"source":"apache","extensions":["exe","dll","com","bat","msi"]},"application/x-msmediaview":{"source":"apache","extensions":["mvb","m13","m14"]},"application/x-msmetafile":{"source":"apache","extensions":["wmf", "wmz","emf","emz"]},"application/x-msmoney":{"source":"apache","extensions":["mny"]},"application/x-mspublisher":{"source":"apache","extensions":["pub"]},"application/x-msschedule":{"source":"apache","extensions":["scd"]},"application/x-msterminal":{"source":"apache","extensions":["trm"]},"application/x-mswrite":{"source":"apache","extensions":["wri"]},"application/x-netcdf":{"source":"apache","extensions":["nc","cdf"]},"application/x-ns-proxy-autoconfig":{"compressible":true,"extensions":["pac"]}, "application/x-nzb":{"source":"apache","extensions":["nzb"]},"application/x-perl":{"source":"nginx","extensions":["pl","pm"]},"application/x-pilot":{"source":"nginx","extensions":["prc","pdb"]},"application/x-pkcs12":{"source":"apache","compressible":false,"extensions":["p12","pfx"]},"application/x-pkcs7-certificates":{"source":"apache","extensions":["p7b","spc"]},"application/x-pkcs7-certreqresp":{"source":"apache","extensions":["p7r"]},"application/x-rar-compressed":{"source":"apache","compressible":false, "extensions":["rar"]},"application/x-redhat-package-manager":{"source":"nginx","extensions":["rpm"]},"application/x-research-info-systems":{"source":"apache","extensions":["ris"]},"application/x-sea":{"source":"nginx","extensions":["sea"]},"application/x-sh":{"source":"apache","compressible":true,"extensions":["sh"]},"application/x-shar":{"source":"apache","extensions":["shar"]},"application/x-shockwave-flash":{"source":"apache","compressible":false,"extensions":["swf"]},"application/x-silverlight-app":{"source":"apache", "extensions":["xap"]},"application/x-sql":{"source":"apache","extensions":["sql"]},"application/x-stuffit":{"source":"apache","compressible":false,"extensions":["sit"]},"application/x-stuffitx":{"source":"apache","extensions":["sitx"]},"application/x-subrip":{"source":"apache","extensions":["srt"]},"application/x-sv4cpio":{"source":"apache","extensions":["sv4cpio"]},"application/x-sv4crc":{"source":"apache","extensions":["sv4crc"]},"application/x-t3vm-image":{"source":"apache","extensions":["t3"]}, "application/x-tads":{"source":"apache","extensions":["gam"]},"application/x-tar":{"source":"apache","compressible":true,"extensions":["tar"]},"application/x-tcl":{"source":"apache","extensions":["tcl","tk"]},"application/x-tex":{"source":"apache","extensions":["tex"]},"application/x-tex-tfm":{"source":"apache","extensions":["tfm"]},"application/x-texinfo":{"source":"apache","extensions":["texinfo","texi"]},"application/x-tgif":{"source":"apache","extensions":["obj"]},"application/x-ustar":{"source":"apache", "extensions":["ustar"]},"application/x-wais-source":{"source":"apache","extensions":["src"]},"application/x-web-app-manifest+json":{"compressible":true,"extensions":["webapp"]},"application/x-www-form-urlencoded":{"source":"iana","compressible":true},"application/x-x509-ca-cert":{"source":"apache","extensions":["der","crt","pem"]},"application/x-xfig":{"source":"apache","extensions":["fig"]},"application/x-xliff+xml":{"source":"apache","extensions":["xlf"]},"application/x-xpinstall":{"source":"apache", "compressible":false,"extensions":["xpi"]},"application/x-xz":{"source":"apache","extensions":["xz"]},"application/x-zmachine":{"source":"apache","extensions":["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{"source":"iana"},"application/xacml+xml":{"source":"iana"},"application/xaml+xml":{"source":"apache","extensions":["xaml"]},"application/xcap-att+xml":{"source":"iana"},"application/xcap-caps+xml":{"source":"iana"},"application/xcap-diff+xml":{"source":"iana","extensions":["xdf"]}, "application/xcap-el+xml":{"source":"iana"},"application/xcap-error+xml":{"source":"iana"},"application/xcap-ns+xml":{"source":"iana"},"application/xcon-conference-info+xml":{"source":"iana"},"application/xcon-conference-info-diff+xml":{"source":"iana"},"application/xenc+xml":{"source":"iana","extensions":["xenc"]},"application/xhtml+xml":{"source":"iana","compressible":true,"extensions":["xhtml","xht"]},"application/xhtml-voice+xml":{"source":"apache"},"application/xml":{"source":"iana","compressible":true, "extensions":["xml","xsl","xsd"]},"application/xml-dtd":{"source":"iana","compressible":true,"extensions":["dtd"]},"application/xml-external-parsed-entity":{"source":"iana"},"application/xml-patch+xml":{"source":"iana"},"application/xmpp+xml":{"source":"iana"},"application/xop+xml":{"source":"iana","compressible":true,"extensions":["xop"]},"application/xproc+xml":{"source":"apache","extensions":["xpl"]},"application/xslt+xml":{"source":"iana","extensions":["xslt"]},"application/xspf+xml":{"source":"apache", "extensions":["xspf"]},"application/xv+xml":{"source":"iana","extensions":["mxml","xhvml","xvml","xvm"]},"application/yang":{"source":"iana","extensions":["yang"]},"application/yin+xml":{"source":"iana","extensions":["yin"]},"application/zip":{"source":"iana","compressible":false,"extensions":["zip"]},"application/zlib":{"source":"iana"},"audio/1d-interleaved-parityfec":{"source":"iana"},"audio/32kadpcm":{"source":"iana"},"audio/3gpp":{"source":"iana"},"audio/3gpp2":{"source":"iana"},"audio/ac3":{"source":"iana"}, "audio/adpcm":{"source":"apache","extensions":["adp"]},"audio/amr":{"source":"iana"},"audio/amr-wb":{"source":"iana"},"audio/amr-wb+":{"source":"iana"},"audio/aptx":{"source":"iana"},"audio/asc":{"source":"iana"},"audio/atrac-advanced-lossless":{"source":"iana"},"audio/atrac-x":{"source":"iana"},"audio/atrac3":{"source":"iana"},"audio/basic":{"source":"iana","compressible":false,"extensions":["au","snd"]},"audio/bv16":{"source":"iana"},"audio/bv32":{"source":"iana"},"audio/clearmode":{"source":"iana"}, "audio/cn":{"source":"iana"},"audio/dat12":{"source":"iana"},"audio/dls":{"source":"iana"},"audio/dsr-es201108":{"source":"iana"},"audio/dsr-es202050":{"source":"iana"},"audio/dsr-es202211":{"source":"iana"},"audio/dsr-es202212":{"source":"iana"},"audio/dv":{"source":"iana"},"audio/dvi4":{"source":"iana"},"audio/eac3":{"source":"iana"},"audio/encaprtp":{"source":"iana"},"audio/evrc":{"source":"iana"},"audio/evrc-qcp":{"source":"iana"},"audio/evrc0":{"source":"iana"},"audio/evrc1":{"source":"iana"}, "audio/evrcb":{"source":"iana"},"audio/evrcb0":{"source":"iana"},"audio/evrcb1":{"source":"iana"},"audio/evrcnw":{"source":"iana"},"audio/evrcnw0":{"source":"iana"},"audio/evrcnw1":{"source":"iana"},"audio/evrcwb":{"source":"iana"},"audio/evrcwb0":{"source":"iana"},"audio/evrcwb1":{"source":"iana"},"audio/evs":{"source":"iana"},"audio/fwdred":{"source":"iana"},"audio/g711-0":{"source":"iana"},"audio/g719":{"source":"iana"},"audio/g722":{"source":"iana"},"audio/g7221":{"source":"iana"},"audio/g723":{"source":"iana"}, "audio/g726-16":{"source":"iana"},"audio/g726-24":{"source":"iana"},"audio/g726-32":{"source":"iana"},"audio/g726-40":{"source":"iana"},"audio/g728":{"source":"iana"},"audio/g729":{"source":"iana"},"audio/g7291":{"source":"iana"},"audio/g729d":{"source":"iana"},"audio/g729e":{"source":"iana"},"audio/gsm":{"source":"iana"},"audio/gsm-efr":{"source":"iana"},"audio/gsm-hr-08":{"source":"iana"},"audio/ilbc":{"source":"iana"},"audio/ip-mr_v2.5":{"source":"iana"},"audio/isac":{"source":"apache"},"audio/l16":{"source":"iana"}, "audio/l20":{"source":"iana"},"audio/l24":{"source":"iana","compressible":false},"audio/l8":{"source":"iana"},"audio/lpc":{"source":"iana"},"audio/midi":{"source":"apache","extensions":["mid","midi","kar","rmi"]},"audio/mobile-xmf":{"source":"iana"},"audio/mp4":{"source":"iana","compressible":false,"extensions":["mp4a","m4a"]},"audio/mp4a-latm":{"source":"iana"},"audio/mpa":{"source":"iana"},"audio/mpa-robust":{"source":"iana"},"audio/mpeg":{"source":"iana","compressible":false,"extensions":["mpga", "mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{"source":"iana"},"audio/musepack":{"source":"apache"},"audio/ogg":{"source":"iana","compressible":false,"extensions":["oga","ogg","spx"]},"audio/opus":{"source":"iana"},"audio/parityfec":{"source":"iana"},"audio/pcma":{"source":"iana"},"audio/pcma-wb":{"source":"iana"},"audio/pcmu":{"source":"iana"},"audio/pcmu-wb":{"source":"iana"},"audio/prs.sid":{"source":"iana"},"audio/qcelp":{"source":"iana"},"audio/raptorfec":{"source":"iana"},"audio/red":{"source":"iana"}, "audio/rtp-enc-aescm128":{"source":"iana"},"audio/rtp-midi":{"source":"iana"},"audio/rtploopback":{"source":"iana"},"audio/rtx":{"source":"iana"},"audio/s3m":{"source":"apache","extensions":["s3m"]},"audio/silk":{"source":"apache","extensions":["sil"]},"audio/smv":{"source":"iana"},"audio/smv-qcp":{"source":"iana"},"audio/smv0":{"source":"iana"},"audio/sp-midi":{"source":"iana"},"audio/speex":{"source":"iana"},"audio/t140c":{"source":"iana"},"audio/t38":{"source":"iana"},"audio/telephone-event":{"source":"iana"}, "audio/tone":{"source":"iana"},"audio/uemclip":{"source":"iana"},"audio/ulpfec":{"source":"iana"},"audio/vdvi":{"source":"iana"},"audio/vmr-wb":{"source":"iana"},"audio/vnd.3gpp.iufp":{"source":"iana"},"audio/vnd.4sb":{"source":"iana"},"audio/vnd.audiokoz":{"source":"iana"},"audio/vnd.celp":{"source":"iana"},"audio/vnd.cisco.nse":{"source":"iana"},"audio/vnd.cmles.radio-events":{"source":"iana"},"audio/vnd.cns.anp1":{"source":"iana"},"audio/vnd.cns.inf1":{"source":"iana"},"audio/vnd.dece.audio":{"source":"iana", "extensions":["uva","uvva"]},"audio/vnd.digital-winds":{"source":"iana","extensions":["eol"]},"audio/vnd.dlna.adts":{"source":"iana"},"audio/vnd.dolby.heaac.1":{"source":"iana"},"audio/vnd.dolby.heaac.2":{"source":"iana"},"audio/vnd.dolby.mlp":{"source":"iana"},"audio/vnd.dolby.mps":{"source":"iana"},"audio/vnd.dolby.pl2":{"source":"iana"},"audio/vnd.dolby.pl2x":{"source":"iana"},"audio/vnd.dolby.pl2z":{"source":"iana"},"audio/vnd.dolby.pulse.1":{"source":"iana"},"audio/vnd.dra":{"source":"iana", "extensions":["dra"]},"audio/vnd.dts":{"source":"iana","extensions":["dts"]},"audio/vnd.dts.hd":{"source":"iana","extensions":["dtshd"]},"audio/vnd.dvb.file":{"source":"iana"},"audio/vnd.everad.plj":{"source":"iana"},"audio/vnd.hns.audio":{"source":"iana"},"audio/vnd.lucent.voice":{"source":"iana","extensions":["lvp"]},"audio/vnd.ms-playready.media.pya":{"source":"iana","extensions":["pya"]},"audio/vnd.nokia.mobile-xmf":{"source":"iana"},"audio/vnd.nortel.vbk":{"source":"iana"},"audio/vnd.nuera.ecelp4800":{"source":"iana", "extensions":["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{"source":"iana","extensions":["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{"source":"iana","extensions":["ecelp9600"]},"audio/vnd.octel.sbc":{"source":"iana"},"audio/vnd.qcelp":{"source":"iana"},"audio/vnd.rhetorex.32kadpcm":{"source":"iana"},"audio/vnd.rip":{"source":"iana","extensions":["rip"]},"audio/vnd.rn-realaudio":{"compressible":false},"audio/vnd.sealedmedia.softseal.mpeg":{"source":"iana"},"audio/vnd.vmx.cvsd":{"source":"iana"},"audio/vnd.wave":{"compressible":false}, "audio/vorbis":{"source":"iana","compressible":false},"audio/vorbis-config":{"source":"iana"},"audio/wav":{"compressible":false,"extensions":["wav"]},"audio/wave":{"compressible":false,"extensions":["wav"]},"audio/webm":{"source":"apache","compressible":false,"extensions":["weba"]},"audio/x-aac":{"source":"apache","compressible":false,"extensions":["aac"]},"audio/x-aiff":{"source":"apache","extensions":["aif","aiff","aifc"]},"audio/x-caf":{"source":"apache","compressible":false,"extensions":["caf"]}, "audio/x-flac":{"source":"apache","extensions":["flac"]},"audio/x-m4a":{"source":"nginx","extensions":["m4a"]},"audio/x-matroska":{"source":"apache","extensions":["mka"]},"audio/x-mpegurl":{"source":"apache","extensions":["m3u"]},"audio/x-ms-wax":{"source":"apache","extensions":["wax"]},"audio/x-ms-wma":{"source":"apache","extensions":["wma"]},"audio/x-pn-realaudio":{"source":"apache","extensions":["ram","ra"]},"audio/x-pn-realaudio-plugin":{"source":"apache","extensions":["rmp"]},"audio/x-realaudio":{"source":"nginx", "extensions":["ra"]},"audio/x-tta":{"source":"apache"},"audio/x-wav":{"source":"apache","extensions":["wav"]},"audio/xm":{"source":"apache","extensions":["xm"]},"chemical/x-cdx":{"source":"apache","extensions":["cdx"]},"chemical/x-cif":{"source":"apache","extensions":["cif"]},"chemical/x-cmdf":{"source":"apache","extensions":["cmdf"]},"chemical/x-cml":{"source":"apache","extensions":["cml"]},"chemical/x-csml":{"source":"apache","extensions":["csml"]},"chemical/x-pdb":{"source":"apache"},"chemical/x-xyz":{"source":"apache", "extensions":["xyz"]},"font/opentype":{"compressible":true,"extensions":["otf"]},"image/bmp":{"source":"apache","compressible":true,"extensions":["bmp"]},"image/cgm":{"source":"iana","extensions":["cgm"]},"image/fits":{"source":"iana"},"image/g3fax":{"source":"iana","extensions":["g3"]},"image/gif":{"source":"iana","compressible":false,"extensions":["gif"]},"image/ief":{"source":"iana","extensions":["ief"]},"image/jp2":{"source":"iana"},"image/jpeg":{"source":"iana","compressible":false,"extensions":["jpeg", "jpg","jpe"]},"image/jpm":{"source":"iana"},"image/jpx":{"source":"iana"},"image/ktx":{"source":"iana","extensions":["ktx"]},"image/naplps":{"source":"iana"},"image/pjpeg":{"compressible":false},"image/png":{"source":"iana","compressible":false,"extensions":["png"]},"image/prs.btif":{"source":"iana","extensions":["btif"]},"image/prs.pti":{"source":"iana"},"image/pwg-raster":{"source":"iana"},"image/sgi":{"source":"apache","extensions":["sgi"]},"image/svg+xml":{"source":"iana","compressible":true, "extensions":["svg","svgz"]},"image/t38":{"source":"iana"},"image/tiff":{"source":"iana","compressible":false,"extensions":["tiff","tif"]},"image/tiff-fx":{"source":"iana"},"image/vnd.adobe.photoshop":{"source":"iana","compressible":true,"extensions":["psd"]},"image/vnd.airzip.accelerator.azv":{"source":"iana"},"image/vnd.cns.inf2":{"source":"iana"},"image/vnd.dece.graphic":{"source":"iana","extensions":["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{"source":"iana","extensions":["djvu","djv"]},"image/vnd.dvb.subtitle":{"source":"iana", "extensions":["sub"]},"image/vnd.dwg":{"source":"iana","extensions":["dwg"]},"image/vnd.dxf":{"source":"iana","extensions":["dxf"]},"image/vnd.fastbidsheet":{"source":"iana","extensions":["fbs"]},"image/vnd.fpx":{"source":"iana","extensions":["fpx"]},"image/vnd.fst":{"source":"iana","extensions":["fst"]},"image/vnd.fujixerox.edmics-mmr":{"source":"iana","extensions":["mmr"]},"image/vnd.fujixerox.edmics-rlc":{"source":"iana","extensions":["rlc"]},"image/vnd.globalgraphics.pgb":{"source":"iana"},"image/vnd.microsoft.icon":{"source":"iana"}, "image/vnd.mix":{"source":"iana"},"image/vnd.mozilla.apng":{"source":"iana"},"image/vnd.ms-modi":{"source":"iana","extensions":["mdi"]},"image/vnd.ms-photo":{"source":"apache","extensions":["wdp"]},"image/vnd.net-fpx":{"source":"iana","extensions":["npx"]},"image/vnd.radiance":{"source":"iana"},"image/vnd.sealed.png":{"source":"iana"},"image/vnd.sealedmedia.softseal.gif":{"source":"iana"},"image/vnd.sealedmedia.softseal.jpg":{"source":"iana"},"image/vnd.svf":{"source":"iana"},"image/vnd.tencent.tap":{"source":"iana"}, "image/vnd.valve.source.texture":{"source":"iana"},"image/vnd.wap.wbmp":{"source":"iana","extensions":["wbmp"]},"image/vnd.xiff":{"source":"iana","extensions":["xif"]},"image/vnd.zbrush.pcx":{"source":"iana"},"image/webp":{"source":"apache","extensions":["webp"]},"image/x-3ds":{"source":"apache","extensions":["3ds"]},"image/x-cmu-raster":{"source":"apache","extensions":["ras"]},"image/x-cmx":{"source":"apache","extensions":["cmx"]},"image/x-freehand":{"source":"apache","extensions":["fh","fhc","fh4", "fh5","fh7"]},"image/x-icon":{"source":"apache","compressible":true,"extensions":["ico"]},"image/x-jng":{"source":"nginx","extensions":["jng"]},"image/x-mrsid-image":{"source":"apache","extensions":["sid"]},"image/x-ms-bmp":{"source":"nginx","compressible":true,"extensions":["bmp"]},"image/x-pcx":{"source":"apache","extensions":["pcx"]},"image/x-pict":{"source":"apache","extensions":["pic","pct"]},"image/x-portable-anymap":{"source":"apache","extensions":["pnm"]},"image/x-portable-bitmap":{"source":"apache", "extensions":["pbm"]},"image/x-portable-graymap":{"source":"apache","extensions":["pgm"]},"image/x-portable-pixmap":{"source":"apache","extensions":["ppm"]},"image/x-rgb":{"source":"apache","extensions":["rgb"]},"image/x-tga":{"source":"apache","extensions":["tga"]},"image/x-xbitmap":{"source":"apache","extensions":["xbm"]},"image/x-xcf":{"compressible":false},"image/x-xpixmap":{"source":"apache","extensions":["xpm"]},"image/x-xwindowdump":{"source":"apache","extensions":["xwd"]},"message/cpim":{"source":"iana"}, "message/delivery-status":{"source":"iana"},"message/disposition-notification":{"source":"iana"},"message/external-body":{"source":"iana"},"message/feedback-report":{"source":"iana"},"message/global":{"source":"iana"},"message/global-delivery-status":{"source":"iana"},"message/global-disposition-notification":{"source":"iana"},"message/global-headers":{"source":"iana"},"message/http":{"source":"iana","compressible":false},"message/imdn+xml":{"source":"iana","compressible":true},"message/news":{"source":"iana"}, "message/partial":{"source":"iana","compressible":false},"message/rfc822":{"source":"iana","compressible":true,"extensions":["eml","mime"]},"message/s-http":{"source":"iana"},"message/sip":{"source":"iana"},"message/sipfrag":{"source":"iana"},"message/tracking-status":{"source":"iana"},"message/vnd.si.simp":{"source":"iana"},"message/vnd.wfa.wsc":{"source":"iana"},"model/iges":{"source":"iana","compressible":false,"extensions":["igs","iges"]},"model/mesh":{"source":"iana","compressible":false,"extensions":["msh", "mesh","silo"]},"model/vnd.collada+xml":{"source":"iana","extensions":["dae"]},"model/vnd.dwf":{"source":"iana","extensions":["dwf"]},"model/vnd.flatland.3dml":{"source":"iana"},"model/vnd.gdl":{"source":"iana","extensions":["gdl"]},"model/vnd.gs-gdl":{"source":"apache"},"model/vnd.gs.gdl":{"source":"iana"},"model/vnd.gtw":{"source":"iana","extensions":["gtw"]},"model/vnd.moml+xml":{"source":"iana"},"model/vnd.mts":{"source":"iana","extensions":["mts"]},"model/vnd.opengex":{"source":"iana"},"model/vnd.parasolid.transmit.binary":{"source":"iana"}, "model/vnd.parasolid.transmit.text":{"source":"iana"},"model/vnd.valve.source.compiled-map":{"source":"iana"},"model/vnd.vtu":{"source":"iana","extensions":["vtu"]},"model/vrml":{"source":"iana","compressible":false,"extensions":["wrl","vrml"]},"model/x3d+binary":{"source":"apache","compressible":false,"extensions":["x3db","x3dbz"]},"model/x3d+fastinfoset":{"source":"iana"},"model/x3d+vrml":{"source":"apache","compressible":false,"extensions":["x3dv","x3dvz"]},"model/x3d+xml":{"source":"iana","compressible":true, "extensions":["x3d","x3dz"]},"model/x3d-vrml":{"source":"iana"},"multipart/alternative":{"source":"iana","compressible":false},"multipart/appledouble":{"source":"iana"},"multipart/byteranges":{"source":"iana"},"multipart/digest":{"source":"iana"},"multipart/encrypted":{"source":"iana","compressible":false},"multipart/form-data":{"source":"iana","compressible":false},"multipart/header-set":{"source":"iana"},"multipart/mixed":{"source":"iana","compressible":false},"multipart/parallel":{"source":"iana"}, "multipart/related":{"source":"iana","compressible":false},"multipart/report":{"source":"iana"},"multipart/signed":{"source":"iana","compressible":false},"multipart/voice-message":{"source":"iana"},"multipart/x-mixed-replace":{"source":"iana"},"text/1d-interleaved-parityfec":{"source":"iana"},"text/cache-manifest":{"source":"iana","compressible":true,"extensions":["appcache","manifest"]},"text/calendar":{"source":"iana","extensions":["ics","ifb"]},"text/calender":{"compressible":true},"text/cmd":{"compressible":true}, "text/coffeescript":{"extensions":["coffee","litcoffee"]},"text/css":{"source":"iana","compressible":true,"extensions":["css"]},"text/csv":{"source":"iana","compressible":true,"extensions":["csv"]},"text/csv-schema":{"source":"iana"},"text/directory":{"source":"iana"},"text/dns":{"source":"iana"},"text/ecmascript":{"source":"iana"},"text/encaprtp":{"source":"iana"},"text/enriched":{"source":"iana"},"text/fwdred":{"source":"iana"},"text/grammar-ref-list":{"source":"iana"},"text/hjson":{"extensions":["hjson"]}, "text/html":{"source":"iana","compressible":true,"extensions":["html","htm","shtml"]},"text/jade":{"extensions":["jade"]},"text/javascript":{"source":"iana","compressible":true},"text/jcr-cnd":{"source":"iana"},"text/jsx":{"compressible":true,"extensions":["jsx"]},"text/less":{"extensions":["less"]},"text/markdown":{"source":"iana"},"text/mathml":{"source":"nginx","extensions":["mml"]},"text/mizar":{"source":"iana"},"text/n3":{"source":"iana","compressible":true,"extensions":["n3"]},"text/parameters":{"source":"iana"}, "text/parityfec":{"source":"iana"},"text/plain":{"source":"iana","compressible":true,"extensions":["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{"source":"iana"},"text/prs.fallenstein.rst":{"source":"iana"},"text/prs.lines.tag":{"source":"iana","extensions":["dsc"]},"text/raptorfec":{"source":"iana"},"text/red":{"source":"iana"},"text/rfc822-headers":{"source":"iana"},"text/richtext":{"source":"iana","compressible":true,"extensions":["rtx"]},"text/rtf":{"source":"iana", "compressible":true,"extensions":["rtf"]},"text/rtp-enc-aescm128":{"source":"iana"},"text/rtploopback":{"source":"iana"},"text/rtx":{"source":"iana"},"text/sgml":{"source":"iana","extensions":["sgml","sgm"]},"text/stylus":{"extensions":["stylus","styl"]},"text/t140":{"source":"iana"},"text/tab-separated-values":{"source":"iana","compressible":true,"extensions":["tsv"]},"text/troff":{"source":"iana","extensions":["t","tr","roff","man","me","ms"]},"text/turtle":{"source":"iana","extensions":["ttl"]}, "text/ulpfec":{"source":"iana"},"text/uri-list":{"source":"iana","compressible":true,"extensions":["uri","uris","urls"]},"text/vcard":{"source":"iana","compressible":true,"extensions":["vcard"]},"text/vnd.a":{"source":"iana"},"text/vnd.abc":{"source":"iana"},"text/vnd.curl":{"source":"iana","extensions":["curl"]},"text/vnd.curl.dcurl":{"source":"apache","extensions":["dcurl"]},"text/vnd.curl.mcurl":{"source":"apache","extensions":["mcurl"]},"text/vnd.curl.scurl":{"source":"apache","extensions":["scurl"]}, "text/vnd.debian.copyright":{"source":"iana"},"text/vnd.dmclientscript":{"source":"iana"},"text/vnd.dvb.subtitle":{"source":"iana","extensions":["sub"]},"text/vnd.esmertec.theme-descriptor":{"source":"iana"},"text/vnd.fly":{"source":"iana","extensions":["fly"]},"text/vnd.fmi.flexstor":{"source":"iana","extensions":["flx"]},"text/vnd.graphviz":{"source":"iana","extensions":["gv"]},"text/vnd.in3d.3dml":{"source":"iana","extensions":["3dml"]},"text/vnd.in3d.spot":{"source":"iana","extensions":["spot"]}, "text/vnd.iptc.newsml":{"source":"iana"},"text/vnd.iptc.nitf":{"source":"iana"},"text/vnd.latex-z":{"source":"iana"},"text/vnd.motorola.reflex":{"source":"iana"},"text/vnd.ms-mediapackage":{"source":"iana"},"text/vnd.net2phone.commcenter.command":{"source":"iana"},"text/vnd.radisys.msml-basic-layout":{"source":"iana"},"text/vnd.si.uricatalogue":{"source":"iana"},"text/vnd.sun.j2me.app-descriptor":{"source":"iana","extensions":["jad"]},"text/vnd.trolltech.linguist":{"source":"iana"},"text/vnd.wap.si":{"source":"iana"}, "text/vnd.wap.sl":{"source":"iana"},"text/vnd.wap.wml":{"source":"iana","extensions":["wml"]},"text/vnd.wap.wmlscript":{"source":"iana","extensions":["wmls"]},"text/vtt":{"charset":"UTF-8","compressible":true,"extensions":["vtt"]},"text/x-asm":{"source":"apache","extensions":["s","asm"]},"text/x-c":{"source":"apache","extensions":["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{"source":"nginx","extensions":["htc"]},"text/x-fortran":{"source":"apache","extensions":["f","for","f77","f90"]}, "text/x-gwt-rpc":{"compressible":true},"text/x-handlebars-template":{"extensions":["hbs"]},"text/x-java-source":{"source":"apache","extensions":["java"]},"text/x-jquery-tmpl":{"compressible":true},"text/x-lua":{"extensions":["lua"]},"text/x-markdown":{"compressible":true,"extensions":["markdown","md","mkd"]},"text/x-nfo":{"source":"apache","extensions":["nfo"]},"text/x-opml":{"source":"apache","extensions":["opml"]},"text/x-pascal":{"source":"apache","extensions":["p","pas"]},"text/x-processing":{"compressible":true, "extensions":["pde"]},"text/x-sass":{"extensions":["sass"]},"text/x-scss":{"extensions":["scss"]},"text/x-setext":{"source":"apache","extensions":["etx"]},"text/x-sfv":{"source":"apache","extensions":["sfv"]},"text/x-suse-ymp":{"compressible":true,"extensions":["ymp"]},"text/x-uuencode":{"source":"apache","extensions":["uu"]},"text/x-vcalendar":{"source":"apache","extensions":["vcs"]},"text/x-vcard":{"source":"apache","extensions":["vcf"]},"text/xml":{"source":"iana","compressible":true,"extensions":["xml"]}, "text/xml-external-parsed-entity":{"source":"iana"},"text/yaml":{"extensions":["yaml","yml"]},"video/1d-interleaved-parityfec":{"source":"apache"},"video/3gpp":{"source":"apache","extensions":["3gp","3gpp"]},"video/3gpp-tt":{"source":"apache"},"video/3gpp2":{"source":"apache","extensions":["3g2"]},"video/bmpeg":{"source":"apache"},"video/bt656":{"source":"apache"},"video/celb":{"source":"apache"},"video/dv":{"source":"apache"},"video/h261":{"source":"apache","extensions":["h261"]},"video/h263":{"source":"apache", "extensions":["h263"]},"video/h263-1998":{"source":"apache"},"video/h263-2000":{"source":"apache"},"video/h264":{"source":"apache","extensions":["h264"]},"video/h264-rcdo":{"source":"apache"},"video/h264-svc":{"source":"apache"},"video/jpeg":{"source":"apache","extensions":["jpgv"]},"video/jpeg2000":{"source":"apache"},"video/jpm":{"source":"apache","extensions":["jpm","jpgm"]},"video/mj2":{"source":"apache","extensions":["mj2","mjp2"]},"video/mp1s":{"source":"apache"},"video/mp2p":{"source":"apache"}, "video/mp2t":{"source":"apache","extensions":["ts"]},"video/mp4":{"source":"apache","compressible":false,"extensions":["mp4","mp4v","mpg4"]},"video/mp4v-es":{"source":"apache"},"video/mpeg":{"source":"apache","compressible":false,"extensions":["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{"source":"apache"},"video/mpv":{"source":"apache"},"video/nv":{"source":"apache"},"video/ogg":{"source":"apache","compressible":false,"extensions":["ogv"]},"video/parityfec":{"source":"apache"},"video/pointer":{"source":"apache"}, "video/quicktime":{"source":"apache","compressible":false,"extensions":["qt","mov"]},"video/raw":{"source":"apache"},"video/rtp-enc-aescm128":{"source":"apache"},"video/rtx":{"source":"apache"},"video/smpte292m":{"source":"apache"},"video/ulpfec":{"source":"apache"},"video/vc1":{"source":"apache"},"video/vnd.cctv":{"source":"apache"},"video/vnd.dece.hd":{"source":"apache","extensions":["uvh","uvvh"]},"video/vnd.dece.mobile":{"source":"apache","extensions":["uvm","uvvm"]},"video/vnd.dece.mp4":{"source":"apache"}, "video/vnd.dece.pd":{"source":"apache","extensions":["uvp","uvvp"]},"video/vnd.dece.sd":{"source":"apache","extensions":["uvs","uvvs"]},"video/vnd.dece.video":{"source":"apache","extensions":["uvv","uvvv"]},"video/vnd.directv.mpeg":{"source":"apache"},"video/vnd.directv.mpeg-tts":{"source":"apache"},"video/vnd.dlna.mpeg-tts":{"source":"apache"},"video/vnd.dvb.file":{"source":"apache","extensions":["dvb"]},"video/vnd.fvt":{"source":"apache","extensions":["fvt"]},"video/vnd.hns.video":{"source":"apache"}, "video/vnd.iptvforum.1dparityfec-1010":{"source":"apache"},"video/vnd.iptvforum.1dparityfec-2005":{"source":"apache"},"video/vnd.iptvforum.2dparityfec-1010":{"source":"apache"},"video/vnd.iptvforum.2dparityfec-2005":{"source":"apache"},"video/vnd.iptvforum.ttsavc":{"source":"apache"},"video/vnd.iptvforum.ttsmpeg2":{"source":"apache"},"video/vnd.motorola.video":{"source":"apache"},"video/vnd.motorola.videop":{"source":"apache"},"video/vnd.mpegurl":{"source":"apache","extensions":["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{"source":"apache", "extensions":["pyv"]},"video/vnd.nokia.interleaved-multimedia":{"source":"apache"},"video/vnd.nokia.videovoip":{"source":"apache"},"video/vnd.objectvideo":{"source":"apache"},"video/vnd.sealed.mpeg1":{"source":"apache"},"video/vnd.sealed.mpeg4":{"source":"apache"},"video/vnd.sealed.swf":{"source":"apache"},"video/vnd.sealedmedia.softseal.mov":{"source":"apache"},"video/vnd.uvvu.mp4":{"source":"apache","extensions":["uvu","uvvu"]},"video/vnd.vivo":{"source":"apache","extensions":["viv"]},"video/webm":{"source":"apache", "compressible":false,"extensions":["webm"]},"video/x-f4v":{"source":"apache","extensions":["f4v"]},"video/x-fli":{"source":"apache","extensions":["fli"]},"video/x-flv":{"source":"apache","compressible":false,"extensions":["flv"]},"video/x-m4v":{"source":"apache","extensions":["m4v"]},"video/x-matroska":{"source":"apache","compressible":false,"extensions":["mkv","mk3d","mks"]},"video/x-mng":{"source":"apache","extensions":["mng"]},"video/x-ms-asf":{"source":"apache","extensions":["asf","asx"]},"video/x-ms-vob":{"source":"apache", "extensions":["vob"]},"video/x-ms-wm":{"source":"apache","extensions":["wm"]},"video/x-ms-wmv":{"source":"apache","compressible":false,"extensions":["wmv"]},"video/x-ms-wmx":{"source":"apache","extensions":["wmx"]},"video/x-ms-wvx":{"source":"apache","extensions":["wvx"]},"video/x-msvideo":{"source":"apache","extensions":["avi"]},"video/x-sgi-movie":{"source":"apache","extensions":["movie"]},"video/x-smv":{"source":"apache","extensions":["smv"]},"x-conference/x-cooltalk":{"source":"apache","extensions":["ice"]}, "x-shader/x-fragment":{"compressible":true},"x-shader/x-vertex":{"compressible":true}}});var system_1=createCommonjsModule(function(module){var system={};module["exports"]=system;system.mimeTypes=mimeTypes});var en_1=createCommonjsModule(function(module){var en={};module["exports"]=en;en.title="English";en.separator=" \x26 ";en.address=address_1$2;en.credit_card=credit_card_1;en.company=company_1;en.internet=internet_1;en.database=database_1;en.lorem=lorem_1;en.name=name_1$2;en.phone_number=phone_number_1$2; en.cell_phone=cell_phone_1$2;en.business=business_1;en.commerce=commerce_1;en.team=team_1;en.hacker=hacker_1;en.app=app_1;en.finance=finance_1;en.date=date_1;en.system=system_1});var ja$2=createCommonjsModule(function(module){var faker=new lib$6({locale:"ja",localeFallback:"en"});faker.locales["ja"]=ja_1;faker.locales["en"]=en_1;module["exports"]=faker});var ja=lib.extend("faker",function(){try{return ja$2}catch(e){return null}});return ja});
version https://git-lfs.github.com/spec/v1 oid sha256:ef2b3c25e4ff39d81b86b97178959b8370a017afd06e6509e0313124a3637ef4 size 1976
version https://git-lfs.github.com/spec/v1 oid sha256:be8f9445e0a8f2293908aedc93313b77110f492f35a9ecf1083b1a532e0ead39 size 2288
// Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. // patch from https://github.com/nodejs/node/blob/v7.2.1/lib/_http_agent.js 'use strict'; const net = require('net'); const util = require('util'); const EventEmitter = require('events'); const debug = util.debuglog('http'); // New Agent code. // The largest departure from the previous implementation is that // an Agent instance holds connections for a variable number of host:ports. // Surprisingly, this is still API compatible as far as third parties are // concerned. The only code that really notices the difference is the // request object. // Another departure is that all code related to HTTP parsing is in // ClientRequest.onSocket(). The Agent is now *strictly* // concerned with managing a connection pool. function Agent(options) { if (!(this instanceof Agent)) return new Agent(options); EventEmitter.call(this); var self = this; self.defaultPort = 80; self.protocol = 'http:'; self.options = util._extend({}, options); // don't confuse net and make it think that we're connecting to a pipe self.options.path = null; self.requests = {}; self.sockets = {}; self.freeSockets = {}; self.keepAliveMsecs = self.options.keepAliveMsecs || 1000; self.keepAlive = self.options.keepAlive || false; self.maxSockets = self.options.maxSockets || Agent.defaultMaxSockets; self.maxFreeSockets = self.options.maxFreeSockets || 256; // [patch start] // free keep-alive socket timeout. By default free socket do not have a timeout. self.freeSocketKeepAliveTimeout = self.options.freeSocketKeepAliveTimeout || 0; // working socket timeout. By default working socket do not have a timeout. self.timeout = self.options.timeout || 0; // the socket active time to live, even if it's in use this.socketActiveTTL = this.options.socketActiveTTL || null; // [patch end] self.on('free', function(socket, options) { var name = self.getName(options); debug('agent.on(free)', name); if (socket.writable && self.requests[name] && self.requests[name].length) { // [patch start] debug('continue handle next request'); // [patch end] self.requests[name].shift().onSocket(socket); if (self.requests[name].length === 0) { // don't leak delete self.requests[name]; } } else { // If there are no pending requests, then put it in // the freeSockets pool, but only if we're allowed to do so. var req = socket._httpMessage; if (req && req.shouldKeepAlive && socket.writable && self.keepAlive) { var freeSockets = self.freeSockets[name]; var freeLen = freeSockets ? freeSockets.length : 0; var count = freeLen; if (self.sockets[name]) count += self.sockets[name].length; if (count > self.maxSockets || freeLen >= self.maxFreeSockets) { socket.destroy(); } else { freeSockets = freeSockets || []; self.freeSockets[name] = freeSockets; socket.setKeepAlive(true, self.keepAliveMsecs); socket.unref(); socket._httpMessage = null; self.removeSocket(socket, options); freeSockets.push(socket); // [patch start] // Add a default error handler to avoid Unhandled 'error' event throw on idle socket // https://github.com/node-modules/agentkeepalive/issues/25 // https://github.com/nodejs/node/pull/4482 (fixed in >= 4.4.0 and >= 5.4.0) if (socket.listeners('error').length === 0) { socket.once('error', freeSocketErrorListener); } // set free keepalive timer // try to use socket custom freeSocketKeepAliveTimeout first const freeSocketKeepAliveTimeout = socket.freeSocketKeepAliveTimeout || self.freeSocketKeepAliveTimeout; socket.setTimeout(freeSocketKeepAliveTimeout); debug(`push to free socket queue and wait for ${freeSocketKeepAliveTimeout}ms`); // [patch end] } } else { socket.destroy(); } } }); } util.inherits(Agent, EventEmitter); exports.Agent = Agent; // [patch start] function freeSocketErrorListener(err) { var socket = this; debug('SOCKET ERROR on FREE socket:', err.message, err.stack); socket.destroy(); socket.emit('agentRemove'); } // [patch end] Agent.defaultMaxSockets = Infinity; Agent.prototype.createConnection = net.createConnection; // Get the key for a given set of request options Agent.prototype.getName = function getName(options) { var name = options.host || 'localhost'; name += ':'; if (options.port) name += options.port; name += ':'; if (options.localAddress) name += options.localAddress; // Pacify parallel/test-http-agent-getname by only appending // the ':' when options.family is set. if (options.family === 4 || options.family === 6) name += ':' + options.family; return name; }; // [patch start] function handleSocketCreation(req) { return function(err, newSocket) { if (err) { process.nextTick(function() { req.emit('error', err); }); return; } req.onSocket(newSocket); } } // [patch end] Agent.prototype.addRequest = function addRequest(req, options, port/*legacy*/, localAddress/*legacy*/) { // Legacy API: addRequest(req, host, port, localAddress) if (typeof options === 'string') { options = { host: options, port, localAddress }; } options = util._extend({}, options); options = util._extend(options, this.options); if (!options.servername) options.servername = calculateServerName(options, req); var name = this.getName(options); if (!this.sockets[name]) { this.sockets[name] = []; } var freeLen = this.freeSockets[name] ? this.freeSockets[name].length : 0; var sockLen = freeLen + this.sockets[name].length; if (freeLen) { // we have a free socket, so use that. var socket = this.freeSockets[name].shift(); debug('have free socket'); // [patch start] // remove free socket error event handler socket.removeListener('error', freeSocketErrorListener); // restart the default timer socket.setTimeout(this.timeout); if (this.socketActiveTTL && Date.now() - socket.createdTime > this.socketActiveTTL) { debug(`socket ${socket.createdTime} expired`); socket.destroy(); return this.createSocket(req, options, handleSocketCreation(req)); } // [patch end] // don't leak if (!this.freeSockets[name].length) delete this.freeSockets[name]; socket.ref(); req.onSocket(socket); this.sockets[name].push(socket); } else if (sockLen < this.maxSockets) { debug('call onSocket', sockLen, freeLen); // If we are under maxSockets create a new one. // [patch start] this.createSocket(req, options, handleSocketCreation(req)); // [patch end] } else { debug('wait for socket'); // We are over limit so we'll add it to the queue. if (!this.requests[name]) { this.requests[name] = []; } this.requests[name].push(req); } }; Agent.prototype.createSocket = function createSocket(req, options, cb) { var self = this; options = util._extend({}, options); options = util._extend(options, self.options); if (!options.servername) options.servername = calculateServerName(options, req); var name = self.getName(options); options._agentKey = name; debug('createConnection', name, options); options.encoding = null; var called = false; const newSocket = self.createConnection(options, oncreate); // [patch start] if (newSocket) { oncreate(null, Object.assign(newSocket, { createdTime: Date.now() })); } // [patch end] function oncreate(err, s) { if (called) return; called = true; if (err) return cb(err); if (!self.sockets[name]) { self.sockets[name] = []; } self.sockets[name].push(s); debug('sockets', name, self.sockets[name].length); function onFree() { self.emit('free', s, options); } s.on('free', onFree); function onClose(err) { debug('CLIENT socket onClose'); // This is the only place where sockets get removed from the Agent. // If you want to remove a socket from the pool, just close it. // All socket errors end in a close event anyway. self.removeSocket(s, options); // [patch start] self.emit('close'); // [patch end] } s.on('close', onClose); // [patch start] // start socket timeout handler function onTimeout() { debug('CLIENT socket onTimeout'); s.destroy(); // Remove it from freeSockets immediately to prevent new requests from being sent through this socket. self.removeSocket(s, options); self.emit('timeout'); } s.on('timeout', onTimeout); // set the default timer s.setTimeout(self.timeout); // [patch end] function onRemove() { // We need this function for cases like HTTP 'upgrade' // (defined by WebSockets) where we need to remove a socket from the // pool because it'll be locked up indefinitely debug('CLIENT socket onRemove'); self.removeSocket(s, options); s.removeListener('close', onClose); s.removeListener('free', onFree); s.removeListener('agentRemove', onRemove); // [patch start] // remove socket timeout handler s.setTimeout(0, onTimeout); // [patch end] } s.on('agentRemove', onRemove); cb(null, s); } }; function calculateServerName(options, req) { let servername = options.host; const hostHeader = req.getHeader('host'); if (hostHeader) { // abc => abc // abc:123 => abc // [::1] => ::1 // [::1]:123 => ::1 if (hostHeader.startsWith('[')) { const index = hostHeader.indexOf(']'); if (index === -1) { // Leading '[', but no ']'. Need to do something... servername = hostHeader; } else { servername = hostHeader.substr(1, index - 1); } } else { servername = hostHeader.split(':', 1)[0]; } } return servername; } Agent.prototype.removeSocket = function removeSocket(s, options) { var name = this.getName(options); debug('removeSocket', name, 'writable:', s.writable); var sets = [this.sockets]; // If the socket was destroyed, remove it from the free buffers too. if (!s.writable) sets.push(this.freeSockets); for (var sk = 0; sk < sets.length; sk++) { var sockets = sets[sk]; if (sockets[name]) { var index = sockets[name].indexOf(s); if (index !== -1) { sockets[name].splice(index, 1); // Don't leak if (sockets[name].length === 0) delete sockets[name]; } } } // [patch start] var freeLen = this.freeSockets[name] ? this.freeSockets[name].length : 0; var sockLen = freeLen + this.sockets[name] ? this.sockets[name].length : 0; // [patch end] if (this.requests[name] && this.requests[name].length && sockLen < this.maxSockets) { debug('removeSocket, have a request, make a socket'); var req = this.requests[name][0]; // If we have pending requests and a socket gets closed make a new one this.createSocket(req, options, function(err, newSocket) { if (err) { process.nextTick(function() { req.emit('error', err); }); return; } newSocket.emit('free'); }); } }; Agent.prototype.destroy = function destroy() { var sets = [this.freeSockets, this.sockets]; for (var s = 0; s < sets.length; s++) { var set = sets[s]; var keys = Object.keys(set); for (var v = 0; v < keys.length; v++) { var setName = set[keys[v]]; for (var n = 0; n < setName.length; n++) { setName[n].destroy(); } } } }; exports.globalAgent = new Agent();
๏ปฟ/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('wordcount', 'hr', { WordCount: 'Rijeฤi:', CharCount: 'Znakova:', CharCountWithHTML: 'Znakova (ukljuฤujuฤ‡i HTML):', Paragraphs: 'Paragraphs:', ParagraphsRemaining: 'Paragraphs remaining', pasteWarning: 'Content can not be pasted because it is above the allowed limit', Selected: 'Selected: ', title: 'Statistika' });
let x: typeof y.z;
var connect = require('connect'); var serveStatic = require('serve-static'); connect().use(serveStatic(__dirname)).listen(8080, function(){ console.log('Server running on 8080...'); });
// Copyright 2011 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. /** * @fileoverview Error classes for the IndexedDB wrapper. * */ goog.provide('goog.db.Error'); goog.provide('goog.db.Error.ErrorCode'); goog.provide('goog.db.Error.ErrorName'); goog.provide('goog.db.Error.VersionChangeBlockedError'); goog.require('goog.debug.Error'); /** * A database error. Since the stack trace can be unhelpful in an asynchronous * context, the error provides a message about where it was produced. * * @param {number|!DOMError} error The DOMError instance returned by the * browser for Chrome22+, or an error code for previous versions. * @param {string} context A description of where the error occurred. * @param {string=} opt_message Additional message. * @constructor * @extends {goog.debug.Error} * @final */ goog.db.Error = function(error, context, opt_message) { var errorCode = null; var internalError = null; if (goog.isNumber(error)) { errorCode = error; internalError = {name: goog.db.Error.getName(errorCode)}; } else { internalError = error; errorCode = goog.db.Error.getCode(error.name); } /** * The code for this error. * * @type {number} */ this.code = errorCode; /** * The DOMException as returned by the browser. * * @type {!DOMError} * @private */ this.error_ = /** @type {!DOMError} */ (internalError); var msg = 'Error ' + context + ': ' + this.getName(); if (opt_message) { msg += ', ' + opt_message; } goog.db.Error.base(this, 'constructor', msg); }; goog.inherits(goog.db.Error, goog.debug.Error); /** * @return {string} The name of the error. */ goog.db.Error.prototype.getName = function() { return this.error_.name; }; /** * A specific kind of database error. If a Version Change is unable to proceed * due to other open database connections, it will block and this error will be * thrown. * * @constructor * @extends {goog.debug.Error} * @final */ goog.db.Error.VersionChangeBlockedError = function() { goog.db.Error.VersionChangeBlockedError.base( this, 'constructor', 'Version change blocked'); }; goog.inherits(goog.db.Error.VersionChangeBlockedError, goog.debug.Error); /** * Synthetic error codes for database errors, for use when IndexedDB * support is not available. This numbering differs in practice * from the browser implementations, but it is not meant to be reliable: * this object merely ensures that goog.db.Error is loadable on platforms * that do not support IndexedDB. * * @enum {number} * @private */ goog.db.Error.DatabaseErrorCode_ = { UNKNOWN_ERR: 1, NON_TRANSIENT_ERR: 2, NOT_FOUND_ERR: 3, CONSTRAINT_ERR: 4, DATA_ERR: 5, NOT_ALLOWED_ERR: 6, TRANSACTION_INACTIVE_ERR: 7, ABORT_ERR: 8, READ_ONLY_ERR: 9, TRANSIENT_ERR: 10, TIMEOUT_ERR: 11, QUOTA_ERR: 12, INVALID_ACCESS_ERR: 13, INVALID_STATE_ERR: 14 }; /** * Error codes for database errors. * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBDatabaseException * * @enum {number} */ goog.db.Error.ErrorCode = { UNKNOWN_ERR: (goog.global.IDBDatabaseException || goog.global.webkitIDBDatabaseException || goog.db.Error.DatabaseErrorCode_) .UNKNOWN_ERR, NON_TRANSIENT_ERR: (goog.global.IDBDatabaseException || goog.global.webkitIDBDatabaseException || goog.db.Error.DatabaseErrorCode_) .NON_TRANSIENT_ERR, NOT_FOUND_ERR: (goog.global.IDBDatabaseException || goog.global.webkitIDBDatabaseException || goog.db.Error.DatabaseErrorCode_) .NOT_FOUND_ERR, CONSTRAINT_ERR: (goog.global.IDBDatabaseException || goog.global.webkitIDBDatabaseException || goog.db.Error.DatabaseErrorCode_) .CONSTRAINT_ERR, DATA_ERR: (goog.global.IDBDatabaseException || goog.global.webkitIDBDatabaseException || goog.db.Error.DatabaseErrorCode_) .DATA_ERR, NOT_ALLOWED_ERR: (goog.global.IDBDatabaseException || goog.global.webkitIDBDatabaseException || goog.db.Error.DatabaseErrorCode_) .NOT_ALLOWED_ERR, TRANSACTION_INACTIVE_ERR: (goog.global.IDBDatabaseException || goog.global.webkitIDBDatabaseException || goog.db.Error.DatabaseErrorCode_) .TRANSACTION_INACTIVE_ERR, ABORT_ERR: (goog.global.IDBDatabaseException || goog.global.webkitIDBDatabaseException || goog.db.Error.DatabaseErrorCode_) .ABORT_ERR, READ_ONLY_ERR: (goog.global.IDBDatabaseException || goog.global.webkitIDBDatabaseException || goog.db.Error.DatabaseErrorCode_) .READ_ONLY_ERR, TIMEOUT_ERR: (goog.global.IDBDatabaseException || goog.global.webkitIDBDatabaseException || goog.db.Error.DatabaseErrorCode_) .TIMEOUT_ERR, QUOTA_ERR: (goog.global.IDBDatabaseException || goog.global.webkitIDBDatabaseException || goog.db.Error.DatabaseErrorCode_) .QUOTA_ERR, INVALID_ACCESS_ERR: (goog.global.DOMException || goog.db.Error.DatabaseErrorCode_) .INVALID_ACCESS_ERR, INVALID_STATE_ERR: (goog.global.DOMException || goog.db.Error.DatabaseErrorCode_) .INVALID_STATE_ERR }; /** * Translates an error code into a more useful message. * * @param {number} code Error code. * @return {string} A debug message. */ goog.db.Error.getMessage = function(code) { switch (code) { case goog.db.Error.ErrorCode.UNKNOWN_ERR: return 'Unknown error'; case goog.db.Error.ErrorCode.NON_TRANSIENT_ERR: return 'Invalid operation'; case goog.db.Error.ErrorCode.NOT_FOUND_ERR: return 'Required database object not found'; case goog.db.Error.ErrorCode.CONSTRAINT_ERR: return 'Constraint unsatisfied'; case goog.db.Error.ErrorCode.DATA_ERR: return 'Invalid data'; case goog.db.Error.ErrorCode.NOT_ALLOWED_ERR: return 'Operation disallowed'; case goog.db.Error.ErrorCode.TRANSACTION_INACTIVE_ERR: return 'Transaction not active'; case goog.db.Error.ErrorCode.ABORT_ERR: return 'Request aborted'; case goog.db.Error.ErrorCode.READ_ONLY_ERR: return 'Modifying operation not allowed in a read-only transaction'; case goog.db.Error.ErrorCode.TIMEOUT_ERR: return 'Transaction timed out'; case goog.db.Error.ErrorCode.QUOTA_ERR: return 'Database storage space quota exceeded'; case goog.db.Error.ErrorCode.INVALID_ACCESS_ERR: return 'Invalid operation'; case goog.db.Error.ErrorCode.INVALID_STATE_ERR: return 'Invalid state'; default: return 'Unrecognized exception with code ' + code; } }; /** * Names of all possible errors as returned from the browser. * @see http://www.w3.org/TR/IndexedDB/#exceptions * @enum {string} */ goog.db.Error.ErrorName = { ABORT_ERR: 'AbortError', CONSTRAINT_ERR: 'ConstraintError', DATA_CLONE_ERR: 'DataCloneError', DATA_ERR: 'DataError', INVALID_ACCESS_ERR: 'InvalidAccessError', INVALID_STATE_ERR: 'InvalidStateError', NOT_FOUND_ERR: 'NotFoundError', QUOTA_EXCEEDED_ERR: 'QuotaExceededError', READ_ONLY_ERR: 'ReadOnlyError', SYNTAX_ERROR: 'SyntaxError', TIMEOUT_ERR: 'TimeoutError', TRANSACTION_INACTIVE_ERR: 'TransactionInactiveError', UNKNOWN_ERR: 'UnknownError', VERSION_ERR: 'VersionError' }; /** * Translates an error name to an error code. This is purely kept for backwards * compatibility with Chrome21. * * @param {string} name The name of the erorr. * @return {number} The error code corresponding to the error. */ goog.db.Error.getCode = function(name) { switch (name) { case goog.db.Error.ErrorName.UNKNOWN_ERR: return goog.db.Error.ErrorCode.UNKNOWN_ERR; case goog.db.Error.ErrorName.NOT_FOUND_ERR: return goog.db.Error.ErrorCode.NOT_FOUND_ERR; case goog.db.Error.ErrorName.CONSTRAINT_ERR: return goog.db.Error.ErrorCode.CONSTRAINT_ERR; case goog.db.Error.ErrorName.DATA_ERR: return goog.db.Error.ErrorCode.DATA_ERR; case goog.db.Error.ErrorName.TRANSACTION_INACTIVE_ERR: return goog.db.Error.ErrorCode.TRANSACTION_INACTIVE_ERR; case goog.db.Error.ErrorName.ABORT_ERR: return goog.db.Error.ErrorCode.ABORT_ERR; case goog.db.Error.ErrorName.READ_ONLY_ERR: return goog.db.Error.ErrorCode.READ_ONLY_ERR; case goog.db.Error.ErrorName.TIMEOUT_ERR: return goog.db.Error.ErrorCode.TIMEOUT_ERR; case goog.db.Error.ErrorName.QUOTA_EXCEEDED_ERR: return goog.db.Error.ErrorCode.QUOTA_ERR; case goog.db.Error.ErrorName.INVALID_ACCESS_ERR: return goog.db.Error.ErrorCode.INVALID_ACCESS_ERR; case goog.db.Error.ErrorName.INVALID_STATE_ERR: return goog.db.Error.ErrorCode.INVALID_STATE_ERR; default: return goog.db.Error.ErrorCode.UNKNOWN_ERR; } }; /** * Converts an error code used by the old spec, to an error name used by the * latest spec. * @see http://www.w3.org/TR/IndexedDB/#exceptions * * @param {!goog.db.Error.ErrorCode|number} code The error code to convert. * @return {!goog.db.Error.ErrorName} The corresponding name of the error. */ goog.db.Error.getName = function(code) { switch (code) { case goog.db.Error.ErrorCode.UNKNOWN_ERR: return goog.db.Error.ErrorName.UNKNOWN_ERR; case goog.db.Error.ErrorCode.NOT_FOUND_ERR: return goog.db.Error.ErrorName.NOT_FOUND_ERR; case goog.db.Error.ErrorCode.CONSTRAINT_ERR: return goog.db.Error.ErrorName.CONSTRAINT_ERR; case goog.db.Error.ErrorCode.DATA_ERR: return goog.db.Error.ErrorName.DATA_ERR; case goog.db.Error.ErrorCode.TRANSACTION_INACTIVE_ERR: return goog.db.Error.ErrorName.TRANSACTION_INACTIVE_ERR; case goog.db.Error.ErrorCode.ABORT_ERR: return goog.db.Error.ErrorName.ABORT_ERR; case goog.db.Error.ErrorCode.READ_ONLY_ERR: return goog.db.Error.ErrorName.READ_ONLY_ERR; case goog.db.Error.ErrorCode.TIMEOUT_ERR: return goog.db.Error.ErrorName.TIMEOUT_ERR; case goog.db.Error.ErrorCode.QUOTA_ERR: return goog.db.Error.ErrorName.QUOTA_EXCEEDED_ERR; case goog.db.Error.ErrorCode.INVALID_ACCESS_ERR: return goog.db.Error.ErrorName.INVALID_ACCESS_ERR; case goog.db.Error.ErrorCode.INVALID_STATE_ERR: return goog.db.Error.ErrorName.INVALID_STATE_ERR; default: return goog.db.Error.ErrorName.UNKNOWN_ERR; } }; /** * Constructs an goog.db.Error instance from an IDBRequest. This abstraction is * necessary to provide backwards compatibility with Chrome21. * * @param {!IDBRequest} request The request that failed. * @param {string} message The error message to add to err if it's wrapped. * @return {!goog.db.Error} The error that caused the failure. */ goog.db.Error.fromRequest = function(request, message) { if ('error' in request) { // Chrome 21 and before. return new goog.db.Error(request.error, message); } else if ('name' in request) { // Chrome 22+. var errorName = goog.db.Error.getName(request.errorCode); return new goog.db.Error( /**@type {!DOMError} */ ({name: errorName}), message); } else { return new goog.db.Error( /** @type {!DOMError} */ ({name: goog.db.Error.ErrorName.UNKNOWN_ERR}), message); } }; /** * Constructs an goog.db.Error instance from an DOMException. This abstraction * is necessary to provide backwards compatibility with Chrome21. * * @param {!IDBDatabaseException} ex The exception that was thrown. * @param {string} message The error message to add to err if it's wrapped. * @return {!goog.db.Error} The error that caused the failure. * @suppress {invalidCasts} The cast from IDBDatabaseException to DOMError * is invalid and will not compile. */ goog.db.Error.fromException = function(ex, message) { if ('name' in ex) { // Chrome 22+. var errorMessage = message + ': ' + ex.message; return new goog.db.Error(/** @type {!DOMError} */ (ex), errorMessage); } else if ('code' in ex) { // Chrome 21 and before. var errorName = goog.db.Error.getName(ex.code); var errorMessage = message + ': ' + ex.message; return new goog.db.Error( /** @type {!DOMError} */ ({name: errorName}), errorMessage); } else { return new goog.db.Error( /** @type {!DOMError} */ ({name: goog.db.Error.ErrorName.UNKNOWN_ERR}), message); } };
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Utils_1 = require("../Utils/Utils"); var HoverMode_1 = require("../../Enums/Modes/HoverMode"); var Mover = (function () { function Mover(container, particle) { this.container = container; this.particle = particle; } Mover.prototype.move = function (delta) { var _a; var container = this.container; var options = container.options; var particle = this.particle; if (options.particles.move.enable) { var slowFactor = this.getProximitySpeedFactor(); var deltaFactor = options.fpsLimit > 0 ? (60 * delta) / 1000 : 3.6; var baseSpeed = (_a = particle.moveSpeed) !== null && _a !== void 0 ? _a : container.retina.moveSpeed; var moveSpeed = baseSpeed / 2 * slowFactor * deltaFactor; particle.position.x += particle.velocity.horizontal * moveSpeed; particle.position.y += particle.velocity.vertical * moveSpeed; } this.moveParallax(); }; Mover.prototype.moveParallax = function () { var container = this.container; var options = container.options; if (!options.interactivity.events.onHover.parallax.enable) { return; } var particle = this.particle; var parallaxForce = options.interactivity.events.onHover.parallax.force; var mousePos = container.interactivity.mouse.position || { x: 0, y: 0 }; var windowDimension = { height: window.innerHeight / 2, width: window.innerWidth / 2, }; var parallaxSmooth = options.interactivity.events.onHover.parallax.smooth; var tmp = { x: (mousePos.x - windowDimension.width) * (particle.size.value / parallaxForce), y: (mousePos.y - windowDimension.height) * (particle.size.value / parallaxForce), }; particle.offset.x += (tmp.x - particle.offset.x) / parallaxSmooth; particle.offset.y += (tmp.y - particle.offset.y) / parallaxSmooth; }; Mover.prototype.getProximitySpeedFactor = function () { var container = this.container; var options = container.options; var particle = this.particle; var active = Utils_1.Utils.isInArray(HoverMode_1.HoverMode.slow, options.interactivity.events.onHover.mode); if (!active) { return 1; } var mousePos = this.container.interactivity.mouse.position; if (!mousePos) { return 1; } var particlePos = particle.position; var dist = Utils_1.Utils.getDistanceBetweenCoordinates(mousePos, particlePos); var radius = container.retina.slowModeRadius; if (dist > radius) { return 1; } var proximityFactor = (dist / radius) || 0; var slowFactor = options.interactivity.modes.slow.factor; return proximityFactor / slowFactor; }; return Mover; }()); exports.Mover = Mover;
/*! (c) 2014 - present: Jason Quense | https://github.com/jquense/react-widgets/blob/master/LICENSE.md */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("react"), require("react-dom")); else if(typeof define === 'function' && define.amd) define(["react", "react-dom"], factory); else if(typeof exports === 'object') exports["ReactWidgets"] = factory(require("react"), require("react-dom")); else root["ReactWidgets"] = factory(root["React"], root["ReactDOM"]); })(this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_5__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 63); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_0__; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process) {/** * Copyright 2013-present, 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. */ if (process.env.NODE_ENV !== 'production') { var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && Symbol.for && Symbol.for('react.element')) || 0xeac7; var isValidElement = function(object) { return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; }; // By explicitly using `prop-types` you are opting into new development behavior. // http://fb.me/prop-types-in-prod var throwOnDirectAccess = true; module.exports = __webpack_require__(66)(isValidElement, throwOnDirectAccess); } else { // By explicitly using `prop-types` you are opting into new production behavior. // http://fb.me/prop-types-in-prod module.exports = __webpack_require__(68)(); } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! Copyright (c) 2016 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ /* global define */ (function () { 'use strict'; var hasOwn = {}.hasOwnProperty; function classNames () { var classes = []; for (var i = 0; i < arguments.length; i++) { var arg = arguments[i]; if (!arg) continue; var argType = typeof arg; if (argType === 'string' || argType === 'number') { classes.push(arg); } else if (Array.isArray(arg)) { classes.push(classNames.apply(null, arg)); } else if (argType === 'object') { for (var key in arg) { if (hasOwn.call(arg, key) && arg[key]) { classes.push(key); } } } } return classes.join(' '); } if (typeof module !== 'undefined' && module.exports) { module.exports = classNames; } else if (true) { // register as 'classnames', consistent with npm package name !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () { return classNames; }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else { window.classNames = classNames; } }()); /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.message = exports.accessor = exports.disabled = exports.dateFormat = exports.numberFormat = exports.elementType = undefined; var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _elementType = __webpack_require__(84); var _elementType2 = _interopRequireDefault(_elementType); var _createChainableTypeChecker = __webpack_require__(57); var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker); var _localizers = __webpack_require__(6); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.elementType = _elementType2.default; var numberFormat = exports.numberFormat = (0, _createChainableTypeChecker2.default)(function () { return _localizers.number.propType.apply(_localizers.number, arguments); }); var dateFormat = exports.dateFormat = (0, _createChainableTypeChecker2.default)(function () { return _localizers.date.propType.apply(_localizers.date, arguments); }); var disabled = exports.disabled = (0, _createChainableTypeChecker2.default)(function () { return _propTypes2.default.bool.apply(_propTypes2.default, arguments); }); disabled.acceptsArray = _propTypes2.default.oneOfType([disabled, _propTypes2.default.array]); var accessor = exports.accessor = _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.func]); var message = exports.message = _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.string, _propTypes2.default.func]); /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.pick = pick; exports.pickElementProps = pickElementProps; exports.omitOwn = omitOwn; var whitelist = ['style', 'className', 'role', 'id', 'autocomplete', 'size', 'tabIndex', 'maxLength', 'name']; var whitelistRegex = [/^aria-/, /^data-/, /^on[A-Z]\w+/]; function pick(props, componentClass) { var keys = Object.keys(componentClass.propTypes); var result = {}; Object.keys(props).forEach(function (key) { if (keys.indexOf(key) === -1) return; result[key] = props[key]; }); return result; } function pickElementProps(component) { for (var _len = arguments.length, others = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { others[_key - 1] = arguments[_key]; } var props = omitOwn.apply(undefined, [component].concat(others)); var result = {}; Object.keys(props).forEach(function (key) { if (whitelist.indexOf(key) !== -1 || whitelistRegex.some(function (r) { return !!key.match(r); })) result[key] = props[key]; }); return result; } function omitOwn(component) { var initial = Object.keys(component.constructor.propTypes); for (var _len2 = arguments.length, others = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { others[_key2 - 1] = arguments[_key2]; } var keys = others.reduce(function (arr, compClass) { return [].concat(arr, Object.keys(compClass.propTypes)); }, initial); var result = {}; Object.keys(component.props).forEach(function (key) { if (keys.indexOf(key) !== -1) return; result[key] = component.props[key]; }); return result; } /***/ }), /* 5 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_5__; /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) { exports.__esModule = true; exports.setDate = exports.date = exports.setNumber = exports.number = undefined; var _invariant = __webpack_require__(26); var _invariant2 = _interopRequireDefault(_invariant); var _ = __webpack_require__(8); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var localePropType = _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.func]); var REQUIRED_NUMBER_FORMATS = ['default']; var REQUIRED_DATE_FORMATS = ['default', 'date', 'time', 'header', 'footer', 'dayOfMonth', 'month', 'year', 'decade', 'century']; var _numberLocalizer = createWrapper('NumberPicker'); var number = exports.number = { propType: function propType() { var _numberLocalizer2; return (_numberLocalizer2 = _numberLocalizer).propType.apply(_numberLocalizer2, arguments); }, getFormat: function getFormat(key, format) { return format || _numberLocalizer.formats[key]; }, parse: function parse() { var _numberLocalizer3; return (_numberLocalizer3 = _numberLocalizer).parse.apply(_numberLocalizer3, arguments); }, format: function format() { var _numberLocalizer4; return (_numberLocalizer4 = _numberLocalizer).format.apply(_numberLocalizer4, arguments); }, decimalChar: function decimalChar() { var _numberLocalizer5; return (_numberLocalizer5 = _numberLocalizer).decimalChar.apply(_numberLocalizer5, arguments); }, precision: function precision() { var _numberLocalizer6; return (_numberLocalizer6 = _numberLocalizer).precision.apply(_numberLocalizer6, arguments); } }; function setNumber(_ref) { var format = _ref.format, _parse = _ref.parse, formats = _ref.formats, _ref$propType = _ref.propType, propType = _ref$propType === undefined ? localePropType : _ref$propType, _ref$decimalChar = _ref.decimalChar, decimalChar = _ref$decimalChar === undefined ? function () { return '.'; } : _ref$decimalChar, _ref$precision = _ref.precision, precision = _ref$precision === undefined ? function () { return null; } : _ref$precision; checkFormats(REQUIRED_NUMBER_FORMATS, formats); _numberLocalizer = { formats: formats, precision: precision, decimalChar: decimalChar, propType: propType, format: wrapFormat(format), parse: function parse(value, culture, format) { var result = _parse.call(this, value, culture, format); !(result == null || typeof result === 'number') ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'number localizer `parse(..)` must return a number, null, or undefined') : (0, _invariant2.default)(false) : void 0; return result; } }; } exports.setNumber = setNumber; var _dateLocalizer = createWrapper('DateTimePicker'); var date = exports.date = { propType: function propType() { var _dateLocalizer2; return (_dateLocalizer2 = _dateLocalizer).propType.apply(_dateLocalizer2, arguments); }, getFormat: function getFormat(key, format) { return format || _dateLocalizer.formats[key]; }, parse: function parse() { var _dateLocalizer3; return (_dateLocalizer3 = _dateLocalizer).parse.apply(_dateLocalizer3, arguments); }, format: function format() { var _dateLocalizer4; return (_dateLocalizer4 = _dateLocalizer).format.apply(_dateLocalizer4, arguments); }, firstOfWeek: function firstOfWeek() { var _dateLocalizer5; return (_dateLocalizer5 = _dateLocalizer).firstOfWeek.apply(_dateLocalizer5, arguments); } }; function setDate(_ref2) { var formats = _ref2.formats, format = _ref2.format, _parse2 = _ref2.parse, firstOfWeek = _ref2.firstOfWeek, _ref2$propType = _ref2.propType, propType = _ref2$propType === undefined ? localePropType : _ref2$propType; checkFormats(REQUIRED_DATE_FORMATS, formats); _dateLocalizer = { formats: formats, propType: propType, firstOfWeek: firstOfWeek, format: wrapFormat(format), parse: function parse(value, culture) { var result = _parse2.call(this, value, culture); !(result == null || result instanceof Date && !isNaN(result.getTime())) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'date localizer `parse(..)` must return a valid Date, null, or undefined') : (0, _invariant2.default)(false) : void 0; return result; } }; } exports.setDate = setDate; var wrapFormat = function wrapFormat(formatter) { return function (value, format, culture) { var result = typeof format === 'function' ? format(value, culture, this) : formatter.call(this, value, format, culture); !(result == null || typeof result === 'string') ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, '`localizer format(..)` must return a string, null, or undefined') : (0, _invariant2.default)(false) : void 0; return result; }; }; function checkFormats(required, formats) { if (process.env.NODE_ENV !== 'production') required.forEach(function (f) { return !(0, _.has)(formats, f) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'localizer missing required format: `%s`', f) : (0, _invariant2.default)(false) : void 0; }); } function createWrapper() { var dummy = {}; if (process.env.NODE_ENV !== 'production') { ['formats', 'parse', 'format', 'firstOfWeek', 'precision', 'propType'].forEach(function (name) { return Object.defineProperty(dummy, name, { enumerable: true, get: function get() { throw new Error('[React Widgets] You are attempting to use a widget that requires localization ' + '(Calendar, DateTimePicker, NumberPicker). ' + 'However there is no localizer set. Please configure a localizer. \n\n' + 'see http://jquense.github.io/react-widgets/docs/#/i18n for more info.'); } }); }); } return dummy; } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), /* 7 */ /***/ (function(module, exports) { // shim for using process in browser var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) { exports.__esModule = true; exports.has = exports.makeArray = undefined; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; exports.isShallowEqual = isShallowEqual; exports.chunk = chunk; exports.groupBySortedKeys = groupBySortedKeys; var _warning = __webpack_require__(65); var _warning2 = _interopRequireDefault(_warning); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var makeArray = exports.makeArray = function makeArray(obj) { return obj == null ? [] : [].concat(obj); }; var has = exports.has = function has(o, k) { return o ? Object.prototype.hasOwnProperty.call(o, k) : false; }; function isShallowEqual(a, b) { if (a === b) return true; if (a instanceof Date && b instanceof Date) return +a === +b; if ((typeof a === 'undefined' ? 'undefined' : _typeof(a)) !== 'object' && (typeof b === 'undefined' ? 'undefined' : _typeof(b)) !== 'object') return a === b; if ((typeof a === 'undefined' ? 'undefined' : _typeof(a)) !== (typeof b === 'undefined' ? 'undefined' : _typeof(b))) return false; if (a == null || b == null) return false; // if they were both null we wouldn't be here var keysA = Object.keys(a); var keysB = Object.keys(b); if (keysA.length !== keysB.length) return false; for (var i = 0; i < keysA.length; i++) { if (!has(b, keysA[i]) || a[keysA[i]] !== b[keysA[i]]) return false; }return true; } function chunk(array, chunkSize) { var index = 0, length = array ? array.length : 0; var result = []; chunkSize = Math.max(+chunkSize || 1, 1); while (index < length) { result.push(array.slice(index, index += chunkSize)); }return result; } function groupBySortedKeys(groupBy, data, keys) { var iter = typeof groupBy === 'function' ? groupBy : function (item) { return item[groupBy]; }; // the keys array ensures that groups are rendered in the order they came in // which means that if you sort the data array it will render sorted, // so long as you also sorted by group keys = keys || []; process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(typeof groupBy !== 'string' || !data.length || has(data[0], groupBy), '[React Widgets] You seem to be trying to group this list by a ' + ('property `' + groupBy + '` that doesn\'t exist in the dataset items, this may be a typo')) : void 0; return data.reduce(function (grps, item) { var group = iter(item); if (has(grps, group)) { grps[group].push(item); } else { keys.push(group); grps[group] = [item]; } return grps; }, {}); } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.mixin = exports.spyOnComponent = exports.timeoutManager = exports.mountManager = exports.focusManager = exports.autoFocus = undefined; var _spyOnComponent = __webpack_require__(28); var _spyOnComponent2 = _interopRequireDefault(_spyOnComponent); var _autoFocus = __webpack_require__(70); var _autoFocus2 = _interopRequireDefault(_autoFocus); var _focusManager = __webpack_require__(71); var _focusManager2 = _interopRequireDefault(_focusManager); var _mountManager = __webpack_require__(39); var _mountManager2 = _interopRequireDefault(_mountManager); var _timeoutManager = __webpack_require__(47); var _timeoutManager2 = _interopRequireDefault(_timeoutManager); var _mixin = __webpack_require__(72); var _mixin2 = _interopRequireDefault(_mixin); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.autoFocus = _autoFocus2.default; exports.focusManager = _focusManager2.default; exports.mountManager = _mountManager2.default; exports.timeoutManager = _timeoutManager2.default; exports.spyOnComponent = _spyOnComponent2.default; exports.mixin = _mixin2.default; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.notify = notify; exports.instanceId = instanceId; exports.isFirstFocusedRender = isFirstFocusedRender; var idCount = 0; function uniqueId(prefix) { return '' + ((prefix == null ? '' : prefix) + ++idCount); } function notify(handler, args) { handler && handler.apply(null, [].concat(args)); } function instanceId(component) { var suffix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; component.__id || (component.__id = uniqueId('rw_')); return (component.props.id || component.__id) + suffix; } function isFirstFocusedRender(component) { return component._firstFocus || component.state.focused && (component._firstFocus = true); } /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = !!(typeof window !== 'undefined' && window.document && window.document.createElement); module.exports = exports['default']; /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.getMessages = getMessages; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var messages = { moveBack: 'Navigate back', moveForward: 'Navigate forward', dateButton: 'Select date', timeButton: 'Select time', openCombobox: 'open combobox', openDropdown: 'open dropdown', placeholder: '', filterPlaceholder: '', emptyList: 'There are no items in this list', emptyFilter: 'The filter returned no results', createOption: function createOption(_ref) { var searchTerm = _ref.searchTerm; return [' Create option', searchTerm && ' ', searchTerm && _react2.default.createElement( 'strong', { key: '_' }, '"' + searchTerm + '"' )]; }, tagsLabel: 'Selected items', removeLabel: 'Remove selected item', noneSelected: 'no selected items', selectedItems: function selectedItems(labels) { return 'Selected items: ' + labels.join(', '); }, // number increment: 'Increment value', decrement: 'Decrement value' }; function getMessages() { var defaults = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var processed = {}; Object.keys(messages).forEach(function (message) { var value = defaults[message]; if (value == null) value = messages[message]; processed[message] = typeof value === 'function' ? value : function () { return value; }; }); return processed; } /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.disabledManager = exports.widgetEditable = exports.widgetEnabled = exports.isInDisabledFieldset = undefined; var _reactDom = __webpack_require__(5); var _matches = __webpack_require__(60); var _matches2 = _interopRequireDefault(_matches); var _reactComponentManagers = __webpack_require__(9); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var isInDisabledFieldset = exports.isInDisabledFieldset = function isInDisabledFieldset(inst) { var node = void 0; try { node = (0, _reactDom.findDOMNode)(inst); } catch (err) {/* ignore */} return !!node && (0, _matches2.default)(node, 'fieldset[disabled] *'); }; var widgetEnabled = exports.widgetEnabled = interactionDecorator(true); var widgetEditable = exports.widgetEditable = interactionDecorator(false); function interactionDecorator(disabledOnly) { function wrap(method) { return function decoratedMethod() { var _props = this.props, disabled = _props.disabled, readOnly = _props.readOnly; disabled = isInDisabledFieldset(this) || disabled == true || !disabledOnly && readOnly === true; for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } if (!disabled) return method.apply(this, args); }; } return function decorate(target, key, desc) { if (desc.initializer) { var init = desc.initializer; desc.initializer = function () { return wrap(init.call(this)).bind(this); }; } else desc.value = wrap(desc.value); return desc; }; } var disabledManager = exports.disabledManager = function disabledManager(component) { var mounted = false; var isInFieldSet = false; var useCached = false; (0, _reactComponentManagers.spyOnComponent)(component, { componentDidMount: function componentDidMount() { mounted = true; // becasue we can't access a dom node in the first render we need to // render again if the component was disabled via a fieldset if (isInDisabledFieldset(this)) this.forceUpdate(); }, componentWillUpdate: function componentWillUpdate() { isInFieldSet = mounted && isInDisabledFieldset(component); useCached = mounted; }, componentDidUpdate: function componentDidUpdate() { useCached = false; }, componentWillUnmount: function componentWillUnmount() { component = null; } }); return function () { return component.props.disabled === true || (useCached ? isInFieldSet : mounted && isInDisabledFieldset(component)) || component.props.disabled // return the prop if nothing is true in case it's an array ; }; }; /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _dateArithmetic = __webpack_require__(96); var _dateArithmetic2 = _interopRequireDefault(_dateArithmetic); var _constants = __webpack_require__(35); var _localizers = __webpack_require__(6); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var dates = _extends({}, _dateArithmetic2.default, { monthsInYear: function monthsInYear(year) { var date = new Date(year, 0, 1); return [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map(function (i) { return dates.month(date, i); }); }, firstVisibleDay: function firstVisibleDay(date, culture) { var firstOfMonth = dates.startOf(date, 'month'); return dates.startOf(firstOfMonth, 'week', _localizers.date.firstOfWeek(culture)); }, lastVisibleDay: function lastVisibleDay(date, culture) { var endOfMonth = dates.endOf(date, 'month'); return dates.endOf(endOfMonth, 'week', _localizers.date.firstOfWeek(culture)); }, visibleDays: function visibleDays(date, culture) { var current = dates.firstVisibleDay(date, culture); var last = dates.lastVisibleDay(date, culture); var days = []; while (dates.lte(current, last, 'day')) { days.push(current); current = dates.add(current, 1, 'day'); } return days; }, move: function move(date, min, max, unit, direction) { var isMonth = unit === 'month'; var isUpOrDown = direction === _constants.directions.UP || direction === _constants.directions.DOWN; var rangeUnit = _constants.calendarViewUnits[unit]; var addUnit = isMonth && isUpOrDown ? 'week' : _constants.calendarViewUnits[unit]; var amount = isMonth || !isUpOrDown ? 1 : 4; var newDate = void 0; if (direction === _constants.directions.UP || direction === _constants.directions.LEFT) amount *= -1; newDate = dates.add(date, amount, addUnit); return dates.inRange(newDate, min, max, rangeUnit) ? newDate : date; }, merge: function merge(date, time, defaultDate) { if (time == null && date == null) return null; if (time == null) time = defaultDate || new Date(); if (date == null) date = defaultDate || new Date(); date = dates.startOf(date, 'day'); date = dates.hours(date, dates.hours(time)); date = dates.minutes(date, dates.minutes(time)); date = dates.seconds(date, dates.seconds(time)); return dates.milliseconds(date, dates.milliseconds(time)); }, today: function today() { return dates.startOf(new Date(), 'day'); }, tomorrow: function tomorrow() { return dates.add(dates.startOf(new Date(), 'day'), 1, 'day'); } }); exports.default = dates; module.exports = exports['default']; /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _createUncontrollable = __webpack_require__(73); var _createUncontrollable2 = _interopRequireDefault(_createUncontrollable); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var mixin = { shouldComponentUpdate: function shouldComponentUpdate() { //let the forceUpdate trigger the update return !this._notifying; } }; function set(component, propName, handler, value, args) { if (handler) { component._notifying = true; handler.call.apply(handler, [component, value].concat(args)); component._notifying = false; } component._values[propName] = value; if (!component.unmounted) component.forceUpdate(); } exports.default = (0, _createUncontrollable2.default)(mixin, set); module.exports = exports['default']; /***/ }), /* 16 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _temp; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 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; } var Widget = (_temp = _class = function (_React$Component) { _inherits(Widget, _React$Component); function Widget() { _classCallCheck(this, Widget); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } Widget.prototype.render = function render() { var _props = this.props, className = _props.className, tabIndex = _props.tabIndex, focused = _props.focused, open = _props.open, dropUp = _props.dropUp, disabled = _props.disabled, readOnly = _props.readOnly, props = _objectWithoutProperties(_props, ['className', 'tabIndex', 'focused', 'open', 'dropUp', 'disabled', 'readOnly']); var isRtl = !!this.context.isRtl; tabIndex = tabIndex != null ? tabIndex : '-1'; return _react2.default.createElement('div', _extends({}, props, { tabIndex: tabIndex, className: (0, _classnames2.default)(className, 'rw-widget', isRtl && 'rw-rtl', disabled && 'rw-state-disabled', readOnly && 'rw-state-readonly', focused && 'rw-state-focus', open && 'rw-open' + (dropUp ? '-up' : '')) })); }; return Widget; }(_react2.default.Component), _class.propTypes = { tabIndex: _propTypes2.default.node, focused: _propTypes2.default.bool, disabled: _propTypes2.default.bool, readOnly: _propTypes2.default.bool, open: _propTypes2.default.bool, dropUp: _propTypes2.default.bool }, _class.contextTypes = { isRtl: _propTypes2.default.bool }, _temp); exports.default = Widget; module.exports = exports['default']; /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; exports.default = createFocusManager; var _reactComponentManagers = __webpack_require__(9); var _interaction = __webpack_require__(13); function createFocusManager(component, options) { var _didHandle = options.didHandle; return (0, _reactComponentManagers.focusManager)(component, _extends({}, options, { onChange: function onChange(focused) { component.setState({ focused: focused }); }, isDisabled: function isDisabled() { return (0, _interaction.isInDisabledFieldset)(component) || component.props.disabled === true; }, didHandle: function didHandle(focused, event) { var handler = this.props[focused ? 'onFocus' : 'onBlur']; handler && handler(event); if (_didHandle && !event.isWidgetDefaultPrevented) _didHandle(focused, event); } })); } module.exports = exports['default']; /***/ }), /* 18 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactComponentManagers = __webpack_require__(9); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = (0, _reactComponentManagers.mixin)({ propTypes: { isRtl: _propTypes2.default.bool }, contextTypes: { isRtl: _propTypes2.default.bool }, childContextTypes: { isRtl: _propTypes2.default.bool }, getChildContext: function getChildContext() { return { isRtl: this.isRtl() }; }, isRtl: function isRtl() { return !!(this.props.isRtl || this.context && this.context.isRtl); } }); module.exports = exports['default']; /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _temp; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 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; } var Button = (_temp = _class = function (_React$Component) { _inherits(Button, _React$Component); function Button() { _classCallCheck(this, Button); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } Button.prototype.render = function render() { var _props = this.props, className = _props.className, disabled = _props.disabled, label = _props.label, icon = _props.icon, busy = _props.busy, active = _props.active, children = _props.children, _props$variant = _props.variant, variant = _props$variant === undefined ? 'primary' : _props$variant, _props$component = _props.component, Tag = _props$component === undefined ? 'button' : _props$component, props = _objectWithoutProperties(_props, ['className', 'disabled', 'label', 'icon', 'busy', 'active', 'children', 'variant', 'component']); var type = props.type; if (Tag === 'button') type = type || 'button'; return _react2.default.createElement( Tag, _extends({}, props, { tabIndex: '-1', title: label, type: type, disabled: disabled, 'aria-disabled': disabled, 'aria-label': label, className: (0, _classnames2.default)(className, 'rw-btn', active && !disabled && 'rw-state-active', variant && 'rw-btn-' + variant) }), (icon || busy) && _react2.default.createElement('span', { 'aria-hidden': 'true', className: (0, _classnames2.default)('rw-i', 'rw-i-' + icon, busy && 'rw-loading') }), children ); }; return Button; }(_react2.default.Component), _class.propTypes = { disabled: _propTypes2.default.bool, label: _propTypes2.default.string, icon: _propTypes2.default.string, busy: _propTypes2.default.bool, active: _propTypes2.default.bool, variant: _propTypes2.default.oneOf(['primary', 'select']), component: _propTypes2.default.any }, _temp); exports.default = Button; module.exports = exports['default']; /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; exports.normalizeComponent = normalizeComponent; exports.defaultGetDataState = defaultGetDataState; exports.default = listDataManager; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _reactComponentManagers = __webpack_require__(9); var _Filter = __webpack_require__(32); var _ = __webpack_require__(8); var _accessorManager = __webpack_require__(24); var _accessorManager2 = _interopRequireDefault(_accessorManager); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } var EMPTY_VALUE = {}; function normalizeComponent(Component) { return function (itemProps) { return Component ? _react2.default.createElement(Component, itemProps) : itemProps.text || itemProps.item; }; } function defaultGetDataState(data, _ref) { var groupBy = _ref.groupBy; var lastState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; if (lastState.data !== data || lastState.groupBy !== groupBy) { if (!groupBy) return {}; var keys = []; var groups = (0, _.groupBySortedKeys)(groupBy, data, keys); return { data: data, groupBy: groupBy, groups: groups, sortedKeys: keys, sequentialData: Object.keys(groups).reduce(function (flat, grp) { return flat.concat(groups[grp]); }, []) }; } return lastState; } function defaultGetStateGetterFromList(_ref2) { var listComponent = _ref2.listComponent; return listComponent && listComponent.getDataState; } function listDataManager(component) { var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, getDataState = _ref3.getDataState, getStateGetterFromProps = _ref3.getStateGetterFromProps, _ref3$accessors = _ref3.accessors, accessors = _ref3$accessors === undefined ? (0, _accessorManager2.default)(component) : _ref3$accessors; var listData = void 0; var listState = void 0; var needsUpdate = true; var currentProps = component.props; if (getDataState) getStateGetterFromProps = null;else { if (!getStateGetterFromProps) getStateGetterFromProps = defaultGetStateGetterFromList; getDataState = getStateGetterFromProps(currentProps) || defaultGetDataState; } (0, _reactComponentManagers.spyOnComponent)(component, { componentWillReceiveProps: function componentWillReceiveProps(nextProps) { if (!needsUpdate) needsUpdate = nextProps !== currentProps; currentProps = nextProps; if (needsUpdate && getStateGetterFromProps) { getDataState = getStateGetterFromProps(currentProps) || defaultGetDataState; } }, componentWillUnmount: function componentWillUnmount() { listData = null; listState = null; currentProps = null; getDataState = null; getStateGetterFromProps = null; } }); function isDisabled(item) { var disabled = currentProps.disabled; if (!Array.isArray(disabled)) return false; return disabled.some(function (disabled) { return accessors.value(item) === accessors.value(disabled); }); } function getMatcher(word) { if (!word) return function () { return true; }; word = word.toLowerCase(); return function (item) { return _Filter.presets.startsWith(accessors.text(item).toLowerCase(), word); }; } function getSequentialData() { var state = manager.getState(); return state && state.sequentialData || listData; } var renderItem = function renderItem(_ref4) { var item = _ref4.item, rest = _objectWithoutProperties(_ref4, ['item']); // eslint-disable-line react/prop-types var Component = currentProps.itemComponent; return Component ? _react2.default.createElement(Component, _extends({ item: item, value: accessors.value(item), text: accessors.text(item), disabled: isDisabled(item) }, rest)) : accessors.text(item); }; var renderGroup = function renderGroup(_ref5) { var group = _ref5.group; // eslint-disable-line react/prop-types var Component = currentProps.groupComponent; return Component ? _react2.default.createElement(Component, { item: group }) : group; }; var manager = { isDisabled: isDisabled, first: function first() { return manager.next(EMPTY_VALUE); }, last: function last() { var data = getSequentialData(); return manager.prevEnabled(data[data.length - 1]); }, prevEnabled: function prevEnabled(item) { return isDisabled(item) ? manager.prev(item) : item; }, prev: function prev(item, word) { var data = getSequentialData(); var matches = getMatcher(word); var nextIdx = data.indexOf(item); if (nextIdx < 0 || nextIdx == null) nextIdx = 0; nextIdx--; while (nextIdx > -1 && (isDisabled(data[nextIdx]) || !matches(data[nextIdx]))) { nextIdx--; }if (nextIdx >= 0) return data[nextIdx]; if (!manager.isDisabled(item)) return item; }, next: function next(item, word) { var data = getSequentialData(); var matches = getMatcher(word); var nextIdx = data.indexOf(item) + 1; var len = data.length; while (nextIdx < len && (isDisabled(data[nextIdx]) || !matches(data[nextIdx]))) { nextIdx++; }if (nextIdx < len) return data[nextIdx]; if (!manager.isDisabled(item)) return item; }, nextEnabled: function nextEnabled(item) { return isDisabled(item) ? manager.next(item) : item; }, setData: function setData(data) { if (!needsUpdate) needsUpdate = data !== listData; listData = data; }, getState: function getState() { if (needsUpdate) { needsUpdate = false; listState = getDataState(listData, currentProps, listState); } return listState; }, defaultProps: function defaultProps() { var _currentProps = currentProps, groupBy = _currentProps.groupBy, optionComponent = _currentProps.optionComponent, searchTerm = _currentProps.searchTerm; return _extends({ groupBy: groupBy, renderItem: renderItem, renderGroup: renderGroup, searchTerm: searchTerm, optionComponent: optionComponent, isDisabled: isDisabled }, currentProps.listProps, { data: listData, dataState: manager.getState() }); } }; return manager; } /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _temp; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 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; } var WidgetPicker = (_temp = _class = function (_React$Component) { _inherits(WidgetPicker, _React$Component); function WidgetPicker() { _classCallCheck(this, WidgetPicker); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } WidgetPicker.prototype.render = function render() { var _props = this.props, open = _props.open, dropUp = _props.dropUp, className = _props.className, disabled = _props.disabled, readOnly = _props.readOnly, focused = _props.focused, props = _objectWithoutProperties(_props, ['open', 'dropUp', 'className', 'disabled', 'readOnly', 'focused']); var openClass = 'rw-open' + (dropUp ? '-up' : ''); return _react2.default.createElement('div', _extends({}, props, { className: (0, _classnames2.default)(className, 'rw-widget-picker', 'rw-widget-container', open && openClass, disabled && 'rw-state-disabled', readOnly && 'rw-state-readonly', focused && 'rw-state-focus') })); }; return WidgetPicker; }(_react2.default.Component), _class.propTypes = { tabIndex: _propTypes2.default.node, focused: _propTypes2.default.bool, disabled: _propTypes2.default.bool, readOnly: _propTypes2.default.bool, open: _propTypes2.default.bool, dropUp: _propTypes2.default.bool, picker: _propTypes2.default.bool }, _temp); exports.default = WidgetPicker; module.exports = exports['default']; /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _temp; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); var _Button = __webpack_require__(19); var _Button2 = _interopRequireDefault(_Button); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 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; } var Select = (_temp = _class = function (_React$Component) { _inherits(Select, _React$Component); function Select() { _classCallCheck(this, Select); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } Select.prototype.render = function render() { var _props = this.props, className = _props.className, bordered = _props.bordered, children = _props.children, props = _objectWithoutProperties(_props, ['className', 'bordered', 'children']); return _react2.default.createElement( 'span', { className: (0, _classnames2.default)(className, 'rw-select', bordered && 'rw-select-bordered') }, children ? _react2.default.Children.map(children, function (child) { return child && _react2.default.cloneElement(child, { variant: 'select' }); }) : _react2.default.createElement(_Button2.default, _extends({}, props, { variant: 'select' })) ); }; return Select; }(_react2.default.Component), _class.propTypes = { bordered: _propTypes2.default.bool }, _temp); exports.default = Select; module.exports = exports['default']; /***/ }), /* 23 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _temp; var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(5); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); var _Props = __webpack_require__(4); var Props = _interopRequireWildcard(_Props); var _widgetHelpers = __webpack_require__(10); var _listDataManager = __webpack_require__(20); var _Listbox = __webpack_require__(58); var _Listbox2 = _interopRequireDefault(_Listbox); var _ListOption = __webpack_require__(42); var _ListOption2 = _interopRequireDefault(_ListOption); var _ListOptionGroup = __webpack_require__(85); var _ListOptionGroup2 = _interopRequireDefault(_ListOptionGroup); var _messages = __webpack_require__(12); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } 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; } var EMPTY_DATA_STATE = {}; var propTypes = { data: _propTypes2.default.array, dataState: _propTypes2.default.shape({ sortedKeys: _propTypes2.default.array, groups: _propTypes2.default.object, data: _propTypes2.default.array, sequentialData: _propTypes2.default.array }), onSelect: _propTypes2.default.func, onMove: _propTypes2.default.func, activeId: _propTypes2.default.string, optionComponent: CustomPropTypes.elementType, renderItem: _propTypes2.default.func.isRequired, renderGroup: _propTypes2.default.func, focusedItem: _propTypes2.default.any, selectedItem: _propTypes2.default.any, searchTerm: _propTypes2.default.string, isDisabled: _propTypes2.default.func.isRequired, groupBy: CustomPropTypes.accessor, messages: _propTypes2.default.shape({ emptyList: _propTypes2.default.func.isRequired }) }; var defaultProps = { onSelect: function onSelect() {}, data: [], dataState: EMPTY_DATA_STATE, optionComponent: _ListOption2.default }; var List = (_temp = _class = function (_React$Component) { _inherits(List, _React$Component); function List() { _classCallCheck(this, List); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } List.prototype.componentDidMount = function componentDidMount() { this.move(); }; List.prototype.componentDidUpdate = function componentDidUpdate() { this.move(); }; List.prototype.mapItems = function mapItems(fn) { var _props = this.props, data = _props.data, dataState = _props.dataState; var sortedKeys = dataState.sortedKeys, groups = dataState.groups; if (!groups) return data.map(function (item, idx) { return fn(item, idx, false); }); var idx = -1; return sortedKeys.reduce(function (items, key) { var group = groups[key]; return items.concat(fn(key, idx, true), group.map(function (item) { return fn(item, ++idx, false); })); }, []); }; List.prototype.render = function render() { var _this2 = this; var _props2 = this.props, className = _props2.className, messages = _props2.messages; var elementProps = Props.pickElementProps(this); var _getMessages = (0, _messages.getMessages)(messages), emptyList = _getMessages.emptyList; return _react2.default.createElement( _Listbox2.default, _extends({}, elementProps, { className: className, emptyListMessage: emptyList(this.props) }), this.mapItems(function (item, idx, isHeader) { return isHeader ? _this2.renderGroupHeader(item) : _this2.renderItem(item, idx); }) ); }; List.prototype.renderGroupHeader = function renderGroupHeader(group) { var renderGroup = this.props.renderGroup; return _react2.default.createElement( _ListOptionGroup2.default, { key: 'group_' + group, group: group }, renderGroup({ group: group }) ); }; List.prototype.renderItem = function renderItem(item, index) { var _props3 = this.props, activeId = _props3.activeId, focusedItem = _props3.focusedItem, selectedItem = _props3.selectedItem, onSelect = _props3.onSelect, isDisabled = _props3.isDisabled, renderItem = _props3.renderItem, Option = _props3.optionComponent; var isFocused = focusedItem === item; return _react2.default.createElement( Option, { dataItem: item, key: 'item_' + index, index: index, activeId: activeId, focused: isFocused, onSelect: onSelect, disabled: isDisabled(item), selected: selectedItem === item }, renderItem({ item: item, index: index }) ); }; List.prototype.move = function move() { var _props4 = this.props, focusedItem = _props4.focusedItem, onMove = _props4.onMove, data = _props4.data, dataState = _props4.dataState; var list = (0, _reactDom.findDOMNode)(this); var idx = renderedIndexOf(focusedItem, list, data, dataState); var selectedItem = list.children[idx]; if (selectedItem) (0, _widgetHelpers.notify)(onMove, [selectedItem, list, focusedItem]); }; return List; }(_react2.default.Component), _class.getDataState = _listDataManager.defaultGetDataState, _temp); function renderedIndexOf(item, list, data, dataState) { var groups = dataState.groups, sortedKeys = dataState.sortedKeys; if (!groups) return data.indexOf(item); var runningIdx = -1; var idx = -1; sortedKeys.some(function (group) { var itemIdx = groups[group].indexOf(item); runningIdx++; if (itemIdx !== -1) { idx = runningIdx + itemIdx + 1; return true; } runningIdx += groups[group].length; }); return idx; } List.propTypes = propTypes; List.defaultProps = defaultProps; exports.default = List; module.exports = exports['default']; /***/ }), /* 24 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.default = createAccessorManager; var _reactComponentManagers = __webpack_require__(9); var _dataHelpers = __webpack_require__(33); var helpers = _interopRequireWildcard(_dataHelpers); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function createAccessorManager(component) { var _component$props = component.props, textField = _component$props.textField, valueField = _component$props.valueField; (0, _reactComponentManagers.spyOnComponent)(component, { componentWillReceiveProps: function componentWillReceiveProps(props) { textField = props.textField; valueField = props.valueField; } }); return { text: function text(item) { return helpers.dataText(item, textField); }, value: function value(item) { return helpers.dataValue(item, valueField); }, indexOf: function indexOf(data, item) { return helpers.dataIndexOf(data, item, valueField); }, matches: function matches(a, b) { return helpers.valueMatcher(a, b, valueField); }, findOrSelf: function findOrSelf(data, item) { return helpers.dataItem(data, item, valueField); }, find: function find(data, item) { var idx = helpers.dataIndexOf(data, item, valueField); if (~idx) { return data[idx]; } } }; } module.exports = exports['default']; /***/ }), /* 25 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.default = createScrollManager; var _scrollTo = __webpack_require__(87); var _scrollTo2 = _interopRequireDefault(_scrollTo); var _reactComponentManagers = __webpack_require__(9); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function createScrollManager(component) { var getScrollParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (list) { return list.parentNode; }; var currentFocused = void 0, currentVisible = void 0, cancelScroll = void 0; var onMove = component.props.onMove; var mounted = true; (0, _reactComponentManagers.spyOnComponent)(component, { componentWillReceiveProps: function componentWillReceiveProps(_ref) { var nextOnMove = _ref.onMove; onMove = nextOnMove; }, componentWillUnmount: function componentWillUnmount() { mounted = false; } }); return function (selected, list, nextFocused) { if (!mounted) return; var lastVisible = currentVisible; var lastItem = currentFocused; var shown = void 0, changed = void 0; currentVisible = !(!list.offsetWidth || !list.offsetHeight); currentFocused = nextFocused; changed = lastItem !== nextFocused; shown = currentVisible && !lastVisible; if (shown || currentVisible && changed) { if (onMove) onMove(selected, list, nextFocused);else { cancelScroll && cancelScroll(); cancelScroll = (0, _scrollTo2.default)(selected, false && getScrollParent(list)); } } }; } module.exports = exports['default']; /***/ }), /* 26 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) {/** * 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. */ /** * 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 (process.env.NODE_ENV !== 'production') { 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( format.replace(/%s/g, function() { return args[argIndex++]; }) ); error.name = 'Invariant Violation'; } error.framesToPop = 1; // we don't care about invariant's own frame throw error; } }; module.exports = invariant; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), /* 27 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = activeElement; var _ownerDocument = __webpack_require__(46); var _ownerDocument2 = _interopRequireDefault(_ownerDocument); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function activeElement() { var doc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0, _ownerDocument2.default)(); try { return doc.activeElement; } catch (e) {/* ie throws if no active element */} } module.exports = exports['default']; /***/ }), /* 28 */ /***/ (function(module, exports) { var LIFECYCLE_HOOKS = { componentWillMount: true, componentDidMount: true, componentWillReceiveProps: true, shouldComponentUpdate: true, componentWillUpdate: true, componentDidUpdate: true, componentWillUnmount: true, } function wrap(base, method) { var before = true; if (Array.isArray(method)) { before = method[0] !== 'after' method = method[1] } if (!base) return method; return function wrappedLifecyclehook() { before && method.apply(this, arguments) base.apply(this, arguments) !before && method.apply(this, arguments) } } module.exports = function spyOnComponent(component, hooks) { var originals = Object.create(null); for (var key in hooks) if (LIFECYCLE_HOOKS[key]) component[key] = wrap( originals[key] = component[key], hooks[key] ) return function reset(key) { if (key && {}.hasOwnProperty.call(originals, key)) component[key] = originals[key] else for (var key in originals) component[key] = originals[key] } } /***/ }), /* 29 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class2, _temp2; var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _SlideDownTransition = __webpack_require__(48); var _SlideDownTransition2 = _interopRequireDefault(_SlideDownTransition); var _PropTypes = __webpack_require__(3); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 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; } var StaticContainer = function (_React$Component) { _inherits(StaticContainer, _React$Component); function StaticContainer() { var _temp, _this, _ret; _classCallCheck(this, StaticContainer); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.shouldComponentUpdate = function (_ref) { var shouldUpdate = _ref.shouldUpdate; return !!shouldUpdate; }, _this.render = function () { return _this.props.children; }, _temp), _possibleConstructorReturn(_this, _ret); } return StaticContainer; }(_react2.default.Component); var Popup = (_temp2 = _class2 = function (_React$Component2) { _inherits(Popup, _React$Component2); function Popup() { _classCallCheck(this, Popup); return _possibleConstructorReturn(this, _React$Component2.apply(this, arguments)); } Popup.prototype.render = function render() { var _props = this.props, className = _props.className, dropUp = _props.dropUp, open = _props.open, Transition = _props.transition, props = _objectWithoutProperties(_props, ['className', 'dropUp', 'open', 'transition']); var child = _react2.default.Children.only(this.props.children); return _react2.default.createElement( Transition, _extends({}, props, { 'in': open, dropUp: dropUp, className: (0, _classnames2.default)(className, 'rw-popup-container') }), _react2.default.createElement( StaticContainer, { shouldUpdate: open }, (0, _react.cloneElement)(child, { className: (0, _classnames2.default)(child.props.className, 'rw-popup') }) ) ); }; return Popup; }(_react2.default.Component), _class2.propTypes = { open: _propTypes2.default.bool, dropUp: _propTypes2.default.bool, onEntering: _propTypes2.default.func, onEntered: _propTypes2.default.func, transition: _PropTypes.elementType }, _class2.defaultProps = { open: false, transition: _SlideDownTransition2.default }, _temp2); exports.default = Popup; module.exports = exports['default']; /***/ }), /* 30 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = height; var _offset = __webpack_require__(55); var _offset2 = _interopRequireDefault(_offset); var _isWindow = __webpack_require__(31); var _isWindow2 = _interopRequireDefault(_isWindow); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function height(node, client) { var win = (0, _isWindow2.default)(node); return win ? win.innerHeight : client ? node.clientHeight : (0, _offset2.default)(node).height; } module.exports = exports['default']; /***/ }), /* 31 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = getWindow; function getWindow(node) { return node === node.window ? node : node.nodeType === 9 ? node.defaultView || node.parentWindow : false; } module.exports = exports["default"]; /***/ }), /* 32 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.propTypes = exports.presets = undefined; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; exports.indexOf = indexOf; exports.filter = filter; exports.suggest = suggest; var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); var _dataHelpers = __webpack_require__(33); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } var presets = exports.presets = { eq: function eq(a, b) { return a === b; }, neq: function neq(a, b) { return a !== b; }, gt: function gt(a, b) { return a > b; }, gte: function gte(a, b) { return a >= b; }, lt: function lt(a, b) { return a < b; }, lte: function lte(a, b) { return a <= b; }, contains: function contains(a, b) { return a.indexOf(b) !== -1; }, startsWith: function startsWith(a, b) { return a.lastIndexOf(b, 0) === 0; }, endsWith: function endsWith(a, b) { var pos = a.length - b.length; var lastIndex = a.indexOf(b, pos); return lastIndex !== -1 && lastIndex === pos; } }; function normalizeFilterType(type) { if (type === false) return null; if (type === true) return 'startsWith'; return type || 'eq'; } function normalizeFilter(_ref) { var filter = _ref.filter, _ref$caseSensitive = _ref.caseSensitive, caseSensitive = _ref$caseSensitive === undefined ? false : _ref$caseSensitive, textField = _ref.textField; filter = normalizeFilterType(filter); if (typeof filter === 'function' || !filter) { return filter; } filter = presets[filter]; return function (item, searchTerm) { var textValue = (0, _dataHelpers.dataText)(item, textField); if (!caseSensitive) { textValue = textValue.toLowerCase(); searchTerm = searchTerm.toLowerCase(); } return filter(textValue, searchTerm); }; } function normalizeOptions(nextOptions) { var options = _extends({}, nextOptions); options.minLengh = options.minLengh || 0; options.filter = normalizeFilter(options); return options; } var propTypes = exports.propTypes = { textField: CustomPropTypes.accessor, caseSensitive: _propTypes2.default.bool, minLength: _propTypes2.default.number, filter: _propTypes2.default.oneOfType([_propTypes2.default.func, _propTypes2.default.bool, _propTypes2.default.oneOf(Object.keys(presets))]) }; function indexOf(data, _ref2) { var _ref2$searchTerm = _ref2.searchTerm, searchTerm = _ref2$searchTerm === undefined ? '' : _ref2$searchTerm, options = _objectWithoutProperties(_ref2, ['searchTerm']); var _normalizeOptions = normalizeOptions(options), filter = _normalizeOptions.filter, minLength = _normalizeOptions.minLength; if (!filter || !searchTerm || !searchTerm.trim() || searchTerm.length < minLength) return -1; for (var idx = 0; idx < data.length; idx++) { if (filter(data[idx], searchTerm, idx)) return idx; }return -1; } function filter(data, _ref3) { var _ref3$searchTerm = _ref3.searchTerm, searchTerm = _ref3$searchTerm === undefined ? '' : _ref3$searchTerm, options = _objectWithoutProperties(_ref3, ['searchTerm']); var _normalizeOptions2 = normalizeOptions(options), filter = _normalizeOptions2.filter, minLength = _normalizeOptions2.minLength; if (!filter || !searchTerm || !searchTerm.trim() || searchTerm.length < minLength) return data; return data.filter(function (item, idx) { return filter(item, searchTerm, idx); }); } function suggest(data, _ref4) { var _ref4$searchTerm = _ref4.searchTerm, searchTerm = _ref4$searchTerm === undefined ? '' : _ref4$searchTerm, options = _objectWithoutProperties(_ref4, ['searchTerm']); var _normalizeOptions3 = normalizeOptions(options), filter = _normalizeOptions3.filter, minLength = _normalizeOptions3.minLength; if (!filter || !searchTerm || !searchTerm.trim() || searchTerm.length < minLength) return searchTerm; for (var idx = 0; idx < data.length; idx++) { if (filter(data[idx], searchTerm, idx)) return data[idx]; }return searchTerm; } /***/ }), /* 33 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.dataText = exports.dataValue = undefined; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; exports.dataIndexOf = dataIndexOf; exports.valueMatcher = valueMatcher; exports.dataItem = dataItem; var _ = __webpack_require__(8); var dataValue = exports.dataValue = function dataValue(data, field) { var value = data; if (typeof field === 'function') value = field(data);else if (data == null) value = data;else if (typeof field === 'string' && (typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object' && field in data) value = data[field]; return value; }; var dataText = exports.dataText = function dataText(item, textField) { var value = dataValue(item, textField); return value == null ? '' : value + ''; }; function dataIndexOf(data, item, valueField) { var idx = -1; var isValueEqual = function isValueEqual(datum) { return valueMatcher(item, datum, valueField); }; while (++idx < data.length) { var datum = data[idx]; if (datum === item || isValueEqual(datum)) return idx; } return -1; } /** * I don't know that the shallow equal makes sense here but am too afraid to * remove it. */ function valueMatcher(a, b, valueField) { return (0, _.isShallowEqual)(dataValue(a, valueField), dataValue(b, valueField)); } function dataItem(data, item, valueField) { var idx = dataIndexOf(data, dataValue(item, valueField), valueField); return idx !== -1 ? data[idx] : item; } /***/ }), /* 34 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _temp, _class2, _temp3; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); var _dates = __webpack_require__(14); var _dates2 = _interopRequireDefault(_dates); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 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; } var VIEW_UNITS = ['month', 'year', 'decade', 'century']; function clamp(date, min, max) { return _dates2.default.max(_dates2.default.min(date, max), min); } var CalendarView = (_temp = _class = function (_React$Component) { _inherits(CalendarView, _React$Component); function CalendarView() { _classCallCheck(this, CalendarView); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } CalendarView.prototype.render = function render() { var _props = this.props, className = _props.className, activeId = _props.activeId, props = _objectWithoutProperties(_props, ['className', 'activeId']); return _react2.default.createElement('table', _extends({}, props, { role: 'grid', tabIndex: '-1', 'aria-activedescendant': activeId || null, className: (0, _classnames2.default)(className, 'rw-nav-view', 'rw-calendar-grid') })); }; return CalendarView; }(_react2.default.Component), _class.propTypes = { activeId: _propTypes2.default.string }, _temp); var CalendarViewCell = (_temp3 = _class2 = function (_React$Component2) { _inherits(CalendarViewCell, _React$Component2); function CalendarViewCell() { var _temp2, _this2, _ret; _classCallCheck(this, CalendarViewCell); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp2 = (_this2 = _possibleConstructorReturn(this, _React$Component2.call.apply(_React$Component2, [this].concat(args))), _this2), _this2.handleChange = function () { var _this2$props = _this2.props, onChange = _this2$props.onChange, min = _this2$props.min, max = _this2$props.max, date = _this2$props.date; onChange(clamp(date, min, max)); }, _temp2), _possibleConstructorReturn(_this2, _ret); } CalendarViewCell.prototype.isEqual = function isEqual(date) { return _dates2.default.eq(this.props.date, date, this.props.unit); }; CalendarViewCell.prototype.isEmpty = function isEmpty() { var _props2 = this.props, unit = _props2.unit, min = _props2.min, max = _props2.max, date = _props2.date; return !_dates2.default.inRange(date, min, max, unit); }; CalendarViewCell.prototype.isNow = function isNow() { return this.props.now && this.isEqual(this.props.now); }; CalendarViewCell.prototype.isFocused = function isFocused() { return !this.props.disabled && !this.isEmpty() && this.isEqual(this.props.focused); }; CalendarViewCell.prototype.isSelected = function isSelected() { return this.props.selected && this.isEqual(this.props.selected); }; CalendarViewCell.prototype.isOffView = function isOffView() { var _props3 = this.props, viewUnit = _props3.viewUnit, focused = _props3.focused, date = _props3.date; return date && focused && viewUnit && _dates2.default[viewUnit](date) !== _dates2.default[viewUnit](focused); }; CalendarViewCell.prototype.render = function render() { var _props4 = this.props, children = _props4.children, activeId = _props4.activeId, label = _props4.label, disabled = _props4.disabled; var isDisabled = disabled || this.isEmpty(); return _react2.default.createElement( 'td', { role: 'gridcell', id: this.isFocused() ? activeId : null, title: label, 'aria-label': label, 'aria-readonly': disabled, 'aria-selected': this.isSelected(), onClick: !isDisabled ? this.handleChange : undefined, className: (0, _classnames2.default)('rw-cell', this.isNow() && 'rw-now', isDisabled && 'rw-state-disabled', this.isEmpty() && 'rw-cell-not-allowed', this.isOffView() && 'rw-cell-off-range', this.isFocused() && 'rw-state-focus', this.isSelected() && 'rw-state-selected') }, children ); }; return CalendarViewCell; }(_react2.default.Component), _class2.propTypes = { id: _propTypes2.default.string, activeId: _propTypes2.default.string.isRequired, label: _propTypes2.default.string, now: _propTypes2.default.instanceOf(Date), date: _propTypes2.default.instanceOf(Date), selected: _propTypes2.default.instanceOf(Date), focused: _propTypes2.default.instanceOf(Date), min: _propTypes2.default.instanceOf(Date), max: _propTypes2.default.instanceOf(Date), unit: _propTypes2.default.oneOf(['day'].concat(VIEW_UNITS)), viewUnit: _propTypes2.default.oneOf(VIEW_UNITS), onChange: _propTypes2.default.func.isRequired, disabled: _propTypes2.default.bool }, _temp3); CalendarView.Body = function (props) { return _react2.default.createElement('tbody', _extends({ className: 'rw-calendar-body' }, props)); }; CalendarView.Row = function (props) { return _react2.default.createElement('tr', _extends({ role: 'row' }, props)); }; CalendarView.Cell = CalendarViewCell; exports.default = CalendarView; module.exports = exports['default']; /***/ }), /* 35 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _calendarViewUnits; var views = { MONTH: 'month', YEAR: 'year', DECADE: 'decade', CENTURY: 'century' }; var directions = exports.directions = { LEFT: 'LEFT', RIGHT: 'RIGHT', UP: 'UP', DOWN: 'DOWN' }; var datePopups = exports.datePopups = { TIME: 'time', DATE: 'date' }; var calendarViews = exports.calendarViews = views; var calendarViewUnits = exports.calendarViewUnits = (_calendarViewUnits = {}, _calendarViewUnits[views.MONTH] = 'day', _calendarViewUnits[views.YEAR] = views.MONTH, _calendarViewUnits[views.DECADE] = views.YEAR, _calendarViewUnits[views.CENTURY] = views.DECADE, _calendarViewUnits); /***/ }), /* 36 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright (c) 2013-present, 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. * * */ 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. */ var emptyFunction = 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; /***/ }), /* 37 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) {/** * Copyright (c) 2013-present, 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. * */ /** * 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 validateFormat = function validateFormat(format) {}; if (process.env.NODE_ENV !== 'production') { validateFormat = function validateFormat(format) { if (format === undefined) { throw new Error('invariant requires an error message argument'); } }; } function invariant(condition, format, a, b, c, d, e, f) { validateFormat(format); 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(format.replace(/%s/g, function () { return args[argIndex++]; })); error.name = 'Invariant Violation'; } error.framesToPop = 1; // we don't care about invariant's own frame throw error; } } module.exports = invariant; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), /* 38 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright 2013-present, 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. */ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; module.exports = ReactPropTypesSecret; /***/ }), /* 39 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.default = spyOnMount; var _spyOnComponent = __webpack_require__(28); var _spyOnComponent2 = _interopRequireDefault(_spyOnComponent); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function spyOnMount(componentInstance) { var mounted = true; (0, _spyOnComponent2.default)(componentInstance, { componentWillUnmount: function componentWillUnmount() { mounted = false; } }); return function () { return mounted; }; } module.exports = exports['default']; /***/ }), /* 40 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = style; var _camelizeStyle = __webpack_require__(54); var _camelizeStyle2 = _interopRequireDefault(_camelizeStyle); var _hyphenateStyle = __webpack_require__(78); var _hyphenateStyle2 = _interopRequireDefault(_hyphenateStyle); var _getComputedStyle2 = __webpack_require__(80); var _getComputedStyle3 = _interopRequireDefault(_getComputedStyle2); var _removeStyle = __webpack_require__(81); var _removeStyle2 = _interopRequireDefault(_removeStyle); var _properties = __webpack_require__(41); var _isTransform = __webpack_require__(82); var _isTransform2 = _interopRequireDefault(_isTransform); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function style(node, property, value) { var css = ''; var transforms = ''; var props = property; if (typeof property === 'string') { if (value === undefined) { return node.style[(0, _camelizeStyle2.default)(property)] || (0, _getComputedStyle3.default)(node).getPropertyValue((0, _hyphenateStyle2.default)(property)); } else { (props = {})[property] = value; } } Object.keys(props).forEach(function (key) { var value = props[key]; if (!value && value !== 0) { (0, _removeStyle2.default)(node, (0, _hyphenateStyle2.default)(key)); } else if ((0, _isTransform2.default)(key)) { transforms += key + '(' + value + ') '; } else { css += (0, _hyphenateStyle2.default)(key) + ': ' + value + ';'; } }); if (transforms) { css += _properties.transform + ': ' + transforms + ';'; } node.style.cssText += ';' + css; } module.exports = exports['default']; /***/ }), /* 41 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.animationEnd = exports.animationDelay = exports.animationTiming = exports.animationDuration = exports.animationName = exports.transitionEnd = exports.transitionDuration = exports.transitionDelay = exports.transitionTiming = exports.transitionProperty = exports.transform = undefined; var _inDOM = __webpack_require__(11); var _inDOM2 = _interopRequireDefault(_inDOM); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var transform = 'transform'; var prefix = void 0, transitionEnd = void 0, animationEnd = void 0; var transitionProperty = void 0, transitionDuration = void 0, transitionTiming = void 0, transitionDelay = void 0; var animationName = void 0, animationDuration = void 0, animationTiming = void 0, animationDelay = void 0; if (_inDOM2.default) { var _getTransitionPropert = getTransitionProperties(); prefix = _getTransitionPropert.prefix; exports.transitionEnd = transitionEnd = _getTransitionPropert.transitionEnd; exports.animationEnd = animationEnd = _getTransitionPropert.animationEnd; exports.transform = transform = prefix + '-' + transform; exports.transitionProperty = transitionProperty = prefix + '-transition-property'; exports.transitionDuration = transitionDuration = prefix + '-transition-duration'; exports.transitionDelay = transitionDelay = prefix + '-transition-delay'; exports.transitionTiming = transitionTiming = prefix + '-transition-timing-function'; exports.animationName = animationName = prefix + '-animation-name'; exports.animationDuration = animationDuration = prefix + '-animation-duration'; exports.animationTiming = animationTiming = prefix + '-animation-delay'; exports.animationDelay = animationDelay = prefix + '-animation-timing-function'; } exports.transform = transform; exports.transitionProperty = transitionProperty; exports.transitionTiming = transitionTiming; exports.transitionDelay = transitionDelay; exports.transitionDuration = transitionDuration; exports.transitionEnd = transitionEnd; exports.animationName = animationName; exports.animationDuration = animationDuration; exports.animationTiming = animationTiming; exports.animationDelay = animationDelay; exports.animationEnd = animationEnd; exports.default = { transform: transform, end: transitionEnd, property: transitionProperty, timing: transitionTiming, delay: transitionDelay, duration: transitionDuration }; function getTransitionProperties() { var style = document.createElement('div').style; var vendorMap = { O: function O(e) { return 'o' + e.toLowerCase(); }, Moz: function Moz(e) { return e.toLowerCase(); }, Webkit: function Webkit(e) { return 'webkit' + e; }, ms: function ms(e) { return 'MS' + e; } }; var vendors = Object.keys(vendorMap); var transitionEnd = void 0, animationEnd = void 0; var prefix = ''; for (var i = 0; i < vendors.length; i++) { var vendor = vendors[i]; if (vendor + 'TransitionProperty' in style) { prefix = '-' + vendor.toLowerCase(); transitionEnd = vendorMap[vendor]('TransitionEnd'); animationEnd = vendorMap[vendor]('AnimationEnd'); break; } } if (!transitionEnd && 'transitionProperty' in style) transitionEnd = 'transitionend'; if (!animationEnd && 'animationName' in style) animationEnd = 'animationend'; style = null; return { animationEnd: animationEnd, transitionEnd: transitionEnd, prefix: prefix }; } /***/ }), /* 42 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _temp2; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); var _Props = __webpack_require__(4); var Props = _interopRequireWildcard(_Props); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } 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; } var ListOption = (_temp2 = _class = function (_React$Component) { _inherits(ListOption, _React$Component); function ListOption() { var _temp, _this, _ret; _classCallCheck(this, ListOption); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleSelect = function (event) { var _this$props = _this.props, onSelect = _this$props.onSelect, disabled = _this$props.disabled, dataItem = _this$props.dataItem; if (onSelect && !disabled) onSelect(dataItem, event); }, _temp), _possibleConstructorReturn(_this, _ret); } ListOption.prototype.render = function render() { var _props = this.props, className = _props.className, children = _props.children, focused = _props.focused, selected = _props.selected, disabled = _props.disabled, activeId = _props.activeId; var Tag = this.props.component || 'li'; var props = Props.omitOwn(this); var classes = { 'rw-state-focus': focused, 'rw-state-selected': selected, 'rw-state-disabled': disabled }; var id = focused ? activeId : undefined; return _react2.default.createElement( Tag, _extends({ id: id, role: 'option', tabIndex: !disabled ? '-1' : undefined, 'aria-selected': !!selected, className: (0, _classnames2.default)('rw-list-option', className, classes), onClick: this.handleSelect }, props), children ); }; return ListOption; }(_react2.default.Component), _class.propTypes = { activeId: _propTypes2.default.string, dataItem: _propTypes2.default.any, index: _propTypes2.default.number, focused: _propTypes2.default.bool, selected: _propTypes2.default.bool, disabled: _propTypes2.default.bool, onSelect: _propTypes2.default.func, component: _propTypes2.default.string }, _temp2); exports.default = ListOption; module.exports = exports['default']; /***/ }), /* 43 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _temp; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 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; } var Input = (_temp = _class = function (_React$Component) { _inherits(Input, _React$Component); function Input() { _classCallCheck(this, Input); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } Input.prototype.render = function render() { var _props = this.props, className = _props.className, disabled = _props.disabled, readOnly = _props.readOnly, value = _props.value, tabIndex = _props.tabIndex, _props$type = _props.type, type = _props$type === undefined ? 'text' : _props$type, _props$component = _props.component, Component = _props$component === undefined ? 'input' : _props$component, props = _objectWithoutProperties(_props, ['className', 'disabled', 'readOnly', 'value', 'tabIndex', 'type', 'component']); return _react2.default.createElement(Component, _extends({}, props, { type: type, tabIndex: tabIndex || 0, autoComplete: 'off', disabled: disabled, readOnly: readOnly, 'aria-disabled': disabled, 'aria-readonly': readOnly, value: value == null ? '' : value, className: (0, _classnames2.default)(className, 'rw-input') })); }; return Input; }(_react2.default.Component), _class.propTypes = { disabled: _propTypes2.default.bool, readOnly: _propTypes2.default.bool, value: _propTypes2.default.string, type: _propTypes2.default.string, tabIndex: _propTypes2.default.string, component: _propTypes2.default.any }, _temp); exports.default = Input; module.exports = exports['default']; /***/ }), /* 44 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) { exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _NEXT_VIEW, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _class3, _temp; var _invariant = __webpack_require__(26); var _invariant2 = _interopRequireDefault(_invariant); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(5); var _activeElement = __webpack_require__(27); var _activeElement2 = _interopRequireDefault(_activeElement); var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); var _deprecated = __webpack_require__(103); var _deprecated2 = _interopRequireDefault(_deprecated); var _uncontrollable = __webpack_require__(15); var _uncontrollable2 = _interopRequireDefault(_uncontrollable); var _Widget = __webpack_require__(16); var _Widget2 = _interopRequireDefault(_Widget); var _WidgetPicker = __webpack_require__(21); var _WidgetPicker2 = _interopRequireDefault(_WidgetPicker); var _Popup = __webpack_require__(29); var _Popup2 = _interopRequireDefault(_Popup); var _Button = __webpack_require__(19); var _Button2 = _interopRequireDefault(_Button); var _Calendar = __webpack_require__(61); var _Calendar2 = _interopRequireDefault(_Calendar); var _DateTimePickerInput = __webpack_require__(105); var _DateTimePickerInput2 = _interopRequireDefault(_DateTimePickerInput); var _Select = __webpack_require__(22); var _Select2 = _interopRequireDefault(_Select); var _TimeList = __webpack_require__(106); var _TimeList2 = _interopRequireDefault(_TimeList); var _messages = __webpack_require__(12); var _Props = __webpack_require__(4); var Props = _interopRequireWildcard(_Props); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); var _focusManager = __webpack_require__(17); var _focusManager2 = _interopRequireDefault(_focusManager); var _scrollManager = __webpack_require__(25); var _scrollManager2 = _interopRequireDefault(_scrollManager); var _withRightToLeft = __webpack_require__(18); var _withRightToLeft2 = _interopRequireDefault(_withRightToLeft); var _interaction = __webpack_require__(13); var _dates = __webpack_require__(14); var _dates2 = _interopRequireDefault(_dates); var _localizers = __webpack_require__(6); var _constants = __webpack_require__(35); var _widgetHelpers = __webpack_require__(10); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _initDefineProp(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } 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; } function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object['ke' + 'ys'](descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object['define' + 'Property'](target, property, desc); desc = null; } return desc; } function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.'); } var NEXT_VIEW = (_NEXT_VIEW = {}, _NEXT_VIEW[_constants.datePopups.DATE] = _constants.datePopups.TIME, _NEXT_VIEW[_constants.datePopups.TIME] = _constants.datePopups.DATE, _NEXT_VIEW); var isBothOrNeither = function isBothOrNeither(a, b) { return a && b || !a && !b; }; var propTypes = _extends({}, _Calendar2.default.ControlledComponent.propTypes, { value: _propTypes2.default.instanceOf(Date), /** * @example ['onChangePicker', [ ['new Date()', null] ]] */ onChange: _propTypes2.default.func, /** * @type (false | 'time' | 'date') */ open: _propTypes2.default.oneOf([false, _constants.datePopups.TIME, _constants.datePopups.DATE]), onToggle: _propTypes2.default.func, /** * Default current date at which the calendar opens. If none is provided, opens at today's date or the `value` date (if any). */ currentDate: _propTypes2.default.instanceOf(Date), /** * Change event Handler that is called when the currentDate is changed. The handler is called with the currentDate object. */ onCurrentDateChange: _propTypes2.default.func, onSelect: _propTypes2.default.func, /** * The minimum Date that can be selected. Min only limits selection, it doesn't constrain the date values that * can be typed or pasted into the widget. If you need this behavior you can constrain values via * the `onChange` handler. * * @example ['prop', ['min', 'new Date()']] */ min: _propTypes2.default.instanceOf(Date), /** * The maximum Date that can be selected. Max only limits selection, it doesn't constrain the date values that * can be typed or pasted into the widget. If you need this behavior you can constrain values via * the `onChange` handler. * * @example ['prop', ['max', 'new Date()']] */ max: _propTypes2.default.instanceOf(Date), /** * The amount of minutes between each entry in the time list. * * @example ['prop', { step: 90 }] */ step: _propTypes2.default.number, culture: _propTypes2.default.string, /** * A formatter used to display the date value. For more information about formats * visit the [Localization page](/i18n) * * @example ['dateFormat', ['format', "{ raw: 'MMM dd, yyyy' }", null, { defaultValue: 'new Date()', time: 'false' }]] */ format: CustomPropTypes.dateFormat, /** * A formatter used by the time dropdown to render times. For more information about formats visit * the [Localization page](/i18n). * * @example ['dateFormat', ['timeFormat', "{ time: 'medium' }", null, { date: 'false', open: '"time"' }]] */ timeFormat: CustomPropTypes.dateFormat, /** * A formatter to be used while the date input has focus. Useful for showing a simpler format for inputing. * For more information about formats visit the [Localization page](/i18n) * * @example ['dateFormat', ['editFormat', "{ date: 'short' }", null, { defaultValue: 'new Date()', format: "{ raw: 'MMM dd, yyyy' }", time: 'false' }]] */ editFormat: CustomPropTypes.dateFormat, /** * Enable the calendar component of the picker. */ date: _propTypes2.default.bool, /** * Enable the time list component of the picker. */ time: _propTypes2.default.bool, /** @ignore */ calendar: (0, _deprecated2.default)(_propTypes2.default.bool, 'Use `date` instead'), /** * A customize the rendering of times but providing a custom component. */ timeComponent: CustomPropTypes.elementType, dropUp: _propTypes2.default.bool, popupTransition: CustomPropTypes.elementType, placeholder: _propTypes2.default.string, name: _propTypes2.default.string, autoFocus: _propTypes2.default.bool, disabled: CustomPropTypes.disabled, readOnly: CustomPropTypes.disabled, /** * Determines how the widget parses the typed date string into a Date object. You can provide an array of formats to try, * or provide a function that returns a date to handle parsing yourself. When `parse` is unspecified and * the `format` prop is a `string` parse will automatically use that format as its default. */ parse: _propTypes2.default.oneOfType([_propTypes2.default.arrayOf(_propTypes2.default.string), _propTypes2.default.string, _propTypes2.default.func]), /** @ignore */ tabIndex: _propTypes2.default.any, /** @ignore */ 'aria-labelledby': _propTypes2.default.string, /** @ignore */ 'aria-describedby': _propTypes2.default.string, onKeyDown: _propTypes2.default.func, onKeyPress: _propTypes2.default.func, onBlur: _propTypes2.default.func, onFocus: _propTypes2.default.func, inputProps: _propTypes2.default.object, messages: _propTypes2.default.shape({ dateButton: _propTypes2.default.string, timeButton: _propTypes2.default.string }) /** * --- * subtitle: DatePicker, TimePicker * localized: true * shortcuts: * - { key: alt + down arrow, label: open calendar or time } * - { key: alt + up arrow, label: close calendar or time } * - { key: down arrow, label: move focus to next item } * - { key: up arrow, label: move focus to previous item } * - { key: home, label: move focus to first item } * - { key: end, label: move focus to last item } * - { key: enter, label: select focused item } * - { key: any key, label: search list for item starting with key } * --- * * @public * @extends Calendar */ }); var DateTimePicker = (0, _withRightToLeft2.default)(_class = (_class2 = (_temp = _class3 = function (_React$Component) { _inherits(DateTimePicker, _React$Component); function DateTimePicker() { _classCallCheck(this, DateTimePicker); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var _this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))); _initDefineProp(_this, 'handleChange', _descriptor, _this); _initDefineProp(_this, 'handleKeyDown', _descriptor2, _this); _initDefineProp(_this, 'handleKeyPress', _descriptor3, _this); _initDefineProp(_this, 'handleDateSelect', _descriptor4, _this); _initDefineProp(_this, 'handleTimeSelect', _descriptor5, _this); _initDefineProp(_this, 'handleCalendarClick', _descriptor6, _this); _initDefineProp(_this, 'handleTimeClick', _descriptor7, _this); _this.parse = function (string) { var _this$props = _this.props, parse = _this$props.parse, culture = _this$props.culture, editFormat = _this$props.editFormat; var format = getFormat(_this.props, true); var parsers = []; if (format != null) parsers.push(format); if (editFormat != null) parsers.push(editFormat); !parsers.length ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'React Widgets: there are no specified `parse` formats provided and the `format` prop is a function. ' + 'the DateTimePicker is unable to parse `%s` into a dateTime, ' + 'please provide either a parse function or localizer compatible `format` prop', string) : (0, _invariant2.default)(false) : void 0; parsers.sort(sortFnsFirst); if (parse) parsers = [].concat(parse, parsers); var date = void 0; for (var i = 0; i < parsers.length; i++) { date = parseDate(string, parsers[i], culture); if (date) return date; } return null; }; _this.messages = (0, _messages.getMessages)(_this.props.messages); _this.inputId = (0, _widgetHelpers.instanceId)(_this, '_input'); _this.dateId = (0, _widgetHelpers.instanceId)(_this, '_date'); _this.listId = (0, _widgetHelpers.instanceId)(_this, '_listbox'); _this.activeCalendarId = (0, _widgetHelpers.instanceId)(_this, '_calendar_active_cell'); _this.activeOptionId = (0, _widgetHelpers.instanceId)(_this, '_listbox_active_option'); _this.handleScroll = (0, _scrollManager2.default)(_this); _this.focusManager = (0, _focusManager2.default)(_this, { didHandle: function didHandle(focused) { if (!focused) _this.close(); } }); _this.state = { focused: false }; return _this; } DateTimePicker.prototype.componentWillReceiveProps = function componentWillReceiveProps(_ref) { var messages = _ref.messages; this.messages = (0, _messages.getMessages)(messages); }; DateTimePicker.prototype.renderInput = function renderInput(owns) { var _props = this.props, open = _props.open, value = _props.value, editFormat = _props.editFormat, culture = _props.culture, placeholder = _props.placeholder, disabled = _props.disabled, readOnly = _props.readOnly, name = _props.name, tabIndex = _props.tabIndex, autoFocus = _props.autoFocus, inputProps = _props.inputProps, ariaLabelledby = _props['aria-labelledby'], ariaDescribedby = _props['aria-describedby']; var focused = this.state.focused; var activeId = null; if (open === _constants.datePopups.TIME) { activeId = this.activeOptionId; } else if (open === _constants.datePopups.DATE) { activeId = this.activeCalendarId; } return _react2.default.createElement(_DateTimePickerInput2.default, _extends({}, inputProps, { id: this.inputId, ref: 'valueInput', role: 'combobox', name: name, tabIndex: tabIndex, autoFocus: autoFocus, placeholder: placeholder, disabled: disabled, readOnly: readOnly, value: value, format: getFormat(this.props), editFormat: editFormat, editing: focused, culture: culture, parse: this.parse, onChange: this.handleChange, 'aria-haspopup': true, 'aria-activedescendant': activeId, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, 'aria-expanded': !!open, 'aria-owns': owns })); }; DateTimePicker.prototype.renderButtons = function renderButtons() { var _props2 = this.props, date = _props2.date, time = _props2.time, disabled = _props2.disabled, readOnly = _props2.readOnly; if (!date && !time) { return null; } var messages = this.messages; return _react2.default.createElement( _Select2.default, { bordered: true }, date && _react2.default.createElement(_Button2.default, { icon: 'calendar', label: messages.dateButton(), disabled: disabled || readOnly, onClick: this.handleCalendarClick }), time && _react2.default.createElement(_Button2.default, { icon: 'clock-o', label: messages.timeButton(), disabled: disabled || readOnly, onClick: this.handleTimeClick }) ); }; DateTimePicker.prototype.renderCalendar = function renderCalendar() { var _this2 = this; var activeCalendarId = this.activeCalendarId, inputId = this.inputId, dateId = this.dateId; var _props3 = this.props, open = _props3.open, value = _props3.value, popupTransition = _props3.popupTransition, dropUp = _props3.dropUp, onCurrentDateChange = _props3.onCurrentDateChange, currentDate = _props3.currentDate; var calendarProps = Props.pick(this.props, _Calendar2.default.ControlledComponent); return _react2.default.createElement( _Popup2.default, { dropUp: dropUp, open: open === _constants.datePopups.DATE, className: 'rw-calendar-popup', transition: popupTransition }, _react2.default.createElement(_Calendar2.default, _extends({}, calendarProps, { ref: 'calPopup', id: dateId, activeId: activeCalendarId, tabIndex: '-1', value: value, autoFocus: false, onChange: this.handleDateSelect // #75: need to aggressively reclaim focus from the calendar otherwise // disabled header/footer buttons will drop focus completely from the widget , onNavigate: function onNavigate() { return _this2.focus(); }, currentDate: currentDate, onCurrentDateChange: onCurrentDateChange, 'aria-hidden': !open, 'aria-live': 'polite', 'aria-labelledby': inputId })) ); }; DateTimePicker.prototype.renderTimeList = function renderTimeList() { var _this3 = this; var activeOptionId = this.activeOptionId, inputId = this.inputId, listId = this.listId; var _props4 = this.props, open = _props4.open, value = _props4.value, min = _props4.min, max = _props4.max, step = _props4.step, currentDate = _props4.currentDate, dropUp = _props4.dropUp, date = _props4.date, culture = _props4.culture, timeFormat = _props4.timeFormat, timeComponent = _props4.timeComponent, popupTransition = _props4.popupTransition; return _react2.default.createElement( _Popup2.default, { dropUp: dropUp, transition: popupTransition, open: open === _constants.datePopups.TIME, onEntering: function onEntering() { return _this3.refs.timePopup.forceUpdate(); } }, _react2.default.createElement( 'div', null, _react2.default.createElement(_TimeList2.default, { ref: 'timePopup', id: listId, min: min, max: max, step: step, currentDate: currentDate, activeId: activeOptionId, format: timeFormat, culture: culture, value: dateOrNull(value), onMove: this.handleScroll, onSelect: this.handleTimeSelect, preserveDate: !!date, itemComponent: timeComponent, 'aria-labelledby': inputId, 'aria-live': open && 'polite', 'aria-hidden': !open, messages: this.messages }) ) ); }; DateTimePicker.prototype.render = function render() { var _props5 = this.props, className = _props5.className, date = _props5.date, time = _props5.time, open = _props5.open, disabled = _props5.disabled, readOnly = _props5.readOnly, dropUp = _props5.dropUp; var focused = this.state.focused; var elementProps = Props.pickElementProps(this, _Calendar2.default.ControlledComponent); var shouldRenderList = open || (0, _widgetHelpers.isFirstFocusedRender)(this); var owns = ''; if (date) owns += this.dateId; if (time) owns += ' ' + this.listId; return _react2.default.createElement( _Widget2.default, _extends({}, elementProps, { open: !!open, dropUp: dropUp, focused: focused, disabled: disabled, readOnly: readOnly, onKeyDown: this.handleKeyDown, onKeyPress: this.handleKeyPress, onBlur: this.focusManager.handleBlur, onFocus: this.focusManager.handleFocus, className: (0, _classnames2.default)(className, 'rw-datetime-picker') }), _react2.default.createElement( _WidgetPicker2.default, null, this.renderInput(owns.trim()), this.renderButtons() ), !!(shouldRenderList && time) && this.renderTimeList(), !!(shouldRenderList && date) && this.renderCalendar() ); }; DateTimePicker.prototype.focus = function focus() { var valueInput = this.refs.valueInput; if (valueInput && (0, _activeElement2.default)() !== (0, _reactDom.findDOMNode)(valueInput)) valueInput.focus(); }; DateTimePicker.prototype.toggle = function toggle(view) { var open = this.props.open; if (!open || open !== view) this.open(view);else this.close(); }; DateTimePicker.prototype.open = function open(view) { var _props6 = this.props, open = _props6.open, date = _props6.date, time = _props6.time, onToggle = _props6.onToggle; if (!view) { if (time) view = _constants.datePopups.TIME; if (date) view = _constants.datePopups.DATE; if (isBothOrNeither(date, time)) view = NEXT_VIEW[open] || _constants.datePopups.DATE; } if (open !== view) (0, _widgetHelpers.notify)(onToggle, view); }; DateTimePicker.prototype.close = function close() { if (this.props.open) (0, _widgetHelpers.notify)(this.props.onToggle, false); }; DateTimePicker.prototype.inRangeValue = function inRangeValue(value) { if (value == null) return value; return _dates2.default.max(_dates2.default.min(value, this.props.max), this.props.min); }; return DateTimePicker; }(_react2.default.Component), _class3.displayName = 'DateTimePicker', _class3.propTypes = propTypes, _class3.defaultProps = _extends({}, _Calendar2.default.ControlledComponent.defaultProps, { value: null, min: new Date(1900, 0, 1), max: new Date(2099, 11, 31), date: true, time: true, open: false }), _temp), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'handleChange', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this4 = this; return function (date, str, constrain) { var _props7 = _this4.props, onChange = _props7.onChange, value = _props7.value; if (constrain) date = _this4.inRangeValue(date); if (onChange) { if (date == null || value == null) { if (date != value //eslint-disable-line eqeqeq ) onChange(date, str); } else if (!_dates2.default.eq(date, value)) { onChange(date, str); } } }; } }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'handleKeyDown', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this5 = this; return function (e) { var _props8 = _this5.props, open = _props8.open, onKeyDown = _props8.onKeyDown; (0, _widgetHelpers.notify)(onKeyDown, [e]); if (e.defaultPrevented) return; if (e.key === 'Escape' && open) _this5.close();else if (e.altKey) { if (e.key === 'ArrowDown') { e.preventDefault(); _this5.open(); } else if (e.key === 'ArrowUp') { e.preventDefault(); _this5.close(); } } else if (open) { if (open === _constants.datePopups.DATE) _this5.refs.calPopup.refs.inner.handleKeyDown(e); if (open === _constants.datePopups.TIME) _this5.refs.timePopup.handleKeyDown(e); } }; } }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'handleKeyPress', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this6 = this; return function (e) { (0, _widgetHelpers.notify)(_this6.props.onKeyPress, [e]); if (e.defaultPrevented) return; if (_this6.props.open === _constants.datePopups.TIME) _this6.refs.timePopup.handleKeyPress(e); }; } }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'handleDateSelect', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this7 = this; return function (date) { var format = getFormat(_this7.props), dateTime = _dates2.default.merge(date, _this7.props.value, _this7.props.currentDate), dateStr = formatDate(date, format, _this7.props.culture); _this7.close(); (0, _widgetHelpers.notify)(_this7.props.onSelect, [dateTime, dateStr]); _this7.handleChange(dateTime, dateStr, true); _this7.focus(); }; } }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, 'handleTimeSelect', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this8 = this; return function (datum) { var format = getFormat(_this8.props), dateTime = _dates2.default.merge(_this8.props.value, datum.date, _this8.props.currentDate), dateStr = formatDate(datum.date, format, _this8.props.culture); _this8.close(); (0, _widgetHelpers.notify)(_this8.props.onSelect, [dateTime, dateStr]); _this8.handleChange(dateTime, dateStr, true); _this8.focus(); }; } }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, 'handleCalendarClick', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this9 = this; return function () { _this9.focus(); _this9.toggle(_constants.datePopups.DATE); }; } }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, 'handleTimeClick', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this10 = this; return function () { _this10.focus(); _this10.toggle(_constants.datePopups.TIME); }; } })), _class2)) || _class; exports.default = (0, _uncontrollable2.default)(DateTimePicker, { open: 'onToggle', value: 'onChange', currentDate: 'onCurrentDateChange' }, ['focus']); function parseDate(string, parser, culture) { return typeof parser === 'function' ? parser(string, culture) : _localizers.date.parse(string, parser, culture); } function getFormat(props) { var isDate = props[_constants.datePopups.DATE] != null ? props[_constants.datePopups.DATE] : true, isTime = props[_constants.datePopups.TIME] != null ? props[_constants.datePopups.TIME] : true; return props.format ? props.format : isDate && isTime || !isDate && !isTime ? _localizers.date.getFormat('default') : _localizers.date.getFormat(isDate ? 'date' : 'time'); } function formatDate(date, format, culture) { var val = ''; if (date instanceof Date && !isNaN(date.getTime())) val = _localizers.date.format(date, format, culture); return val; } function sortFnsFirst(a, b) { var aFn = typeof a === 'function'; var bFn = typeof b === 'function'; if (aFn && !bFn) return -1; if (!aFn && bFn) return 1; if (aFn && bFn || !aFn && !bFn) return 0; } function dateOrNull(dt) { if (dt && !isNaN(dt.getTime())) return dt; return null; } module.exports = exports['default']; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), /* 45 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) {/** * 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. * */ var emptyFunction = __webpack_require__(36); /** * 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 (process.env.NODE_ENV !== 'production') { var printWarning = function printWarning(format) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } var argIndex = 0; var message = 'Warning: ' + format.replace(/%s/g, function () { return args[argIndex++]; }); if (typeof console !== 'undefined') { console.error(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) {} }; warning = function warning(condition, format) { if (format === undefined) { throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); } if (format.indexOf('Failed Composite propType: ') === 0) { return; // Ignore CompositeComponent proptype check. } if (!condition) { for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { args[_key2 - 2] = arguments[_key2]; } printWarning.apply(undefined, [format].concat(args)); } }; } module.exports = warning; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), /* 46 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = ownerDocument; function ownerDocument(node) { return node && node.ownerDocument || document; } module.exports = exports["default"]; /***/ }), /* 47 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.default = createTimeoutManager; var _spyOnComponent = __webpack_require__(28); var _spyOnComponent2 = _interopRequireDefault(_spyOnComponent); var _mountManager = __webpack_require__(39); var _mountManager2 = _interopRequireDefault(_mountManager); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function createTimeoutManager(componentInstance) { var isMounted = (0, _mountManager2.default)(componentInstance); var timers = Object.create(null); var manager = void 0; (0, _spyOnComponent2.default)(componentInstance, { componentWillUnmount: function componentWillUnmount() { for (var k in timers) { clearTimeout(timers[k]); }timers = null; } }); return manager = { clear: function clear(key) { clearTimeout(timers[key]); }, set: function set(key, fn, ms) { if (!isMounted()) return; manager.clear(key); timers[key] = setTimeout(fn, ms); } }; } module.exports = exports['default']; /***/ }), /* 48 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _transitionClasses; var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); var _events = __webpack_require__(49); var _events2 = _interopRequireDefault(_events); var _style = __webpack_require__(40); var _style2 = _interopRequireDefault(_style); var _height = __webpack_require__(30); var _height2 = _interopRequireDefault(_height); var _properties = __webpack_require__(41); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _Transition = __webpack_require__(56); var _Transition2 = _interopRequireDefault(_Transition); 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; } var transitionClasses = (_transitionClasses = {}, _transitionClasses[_Transition.ENTERING] = 'rw-popup-transition-entering', _transitionClasses[_Transition.EXITING] = 'rw-popup-transition-exiting', _transitionClasses[_Transition.EXITED] = 'rw-popup-transition-exited', _transitionClasses); var propTypes = { in: _propTypes2.default.bool.isRequired, dropUp: _propTypes2.default.bool, onEntering: _propTypes2.default.func, onEntered: _propTypes2.default.func }; function parseDuration(node) { var str = (0, _style2.default)(node, _properties.transitionDuration); var mult = str.indexOf('ms') === -1 ? 1000 : 1; return parseFloat(str) * mult; } var SlideDownTransition = function (_React$Component) { _inherits(SlideDownTransition, _React$Component); function SlideDownTransition() { var _temp, _this, _ret; _classCallCheck(this, SlideDownTransition); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleTransitionEnd = function (node, done) { var duration = parseDuration(node.lastChild) || 0; var handler = function handler() { _events2.default.off(node, _properties.transitionEnd, handler, false); done(); }; setTimeout(handler, duration * 1.5); _events2.default.on(node, _properties.transitionEnd, handler, false); }, _this.handleEntered = function (elem) { _this.clearContainerHeight(elem); if (_this.props.onEntered) _this.props.onEntered(); }, _this.handleEntering = function () { if (_this.props.onEntering) _this.props.onEntering(); }, _this.setContainerHeight = function (elem) { elem.style.height = _this.getHeight() + 'px'; }, _this.clearContainerHeight = function (elem) { elem.style.height = ''; }, _temp), _possibleConstructorReturn(_this, _ret); } SlideDownTransition.prototype.getHeight = function getHeight() { var container = this.element; var content = container.firstChild; var margin = parseInt((0, _style2.default)(content, 'margin-top'), 10) + parseInt((0, _style2.default)(content, 'margin-bottom'), 10); var old = container.style.display; var height = void 0; container.style.display = 'block'; height = ((0, _height2.default)(content) || 0) + (isNaN(margin) ? 0 : margin); container.style.display = old; return height; }; SlideDownTransition.prototype.render = function render() { var _this2 = this; var _props = this.props, children = _props.children, className = _props.className, dropUp = _props.dropUp; return _react2.default.createElement( _Transition2.default, { appear: true, 'in': this.props.in, timeout: 5000, onEnter: this.setContainerHeight, onEntering: this.handleEntering, onEntered: this.handleEntered, onExit: this.setContainerHeight, onExited: this.clearContainerHeight, addEndListener: this.handleTransitionEnd }, function (status, innerProps) { return _react2.default.createElement( 'div', _extends({}, innerProps, { ref: function ref(r) { return _this2.element = r; }, className: (0, _classnames2.default)(className, dropUp && 'rw-dropup', transitionClasses[status]) }), _react2.default.createElement( 'div', { className: 'rw-popup-transition' }, children ) ); } ); }; return SlideDownTransition; }(_react2.default.Component); SlideDownTransition.propTypes = propTypes; exports.default = SlideDownTransition; module.exports = exports['default']; /***/ }), /* 49 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.listen = exports.filter = exports.off = exports.on = undefined; var _on = __webpack_require__(50); var _on2 = _interopRequireDefault(_on); var _off = __webpack_require__(51); var _off2 = _interopRequireDefault(_off); var _filter = __webpack_require__(75); var _filter2 = _interopRequireDefault(_filter); var _listen = __webpack_require__(76); var _listen2 = _interopRequireDefault(_listen); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.on = _on2.default; exports.off = _off2.default; exports.filter = _filter2.default; exports.listen = _listen2.default; exports.default = { on: _on2.default, off: _off2.default, filter: _filter2.default, listen: _listen2.default }; /***/ }), /* 50 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _inDOM = __webpack_require__(11); var _inDOM2 = _interopRequireDefault(_inDOM); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var on = function on() {}; if (_inDOM2.default) { on = function () { if (document.addEventListener) return function (node, eventName, handler, capture) { return node.addEventListener(eventName, handler, capture || false); };else if (document.attachEvent) return function (node, eventName, handler) { return node.attachEvent('on' + eventName, function (e) { e = e || window.event; e.target = e.target || e.srcElement; e.currentTarget = node; handler.call(node, e); }); }; }(); } exports.default = on; module.exports = exports['default']; /***/ }), /* 51 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _inDOM = __webpack_require__(11); var _inDOM2 = _interopRequireDefault(_inDOM); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var off = function off() {}; if (_inDOM2.default) { off = function () { if (document.addEventListener) return function (node, eventName, handler, capture) { return node.removeEventListener(eventName, handler, capture || false); };else if (document.attachEvent) return function (node, eventName, handler) { return node.detachEvent('on' + eventName, handler); }; }(); } exports.default = off; module.exports = exports['default']; /***/ }), /* 52 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _inDOM = __webpack_require__(11); var _inDOM2 = _interopRequireDefault(_inDOM); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = function () { // HTML DOM and SVG DOM may have different support levels, // so we need to check on context instead of a document root element. return _inDOM2.default ? function (context, node) { if (context.contains) { return context.contains(node); } else if (context.compareDocumentPosition) { return context === node || !!(context.compareDocumentPosition(node) & 16); } else { return fallback(context, node); } } : fallback; }(); function fallback(context, node) { if (node) do { if (node === context) return true; } while (node = node.parentNode); return false; } module.exports = exports['default']; /***/ }), /* 53 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = qsa; // Zepto.js // (c) 2010-2015 Thomas Fuchs // Zepto.js may be freely distributed under the MIT license. var simpleSelectorRE = /^[\w-]*$/; var toArray = Function.prototype.bind.call(Function.prototype.call, [].slice); function qsa(element, selector) { var maybeID = selector[0] === '#', maybeClass = selector[0] === '.', nameOnly = maybeID || maybeClass ? selector.slice(1) : selector, isSimple = simpleSelectorRE.test(nameOnly), found; if (isSimple) { if (maybeID) { element = element.getElementById ? element : document; return (found = element.getElementById(nameOnly)) ? [found] : []; } if (element.getElementsByClassName && maybeClass) return toArray(element.getElementsByClassName(nameOnly)); return toArray(element.getElementsByTagName(selector)); } return toArray(element.querySelectorAll(selector)); } module.exports = exports['default']; /***/ }), /* 54 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = camelizeStyleName; var _camelize = __webpack_require__(77); var _camelize2 = _interopRequireDefault(_camelize); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var msPattern = /^-ms-/; /** * Copyright 2014-2015, Facebook, Inc. * All rights reserved. * https://github.com/facebook/react/blob/2aeb8a2a6beb00617a4217f7f8284924fa2ad819/src/vendor/core/camelizeStyleName.js */ function camelizeStyleName(string) { return (0, _camelize2.default)(string.replace(msPattern, 'ms-')); } module.exports = exports['default']; /***/ }), /* 55 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = offset; var _contains = __webpack_require__(52); var _contains2 = _interopRequireDefault(_contains); var _isWindow = __webpack_require__(31); var _isWindow2 = _interopRequireDefault(_isWindow); var _ownerDocument = __webpack_require__(46); var _ownerDocument2 = _interopRequireDefault(_ownerDocument); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function offset(node) { var doc = (0, _ownerDocument2.default)(node), win = (0, _isWindow2.default)(doc), docElem = doc && doc.documentElement, box = { top: 0, left: 0, height: 0, width: 0 }; if (!doc) return; // Make sure it's not a disconnected DOM node if (!(0, _contains2.default)(docElem, node)) return box; if (node.getBoundingClientRect !== undefined) box = node.getBoundingClientRect(); // IE8 getBoundingClientRect doesn't support width & height box = { top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0), left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0), width: (box.width == null ? node.offsetWidth : box.width) || 0, height: (box.height == null ? node.offsetHeight : box.height) || 0 }; return box; } module.exports = exports['default']; /***/ }), /* 56 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) { exports.__esModule = true; exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = undefined; var _propTypes = __webpack_require__(1); var PropTypes = _interopRequireWildcard(_propTypes); var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(5); var _reactDom2 = _interopRequireDefault(_reactDom); var _PropTypes = __webpack_require__(83); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 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; } var UNMOUNTED = exports.UNMOUNTED = 'unmounted'; var EXITED = exports.EXITED = 'exited'; var ENTERING = exports.ENTERING = 'entering'; var ENTERED = exports.ENTERED = 'entered'; var EXITING = exports.EXITING = 'exiting'; /** * The Transition component lets you describe a transition from one component * state to another _over time_ with a simple declarative API. Most commonly * it's used to animate the mounting and unmounting of a component, but can also * be used to describe in-place transition states as well. * * By default the `Transition` component does not alter the behavior of the * component it renders, it only tracks "enter" and "exit" states for the components. * It's up to you to give meaning and effect to those states. For example we can * add styles to a component when it enters or exits: * * ```jsx * import Transition from 'react-transition-group/Transition'; * * const duration = 300; * * const defaultStyle = { * transition: `opacity ${duration}ms ease-in-out`, * opacity: 0, * } * * const transitionStyles = { * entering: { opacity: 1 }, * entered: { opacity: 1 }, * }; * * const Fade = ({ in: inProp }) => ( * <Transition in={inProp} timeout={duration}> * {(state) => ( * <div style={{ * ...defaultStyle, * ...transitionStyles[state] * }}> * I'm A fade Transition! * </div> * )} * </Transition> * ); * ``` * * As noted the `Transition` component doesn't _do_ anything by itself to its child component. * What it does do is track transition states over time so you can update the * component (such as by adding styles or classes) when it changes states. * * There are 4 main states a Transition can be in: * - `ENTERING` * - `ENTERED` * - `EXITING` * - `EXITED` * * Transition state is toggled via the `in` prop. When `true` the component begins the * "Enter" stage. During this stage, the component will shift from its current transition state, * to `'entering'` for the duration of the transition and then to the `'entered'` stage once * it's complete. Let's take the following example: * * ```jsx * state= { in: false }; * * toggleEnterState = () => { * this.setState({ in: true }); * } * * render() { * return ( * <div> * <Transition in={this.state.in} timeout={500} /> * <button onClick={this.toggleEnterState}>Click to Enter</button> * </div> * ); * } * ``` * * When the button is clicked the component will shift to the `'entering'` state and * stay there for 500ms (the value of `timeout`) when finally switches to `'entered'`. * * When `in` is `false` the same thing happens except the state moves from `'exiting'` to `'exited'`. */ var Transition = function (_React$Component) { _inherits(Transition, _React$Component); function Transition(props, context) { _classCallCheck(this, Transition); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context)); var parentGroup = context.transitionGroup; // In the context of a TransitionGroup all enters are really appears var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear; var initialStatus = void 0; _this.nextStatus = null; if (props.in) { if (appear) { initialStatus = EXITED; _this.nextStatus = ENTERING; } else { initialStatus = ENTERED; } } else { if (props.unmountOnExit || props.mountOnEnter) { initialStatus = UNMOUNTED; } else { initialStatus = EXITED; } } _this.state = { status: initialStatus }; _this.nextCallback = null; return _this; } Transition.prototype.getChildContext = function getChildContext() { return { transitionGroup: null }; // allows for nested Transitions }; Transition.prototype.componentDidMount = function componentDidMount() { this.updateStatus(true); }; Transition.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { var status = this.state.status; if (nextProps.in) { if (status === UNMOUNTED) { this.setState({ status: EXITED }); } if (status !== ENTERING && status !== ENTERED) { this.nextStatus = ENTERING; } } else { if (status === ENTERING || status === ENTERED) { this.nextStatus = EXITING; } } }; Transition.prototype.componentDidUpdate = function componentDidUpdate() { this.updateStatus(); }; Transition.prototype.componentWillUnmount = function componentWillUnmount() { this.cancelNextCallback(); }; Transition.prototype.getTimeouts = function getTimeouts() { var timeout = this.props.timeout; var exit = void 0, enter = void 0, appear = void 0; exit = enter = appear = timeout; if (timeout != null && typeof timeout !== 'number') { exit = timeout.exit; enter = timeout.enter; appear = timeout.appear; } return { exit: exit, enter: enter, appear: appear }; }; Transition.prototype.updateStatus = function updateStatus() { var mounting = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (this.nextStatus !== null) { // nextStatus will always be ENTERING or EXITING. this.cancelNextCallback(); var node = _reactDom2.default.findDOMNode(this); if (this.nextStatus === ENTERING) { this.performEnter(node, mounting); } else { this.performExit(node); } this.nextStatus = null; } else if (this.props.unmountOnExit && this.state.status === EXITED) { this.setState({ status: UNMOUNTED }); } }; Transition.prototype.performEnter = function performEnter(node, mounting) { var _this2 = this; var enter = this.props.enter; var appearing = this.context.transitionGroup ? this.context.transitionGroup.isMounting : mounting; var timeouts = this.getTimeouts(); // no enter animation skip right to ENTERED // if we are mounting and running this it means appear _must_ be set if (!mounting && !enter) { this.safeSetState({ status: ENTERED }, function () { _this2.props.onEntered(node); }); return; } this.props.onEnter(node, appearing); this.safeSetState({ status: ENTERING }, function () { _this2.props.onEntering(node, appearing); // FIXME: appear timeout? _this2.onTransitionEnd(node, timeouts.enter, function () { _this2.safeSetState({ status: ENTERED }, function () { _this2.props.onEntered(node, appearing); }); }); }); }; Transition.prototype.performExit = function performExit(node) { var _this3 = this; var exit = this.props.exit; var timeouts = this.getTimeouts(); // no exit animation skip right to EXITED if (!exit) { this.safeSetState({ status: EXITED }, function () { _this3.props.onExited(node); }); return; } this.props.onExit(node); this.safeSetState({ status: EXITING }, function () { _this3.props.onExiting(node); _this3.onTransitionEnd(node, timeouts.exit, function () { _this3.safeSetState({ status: EXITED }, function () { _this3.props.onExited(node); }); }); }); }; Transition.prototype.cancelNextCallback = function cancelNextCallback() { if (this.nextCallback !== null) { this.nextCallback.cancel(); this.nextCallback = null; } }; Transition.prototype.safeSetState = function safeSetState(nextState, callback) { // This shouldn't be necessary, but there are weird race conditions with // setState callbacks and unmounting in testing, so always make sure that // we can cancel any pending setState callbacks after we unmount. this.setState(nextState, this.setNextCallback(callback)); }; Transition.prototype.setNextCallback = function setNextCallback(callback) { var _this4 = this; var active = true; this.nextCallback = function (event) { if (active) { active = false; _this4.nextCallback = null; callback(event); } }; this.nextCallback.cancel = function () { active = false; }; return this.nextCallback; }; Transition.prototype.onTransitionEnd = function onTransitionEnd(node, timeout, handler) { this.setNextCallback(handler); if (node) { if (this.props.addEndListener) { this.props.addEndListener(node, this.nextCallback); } if (timeout != null) { setTimeout(this.nextCallback, timeout); } } else { setTimeout(this.nextCallback, 0); } }; Transition.prototype.render = function render() { var status = this.state.status; if (status === UNMOUNTED) { return null; } var _props = this.props, children = _props.children, childProps = _objectWithoutProperties(_props, ['children']); // filter props for Transtition delete childProps.in; delete childProps.mountOnEnter; delete childProps.unmountOnExit; delete childProps.appear; delete childProps.enter; delete childProps.exit; delete childProps.timeout; delete childProps.addEndListener; delete childProps.onEnter; delete childProps.onEntering; delete childProps.onEntered; delete childProps.onExit; delete childProps.onExiting; delete childProps.onExited; if (typeof children === 'function') { return children(status, childProps); } var child = _react2.default.Children.only(children); return _react2.default.cloneElement(child, childProps); }; return Transition; }(_react2.default.Component); Transition.contextTypes = { transitionGroup: PropTypes.object }; Transition.childContextTypes = { transitionGroup: function transitionGroup() {} }; Transition.propTypes = process.env.NODE_ENV !== "production" ? { /** * A `function` child can be used instead of a React element. * This function is called with the current transition status * ('entering', 'entered', 'exiting', 'exited', 'unmounted'), which can used * to apply context specific props to a component. * * ```jsx * <Transition timeout={150}> * {(status) => ( * <MyComponent className={`fade fade-${status}`} /> * )} * </Transition> * ``` */ children: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.element.isRequired]).isRequired, /** * Show the component; triggers the enter or exit states */ in: PropTypes.bool, /** * By default the child component is mounted immediately along with * the parent `Transition` component. If you want to "lazy mount" the component on the * first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay * mounted, even on "exited", unless you also specify `unmountOnExit`. */ mountOnEnter: PropTypes.bool, /** * By default the child component stays mounted after it reaches the `'exited'` state. * Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting. */ unmountOnExit: PropTypes.bool, /** * Normally a component is not transitioned if it shown when the `<Transition>` component mounts. * If you want to transition on the first mount set `appear` to `true`, and the * component will transition in as soon as the `<Transition>` mounts. * * > Note: there are no specific "appear" states. `apprear` only an additional `enter` transition. */ appear: PropTypes.bool, /** * Enable or disable enter transitions. */ enter: PropTypes.bool, /** * Enable or disable exit transitions. */ exit: PropTypes.bool, /** * The duration for the transition, in milliseconds. * Required unless `addEventListener` is provided * * You may specify a single timeout for all transitions like: `timeout={500}`, * or individually like: * * ```jsx * timeout={{ * enter: 300, * exit: 500, * }} * ``` * * @type {number | { enter?: number, exit?: number }} */ timeout: function timeout(props) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } var pt = _PropTypes.timeoutsShape; if (!props.addEndListener) pt = pt.isRequired; return pt.apply(undefined, [props].concat(args)); }, /** * Add a custom transition end trigger. Called with the transitioning * DOM node and a `done` callback. Allows for more fine grained transition end * logic. **Note:** Timeouts are still used as a fallback if provided. * * ```jsx * addEndListener={(node, done) => { * // use the css transitionend event to mark the finish of a transition * node.addEventListener('transitionend', done, false); * }} * ``` */ addEndListener: PropTypes.func, /** * Callback fired before the "entering" status is applied. An extra parameter * `isAppearing` is supplied to indicate if the enter stage is occuring on the initial mount * * @type Function(node: HtmlElement, isAppearing: bool) -> void */ onEnter: PropTypes.func, /** * Callback fired after the "entering" status is applied. An extra parameter * `isAppearing` is supplied to indicate if the enter stage is occuring on the initial mount * * @type Function(node: HtmlElement, isAppearing: bool) */ onEntering: PropTypes.func, /** * Callback fired after the "enter" status is applied. An extra parameter * `isAppearing` is supplied to indicate if the enter stage is occuring on the initial mount * * @type Function(node: HtmlElement, isAppearing: bool) -> void */ onEntered: PropTypes.func, /** * Callback fired before the "exiting" status is applied. * * @type Function(node: HtmlElement) -> void */ onExit: PropTypes.func, /** * Callback fired after the "exiting" status is applied. * * @type Function(node: HtmlElement) -> void */ onExiting: PropTypes.func, /** * Callback fired after the "exited" status is applied. * * @type Function(node: HtmlElement) -> void */ onExited: PropTypes.func } : {}; // Name the function so it is clearer in the documentation function noop() {} Transition.defaultProps = { in: false, mountOnEnter: false, unmountOnExit: false, appear: false, enter: true, exit: true, onEnter: noop, onEntering: noop, onEntered: noop, onExit: noop, onExiting: noop, onExited: noop }; Transition.UNMOUNTED = 0; Transition.EXITED = 1; Transition.ENTERING = 2; Transition.ENTERED = 3; Transition.EXITING = 4; exports.default = Transition; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), /* 57 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.default = createChainableTypeChecker; /** * Copyright 2013-present, 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. */ // Mostly taken from ReactPropTypes. function createChainableTypeChecker(validate) { function checkType(isRequired, props, propName, componentName, location, propFullName) { var componentNameSafe = componentName || '<<anonymous>>'; var propFullNameSafe = propFullName || propName; if (props[propName] == null) { if (isRequired) { return new Error('Required ' + location + ' `' + propFullNameSafe + '` was not specified ' + ('in `' + componentNameSafe + '`.')); } return null; } for (var _len = arguments.length, args = Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++) { args[_key - 6] = arguments[_key]; } return validate.apply(undefined, [props, propName, componentNameSafe, location, propFullNameSafe].concat(args)); } var chainedCheckType = checkType.bind(null, false); chainedCheckType.isRequired = checkType.bind(null, true); return chainedCheckType; } /***/ }), /* 58 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); var _widgetHelpers = __webpack_require__(10); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 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; } var propTypes = { className: _propTypes2.default.string, role: _propTypes2.default.string, nodeRef: _propTypes2.default.func, emptyListMessage: _propTypes2.default.node }; var Listbox = function (_React$Component) { _inherits(Listbox, _React$Component); function Listbox() { _classCallCheck(this, Listbox); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } Listbox.prototype.render = function render() { var _props = this.props, className = _props.className, role = _props.role, children = _props.children, emptyListMessage = _props.emptyListMessage, nodeRef = _props.nodeRef, props = _objectWithoutProperties(_props, ['className', 'role', 'children', 'emptyListMessage', 'nodeRef']); var id = (0, _widgetHelpers.instanceId)(this); return _react2.default.createElement( 'ul', _extends({ id: id, tabIndex: '-1', ref: nodeRef, className: (0, _classnames2.default)(className, 'rw-list'), role: role === undefined ? 'listbox' : role }, props), _react2.default.Children.count(children) ? children : _react2.default.createElement( 'li', { className: 'rw-list-empty' }, emptyListMessage ) ); }; return Listbox; }(_react2.default.Component); Listbox.propTypes = propTypes; exports.default = Listbox; module.exports = exports['default']; /***/ }), /* 59 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _propTypes = __webpack_require__(1); var PropTypes = _interopRequireWildcard(_propTypes); var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _Listbox = __webpack_require__(58); var _Listbox2 = _interopRequireDefault(_Listbox); var _ListOption = __webpack_require__(42); var _ListOption2 = _interopRequireDefault(_ListOption); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } var propTypes = { searchTerm: PropTypes.string, focused: PropTypes.bool, onSelect: PropTypes.func.isRequired, activeId: PropTypes.string }; function AddToListOption(_ref) { var searchTerm = _ref.searchTerm, onSelect = _ref.onSelect, focused = _ref.focused, children = _ref.children, activeId = _ref.activeId, props = _objectWithoutProperties(_ref, ['searchTerm', 'onSelect', 'focused', 'children', 'activeId']); return _react2.default.createElement( _Listbox2.default, _extends({}, props, { className: 'rw-list-option-create' }), _react2.default.createElement( _ListOption2.default, { onSelect: onSelect, focused: focused, activeId: activeId, dataItem: searchTerm }, children ) ); } AddToListOption.propTypes = propTypes; exports.default = AddToListOption; module.exports = exports['default']; /***/ }), /* 60 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _inDOM = __webpack_require__(11); var _inDOM2 = _interopRequireDefault(_inDOM); var _querySelectorAll = __webpack_require__(53); var _querySelectorAll2 = _interopRequireDefault(_querySelectorAll); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var matches = void 0; if (_inDOM2.default) { (function () { var body = document.body; var nativeMatch = body.matches || body.matchesSelector || body.webkitMatchesSelector || body.mozMatchesSelector || body.msMatchesSelector; matches = nativeMatch ? function (node, selector) { return nativeMatch.call(node, selector); } : ie8MatchesSelector; })(); } exports.default = matches; function ie8MatchesSelector(node, selector) { var matches = (0, _querySelectorAll2.default)(node.document || node.ownerDocument, selector), i = 0; while (matches[i] && matches[i] !== node) { i++; }return !!matches[i]; } module.exports = exports['default']; /***/ }), /* 61 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _VIEW, _OPPOSITE_DIRECTION, _MULTIPLIER, _class, _desc, _value2, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _class3, _temp; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(5); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); var _uncontrollable = __webpack_require__(15); var _uncontrollable2 = _interopRequireDefault(_uncontrollable); var _reactComponentManagers = __webpack_require__(9); var _Widget = __webpack_require__(16); var _Widget2 = _interopRequireDefault(_Widget); var _Header = __webpack_require__(93); var _Header2 = _interopRequireDefault(_Header); var _Footer = __webpack_require__(94); var _Footer2 = _interopRequireDefault(_Footer); var _Month = __webpack_require__(95); var _Month2 = _interopRequireDefault(_Month); var _Year = __webpack_require__(97); var _Year2 = _interopRequireDefault(_Year); var _Decade = __webpack_require__(98); var _Decade2 = _interopRequireDefault(_Decade); var _Century = __webpack_require__(99); var _Century2 = _interopRequireDefault(_Century); var _messages = __webpack_require__(12); var _SlideTransitionGroup = __webpack_require__(62); var _SlideTransitionGroup2 = _interopRequireDefault(_SlideTransitionGroup); var _focusManager = __webpack_require__(17); var _focusManager2 = _interopRequireDefault(_focusManager); var _localizers = __webpack_require__(6); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); var _constants = __webpack_require__(35); var constants = _interopRequireWildcard(_constants); var _Props = __webpack_require__(4); var Props = _interopRequireWildcard(_Props); var _dates = __webpack_require__(14); var _dates2 = _interopRequireDefault(_dates); var _withRightToLeft = __webpack_require__(18); var _withRightToLeft2 = _interopRequireDefault(_withRightToLeft); var _widgetHelpers = __webpack_require__(10); var _interaction = __webpack_require__(13); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _initDefineProp(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } 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; } function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object['ke' + 'ys'](descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object['define' + 'Property'](target, property, desc); desc = null; } return desc; } function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.'); } var _constants$directions = constants.directions, DOWN = _constants$directions.DOWN, UP = _constants$directions.UP, LEFT = _constants$directions.LEFT, RIGHT = _constants$directions.RIGHT; var last = function last(a) { return a[a.length - 1]; }; var views = constants.calendarViews; var VIEW_OPTIONS = Object.keys(views).map(function (k) { return views[k]; }); var VIEW_UNIT = constants.calendarViewUnits; var VIEW = (_VIEW = {}, _VIEW[views.MONTH] = _Month2.default, _VIEW[views.YEAR] = _Year2.default, _VIEW[views.DECADE] = _Decade2.default, _VIEW[views.CENTURY] = _Century2.default, _VIEW); var ARROWS_TO_DIRECTION = { ArrowDown: DOWN, ArrowUp: UP, ArrowRight: RIGHT, ArrowLeft: LEFT }; var OPPOSITE_DIRECTION = (_OPPOSITE_DIRECTION = {}, _OPPOSITE_DIRECTION[LEFT] = RIGHT, _OPPOSITE_DIRECTION[RIGHT] = LEFT, _OPPOSITE_DIRECTION); var MULTIPLIER = (_MULTIPLIER = {}, _MULTIPLIER[views.YEAR] = 1, _MULTIPLIER[views.DECADE] = 10, _MULTIPLIER[views.CENTURY] = 100, _MULTIPLIER); var propTypes = { /** @ignore */ activeId: _propTypes2.default.string, disabled: CustomPropTypes.disabled, readOnly: CustomPropTypes.disabled, onChange: _propTypes2.default.func, value: _propTypes2.default.instanceOf(Date), /** * The minimum date that the Calendar can navigate from. * * @example ['prop', ['min', 'new Date()']] */ min: _propTypes2.default.instanceOf(Date).isRequired, /** * The maximum date that the Calendar can navigate to. * * @example ['prop', ['max', 'new Date()']] */ max: _propTypes2.default.instanceOf(Date).isRequired, /** * Default current date at which the calendar opens. If none is provided, opens at today's date or the `value` date (if any). */ currentDate: _propTypes2.default.instanceOf(Date), /** * Change event Handler that is called when the currentDate is changed. The handler is called with the currentDate object. */ onCurrentDateChange: _propTypes2.default.func, /** * Controls the currently displayed calendar view. Use `defaultView` to set a unique starting view. * * @type {("month"|"year"|"decade"|"century")} * @controllable onViewChange */ view: function view(props) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return _propTypes2.default.oneOf(props.views || VIEW_OPTIONS).apply(undefined, [props].concat(args)); }, /** * Defines a list of views the Calendar can traverse through, starting with the * first in the list to the last. * * @type array<"month"|"year"|"decade"|"century"> */ views: _propTypes2.default.arrayOf(_propTypes2.default.oneOf(VIEW_OPTIONS)).isRequired, /** * A callback fired when the `view` changes. * * @controllable view */ onViewChange: _propTypes2.default.func, /** * Callback fired when the Calendar navigates between views, or forward and backwards in time. * * @type function(date: ?Date, direction: string, view: string) */ onNavigate: _propTypes2.default.func, culture: _propTypes2.default.string, autoFocus: _propTypes2.default.bool, /** * Show or hide the Calendar footer. * * @example ['prop', ['footer', true]] */ footer: _propTypes2.default.bool, /** * Provide a custom component to render the days of the month. The Component is provided the following props * * - `date`: a `Date` object for the day of the month to render * - `label`: a formatted `string` of the date to render. To adjust the format of the `label` string use the `dateFormat` prop, listed below. */ dayComponent: CustomPropTypes.elementType, /** * A formatter for the header button of the month view. * * @example ['dateFormat', ['headerFormat', "{ date: 'medium' }"]] */ headerFormat: CustomPropTypes.dateFormat, /** * A formatter for the Calendar footer, formats today's Date as a string. * * @example ['dateFormat', ['footerFormat', "{ date: 'medium' }", "date => 'Today is: ' + formatter(date)"]] */ footerFormat: CustomPropTypes.dateFormat, /** * A formatter calendar days of the week, the default formats each day as a Narrow name: "Mo", "Tu", etc. * * @example ['prop', { dayFormat: "day => \n['๐ŸŽ‰', 'M', 'T','W','Th', 'F', '๐ŸŽ‰'][day.getDay()]" }] */ dayFormat: CustomPropTypes.dateFormat, /** * A formatter for day of the month * * @example ['prop', { dateFormat: "dt => String(dt.getDate())" }] */ dateFormat: CustomPropTypes.dateFormat, /** * A formatter for month name. * * @example ['dateFormat', ['monthFormat', "{ raw: 'MMMM' }", null, { defaultView: '"year"' }]] */ monthFormat: CustomPropTypes.dateFormat, /** * A formatter for month name. * * @example ['dateFormat', ['yearFormat', "{ raw: 'yy' }", null, { defaultView: '"decade"' }]] */ yearFormat: CustomPropTypes.dateFormat, /** * A formatter for decade, the default formats the first and last year of the decade like: 2000 - 2009. */ decadeFormat: CustomPropTypes.dateFormat, /** * A formatter for century, the default formats the first and last year of the century like: 1900 - 1999. */ centuryFormat: CustomPropTypes.dateFormat, messages: _propTypes2.default.shape({ moveBack: _propTypes2.default.string, moveForward: _propTypes2.default.string }), onKeyDown: _propTypes2.default.func, /** @ignore */ tabIndex: _propTypes2.default.any /** * --- * localized: true * shortcuts: * - { key: ctrl + down arrow, label: navigate to next view } * - { key: ctrl + up arrow, label: navigate to previous view } * - { key: ctrl + left arrow, label: navigate to previous: month, year, decade, or century } * - { key: ctrl + right arrow, label: navigate to next: month, year, decade, or century } * - { key: left arrow, label: move focus to previous date} * - { key: right arrow, label: move focus to next date } * - { key: up arrow, label: move focus up within view } * - { key: down key, label: move focus down within view } * --- * * @public */ }; var Calendar = (0, _withRightToLeft2.default)(_class = (_class2 = (_temp = _class3 = function (_React$Component) { _inherits(Calendar, _React$Component); function Calendar() { _classCallCheck(this, Calendar); for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } var _this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))); _this.handleFocusWillChange = function () { if (_this.props.tabIndex == -1) return false; }; _initDefineProp(_this, 'handleViewChange', _descriptor, _this); _initDefineProp(_this, 'handleMoveBack', _descriptor2, _this); _initDefineProp(_this, 'handleMoveForward', _descriptor3, _this); _initDefineProp(_this, 'handleChange', _descriptor4, _this); _initDefineProp(_this, 'handleFooterClick', _descriptor5, _this); _initDefineProp(_this, 'handleKeyDown', _descriptor6, _this); _this.messages = (0, _messages.getMessages)(_this.props.messages); _this.viewId = (0, _widgetHelpers.instanceId)(_this, '_calendar'); _this.labelId = (0, _widgetHelpers.instanceId)(_this, '_calendar_label'); _this.activeId = _this.props.activeId || (0, _widgetHelpers.instanceId)(_this, '_calendar_active_cell'); (0, _reactComponentManagers.autoFocus)(_this); _this.focusManager = (0, _focusManager2.default)(_this, { willHandle: _this.handleFocusWillChange }); var _this$props = _this.props, view = _this$props.view, views = _this$props.views; _this.state = { selectedIndex: 0, view: view || views[0] }; return _this; } Calendar.prototype.componentWillReceiveProps = function componentWillReceiveProps(_ref) { var messages = _ref.messages, view = _ref.view, views = _ref.views, value = _ref.value, currentDate = _ref.currentDate; var val = this.inRangeValue(value); this.messages = (0, _messages.getMessages)(messages); view = view || views[0]; this.setState({ view: view, slideDirection: this.getSlideDirection({ view: view, views: views, currentDate: currentDate }) }); //if the value changes reset views to the new one if (!_dates2.default.eq(val, dateOrNull(this.props.value), VIEW_UNIT[view])) { this.setCurrentDate(val, currentDate); } }; Calendar.prototype.render = function render() { var _props = this.props, className = _props.className, value = _props.value, footerFormat = _props.footerFormat, disabled = _props.disabled, readOnly = _props.readOnly, footer = _props.footer, views = _props.views, min = _props.min, max = _props.max, culture = _props.culture, tabIndex = _props.tabIndex; var _state = this.state, view = _state.view, slideDirection = _state.slideDirection, focused = _state.focused; var currentDate = this.getCurrentDate(); var View = VIEW[view], todaysDate = new Date(), todayNotInRange = !_dates2.default.inRange(todaysDate, min, max, view); var key = view + '_' + _dates2.default[view](currentDate); var elementProps = Props.pickElementProps(this), viewProps = Props.pick(this.props, View); var isDisabled = disabled || readOnly; return _react2.default.createElement( _Widget2.default, _extends({}, elementProps, { role: 'group', focused: focused, disabled: disabled, readOnly: readOnly, tabIndex: tabIndex || 0, onKeyDown: this.handleKeyDown, onBlur: this.focusManager.handleBlur, onFocus: this.focusManager.handleFocus, className: (0, _classnames2.default)(className, 'rw-calendar rw-widget-container'), 'aria-activedescendant': this.activeId }), _react2.default.createElement(_Header2.default, { label: this.getHeaderLabel(), labelId: this.labelId, messages: this.messages, upDisabled: isDisabled || view === last(views), prevDisabled: isDisabled || !_dates2.default.inRange(this.nextDate(LEFT), min, max, view), nextDisabled: isDisabled || !_dates2.default.inRange(this.nextDate(RIGHT), min, max, view), onViewChange: this.handleViewChange, onMoveLeft: this.handleMoveBack, onMoveRight: this.handleMoveForward }), _react2.default.createElement( Calendar.Transition, { direction: slideDirection }, _react2.default.createElement(View, _extends({}, viewProps, { key: key, id: this.viewId, activeId: this.activeId, value: value, today: todaysDate, disabled: disabled, focused: currentDate, onChange: this.handleChange, onKeyDown: this.handleKeyDown, 'aria-labelledby': this.labelId })) ), footer && _react2.default.createElement(_Footer2.default, { value: todaysDate, format: footerFormat, culture: culture, disabled: disabled || todayNotInRange, readOnly: readOnly, onClick: this.handleFooterClick }) ); }; Calendar.prototype.navigate = function navigate(direction, date) { var _props2 = this.props, views = _props2.views, min = _props2.min, max = _props2.max, onNavigate = _props2.onNavigate, onViewChange = _props2.onViewChange; var view = this.state.view; var slideDir = direction === LEFT || direction === UP ? 'right' : 'left'; if (direction === UP) view = views[views.indexOf(view) + 1] || view; if (direction === DOWN) view = views[views.indexOf(view) - 1] || view; if (!date) date = [LEFT, RIGHT].indexOf(direction) !== -1 ? this.nextDate(direction) : this.getCurrentDate(); if (_dates2.default.inRange(date, min, max, view)) { (0, _widgetHelpers.notify)(onNavigate, [date, slideDir, view]); this.focus(true); this.setCurrentDate(date); (0, _widgetHelpers.notify)(onViewChange, [view]); } }; Calendar.prototype.focus = function focus() { if (+this.props.tabIndex > -1) (0, _reactDom.findDOMNode)(this).focus(); }; Calendar.prototype.getCurrentDate = function getCurrentDate() { return this.props.currentDate || this.props.value || new Date(); }; Calendar.prototype.setCurrentDate = function setCurrentDate(date) { var currentDate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getCurrentDate(); var inRangeDate = this.inRangeValue(date ? new Date(date) : currentDate); if (_dates2.default.eq(inRangeDate, dateOrNull(currentDate), VIEW_UNIT[this.state.view])) return; (0, _widgetHelpers.notify)(this.props.onCurrentDateChange, inRangeDate); }; Calendar.prototype.nextDate = function nextDate(direction) { var method = direction === LEFT ? 'subtract' : 'add', view = this.state.view, unit = view === views.MONTH ? view : views.YEAR, multi = MULTIPLIER[view] || 1; return _dates2.default[method](this.getCurrentDate(), 1 * multi, unit); }; Calendar.prototype.getHeaderLabel = function getHeaderLabel() { var _props3 = this.props, culture = _props3.culture, decadeFormat = _props3.decadeFormat, yearFormat = _props3.yearFormat, headerFormat = _props3.headerFormat, centuryFormat = _props3.centuryFormat, view = this.state.view, currentDate = this.getCurrentDate(); switch (view) { case views.MONTH: headerFormat = _localizers.date.getFormat('header', headerFormat); return _localizers.date.format(currentDate, headerFormat, culture); case views.YEAR: yearFormat = _localizers.date.getFormat('year', yearFormat); return _localizers.date.format(currentDate, yearFormat, culture); case views.DECADE: decadeFormat = _localizers.date.getFormat('decade', decadeFormat); return _localizers.date.format(_dates2.default.startOf(currentDate, 'decade'), decadeFormat, culture); case views.CENTURY: centuryFormat = _localizers.date.getFormat('century', centuryFormat); return _localizers.date.format(_dates2.default.startOf(currentDate, 'century'), centuryFormat, culture); } }; Calendar.prototype.inRangeValue = function inRangeValue(_value) { var value = dateOrNull(_value); if (value === null) return value; return _dates2.default.max(_dates2.default.min(value, this.props.max), this.props.min); }; Calendar.prototype.isValidView = function isValidView(next) { var views = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.props.views; return views.indexOf(next) !== -1; }; Calendar.prototype.getSlideDirection = function getSlideDirection(_ref2) { var view = _ref2.view, currentDate = _ref2.currentDate, views = _ref2.views; var lastDate = this.props.currentDate; var _state2 = this.state, slideDirection = _state2.slideDirection, lastView = _state2.view; if (lastView !== view) { return views.indexOf(lastView) > views.indexOf(view) ? 'top' : 'bottom'; } if (lastDate !== currentDate) { return _dates2.default.gt(currentDate, lastDate) ? 'left' : 'right'; } return slideDirection; }; return Calendar; }(_react2.default.Component), _class3.displayName = 'Calendar', _class3.propTypes = propTypes, _class3.defaultProps = { value: null, min: new Date(1900, 0, 1), max: new Date(2099, 11, 31), views: VIEW_OPTIONS, tabIndex: '0', footer: true }, _class3.Transition = _SlideTransitionGroup2.default, _temp), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'handleViewChange', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this2 = this; return function () { _this2.navigate(UP); }; } }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'handleMoveBack', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this3 = this; return function () { _this3.navigate(LEFT); }; } }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'handleMoveForward', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this4 = this; return function () { _this4.navigate(RIGHT); }; } }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'handleChange', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this5 = this; return function (date) { var _props4 = _this5.props, views = _props4.views, onChange = _props4.onChange; var view = _this5.state.view; if (views[0] === view) { _this5.setCurrentDate(date); (0, _widgetHelpers.notify)(onChange, date); _this5.focus(); return; } _this5.navigate(DOWN, date); }; } }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, 'handleFooterClick', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this6 = this; return function (date) { var _props5 = _this6.props, views = _props5.views, min = _props5.min, max = _props5.max, onViewChange = _props5.onViewChange; var firstView = views[0]; (0, _widgetHelpers.notify)(_this6.props.onChange, date); if (_dates2.default.inRange(date, min, max, firstView)) { _this6.focus(); _this6.setCurrentDate(date); (0, _widgetHelpers.notify)(onViewChange, [firstView]); } }; } }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, 'handleKeyDown', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this7 = this; return function (e) { var ctrl = e.ctrlKey || e.metaKey, key = e.key, direction = ARROWS_TO_DIRECTION[key], currentDate = _this7.getCurrentDate(), view = _this7.state.view, unit = VIEW_UNIT[view]; if (key === 'Enter') { e.preventDefault(); return _this7.handleChange(currentDate); } if (direction) { if (ctrl) { e.preventDefault(); _this7.navigate(direction); } else { if (_this7.isRtl() && OPPOSITE_DIRECTION[direction]) direction = OPPOSITE_DIRECTION[direction]; var nextDate = _dates2.default.move(currentDate, _this7.props.min, _this7.props.max, view, direction); if (!_dates2.default.eq(currentDate, nextDate, unit)) { e.preventDefault(); if (_dates2.default.gt(nextDate, currentDate, view)) _this7.navigate(RIGHT, nextDate);else if (_dates2.default.lt(nextDate, currentDate, view)) _this7.navigate(LEFT, nextDate);else _this7.setCurrentDate(nextDate); } } } (0, _widgetHelpers.notify)(_this7.props.onKeyDown, [e]); }; } })), _class2)) || _class; function dateOrNull(dt) { if (dt && !isNaN(dt.getTime())) return dt; return null; } exports.default = (0, _uncontrollable2.default)(Calendar, { value: 'onChange', currentDate: 'onCurrentDateChange', view: 'onViewChange' }, ['focus']); module.exports = exports['default']; /***/ }), /* 62 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _transitionStyle, _transitionClasses, _class, _temp2, _class2, _temp4; var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); var _events = __webpack_require__(49); var _events2 = _interopRequireDefault(_events); var _style = __webpack_require__(40); var _style2 = _interopRequireDefault(_style); var _height = __webpack_require__(30); var _height2 = _interopRequireDefault(_height); var _properties = __webpack_require__(41); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _TransitionGroup = __webpack_require__(100); var _TransitionGroup2 = _interopRequireDefault(_TransitionGroup); var _Transition = __webpack_require__(56); var _Transition2 = _interopRequireDefault(_Transition); var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(5); var _Props = __webpack_require__(4); var Props = _interopRequireWildcard(_Props); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 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; } var DirectionPropType = _propTypes2.default.oneOf(['left', 'right', 'top', 'bottom']); var transitionStyle = (_transitionStyle = {}, _transitionStyle[_Transition.ENTERING] = { position: 'absolute' }, _transitionStyle[_Transition.EXITING] = { position: 'absolute' }, _transitionStyle); var transitionClasses = (_transitionClasses = {}, _transitionClasses[_Transition.ENTERED] = 'rw-calendar-transition-entered', _transitionClasses[_Transition.ENTERING] = 'rw-calendar-transition-entering', _transitionClasses[_Transition.EXITING] = 'rw-calendar-transition-exiting', _transitionClasses[_Transition.EXITED] = 'rw-calendar-transition-exited', _transitionClasses); function parseDuration(node) { var str = (0, _style2.default)(node, _properties.transitionDuration); var mult = str.indexOf('ms') === -1 ? 1000 : 1; return parseFloat(str) * mult; } var SlideTransition = (_temp2 = _class = function (_React$Component) { _inherits(SlideTransition, _React$Component); function SlideTransition() { var _temp, _this, _ret; _classCallCheck(this, SlideTransition); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleTransitionEnd = function (node, done) { var duration = parseDuration(node) || 300; var handler = function handler() { _events2.default.off(node, _properties.transitionEnd, handler, false); done(); }; setTimeout(handler, duration * 1.5); _events2.default.on(node, _properties.transitionEnd, handler, false); }, _temp), _possibleConstructorReturn(_this, _ret); } SlideTransition.prototype.render = function render() { var _props = this.props, children = _props.children, props = _objectWithoutProperties(_props, ['children']); var direction = this.context.direction; var child = _react2.default.Children.only(children); return _react2.default.createElement( _Transition2.default, _extends({}, props, { timeout: 5000, addEndListener: this.handleTransitionEnd }), function (status, innerProps) { return _react2.default.cloneElement(child, _extends({}, innerProps, { style: transitionStyle[status], className: (0, _classnames2.default)(child.props.className, 'rw-calendar-transition', 'rw-calendar-transition-' + direction, transitionClasses[status]) })); } ); }; return SlideTransition; }(_react2.default.Component), _class.contextTypes = { direction: DirectionPropType }, _temp2); var SlideTransitionGroup = (_temp4 = _class2 = function (_React$Component2) { _inherits(SlideTransitionGroup, _React$Component2); function SlideTransitionGroup() { var _temp3, _this2, _ret2; _classCallCheck(this, SlideTransitionGroup); for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } return _ret2 = (_temp3 = (_this2 = _possibleConstructorReturn(this, _React$Component2.call.apply(_React$Component2, [this].concat(args))), _this2), _this2.handleEnter = function (child) { var node = (0, _reactDom.findDOMNode)(_this2); if (!child) return; var height = (0, _height2.default)(child) + 'px'; (0, _style2.default)(node, { height: height, overflow: 'hidden' }); }, _this2.handleExited = function () { var node = (0, _reactDom.findDOMNode)(_this2); (0, _style2.default)(node, { overflow: '', height: '' }); }, _temp3), _possibleConstructorReturn(_this2, _ret2); } SlideTransitionGroup.prototype.getChildContext = function getChildContext() { return { direction: this.props.direction }; }; SlideTransitionGroup.prototype.render = function render() { var _props2 = this.props, children = _props2.children, direction = _props2.direction; return _react2.default.createElement( _TransitionGroup2.default, _extends({}, Props.omitOwn(this), { component: 'div', className: 'rw-calendar-transition-group' }), _react2.default.createElement( SlideTransition, { key: children.key, direction: direction, onEnter: this.handleEnter, onExited: this.handleExited }, children ) ); }; return SlideTransitionGroup; }(_react2.default.Component), _class2.propTypes = { direction: DirectionPropType }, _class2.defaultProps = { direction: 'left' }, _class2.childContextTypes = { direction: DirectionPropType }, _temp4); exports.default = SlideTransitionGroup; module.exports = exports['default']; /***/ }), /* 63 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.setNumberLocalizer = exports.setDateLocalizer = exports.setLocalizers = exports.utils = exports.SelectList = exports.Multiselect = exports.NumberPicker = exports.DateTimePicker = exports.TimePicker = exports.DatePicker = exports.Calendar = exports.Combobox = exports.DropdownList = undefined; var _configure = __webpack_require__(64); var _configure2 = _interopRequireDefault(_configure); var _DropdownList = __webpack_require__(69); var _DropdownList2 = _interopRequireDefault(_DropdownList); var _Combobox = __webpack_require__(91); var _Combobox2 = _interopRequireDefault(_Combobox); var _Calendar = __webpack_require__(61); var _Calendar2 = _interopRequireDefault(_Calendar); var _DatePicker = __webpack_require__(102); var _DatePicker2 = _interopRequireDefault(_DatePicker); var _TimePicker = __webpack_require__(107); var _TimePicker2 = _interopRequireDefault(_TimePicker); var _DateTimePicker = __webpack_require__(44); var _DateTimePicker2 = _interopRequireDefault(_DateTimePicker); var _NumberPicker = __webpack_require__(108); var _NumberPicker2 = _interopRequireDefault(_NumberPicker); var _Multiselect = __webpack_require__(110); var _Multiselect2 = _interopRequireDefault(_Multiselect); var _SelectList = __webpack_require__(115); var _SelectList2 = _interopRequireDefault(_SelectList); var _SlideTransitionGroup = __webpack_require__(62); var _SlideTransitionGroup2 = _interopRequireDefault(_SlideTransitionGroup); var _SlideDownTransition = __webpack_require__(48); var _SlideDownTransition2 = _interopRequireDefault(_SlideDownTransition); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /* eslint-disable global-require */ var setLocalizers = _configure2.default.setLocalizers, setDateLocalizer = _configure2.default.setDateLocalizer, setNumberLocalizer = _configure2.default.setNumberLocalizer; var utils = { SlideTransitionGroup: _SlideTransitionGroup2.default, SlideDownTransition: _SlideDownTransition2.default }; exports.DropdownList = _DropdownList2.default; exports.Combobox = _Combobox2.default; exports.Calendar = _Calendar2.default; exports.DatePicker = _DatePicker2.default; exports.TimePicker = _TimePicker2.default; exports.DateTimePicker = _DateTimePicker2.default; exports.NumberPicker = _NumberPicker2.default; exports.Multiselect = _Multiselect2.default; exports.SelectList = _SelectList2.default; exports.utils = utils; exports.setLocalizers = setLocalizers; exports.setDateLocalizer = setDateLocalizer; exports.setNumberLocalizer = setNumberLocalizer; /***/ }), /* 64 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _localizers = __webpack_require__(6); var localizers = _interopRequireWildcard(_localizers); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } exports.default = { setLocalizers: function setLocalizers(_ref) { var date = _ref.date, number = _ref.number; date && this.setDateLocalizer(date); number && this.setNumberLocalizer(number); }, setDateLocalizer: localizers.setDate, setNumberLocalizer: localizers.setNumber }; module.exports = exports['default']; /***/ }), /* 65 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) {/** * 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. */ /** * 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 = function() {}; if (process.env.NODE_ENV !== 'production') { warning = function(condition, format, args) { var len = arguments.length; args = new Array(len > 2 ? len - 2 : 0); for (var key = 2; key < len; key++) { args[key - 2] = arguments[key]; } 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 (!condition) { var argIndex = 0; var message = 'Warning: ' + format.replace(/%s/g, function() { return args[argIndex++]; }); if (typeof console !== 'undefined') { console.error(message); } try { // 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; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), /* 66 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) {/** * Copyright 2013-present, 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. */ var emptyFunction = __webpack_require__(36); var invariant = __webpack_require__(37); var warning = __webpack_require__(45); var ReactPropTypesSecret = __webpack_require__(38); var checkPropTypes = __webpack_require__(67); module.exports = function(isValidElement, throwOnDirectAccess) { /* 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; } } /** * 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>>'; // Important! // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. var ReactPropTypes = { array: createPrimitiveTypeChecker('array'), bool: createPrimitiveTypeChecker('boolean'), func: createPrimitiveTypeChecker('function'), number: createPrimitiveTypeChecker('number'), object: createPrimitiveTypeChecker('object'), string: createPrimitiveTypeChecker('string'), symbol: createPrimitiveTypeChecker('symbol'), any: createAnyTypeChecker(), arrayOf: createArrayOfTypeChecker, element: createElementTypeChecker(), instanceOf: createInstanceTypeChecker, node: createNodeChecker(), objectOf: createObjectOfTypeChecker, oneOf: createEnumTypeChecker, oneOfType: createUnionTypeChecker, shape: createShapeTypeChecker }; /** * inlined Object.is polyfill to avoid requiring consumers ship their own * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is */ /*eslint-disable no-self-compare*/ function is(x, y) { // SameValue algorithm if (x === y) { // Steps 1-5, 7-10 // Steps 6.b-6.e: +0 != -0 return x !== 0 || 1 / x === 1 / y; } else { // Step 6.a: NaN == NaN return x !== x && y !== y; } } /*eslint-enable no-self-compare*/ /** * We use an Error-like object for backward compatibility as people may call * PropTypes directly and inspect their output. However, we don't use real * Errors anymore. We don't inspect their stack anyway, and creating them * is prohibitively expensive if they are created too often, such as what * happens in oneOfType() for any type before the one that matched. */ function PropTypeError(message) { this.message = message; this.stack = ''; } // Make `instanceof Error` still work for returned errors. PropTypeError.prototype = Error.prototype; function createChainableTypeChecker(validate) { if (process.env.NODE_ENV !== 'production') { var manualPropTypeCallCache = {}; var manualPropTypeWarningCount = 0; } function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { componentName = componentName || ANONYMOUS; propFullName = propFullName || propName; if (secret !== ReactPropTypesSecret) { if (throwOnDirectAccess) { // New behavior only for users of `prop-types` package invariant( false, 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use `PropTypes.checkPropTypes()` to call them. ' + 'Read more at http://fb.me/use-check-prop-types' ); } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { // Old behavior for people using React.PropTypes var cacheKey = componentName + ':' + propName; if ( !manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors manualPropTypeWarningCount < 3 ) { warning( false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', propFullName, componentName ); manualPropTypeCallCache[cacheKey] = true; manualPropTypeWarningCount++; } } } if (props[propName] == null) { if (isRequired) { if (props[propName] === null) { return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); } return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); } return null; } else { return validate(props, propName, componentName, location, propFullName); } } var chainedCheckType = checkType.bind(null, false); chainedCheckType.isRequired = checkType.bind(null, true); return chainedCheckType; } function createPrimitiveTypeChecker(expectedType) { function validate(props, propName, componentName, location, propFullName, secret) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== expectedType) { // `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 PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); } return null; } return createChainableTypeChecker(validate); } function createAnyTypeChecker() { return createChainableTypeChecker(emptyFunction.thatReturnsNull); } function createArrayOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location, propFullName) { if (typeof typeChecker !== 'function') { return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); } var propValue = props[propName]; if (!Array.isArray(propValue)) { var propType = getPropType(propValue); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); } for (var i = 0; i < propValue.length; i++) { var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); if (error instanceof Error) { return error; } } return null; } return createChainableTypeChecker(validate); } function createElementTypeChecker() { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; if (!isValidElement(propValue)) { var propType = getPropType(propValue); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); } return null; } return createChainableTypeChecker(validate); } function createInstanceTypeChecker(expectedClass) { function validate(props, propName, componentName, location, propFullName) { if (!(props[propName] instanceof expectedClass)) { var expectedClassName = expectedClass.name || ANONYMOUS; var actualClassName = getClassName(props[propName]); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); } return null; } return createChainableTypeChecker(validate); } function createEnumTypeChecker(expectedValues) { if (!Array.isArray(expectedValues)) { process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; return emptyFunction.thatReturnsNull; } function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; for (var i = 0; i < expectedValues.length; i++) { if (is(propValue, expectedValues[i])) { return null; } } var valuesString = JSON.stringify(expectedValues); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); } return createChainableTypeChecker(validate); } function createObjectOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location, propFullName) { if (typeof typeChecker !== 'function') { return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); } var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` 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, propFullName + '.' + key, ReactPropTypesSecret); if (error instanceof Error) { return error; } } } return null; } return createChainableTypeChecker(validate); } function createUnionTypeChecker(arrayOfTypeCheckers) { if (!Array.isArray(arrayOfTypeCheckers)) { process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; return emptyFunction.thatReturnsNull; } for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; if (typeof checker !== 'function') { warning( false, 'Invalid argument supplid to oneOfType. Expected an array of check functions, but ' + 'received %s at index %s.', getPostfixForTypeWarning(checker), i ); return emptyFunction.thatReturnsNull; } } function validate(props, propName, componentName, location, propFullName) { for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { return null; } } return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); } return createChainableTypeChecker(validate); } function createNodeChecker() { function validate(props, propName, componentName, location, propFullName) { if (!isNode(props[propName])) { return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); } return null; } return createChainableTypeChecker(validate); } function createShapeTypeChecker(shapeTypes) { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` 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, propFullName + '.' + key, ReactPropTypesSecret); 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 || isValidElement(propValue)) { return true; } var iteratorFn = getIteratorFn(propValue); if (iteratorFn) { var iterator = iteratorFn.call(propValue); var step; if (iteratorFn !== propValue.entries) { while (!(step = iterator.next()).done) { if (!isNode(step.value)) { return false; } } } else { // Iterator will provide entry [k,v] tuples rather than values. while (!(step = iterator.next()).done) { var entry = step.value; if (entry) { if (!isNode(entry[1])) { return false; } } } } } else { return false; } return true; default: return false; } } function isSymbol(propType, propValue) { // Native Symbol. if (propType === 'symbol') { return true; } // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' if (propValue['@@toStringTag'] === 'Symbol') { return true; } // Fallback for non-spec compliant Symbols which are polyfilled. if (typeof Symbol === 'function' && propValue instanceof Symbol) { return true; } 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'; } if (isSymbol(propType, propValue)) { return 'symbol'; } return propType; } // This handles more types than `getPropType`. Only used for error messages. // See `createPrimitiveTypeChecker`. function getPreciseType(propValue) { if (typeof propValue === 'undefined' || propValue === null) { return '' + propValue; } var propType = getPropType(propValue); if (propType === 'object') { if (propValue instanceof Date) { return 'date'; } else if (propValue instanceof RegExp) { return 'regexp'; } } return propType; } // Returns a string that is postfixed to a warning about an invalid type. // For example, "undefined" or "of type array" function getPostfixForTypeWarning(value) { var type = getPreciseType(value); switch (type) { case 'array': case 'object': return 'an ' + type; case 'boolean': case 'date': case 'regexp': return 'a ' + type; default: return type; } } // Returns class name of the object, if any. function getClassName(propValue) { if (!propValue.constructor || !propValue.constructor.name) { return ANONYMOUS; } return propValue.constructor.name; } ReactPropTypes.checkPropTypes = checkPropTypes; ReactPropTypes.PropTypes = ReactPropTypes; return ReactPropTypes; }; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), /* 67 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) {/** * Copyright 2013-present, 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. */ if (process.env.NODE_ENV !== 'production') { var invariant = __webpack_require__(37); var warning = __webpack_require__(45); var ReactPropTypesSecret = __webpack_require__(38); var loggedTypeFailures = {}; } /** * Assert that the values match with the type specs. * Error messages are memorized and will only be shown once. * * @param {object} typeSpecs Map of name to a ReactPropType * @param {object} values Runtime values that need to be type-checked * @param {string} location e.g. "prop", "context", "child context" * @param {string} componentName Name of the component for error messages. * @param {?Function} getStack Returns the component stack. * @private */ function checkPropTypes(typeSpecs, values, location, componentName, getStack) { if (process.env.NODE_ENV !== 'production') { for (var typeSpecName in typeSpecs) { if (typeSpecs.hasOwnProperty(typeSpecName)) { 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. invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', location, typeSpecName); error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); } catch (ex) { error = ex; } warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); 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 stack = getStack ? getStack() : ''; warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); } } } } } module.exports = checkPropTypes; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), /* 68 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright 2013-present, 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. */ var emptyFunction = __webpack_require__(36); var invariant = __webpack_require__(37); var ReactPropTypesSecret = __webpack_require__(38); module.exports = function() { function shim(props, propName, componentName, location, propFullName, secret) { if (secret === ReactPropTypesSecret) { // It is still safe when called from React. return; } invariant( false, 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types' ); }; shim.isRequired = shim; function getShim() { return shim; }; // Important! // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. var ReactPropTypes = { array: shim, bool: shim, func: shim, number: shim, object: shim, string: shim, symbol: shim, any: shim, arrayOf: getShim, element: shim, instanceOf: getShim, node: shim, objectOf: getShim, oneOf: getShim, oneOfType: getShim, shape: getShim }; ReactPropTypes.checkPropTypes = emptyFunction; ReactPropTypes.PropTypes = ReactPropTypes; return ReactPropTypes; }; /***/ }), /* 69 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _class3, _temp; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(5); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _activeElement = __webpack_require__(27); var _activeElement2 = _interopRequireDefault(_activeElement); var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); var _reactComponentManagers = __webpack_require__(9); var _uncontrollable = __webpack_require__(15); var _uncontrollable2 = _interopRequireDefault(_uncontrollable); var _Widget = __webpack_require__(16); var _Widget2 = _interopRequireDefault(_Widget); var _WidgetPicker = __webpack_require__(21); var _WidgetPicker2 = _interopRequireDefault(_WidgetPicker); var _Select = __webpack_require__(22); var _Select2 = _interopRequireDefault(_Select); var _Popup = __webpack_require__(29); var _Popup2 = _interopRequireDefault(_Popup); var _List = __webpack_require__(23); var _List2 = _interopRequireDefault(_List); var _AddToListOption = __webpack_require__(59); var _AddToListOption2 = _interopRequireDefault(_AddToListOption); var _DropdownListInput = __webpack_require__(86); var _DropdownListInput2 = _interopRequireDefault(_DropdownListInput); var _messages = __webpack_require__(12); var _Props = __webpack_require__(4); var Props = _interopRequireWildcard(_Props); var _Filter = __webpack_require__(32); var Filter = _interopRequireWildcard(_Filter); var _focusManager = __webpack_require__(17); var _focusManager2 = _interopRequireDefault(_focusManager); var _listDataManager = __webpack_require__(20); var _listDataManager2 = _interopRequireDefault(_listDataManager); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); var _accessorManager = __webpack_require__(24); var _accessorManager2 = _interopRequireDefault(_accessorManager); var _scrollManager = __webpack_require__(25); var _scrollManager2 = _interopRequireDefault(_scrollManager); var _withRightToLeft = __webpack_require__(18); var _withRightToLeft2 = _interopRequireDefault(_withRightToLeft); var _interaction = __webpack_require__(13); var _widgetHelpers = __webpack_require__(10); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _initDefineProp(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } 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; } function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object['ke' + 'ys'](descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object['define' + 'Property'](target, property, desc); desc = null; } return desc; } function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.'); } var CREATE_OPTION = {}; /** * --- * shortcuts: * - { key: alt + down arrow, label: open dropdown } * - { key: alt + up arrow, label: close dropdown } * - { key: down arrow, label: move focus to next item } * - { key: up arrow, label: move focus to previous item } * - { key: home, label: move focus to first item } * - { key: end, label: move focus to last item } * - { key: enter, label: select focused item } * - { key: ctrl + enter, label: create new option from current searchTerm } * - { key: any key, label: search list for item starting with key } * --- * * A `<select>` replacement for single value lists. * @public */ var DropdownList = (0, _withRightToLeft2.default)(_class = (_class2 = (_temp = _class3 = function (_React$Component) { _inherits(DropdownList, _React$Component); function DropdownList() { _classCallCheck(this, DropdownList); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var _this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))); _this.handleFocusChanged = function (focused) { if (!focused) _this.close(); }; _initDefineProp(_this, 'handleSelect', _descriptor, _this); _initDefineProp(_this, 'handleCreate', _descriptor2, _this); _initDefineProp(_this, 'handleClick', _descriptor3, _this); _initDefineProp(_this, 'handleKeyDown', _descriptor4, _this); _initDefineProp(_this, 'handleKeyPress', _descriptor5, _this); _this.handleInputChange = function (e) { _this.search(e.target.value, e, 'input'); }; _this.focus = function (target) { var _this$props = _this.props, filter = _this$props.filter, open = _this$props.open; var inst = target || (filter && open ? _this.refs.filter : _this.refs.input); inst = (0, _reactDom.findDOMNode)(inst); if (inst && (0, _activeElement2.default)() !== inst) inst.focus(); }; (0, _reactComponentManagers.autoFocus)(_this); _this.messages = (0, _messages.getMessages)(_this.props.messages); _this.inputId = (0, _widgetHelpers.instanceId)(_this, '_input'); _this.listId = (0, _widgetHelpers.instanceId)(_this, '_listbox'); _this.activeId = (0, _widgetHelpers.instanceId)(_this, '_listbox_active_option'); _this.list = (0, _listDataManager2.default)(_this); _this.mounted = (0, _reactComponentManagers.mountManager)(_this); _this.timeouts = (0, _reactComponentManagers.timeoutManager)(_this); _this.accessors = (0, _accessorManager2.default)(_this); _this.handleScroll = (0, _scrollManager2.default)(_this); _this.focusManager = (0, _focusManager2.default)(_this, { didHandle: _this.handleFocusChanged }); _this.state = _this.getStateFromProps(_this.props); return _this; } DropdownList.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { this.messages = (0, _messages.getMessages)(nextProps.messages); this.setState(this.getStateFromProps(nextProps)); }; DropdownList.prototype.getStateFromProps = function getStateFromProps(props) { var open = props.open, value = props.value, data = props.data, searchTerm = props.searchTerm, filter = props.filter, minLength = props.minLength, caseSensitive = props.caseSensitive; var accessors = this.accessors, list = this.list; var initialIdx = accessors.indexOf(data, value); if (open) data = Filter.filter(data, { filter: filter, searchTerm: searchTerm, minLength: minLength, caseSensitive: caseSensitive, textField: this.accessors.text }); list.setData(data); var selectedItem = data[initialIdx]; return { data: data, selectedItem: list.nextEnabled(selectedItem), focusedItem: list.nextEnabled(selectedItem || data[0]) }; }; DropdownList.prototype.change = function change(nextValue, originalEvent) { var _props = this.props, onChange = _props.onChange, searchTerm = _props.searchTerm, lastValue = _props.value; if (!this.accessors.matches(nextValue, lastValue)) { (0, _widgetHelpers.notify)(onChange, [nextValue, { originalEvent: originalEvent, lastValue: lastValue, searchTerm: searchTerm }]); this.clearSearch(originalEvent); this.close(); } }; DropdownList.prototype.renderList = function renderList(messages) { var _props2 = this.props, open = _props2.open, filter = _props2.filter, data = _props2.data, searchTerm = _props2.searchTerm; var _state = this.state, selectedItem = _state.selectedItem, focusedItem = _state.focusedItem; var _accessors = this.accessors, value = _accessors.value, text = _accessors.text; var List = this.props.listComponent; var props = this.list.defaultProps(); return _react2.default.createElement( 'div', null, filter && _react2.default.createElement( _WidgetPicker2.default, { ref: 'filterWrapper', className: 'rw-filter-input rw-input' }, _react2.default.createElement('input', { ref: 'filter', value: searchTerm, className: 'rw-input-reset', onChange: this.handleInputChange, placeholder: messages.filterPlaceholder(this.props) }), _react2.default.createElement(_Select2.default, { icon: 'search', role: 'presentation', 'aria-hidden': 'true' }) ), _react2.default.createElement(List, _extends({}, props, { ref: 'list', id: this.listId, activeId: this.activeId, valueAccessor: value, textAccessor: text, selectedItem: selectedItem, focusedItem: open ? focusedItem : null, onSelect: this.handleSelect, onMove: this.handleScroll, 'aria-live': open && 'polite', 'aria-labelledby': this.inputId, 'aria-hidden': !this.props.open, messages: { emptyList: data.length ? messages.emptyFilter : messages.emptyList } })), this.allowCreate() && _react2.default.createElement( _AddToListOption2.default, { id: this.createId, searchTerm: searchTerm, onSelect: this.handleCreate, focused: !focusedItem || focusedItem === CREATE_OPTION }, messages.createOption(this.props) ) ); }; DropdownList.prototype.render = function render() { var _this2 = this; var _props3 = this.props, className = _props3.className, tabIndex = _props3.tabIndex, popupTransition = _props3.popupTransition, textField = _props3.textField, data = _props3.data, busy = _props3.busy, dropUp = _props3.dropUp, placeholder = _props3.placeholder, value = _props3.value, open = _props3.open, filter = _props3.filter, inputProps = _props3.inputProps, valueComponent = _props3.valueComponent; var focused = this.state.focused; var disabled = this.props.disabled === true, readOnly = this.props.readOnly === true, valueItem = this.accessors.findOrSelf(data, value); var shouldRenderPopup = open || (0, _widgetHelpers.isFirstFocusedRender)(this); var elementProps = _extends(Props.pickElementProps(this), { name: undefined, role: 'combobox', id: this.inputId, tabIndex: open && filter ? -1 : tabIndex || 0, 'aria-owns': this.listId, 'aria-activedescendant': open ? this.activeId : null, 'aria-expanded': !!open, 'aria-haspopup': true, 'aria-busy': !!busy, 'aria-live': !open && 'polite', 'aria-autocomplete': 'list', 'aria-disabled': disabled, 'aria-readonly': readOnly }); var messages = this.messages; return _react2.default.createElement( _Widget2.default, _extends({}, elementProps, { ref: 'input', open: open, dropUp: dropUp, focused: focused, disabled: disabled, readOnly: readOnly, onBlur: this.focusManager.handleBlur, onFocus: this.focusManager.handleFocus, onKeyDown: this.handleKeyDown, onKeyPress: this.handleKeyPress, className: (0, _classnames2.default)(className, 'rw-dropdown-list') }), _react2.default.createElement( _WidgetPicker2.default, { onClick: this.handleClick, className: 'rw-widget-input' }, _react2.default.createElement(_DropdownListInput2.default, _extends({}, inputProps, { value: valueItem, textField: textField, placeholder: placeholder, valueComponent: valueComponent })), _react2.default.createElement(_Select2.default, { busy: busy, icon: 'caret-down', role: 'presentational', 'aria-hidden': 'true', disabled: disabled || readOnly, label: messages.openDropdown(this.props) }) ), shouldRenderPopup && _react2.default.createElement( _Popup2.default, { open: open, dropUp: dropUp, transition: popupTransition, onEntered: function onEntered() { return _this2.focus(); }, onEntering: function onEntering() { return _this2.refs.list.forceUpdate(); } }, this.renderList(messages) ) ); }; DropdownList.prototype.findOption = function findOption(character, cb) { var _this3 = this; var word = ((this._currentWord || '') + character).toLowerCase(); if (!character) return; this._currentWord = word; this.timeouts.set('search', function () { var list = _this3.list, key = _this3.props.open ? 'focusedItem' : 'selectedItem', item = list.next(_this3.state[key], word); _this3._currentWord = ''; if (item) cb(item); }, this.props.delay); }; DropdownList.prototype.clearSearch = function clearSearch(originalEvent) { this.search('', originalEvent, 'clear'); }; DropdownList.prototype.search = function search(searchTerm, originalEvent) { var action = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'input'; var _props4 = this.props, onSearch = _props4.onSearch, lastSearchTerm = _props4.searchTerm; if (searchTerm !== lastSearchTerm) (0, _widgetHelpers.notify)(onSearch, [searchTerm, { action: action, lastSearchTerm: lastSearchTerm, originalEvent: originalEvent }]); }; DropdownList.prototype.open = function open() { if (!this.props.open) (0, _widgetHelpers.notify)(this.props.onToggle, true); }; DropdownList.prototype.close = function close() { if (this.props.open) (0, _widgetHelpers.notify)(this.props.onToggle, false); }; DropdownList.prototype.toggle = function toggle() { this.props.open ? this.close() : this.open(); }; DropdownList.prototype.allowCreate = function allowCreate() { var _props5 = this.props, searchTerm = _props5.searchTerm, onCreate = _props5.onCreate, allowCreate = _props5.allowCreate; return !!(onCreate && (allowCreate === true || allowCreate === 'onFilter' && searchTerm) && !this.hasExtactMatch()); }; DropdownList.prototype.hasExtactMatch = function hasExtactMatch() { var _props6 = this.props, searchTerm = _props6.searchTerm, caseSensitive = _props6.caseSensitive, filter = _props6.filter; var data = this.state.data; var text = this.accessors.text; var lower = function lower(text) { return caseSensitive ? text : text.toLowerCase(); }; // if there is an exact match on textFields: return filter && data.some(function (v) { return lower(text(v)) === lower(searchTerm); }); }; return DropdownList; }(_react2.default.Component), _class3.propTypes = _extends({}, Filter.propTypes, { value: _propTypes2.default.any, /** * @type {function ( * dataItems: ?any, * metadata: { * lastValue: ?any, * searchTerm: ?string * originalEvent: SyntheticEvent, * } * ): void} */ onChange: _propTypes2.default.func, open: _propTypes2.default.bool, onToggle: _propTypes2.default.func, data: _propTypes2.default.array, valueField: CustomPropTypes.accessor, textField: CustomPropTypes.accessor, allowCreate: _propTypes2.default.oneOf([true, false, 'onFilter']), /** * A React component for customizing the rendering of the DropdownList * value */ valueComponent: CustomPropTypes.elementType, itemComponent: CustomPropTypes.elementType, listComponent: CustomPropTypes.elementType, groupComponent: CustomPropTypes.elementType, groupBy: CustomPropTypes.accessor, /** * * @type {(dataItem: ?any, metadata: { originalEvent: SyntheticEvent }) => void} */ onSelect: _propTypes2.default.func, onCreate: _propTypes2.default.func, /** * @type function(searchTerm: string, metadata: { action, lastSearchTerm, originalEvent? }) */ onSearch: _propTypes2.default.func, searchTerm: _propTypes2.default.string, busy: _propTypes2.default.bool, placeholder: _propTypes2.default.string, dropUp: _propTypes2.default.bool, popupTransition: CustomPropTypes.elementType, disabled: CustomPropTypes.disabled.acceptsArray, readOnly: CustomPropTypes.disabled, inputProps: _propTypes2.default.object, listProps: _propTypes2.default.object, messages: _propTypes2.default.shape({ open: _propTypes2.default.string, emptyList: CustomPropTypes.message, emptyFilter: CustomPropTypes.message, filterPlaceholder: _propTypes2.default.string, createOption: CustomPropTypes.message }) }), _class3.defaultProps = { data: [], delay: 500, searchTerm: '', allowCreate: false, listComponent: _List2.default }, _temp), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'handleSelect', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this4 = this; return function (dataItem, originalEvent) { if (dataItem === undefined || dataItem === CREATE_OPTION) { _this4.handleCreate(_this4.props.searchTerm); return; } (0, _widgetHelpers.notify)(_this4.props.onSelect, [dataItem, { originalEvent: originalEvent }]); _this4.change(dataItem, originalEvent); _this4.close(); _this4.focus(_this4); }; } }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'handleCreate', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this5 = this; return function () { var searchTerm = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; var event = arguments[1]; (0, _widgetHelpers.notify)(_this5.props.onCreate, searchTerm); _this5.clearSearch(event); _this5.close(); _this5.focus(_this5); }; } }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'handleClick', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this6 = this; return function (e) { _this6.focus(); _this6.toggle(); (0, _widgetHelpers.notify)(_this6.props.onClick, e); }; } }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'handleKeyDown', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this7 = this; return function (e) { var key = e.key, altKey = e.altKey, ctrlKey = e.ctrlKey; var list = _this7.list; var _props7 = _this7.props, open = _props7.open, onKeyDown = _props7.onKeyDown, filter = _props7.filter, searchTerm = _props7.searchTerm; var _state2 = _this7.state, focusedItem = _state2.focusedItem, selectedItem = _state2.selectedItem; var createIsFocused = focusedItem === CREATE_OPTION; var canCreate = _this7.allowCreate(); (0, _widgetHelpers.notify)(onKeyDown, [e]); var closeWithFocus = function closeWithFocus() { _this7.close(); (0, _reactDom.findDOMNode)(_this7).focus(); }; var change = function change(item) { return item != null && _this7.change(item, e); }; var focusItem = function focusItem(item) { return _this7.setState({ focusedItem: item }); }; if (e.defaultPrevented) return; if (key === 'End') { e.preventDefault(); if (open) focusItem(list.last());else change(list.last()); } else if (key === 'Home') { e.preventDefault(); if (open) focusItem(list.first());else change(list.first()); } else if (key === 'Escape' && open) { e.preventDefault(); closeWithFocus(); } else if (key === 'Enter' && open && ctrlKey && canCreate) { e.preventDefault(); _this7.handleCreate(searchTerm, e); } else if ((key === 'Enter' || key === ' ' && !filter) && open) { e.preventDefault(); _this7.handleSelect(focusedItem, e); } else if (key === ' ' && !open) { e.preventDefault(); _this7.open(); } else if (key === 'ArrowDown') { e.preventDefault(); if (altKey) return _this7.open(); if (!open) change(list.next(selectedItem)); var next = list.next(focusedItem); var creating = createIsFocused || canCreate && focusedItem === next; focusItem(creating ? CREATE_OPTION : next); } else if (key === 'ArrowUp') { e.preventDefault(); if (altKey) return closeWithFocus(); if (!open) return change(list.prev(selectedItem)); focusItem(createIsFocused ? list.last() : list.prev(focusedItem)); } }; } }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, 'handleKeyPress', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this8 = this; return function (e) { (0, _widgetHelpers.notify)(_this8.props.onKeyPress, [e]); if (e.defaultPrevented) return; if (!(_this8.props.filter && _this8.props.open)) _this8.findOption(String.fromCharCode(e.which), function (item) { _this8.mounted() && _this8.props.open ? _this8.setState({ focusedItem: item }) : item && _this8.change(item, e); }); }; } })), _class2)) || _class; exports.default = (0, _uncontrollable2.default)(DropdownList, { open: 'onToggle', value: 'onChange', searchTerm: 'onSearch' }, ['focus']); module.exports = exports['default']; /***/ }), /* 70 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.PropTypes = undefined; exports.default = makeAutoFocusable; var _propTypes = __webpack_require__(1); var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(5); var _spyOnComponent = __webpack_require__(28); var _spyOnComponent2 = _interopRequireDefault(_spyOnComponent); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var PropTypes = exports.PropTypes = { autoFocus: _propTypes.bool }; function makeAutoFocusable(instance) { (0, _spyOnComponent2.default)(instance, { componentDidMount: function componentDidMount() { var autoFocus = this.props.autoFocus; if (autoFocus) this.focus ? this.focus() : (0, _reactDom.findDOMNode)(this).focus(); } }); } /***/ }), /* 71 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.callFocusEventHandler = callFocusEventHandler; exports.default = createFocusManager; var _reactDom = __webpack_require__(5); var _timeoutManager = __webpack_require__(47); var _timeoutManager2 = _interopRequireDefault(_timeoutManager); var _mountManager = __webpack_require__(39); var _mountManager2 = _interopRequireDefault(_mountManager); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function callFocusEventHandler(inst, focused, e) { var handler = inst.props[focused ? 'onFocus' : 'onBlur']; handler && handler(e); } function createFocusManager(instance, _ref) { var willHandle = _ref.willHandle, didHandle = _ref.didHandle, onChange = _ref.onChange, _ref$isDisabled = _ref.isDisabled, isDisabled = _ref$isDisabled === undefined ? function () { return !!instance.props.disabled; } : _ref$isDisabled; var lastFocused = void 0; var timeouts = (0, _timeoutManager2.default)(instance); var isMounted = (0, _mountManager2.default)(instance); function _handleFocus(focused, event) { if (event && event.persist) event.persist(); if (willHandle && willHandle(focused, event) === false) return; timeouts.set('focus', function () { (0, _reactDom.unstable_batchedUpdates)(function () { if (focused !== lastFocused) { if (didHandle) didHandle.call(instance, focused, event); // only fire a change when unmounted if its a blur if (isMounted() || !focused) { lastFocused = focused; onChange && onChange(focused, event); } } }); }); } return { handleBlur: function handleBlur(event) { if (!isDisabled()) _handleFocus(false, event); }, handleFocus: function handleFocus(event) { if (!isDisabled()) _handleFocus(true, event); } }; } /***/ }), /* 72 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; exports.mixin = mixin; exports.default = mixIntoClass; function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } function mixin(componentClass, _ref) { var propTypes = _ref.propTypes, contextTypes = _ref.contextTypes, childContextTypes = _ref.childContextTypes, getChildContext = _ref.getChildContext, protoSpec = _objectWithoutProperties(_ref, ["propTypes", "contextTypes", "childContextTypes", "getChildContext"]); if (propTypes) componentClass.propTypes = _extends({}, componentClass.propTypes, propTypes); if (contextTypes) componentClass.contextTypes = _extends({}, componentClass.contextTypes, contextTypes); if (childContextTypes) componentClass.childContextTypes = _extends({}, componentClass.childContextTypes, childContextTypes); if (getChildContext) { var baseGCContext = componentClass.prototype.getChildContext; componentClass.prototype.getChildContext = function $getChildContext() { return _extends({}, baseGCContext && baseGCContext.call(this), getChildContext.call(this)); }; } _extends(componentClass.prototype, protoSpec); return componentClass; } function mixIntoClass(spec) { return function (componentClass) { return mixin(componentClass, spec); }; } /***/ }), /* 73 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; exports.default = createUncontrollable; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _invariant = __webpack_require__(26); var _invariant2 = _interopRequireDefault(_invariant); var _utils = __webpack_require__(74); var utils = _interopRequireWildcard(_utils); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } 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; } function createUncontrollable(mixin, set) { return uncontrollable; function uncontrollable(Component, controlledValues) { var _class, _temp; var methods = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; var displayName = Component.displayName || Component.name || 'Component', basePropTypes = utils.getType(Component).propTypes, isCompositeComponent = utils.isReactComponent(Component), controlledProps = Object.keys(controlledValues), propTypes; var OMIT_PROPS = ['valueLink', 'checkedLink'].concat(controlledProps.map(utils.defaultKey)); propTypes = utils.uncontrolledPropTypes(controlledValues, basePropTypes, displayName); (0, _invariant2.default)(isCompositeComponent || !methods.length, '[uncontrollable] stateless function components cannot pass through methods ' + 'because they have no associated instances. Check component: ' + displayName + ', ' + 'attempting to pass through methods: ' + methods.join(', ')); methods = utils.transform(methods, function (obj, method) { obj[method] = function () { var _refs$inner; return (_refs$inner = this.refs.inner)[method].apply(_refs$inner, arguments); }; }, {}); var component = (_temp = _class = function (_React$Component) { _inherits(component, _React$Component); function component() { _classCallCheck(this, component); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } component.prototype.shouldComponentUpdate = function shouldComponentUpdate() { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return !mixin.shouldComponentUpdate || mixin.shouldComponentUpdate.apply(this, args); }; component.prototype.componentWillMount = function componentWillMount() { var _this2 = this; var props = this.props; this._values = {}; controlledProps.forEach(function (key) { _this2._values[key] = props[utils.defaultKey(key)]; }); }; /** * If a prop switches from controlled to Uncontrolled * reset its value to the defaultValue */ component.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { var _this3 = this; var props = this.props; if (mixin.componentWillReceiveProps) { mixin.componentWillReceiveProps.call(this, nextProps); } controlledProps.forEach(function (key) { if (utils.getValue(nextProps, key) === undefined && utils.getValue(props, key) !== undefined) { _this3._values[key] = nextProps[utils.defaultKey(key)]; } }); }; component.prototype.componentWillUnmount = function componentWillUnmount() { this.unmounted = true; }; component.prototype.getControlledInstance = function getControlledInstance() { return this.refs.inner; }; component.prototype.render = function render() { var _this4 = this; var newProps = {}, props = omitProps(this.props); utils.each(controlledValues, function (handle, propName) { var linkPropName = utils.getLinkName(propName), prop = _this4.props[propName]; if (linkPropName && !isProp(_this4.props, propName) && isProp(_this4.props, linkPropName)) { prop = _this4.props[linkPropName].value; } newProps[propName] = prop !== undefined ? prop : _this4._values[propName]; newProps[handle] = setAndNotify.bind(_this4, propName); }); newProps = _extends({}, props, newProps, { ref: isCompositeComponent ? 'inner' : null }); return _react2.default.createElement(Component, newProps); }; return component; }(_react2.default.Component), _class.displayName = 'Uncontrolled(' + displayName + ')', _class.propTypes = propTypes, _temp); _extends(component.prototype, methods); component.ControlledComponent = Component; /** * useful when wrapping a Component and you want to control * everything */ component.deferControlTo = function (newComponent) { var additions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var nextMethods = arguments[2]; return uncontrollable(newComponent, _extends({}, controlledValues, additions), nextMethods); }; return component; function setAndNotify(propName, value) { var linkName = utils.getLinkName(propName), handler = this.props[controlledValues[propName]]; if (linkName && isProp(this.props, linkName) && !handler) { handler = this.props[linkName].requestChange; } for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { args[_key2 - 2] = arguments[_key2]; } set(this, propName, handler, value, args); } function isProp(props, prop) { return props[prop] !== undefined; } function omitProps(props) { var result = {}; utils.each(props, function (value, key) { if (OMIT_PROPS.indexOf(key) === -1) result[key] = value; }); return result; } } } module.exports = exports['default']; /***/ }), /* 74 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) { exports.__esModule = true; exports.version = undefined; exports.uncontrolledPropTypes = uncontrolledPropTypes; exports.getType = getType; exports.getValue = getValue; exports.getLinkName = getLinkName; exports.defaultKey = defaultKey; exports.chain = chain; exports.transform = transform; exports.each = each; exports.has = has; exports.isReactComponent = isReactComponent; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _invariant = __webpack_require__(26); var _invariant2 = _interopRequireDefault(_invariant); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function readOnlyPropType(handler, name) { return function (props, propName) { if (props[propName] !== undefined) { if (!props[handler]) { return new Error('You have provided a `' + propName + '` prop to ' + '`' + name + '` without an `' + handler + '` handler. This will render a read-only field. ' + 'If the field should be mutable use `' + defaultKey(propName) + '`. Otherwise, set `' + handler + '`'); } } }; } function uncontrolledPropTypes(controlledValues, basePropTypes, displayName) { var propTypes = {}; if (process.env.NODE_ENV !== 'production' && basePropTypes) { transform(controlledValues, function (obj, handler, prop) { (0, _invariant2.default)(typeof handler === 'string' && handler.trim().length, 'Uncontrollable - [%s]: the prop `%s` needs a valid handler key name in order to make it uncontrollable', displayName, prop); obj[prop] = readOnlyPropType(handler, displayName); }, propTypes); } return propTypes; } var version = exports.version = _react2.default.version.split('.').map(parseFloat); function getType(component) { if (version[0] >= 15 || version[0] === 0 && version[1] >= 13) return component; return component.type; } function getValue(props, name) { var linkPropName = getLinkName(name); if (linkPropName && !isProp(props, name) && isProp(props, linkPropName)) return props[linkPropName].value; return props[name]; } function isProp(props, prop) { return props[prop] !== undefined; } function getLinkName(name) { return name === 'value' ? 'valueLink' : name === 'checked' ? 'checkedLink' : null; } function defaultKey(key) { return 'default' + key.charAt(0).toUpperCase() + key.substr(1); } function chain(thisArg, a, b) { return function chainedFunction() { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } a && a.call.apply(a, [thisArg].concat(args)); b && b.call.apply(b, [thisArg].concat(args)); }; } function transform(obj, cb, seed) { each(obj, cb.bind(null, seed = seed || (Array.isArray(obj) ? [] : {}))); return seed; } function each(obj, cb, thisArg) { if (Array.isArray(obj)) return obj.forEach(cb, thisArg); for (var key in obj) { if (has(obj, key)) cb.call(thisArg, obj[key], key, obj); } } function has(o, k) { return o ? Object.prototype.hasOwnProperty.call(o, k) : false; } /** * Copyright (c) 2013-present, 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. */ function isReactComponent(component) { return !!(component && component.prototype && component.prototype.isReactComponent); } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), /* 75 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = filterEvents; var _contains = __webpack_require__(52); var _contains2 = _interopRequireDefault(_contains); var _querySelectorAll = __webpack_require__(53); var _querySelectorAll2 = _interopRequireDefault(_querySelectorAll); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function filterEvents(selector, handler) { return function filterHandler(e) { var top = e.currentTarget, target = e.target, matches = (0, _querySelectorAll2.default)(top, selector); if (matches.some(function (match) { return (0, _contains2.default)(match, target); })) handler.call(this, e); }; } module.exports = exports['default']; /***/ }), /* 76 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _inDOM = __webpack_require__(11); var _inDOM2 = _interopRequireDefault(_inDOM); var _on = __webpack_require__(50); var _on2 = _interopRequireDefault(_on); var _off = __webpack_require__(51); var _off2 = _interopRequireDefault(_off); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var listen = function listen() {}; if (_inDOM2.default) { listen = function listen(node, eventName, handler, capture) { (0, _on2.default)(node, eventName, handler, capture); return function () { (0, _off2.default)(node, eventName, handler, capture); }; }; } exports.default = listen; module.exports = exports['default']; /***/ }), /* 77 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = camelize; var rHyphen = /-(.)/g; function camelize(string) { return string.replace(rHyphen, function (_, chr) { return chr.toUpperCase(); }); } module.exports = exports["default"]; /***/ }), /* 78 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = hyphenateStyleName; var _hyphenate = __webpack_require__(79); var _hyphenate2 = _interopRequireDefault(_hyphenate); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var msPattern = /^ms-/; /** * Copyright 2013-2014, Facebook, Inc. * All rights reserved. * https://github.com/facebook/react/blob/2aeb8a2a6beb00617a4217f7f8284924fa2ad819/src/vendor/core/hyphenateStyleName.js */ function hyphenateStyleName(string) { return (0, _hyphenate2.default)(string).replace(msPattern, '-ms-'); } module.exports = exports['default']; /***/ }), /* 79 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = hyphenate; var rUpper = /([A-Z])/g; function hyphenate(string) { return string.replace(rUpper, '-$1').toLowerCase(); } module.exports = exports['default']; /***/ }), /* 80 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = _getComputedStyle; var _camelizeStyle = __webpack_require__(54); var _camelizeStyle2 = _interopRequireDefault(_camelizeStyle); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var rposition = /^(top|right|bottom|left)$/; var rnumnonpx = /^([+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|))(?!px)[a-z%]+$/i; function _getComputedStyle(node) { if (!node) throw new TypeError('No Element passed to `getComputedStyle()`'); var doc = node.ownerDocument; return 'defaultView' in doc ? doc.defaultView.opener ? node.ownerDocument.defaultView.getComputedStyle(node, null) : window.getComputedStyle(node, null) : { //ie 8 "magic" from: https://github.com/jquery/jquery/blob/1.11-stable/src/css/curCSS.js#L72 getPropertyValue: function getPropertyValue(prop) { var style = node.style; prop = (0, _camelizeStyle2.default)(prop); if (prop == 'float') prop = 'styleFloat'; var current = node.currentStyle[prop] || null; if (current == null && style && style[prop]) current = style[prop]; if (rnumnonpx.test(current) && !rposition.test(prop)) { // Remember the original values var left = style.left; var runStyle = node.runtimeStyle; var rsLeft = runStyle && runStyle.left; // Put in the new values to get a computed value out if (rsLeft) runStyle.left = node.currentStyle.left; style.left = prop === 'fontSize' ? '1em' : current; current = style.pixelLeft + 'px'; // Revert the changed values style.left = left; if (rsLeft) runStyle.left = rsLeft; } return current; } }; } module.exports = exports['default']; /***/ }), /* 81 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = removeStyle; function removeStyle(node, key) { return 'removeProperty' in node.style ? node.style.removeProperty(key) : node.style.removeAttribute(key); } module.exports = exports['default']; /***/ }), /* 82 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = isTransform; var supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i; function isTransform(property) { return !!(property && supportedTransforms.test(property)); } module.exports = exports["default"]; /***/ }), /* 83 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.classNamesShape = exports.timeoutsShape = undefined; exports.transitionTimeout = transitionTimeout; var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function transitionTimeout(transitionType) { var timeoutPropName = 'transition' + transitionType + 'Timeout'; var enabledPropName = 'transition' + transitionType; return function (props) { // If the transition is enabled if (props[enabledPropName]) { // If no timeout duration is provided if (props[timeoutPropName] == null) { return new Error(timeoutPropName + ' wasn\'t supplied to CSSTransitionGroup: ' + 'this can cause unreliable animations and won\'t be supported in ' + 'a future version of React. See ' + 'https://fb.me/react-animation-transition-group-timeout for more ' + 'information.'); // If the duration isn't a number } else if (typeof props[timeoutPropName] !== 'number') { return new Error(timeoutPropName + ' must be a number (in milliseconds)'); } } return null; }; } var timeoutsShape = exports.timeoutsShape = _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.shape({ enter: _propTypes2.default.number, exit: _propTypes2.default.number }).isRequired]); var classNamesShape = exports.classNamesShape = _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.shape({ enter: _propTypes2.default.string, exit: _propTypes2.default.string, active: _propTypes2.default.string }), _propTypes2.default.shape({ enter: _propTypes2.default.string, enterActive: _propTypes2.default.string, exit: _propTypes2.default.string, exitActive: _propTypes2.default.string })]); /***/ }), /* 84 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _createChainableTypeChecker = __webpack_require__(57); var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function elementType(props, propName, componentName, location, propFullName) { var propValue = props[propName]; var propType = typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue); if (_react2.default.isValidElement(propValue)) { return new Error('Invalid ' + location + ' `' + propFullName + '` of type ReactElement ' + ('supplied to `' + componentName + '`, expected an element type (a string ') + 'or a ReactClass).'); } if (propType !== 'function' && propType !== 'string') { return new Error('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected an element type (a string ') + 'or a ReactClass).'); } return null; } exports.default = (0, _createChainableTypeChecker2.default)(elementType); /***/ }), /* 85 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var propTypes = { className: _propTypes2.default.string, component: _propTypes2.default.string }; function ListOptionGroup(_ref) { var children = _ref.children, className = _ref.className, _ref$component = _ref.component, component = _ref$component === undefined ? 'li' : _ref$component; var Tag = component; return _react2.default.createElement( Tag, { tabIndex: '-1', role: 'separator', className: (0, _classnames2.default)(className, 'rw-list-optgroup') }, children ); } ListOptionGroup.propTypes = propTypes; exports.default = ListOptionGroup; module.exports = exports['default']; /***/ }), /* 86 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _class, _temp; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); var _dataHelpers = __webpack_require__(33); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } 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; } var DropdownListInput = (_temp = _class = function (_React$Component) { _inherits(DropdownListInput, _React$Component); function DropdownListInput() { _classCallCheck(this, DropdownListInput); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } DropdownListInput.prototype.render = function render() { var _props = this.props, placeholder = _props.placeholder, value = _props.value, textField = _props.textField, Component = _props.valueComponent; return _react2.default.createElement( 'div', { className: 'rw-input rw-dropdown-list-input' }, !value && placeholder ? _react2.default.createElement( 'span', { className: 'rw-placeholder' }, placeholder ) : Component ? _react2.default.createElement(Component, { item: value }) : (0, _dataHelpers.dataText)(value, textField) ); }; return DropdownListInput; }(_react2.default.Component), _class.propTypes = { value: _propTypes2.default.any, placeholder: _propTypes2.default.string, textField: CustomPropTypes.accessor, valueComponent: CustomPropTypes.elementType }, _temp); exports.default = DropdownListInput; module.exports = exports['default']; /***/ }), /* 87 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = scrollTo; var _offset = __webpack_require__(55); var _offset2 = _interopRequireDefault(_offset); var _height = __webpack_require__(30); var _height2 = _interopRequireDefault(_height); var _scrollParent = __webpack_require__(88); var _scrollParent2 = _interopRequireDefault(_scrollParent); var _scrollTop = __webpack_require__(89); var _scrollTop2 = _interopRequireDefault(_scrollTop); var _requestAnimationFrame = __webpack_require__(90); var _requestAnimationFrame2 = _interopRequireDefault(_requestAnimationFrame); var _isWindow = __webpack_require__(31); var _isWindow2 = _interopRequireDefault(_isWindow); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function scrollTo(selected, scrollParent) { var offset = (0, _offset2.default)(selected); var poff = { top: 0, left: 0 }; var list = void 0, listScrollTop = void 0, selectedTop = void 0, isWin = void 0; var selectedHeight = void 0, listHeight = void 0, bottom = void 0; if (!selected) return; list = scrollParent || (0, _scrollParent2.default)(selected); isWin = (0, _isWindow2.default)(list); listScrollTop = (0, _scrollTop2.default)(list); listHeight = (0, _height2.default)(list, true); isWin = (0, _isWindow2.default)(list); if (!isWin) poff = (0, _offset2.default)(list); offset = { top: offset.top - poff.top, left: offset.left - poff.left, height: offset.height, width: offset.width }; selectedHeight = offset.height; selectedTop = offset.top + (isWin ? 0 : listScrollTop); bottom = selectedTop + selectedHeight; listScrollTop = listScrollTop > selectedTop ? selectedTop : bottom > listScrollTop + listHeight ? bottom - listHeight : listScrollTop; var id = (0, _requestAnimationFrame2.default)(function () { return (0, _scrollTop2.default)(list, listScrollTop); }); return function () { return _requestAnimationFrame2.default.cancel(id); }; } module.exports = exports['default']; /***/ }), /* 88 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = scrollPrarent; var _style = __webpack_require__(40); var _style2 = _interopRequireDefault(_style); var _height = __webpack_require__(30); var _height2 = _interopRequireDefault(_height); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function scrollPrarent(node) { var position = (0, _style2.default)(node, 'position'), excludeStatic = position === 'absolute', ownerDoc = node.ownerDocument; if (position === 'fixed') return ownerDoc || document; while ((node = node.parentNode) && node.nodeType !== 9) { var isStatic = excludeStatic && (0, _style2.default)(node, 'position') === 'static', style = (0, _style2.default)(node, 'overflow') + (0, _style2.default)(node, 'overflow-y') + (0, _style2.default)(node, 'overflow-x'); if (isStatic) continue; if (/(auto|scroll)/.test(style) && (0, _height2.default)(node) < node.scrollHeight) return node; } return document; } module.exports = exports['default']; /***/ }), /* 89 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = scrollTop; var _isWindow = __webpack_require__(31); var _isWindow2 = _interopRequireDefault(_isWindow); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function scrollTop(node, val) { var win = (0, _isWindow2.default)(node); if (val === undefined) return win ? 'pageYOffset' in win ? win.pageYOffset : win.document.documentElement.scrollTop : node.scrollTop; if (win) win.scrollTo('pageXOffset' in win ? win.pageXOffset : win.document.documentElement.scrollLeft, val);else node.scrollTop = val; } module.exports = exports['default']; /***/ }), /* 90 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _inDOM = __webpack_require__(11); var _inDOM2 = _interopRequireDefault(_inDOM); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var vendors = ['', 'webkit', 'moz', 'o', 'ms']; var cancel = 'clearTimeout'; var raf = fallback; var compatRaf = void 0; var getKey = function getKey(vendor, k) { return vendor + (!vendor ? k : k[0].toUpperCase() + k.substr(1)) + 'AnimationFrame'; }; if (_inDOM2.default) { vendors.some(function (vendor) { var rafKey = getKey(vendor, 'request'); if (rafKey in window) { cancel = getKey(vendor, 'cancel'); return raf = function raf(cb) { return window[rafKey](cb); }; } }); } /* https://github.com/component/raf */ var prev = new Date().getTime(); function fallback(fn) { var curr = new Date().getTime(), ms = Math.max(0, 16 - (curr - prev)), req = setTimeout(fn, ms); prev = curr; return req; } compatRaf = function compatRaf(cb) { return raf(cb); }; compatRaf.cancel = function (id) { window[cancel] && typeof window[cancel] === 'function' && window[cancel](id); }; exports.default = compatRaf; module.exports = exports['default']; /***/ }), /* 91 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _class3, _temp; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); var _uncontrollable = __webpack_require__(15); var _uncontrollable2 = _interopRequireDefault(_uncontrollable); var _Widget = __webpack_require__(16); var _Widget2 = _interopRequireDefault(_Widget); var _WidgetPicker = __webpack_require__(21); var _WidgetPicker2 = _interopRequireDefault(_WidgetPicker); var _List = __webpack_require__(23); var _List2 = _interopRequireDefault(_List); var _Popup = __webpack_require__(29); var _Popup2 = _interopRequireDefault(_Popup); var _Select = __webpack_require__(22); var _Select2 = _interopRequireDefault(_Select); var _ComboboxInput = __webpack_require__(92); var _ComboboxInput2 = _interopRequireDefault(_ComboboxInput); var _messages = __webpack_require__(12); var _focusManager = __webpack_require__(17); var _focusManager2 = _interopRequireDefault(_focusManager); var _listDataManager = __webpack_require__(20); var _listDataManager2 = _interopRequireDefault(_listDataManager); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); var _accessorManager = __webpack_require__(24); var _accessorManager2 = _interopRequireDefault(_accessorManager); var _scrollManager = __webpack_require__(25); var _scrollManager2 = _interopRequireDefault(_scrollManager); var _withRightToLeft = __webpack_require__(18); var _withRightToLeft2 = _interopRequireDefault(_withRightToLeft); var _ = __webpack_require__(8); var _Props = __webpack_require__(4); var Props = _interopRequireWildcard(_Props); var _Filter = __webpack_require__(32); var Filter = _interopRequireWildcard(_Filter); var _interaction = __webpack_require__(13); var _widgetHelpers = __webpack_require__(10); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _initDefineProp(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } 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; } function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object['ke' + 'ys'](descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object['define' + 'Property'](target, property, desc); desc = null; } return desc; } function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.'); } var propTypes = _extends({}, Filter.propTypes, { value: _propTypes2.default.any, onChange: _propTypes2.default.func, open: _propTypes2.default.bool, onToggle: _propTypes2.default.func, itemComponent: CustomPropTypes.elementType, listComponent: CustomPropTypes.elementType, groupComponent: CustomPropTypes.elementType, groupBy: CustomPropTypes.accessor, data: _propTypes2.default.array, valueField: CustomPropTypes.accessor, textField: CustomPropTypes.accessor, name: _propTypes2.default.string, /** * * @type {(dataItem: ?any, metadata: { originalEvent: SyntheticEvent }) => void} */ onSelect: _propTypes2.default.func, autoFocus: _propTypes2.default.bool, disabled: CustomPropTypes.disabled.acceptsArray, readOnly: CustomPropTypes.disabled, /** * When `true` the Combobox will suggest, or fill in, values as you type. The suggestions * are always "startsWith", meaning it will search from the start of the `textField` property */ suggest: Filter.propTypes.filter, busy: _propTypes2.default.bool, delay: _propTypes2.default.number, dropUp: _propTypes2.default.bool, popupTransition: CustomPropTypes.elementType, placeholder: _propTypes2.default.string, inputProps: _propTypes2.default.object, listProps: _propTypes2.default.object, messages: _propTypes2.default.shape({ openCombobox: CustomPropTypes.message, emptyList: CustomPropTypes.message, emptyFilter: CustomPropTypes.message }) /** * --- * shortcuts: * - { key: alt + down arrow, label: open combobox } * - { key: alt + up arrow, label: close combobox } * - { key: down arrow, label: move focus to next item } * - { key: up arrow, label: move focus to previous item } * - { key: home, label: move focus to first item } * - { key: end, label: move focus to last item } * - { key: enter, label: select focused item } * - { key: any key, label: search list for item starting with key } * --- * * Select an item from the list, or input a custom value. The Combobox can also make suggestions as you type. * @public */ }); var Combobox = (0, _withRightToLeft2.default)(_class = (_class2 = (_temp = _class3 = function (_React$Component) { _inherits(Combobox, _React$Component); function Combobox(props, context) { _classCallCheck(this, Combobox); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context)); _this.handleFocusWillChange = function (focused) { if (!focused && _this.refs.input) _this.refs.input.accept(); if (focused) _this.focus(); }; _this.handleFocusChanged = function (focused) { if (!focused) _this.close(); }; _initDefineProp(_this, 'handleSelect', _descriptor, _this); _this.handleInputKeyDown = function (_ref) { var key = _ref.key; _this._deleting = key === 'Backspace' || key === 'Delete'; _this._isTyping = true; }; _this.handleInputChange = function (event) { var suggestion = _this.suggest(event.target.value); _this.change(suggestion, true, event); _this.open(); }; _initDefineProp(_this, 'handleKeyDown', _descriptor2, _this); _initDefineProp(_this, 'toggle', _descriptor3, _this); _this.messages = (0, _messages.getMessages)(props.messages); _this.inputId = (0, _widgetHelpers.instanceId)(_this, '_input'); _this.listId = (0, _widgetHelpers.instanceId)(_this, '_listbox'); _this.activeId = (0, _widgetHelpers.instanceId)(_this, '_listbox_active_option'); _this.list = (0, _listDataManager2.default)(_this); _this.accessors = (0, _accessorManager2.default)(_this); _this.handleScroll = (0, _scrollManager2.default)(_this); _this.focusManager = (0, _focusManager2.default)(_this, { willHandle: _this.handleFocusWillChange, didHandle: _this.handleFocusChanged }); _this.state = _extends({}, _this.getStateFromProps(props), { open: false }); return _this; } Combobox.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) { var isSuggesting = this.refs.input && this.refs.input.isSuggesting(), stateChanged = !(0, _.isShallowEqual)(nextState, this.state), valueChanged = !(0, _.isShallowEqual)(nextProps, this.props); return isSuggesting || stateChanged || valueChanged; }; Combobox.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { this.messages = (0, _messages.getMessages)(nextProps.messages); this.setState(this.getStateFromProps(nextProps)); }; Combobox.prototype.getStateFromProps = function getStateFromProps(props) { var accessors = this.accessors, list = this.list; var value = props.value, data = props.data, filter = props.filter; var index = accessors.indexOf(data, value); var dataItem = index === -1 ? value : data[index]; var itemText = accessors.text(dataItem); var searchTerm = void 0; // filter only when the value is not an item in the data list if (index === -1 || this.refs.input && this.refs.input.isSuggesting()) { searchTerm = itemText; } data = Filter.filter(data, _extends({ searchTerm: searchTerm }, props)); var focusedIndex = index; // index may have changed after filtering if (index !== -1) { index = accessors.indexOf(data, value); focusedIndex = index; } else { // value isn't a dataItem so find the close match focusedIndex = Filter.indexOf(data, { searchTerm: searchTerm, textField: accessors.text, filter: filter || true }); } list.setData(data); return { data: data, selectedItem: list.nextEnabled(data[index]), focusedItem: list.nextEnabled(~focusedIndex ? data[focusedIndex] : data[0]) }; }; // has to be done early since `accept()` re-focuses the input Combobox.prototype.renderInput = function renderInput() { var _props = this.props, suggest = _props.suggest, filter = _props.filter, busy = _props.busy, name = _props.name, data = _props.data, value = _props.value, autoFocus = _props.autoFocus, tabIndex = _props.tabIndex, placeholder = _props.placeholder, inputProps = _props.inputProps, disabled = _props.disabled, readOnly = _props.readOnly, open = _props.open; var valueItem = this.accessors.findOrSelf(data, value); var completeType = suggest ? filter ? 'both' : 'inline' : filter ? 'list' : ''; return _react2.default.createElement(_ComboboxInput2.default, _extends({}, inputProps, { ref: 'input', role: 'combobox', name: name, id: this.inputId, autoFocus: autoFocus, tabIndex: tabIndex, suggest: suggest, disabled: disabled === true, readOnly: readOnly === true, 'aria-busy': !!busy, 'aria-owns': this.listId, 'aria-autocomplete': completeType, 'aria-activedescendant': open ? this.activeId : null, 'aria-expanded': open, 'aria-haspopup': true, placeholder: placeholder, value: this.accessors.text(valueItem), onChange: this.handleInputChange, onKeyDown: this.handleInputKeyDown })); }; Combobox.prototype.renderList = function renderList(messages) { var activeId = this.activeId, inputId = this.inputId, listId = this.listId, accessors = this.accessors; var _props2 = this.props, open = _props2.open, data = _props2.data; var _state = this.state, selectedItem = _state.selectedItem, focusedItem = _state.focusedItem; var List = this.props.listComponent; var props = this.list.defaultProps(); return _react2.default.createElement(List, _extends({ ref: 'list' }, props, { id: listId, activeId: activeId, valueAccessor: accessors.value, textAccessor: accessors.text, selectedItem: selectedItem, focusedItem: open ? focusedItem : null, 'aria-hidden': !open, 'aria-labelledby': inputId, 'aria-live': open && 'polite', onSelect: this.handleSelect, onMove: this.handleScroll, messages: { emptyList: data.length ? messages.emptyFilter : messages.emptyList } })); }; Combobox.prototype.render = function render() { var _this2 = this; var _props3 = this.props, className = _props3.className, popupTransition = _props3.popupTransition, busy = _props3.busy, dropUp = _props3.dropUp, open = _props3.open; var focused = this.state.focused; var disabled = this.props.disabled === true, readOnly = this.props.readOnly === true; var elementProps = Props.pickElementProps(this); var shouldRenderPopup = open || (0, _widgetHelpers.isFirstFocusedRender)(this); var messages = this.messages; return _react2.default.createElement( _Widget2.default, _extends({}, elementProps, { open: open, dropUp: dropUp, focused: focused, disabled: disabled, readOnly: readOnly, onBlur: this.focusManager.handleBlur, onFocus: this.focusManager.handleFocus, onKeyDown: this.handleKeyDown, className: (0, _classnames2.default)(className, 'rw-combobox') }), _react2.default.createElement( _WidgetPicker2.default, null, this.renderInput(), _react2.default.createElement(_Select2.default, { bordered: true, busy: busy, icon: 'caret-down', onClick: this.toggle, disabled: disabled || readOnly, label: messages.openCombobox(this.props) }) ), shouldRenderPopup && _react2.default.createElement( _Popup2.default, { open: open, dropUp: dropUp, transition: popupTransition, onEntering: function onEntering() { return _this2.refs.list.forceUpdate(); } }, _react2.default.createElement( 'div', null, this.renderList(messages) ) ) ); }; Combobox.prototype.focus = function focus() { if (this.refs.input) this.refs.input.focus(); }; Combobox.prototype.change = function change(nextValue, typing, originalEvent) { var _props4 = this.props, onChange = _props4.onChange, lastValue = _props4.value; this._typedChange = !!typing; (0, _widgetHelpers.notify)(onChange, [nextValue, { lastValue: lastValue, originalEvent: originalEvent }]); }; Combobox.prototype.open = function open() { if (!this.props.open) (0, _widgetHelpers.notify)(this.props.onToggle, true); }; Combobox.prototype.close = function close() { if (this.props.open) (0, _widgetHelpers.notify)(this.props.onToggle, false); }; Combobox.prototype.suggest = function suggest(searchTerm) { var _props5 = this.props, textField = _props5.textField, suggest = _props5.suggest, minLength = _props5.minLength; var data = this.state.data; if (!this._deleting) return Filter.suggest(data, { minLength: minLength, textField: textField, searchTerm: searchTerm, filter: suggest, caseSensitive: false }); return searchTerm; }; return Combobox; }(_react2.default.Component), _class3.propTypes = propTypes, _class3.defaultProps = { data: [], value: '', open: false, suggest: false, filter: false, delay: 500, listComponent: _List2.default }, _temp), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'handleSelect', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this3 = this; return function (data, originalEvent) { _this3.close(); (0, _widgetHelpers.notify)(_this3.props.onSelect, [data, { originalEvent: originalEvent }]); _this3.change(data, false, originalEvent); _this3.focus(); }; } }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'handleKeyDown', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this4 = this; return function (e) { var key = e.key, altKey = e.altKey; var list = _this4.list; var _props6 = _this4.props, open = _props6.open, onKeyDown = _props6.onKeyDown; var _state2 = _this4.state, focusedItem = _state2.focusedItem, selectedItem = _state2.selectedItem; (0, _widgetHelpers.notify)(onKeyDown, [e]); if (e.defaultPrevented) return; var select = function select(item) { return item != null && _this4.handleSelect(item, e); }; var focusItem = function focusItem(item) { return _this4.setState({ focusedItem: item }); }; if (key === 'End' && open) { e.preventDefault(); focusItem(list.last()); } else if (key === 'Home' && open) { e.preventDefault(); focusItem(list.first()); } else if (key === 'Escape' && open) { e.preventDefault(); _this4.close(); } else if (key === 'Enter' && open) { e.preventDefault(); select(_this4.state.focusedItem); } else if (key === 'Tab') { _this4.refs.input.accept(); } else if (key === 'ArrowDown') { e.preventDefault(); if (altKey) return _this4.open(); if (open) focusItem(list.next(focusedItem));else select(list.next(selectedItem)); } else if (key === 'ArrowUp') { e.preventDefault(); if (altKey) return _this4.close(); if (open) focusItem(list.prev(focusedItem));else select(list.prev(selectedItem)); } }; } }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'toggle', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this5 = this; return function () { _this5.focus(); _this5.props.open ? _this5.close() : _this5.open(); }; } })), _class2)) || _class; exports.default = (0, _uncontrollable2.default)(Combobox, { open: 'onToggle', value: 'onChange' }, ['focus']); module.exports = exports['default']; /***/ }), /* 92 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.caretSet = undefined; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _temp2; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactDom = __webpack_require__(5); var _Input = __webpack_require__(43); var _Input2 = _interopRequireDefault(_Input); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 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; } var caretSet = exports.caretSet = function caretSet(node, start, end) { try { node.setSelectionRange(start, end); } catch (e) { /* not focused or not visible */ } }; var ComboboxInput = (_temp2 = _class = function (_React$Component) { _inherits(ComboboxInput, _React$Component); function ComboboxInput() { var _temp, _this, _ret; _classCallCheck(this, ComboboxInput); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleChange = function (e) { var _this$props = _this.props, placeholder = _this$props.placeholder, value = _this$props.value, onChange = _this$props.onChange; var stringValue = e.target.value; var hasPlaceholder = !!placeholder; // IE fires input events when setting/unsetting placeholders. // issue #112 if (hasPlaceholder && !stringValue && stringValue === (value || '')) return; _this._last = stringValue; onChange(e, stringValue); }, _temp), _possibleConstructorReturn(_this, _ret); } ComboboxInput.prototype.componentDidUpdate = function componentDidUpdate() { var input = (0, _reactDom.findDOMNode)(this); var val = this.props.value; if (this.isSuggesting()) { var start = val.toLowerCase().indexOf(this._last.toLowerCase()) + this._last.length; var end = val.length - start; if (start >= 0 && end !== 0) { caretSet(input, start, start + end); } } }; ComboboxInput.prototype.render = function render() { var _props = this.props, onKeyDown = _props.onKeyDown, props = _objectWithoutProperties(_props, ['onKeyDown']); delete props.suggest; return _react2.default.createElement(_Input2.default, _extends({}, props, { className: 'rw-widget-input', onKeyDown: onKeyDown, onChange: this.handleChange })); }; ComboboxInput.prototype.isSuggesting = function isSuggesting() { var _props2 = this.props, value = _props2.value, suggest = _props2.suggest; if (!suggest) return false; return this._last != null && value.toLowerCase().indexOf(this._last.toLowerCase()) !== -1; }; ComboboxInput.prototype.accept = function accept() { this._last = null; // caretSet(node, end, end) }; ComboboxInput.prototype.focus = function focus() { (0, _reactDom.findDOMNode)(this).focus(); }; return ComboboxInput; }(_react2.default.Component), _class.propTypes = { value: _propTypes2.default.string, placeholder: _propTypes2.default.string, suggest: _propTypes2.default.bool, onChange: _propTypes2.default.func.isRequired, onKeyDown: _propTypes2.default.func }, _class.defaultProps = { value: '' }, _temp2); exports.default = ComboboxInput; /***/ }), /* 93 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _class, _temp; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _Button = __webpack_require__(19); var _Button2 = _interopRequireDefault(_Button); 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; } var Header = (_temp = _class = function (_React$Component) { _inherits(Header, _React$Component); function Header() { _classCallCheck(this, Header); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } Header.prototype.render = function render() { var _props = this.props, messages = _props.messages, label = _props.label, labelId = _props.labelId, onMoveRight = _props.onMoveRight, onMoveLeft = _props.onMoveLeft, onViewChange = _props.onViewChange, prevDisabled = _props.prevDisabled, upDisabled = _props.upDisabled, nextDisabled = _props.nextDisabled; var rtl = this.context.isRtl; return _react2.default.createElement( 'div', { className: 'rw-calendar-header' }, _react2.default.createElement(_Button2.default, { className: 'rw-calendar-btn-left', onClick: onMoveLeft, disabled: prevDisabled, label: messages.moveBack(), icon: 'chevron-' + (rtl ? 'right' : 'left') }), _react2.default.createElement( _Button2.default, { id: labelId, onClick: onViewChange, className: 'rw-calendar-btn-view', disabled: upDisabled, 'aria-live': 'polite', 'aria-atomic': 'true' }, label ), _react2.default.createElement(_Button2.default, { className: 'rw-calendar-btn-right', onClick: onMoveRight, disabled: nextDisabled, label: messages.moveForward(), icon: 'chevron-' + (rtl ? 'left' : 'right') }) ); }; return Header; }(_react2.default.Component), _class.propTypes = { label: _propTypes2.default.string.isRequired, labelId: _propTypes2.default.string, upDisabled: _propTypes2.default.bool.isRequired, prevDisabled: _propTypes2.default.bool.isRequired, nextDisabled: _propTypes2.default.bool.isRequired, onViewChange: _propTypes2.default.func.isRequired, onMoveLeft: _propTypes2.default.func.isRequired, onMoveRight: _propTypes2.default.func.isRequired, messages: _propTypes2.default.shape({ moveBack: _propTypes2.default.func.isRequired, moveForward: _propTypes2.default.func.isRequired }) }, _class.contextTypes = { isRtl: _propTypes2.default.bool }, _temp); exports.default = Header; module.exports = exports['default']; /***/ }), /* 94 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.default = Footer; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _Button = __webpack_require__(19); var _Button2 = _interopRequireDefault(_Button); var _localizers = __webpack_require__(6); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var propTypes = { disabled: _propTypes2.default.bool, readOnly: _propTypes2.default.bool, value: _propTypes2.default.instanceOf(Date), onClick: _propTypes2.default.func.isRequired, culture: _propTypes2.default.string, format: CustomPropTypes.dateFormat }; function Footer(_ref) { var disabled = _ref.disabled, readOnly = _ref.readOnly, value = _ref.value, onClick = _ref.onClick, culture = _ref.culture, format = _ref.format; return _react2.default.createElement( 'div', { className: 'rw-calendar-footer' }, _react2.default.createElement( _Button2.default, { disabled: !!(disabled || readOnly), onClick: onClick.bind(null, value) }, _localizers.date.format(value, _localizers.date.getFormat('footer', format), culture) ) ); } Footer.propTypes = propTypes; module.exports = exports['default']; /***/ }), /* 95 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _temp2; var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _CalendarView = __webpack_require__(34); var _CalendarView2 = _interopRequireDefault(_CalendarView); var _dates = __webpack_require__(14); var _dates2 = _interopRequireDefault(_dates); var _localizers = __webpack_require__(6); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); var _ = __webpack_require__(8); var _Props = __webpack_require__(4); var Props = _interopRequireWildcard(_Props); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } 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; } var isEqual = function isEqual(dateA, dateB) { return _dates2.default.eq(dateA, dateB, 'day'); }; var MonthView = (_temp2 = _class = function (_React$Component) { _inherits(MonthView, _React$Component); function MonthView() { var _temp, _this, _ret; _classCallCheck(this, MonthView); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.renderRow = function (row, rowIdx) { var _this$props = _this.props, focused = _this$props.focused, today = _this$props.today, activeId = _this$props.activeId, disabled = _this$props.disabled, onChange = _this$props.onChange, value = _this$props.value, culture = _this$props.culture, min = _this$props.min, max = _this$props.max, footerFormat = _this$props.footerFormat, dateFormat = _this$props.dateFormat, Day = _this$props.dayComponent; footerFormat = _localizers.date.getFormat('footer', footerFormat); dateFormat = _localizers.date.getFormat('dayOfMonth', dateFormat); return _react2.default.createElement( _CalendarView2.default.Row, { key: rowIdx }, row.map(function (date, colIdx) { var formattedDate = _localizers.date.format(date, dateFormat, culture); var label = _localizers.date.format(date, footerFormat, culture); return _react2.default.createElement( _CalendarView2.default.Cell, { key: colIdx, activeId: activeId, label: label, date: date, now: today, min: min, max: max, unit: 'day', viewUnit: 'month', onChange: onChange, focused: focused, selected: value, disabled: disabled }, Day ? _react2.default.createElement(Day, { date: date, label: formattedDate }) : formattedDate ); }) ); }, _temp), _possibleConstructorReturn(_this, _ret); } MonthView.prototype.renderHeaders = function renderHeaders(week, format, culture) { var firstOfWeek = _localizers.date.firstOfWeek(culture); return week.map(function (date) { return _react2.default.createElement( 'th', { key: 'header_' + _dates2.default.weekday(date, undefined, firstOfWeek) }, _localizers.date.format(date, format, culture) ); }); }; MonthView.prototype.render = function render() { var _props = this.props, className = _props.className, focused = _props.focused, culture = _props.culture, activeId = _props.activeId, dayFormat = _props.dayFormat; var month = _dates2.default.visibleDays(focused, culture); var rows = (0, _.chunk)(month, 7); dayFormat = _localizers.date.getFormat('weekday', dayFormat); return _react2.default.createElement( _CalendarView2.default, _extends({}, Props.omitOwn(this), { activeId: activeId, className: (0, _classnames2.default)(className, 'rw-calendar-month') }), _react2.default.createElement( 'thead', null, _react2.default.createElement( 'tr', null, this.renderHeaders(rows[0], dayFormat, culture) ) ), _react2.default.createElement( _CalendarView2.default.Body, null, rows.map(this.renderRow) ) ); }; return MonthView; }(_react2.default.Component), _class.propTypes = { activeId: _propTypes2.default.string, culture: _propTypes2.default.string, today: _propTypes2.default.instanceOf(Date), value: _propTypes2.default.instanceOf(Date), focused: _propTypes2.default.instanceOf(Date), min: _propTypes2.default.instanceOf(Date), max: _propTypes2.default.instanceOf(Date), onChange: _propTypes2.default.func.isRequired, dayComponent: CustomPropTypes.elementType, dayFormat: CustomPropTypes.dateFormat, dateFormat: CustomPropTypes.dateFormat, footerFormat: CustomPropTypes.dateFormat, disabled: _propTypes2.default.bool }, _class.isEqual = isEqual, _temp2); exports.default = MonthView; module.exports = exports['default']; /***/ }), /* 96 */ /***/ (function(module, exports) { var MILI = 'milliseconds' , SECONDS = 'seconds' , MINUTES = 'minutes' , HOURS = 'hours' , DAY = 'day' , WEEK = 'week' , MONTH = 'month' , YEAR = 'year' , DECADE = 'decade' , CENTURY = 'century'; var dates = module.exports = { add: function(date, num, unit) { date = new Date(date) switch (unit){ case MILI: case SECONDS: case MINUTES: case HOURS: case YEAR: return dates[unit](date, dates[unit](date) + num) case DAY: return dates.date(date, dates.date(date) + num) case WEEK: return dates.date(date, dates.date(date) + (7 * num)) case MONTH: return monthMath(date, num) case DECADE: return dates.year(date, dates.year(date) + (num * 10)) case CENTURY: return dates.year(date, dates.year(date) + (num * 100)) } throw new TypeError('Invalid units: "' + unit + '"') }, subtract: function(date, num, unit) { return dates.add(date, -num, unit) }, startOf: function(date, unit, firstOfWeek) { date = new Date(date) switch (unit) { case 'century': case 'decade': case 'year': date = dates.month(date, 0); case 'month': date = dates.date(date, 1); case 'week': case 'day': date = dates.hours(date, 0); case 'hours': date = dates.minutes(date, 0); case 'minutes': date = dates.seconds(date, 0); case 'seconds': date = dates.milliseconds(date, 0); } if (unit === DECADE) date = dates.subtract(date, dates.year(date) % 10, 'year') if (unit === CENTURY) date = dates.subtract(date, dates.year(date) % 100, 'year') if (unit === WEEK) date = dates.weekday(date, 0, firstOfWeek); return date }, endOf: function(date, unit, firstOfWeek){ date = new Date(date) date = dates.startOf(date, unit, firstOfWeek) date = dates.add(date, 1, unit) date = dates.subtract(date, 1, MILI) return date }, eq: createComparer(function(a, b){ return a === b }), neq: createComparer(function(a, b){ return a !== b }), gt: createComparer(function(a, b){ return a > b }), gte: createComparer(function(a, b){ return a >= b }), lt: createComparer(function(a, b){ return a < b }), lte: createComparer(function(a, b){ return a <= b }), min: function(){ return new Date(Math.min.apply(Math, arguments)) }, max: function(){ return new Date(Math.max.apply(Math, arguments)) }, inRange: function(day, min, max, unit){ unit = unit || 'day' return (!min || dates.gte(day, min, unit)) && (!max || dates.lte(day, max, unit)) }, milliseconds: createAccessor('Milliseconds'), seconds: createAccessor('Seconds'), minutes: createAccessor('Minutes'), hours: createAccessor('Hours'), day: createAccessor('Day'), date: createAccessor('Date'), month: createAccessor('Month'), year: createAccessor('FullYear'), decade: function (date, val) { return val === undefined ? dates.year(dates.startOf(date, DECADE)) : dates.add(date, val + 10, YEAR); }, century: function (date, val) { return val === undefined ? dates.year(dates.startOf(date, CENTURY)) : dates.add(date, val + 100, YEAR); }, weekday: function (date, val, firstDay) { var weekday = (dates.day(date) + 7 - (firstDay || 0) ) % 7; return val === undefined ? weekday : dates.add(date, val - weekday, DAY); }, diff: function (date1, date2, unit, asFloat) { var dividend, divisor, result; switch (unit) { case MILI: case SECONDS: case MINUTES: case HOURS: case DAY: case WEEK: dividend = date2.getTime() - date1.getTime(); break; case MONTH: case YEAR: case DECADE: case CENTURY: dividend = (dates.year(date2) - dates.year(date1)) * 12 + dates.month(date2) - dates.month(date1); break; default: throw new TypeError('Invalid units: "' + unit + '"'); } switch (unit) { case MILI: divisor = 1; break; case SECONDS: divisor = 1000; break; case MINUTES: divisor = 1000 * 60; break; case HOURS: divisor = 1000 * 60 * 60; break; case DAY: divisor = 1000 * 60 * 60 * 24; break; case WEEK: divisor = 1000 * 60 * 60 * 24 * 7; break; case MONTH: divisor = 1; break; case YEAR: divisor = 12; break; case DECADE: divisor = 120; break; case CENTURY: divisor = 1200; break; default: throw new TypeError('Invalid units: "' + unit + '"'); } result = dividend / divisor; return asFloat ? result : absoluteFloor(result); } }; function absoluteFloor(number) { return number < 0 ? Math.ceil(number) : Math.floor(number); } function monthMath(date, val){ var current = dates.month(date) , newMonth = (current + val); date = dates.month(date, newMonth) while (newMonth < 0 ) newMonth = 12 + newMonth //month rollover if ( dates.month(date) !== ( newMonth % 12)) date = dates.date(date, 0) //move to last of month return date } function createAccessor(method){ return function(date, val){ if (val === undefined) return date['get' + method]() date = new Date(date) date['set' + method](val) return date } } function createComparer(operator) { return function (a, b, unit) { return operator(+dates.startOf(a, unit), +dates.startOf(b, unit)) }; } /***/ }), /* 97 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _temp2; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _CalendarView = __webpack_require__(34); var _CalendarView2 = _interopRequireDefault(_CalendarView); var _dates = __webpack_require__(14); var _dates2 = _interopRequireDefault(_dates); var _localizers = __webpack_require__(6); var _ = __webpack_require__(8); var _Props = __webpack_require__(4); var Props = _interopRequireWildcard(_Props); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } 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; } var YearView = (_temp2 = _class = function (_React$Component) { _inherits(YearView, _React$Component); function YearView() { var _temp, _this, _ret; _classCallCheck(this, YearView); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.renderRow = function (row, rowIdx) { var _this$props = _this.props, focused = _this$props.focused, activeId = _this$props.activeId, disabled = _this$props.disabled, onChange = _this$props.onChange, value = _this$props.value, today = _this$props.today, culture = _this$props.culture, headerFormat = _this$props.headerFormat, monthFormat = _this$props.monthFormat, min = _this$props.min, max = _this$props.max; headerFormat = _localizers.date.getFormat('header', headerFormat); monthFormat = _localizers.date.getFormat('month', monthFormat); return _react2.default.createElement( _CalendarView2.default.Row, { key: rowIdx }, row.map(function (date, colIdx) { var label = _localizers.date.format(date, headerFormat, culture); return _react2.default.createElement( _CalendarView2.default.Cell, { key: colIdx, activeId: activeId, label: label, date: date, now: today, min: min, max: max, unit: 'month', onChange: onChange, focused: focused, selected: value, disabled: disabled }, _localizers.date.format(date, monthFormat, culture) ); }) ); }, _temp), _possibleConstructorReturn(_this, _ret); } YearView.prototype.render = function render() { var _props = this.props, focused = _props.focused, activeId = _props.activeId, months = _dates2.default.monthsInYear(_dates2.default.year(focused)); return _react2.default.createElement( _CalendarView2.default, _extends({}, Props.omitOwn(this), { activeId: activeId }), _react2.default.createElement( _CalendarView2.default.Body, null, (0, _.chunk)(months, 4).map(this.renderRow) ) ); }; return YearView; }(_react2.default.Component), _class.propTypes = { activeId: _propTypes2.default.string, culture: _propTypes2.default.string, today: _propTypes2.default.instanceOf(Date), value: _propTypes2.default.instanceOf(Date), focused: _propTypes2.default.instanceOf(Date), min: _propTypes2.default.instanceOf(Date), max: _propTypes2.default.instanceOf(Date), onChange: _propTypes2.default.func.isRequired, headerFormat: CustomPropTypes.dateFormat, monthFormat: CustomPropTypes.dateFormat, disabled: _propTypes2.default.bool }, _temp2); exports.default = YearView; module.exports = exports['default']; /***/ }), /* 98 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _temp2; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _CalendarView = __webpack_require__(34); var _CalendarView2 = _interopRequireDefault(_CalendarView); var _dates = __webpack_require__(14); var _dates2 = _interopRequireDefault(_dates); var _localizers = __webpack_require__(6); var _ = __webpack_require__(8); var _Props = __webpack_require__(4); var Props = _interopRequireWildcard(_Props); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } 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; } var DecadeView = (_temp2 = _class = function (_React$Component) { _inherits(DecadeView, _React$Component); function DecadeView() { var _temp, _this, _ret; _classCallCheck(this, DecadeView); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.renderRow = function (row, rowIdx) { var _this$props = _this.props, focused = _this$props.focused, activeId = _this$props.activeId, disabled = _this$props.disabled, onChange = _this$props.onChange, yearFormat = _this$props.yearFormat, value = _this$props.value, today = _this$props.today, culture = _this$props.culture, min = _this$props.min, max = _this$props.max; return _react2.default.createElement( _CalendarView2.default.Row, { key: rowIdx }, row.map(function (date, colIdx) { var label = _localizers.date.format(date, _localizers.date.getFormat('year', yearFormat), culture); return _react2.default.createElement( _CalendarView2.default.Cell, { key: colIdx, unit: 'year', activeId: activeId, label: label, date: date, now: today, min: min, max: max, onChange: onChange, focused: focused, selected: value, disabled: disabled }, label ); }) ); }, _temp), _possibleConstructorReturn(_this, _ret); } DecadeView.prototype.render = function render() { var _props = this.props, focused = _props.focused, activeId = _props.activeId; return _react2.default.createElement( _CalendarView2.default, _extends({}, Props.omitOwn(this), { activeId: activeId }), _react2.default.createElement( _CalendarView2.default.Body, null, (0, _.chunk)(getDecadeYears(focused), 4).map(this.renderRow) ) ); }; return DecadeView; }(_react2.default.Component), _class.propTypes = { activeId: _propTypes2.default.string, culture: _propTypes2.default.string, today: _propTypes2.default.instanceOf(Date), value: _propTypes2.default.instanceOf(Date), focused: _propTypes2.default.instanceOf(Date), min: _propTypes2.default.instanceOf(Date), max: _propTypes2.default.instanceOf(Date), onChange: _propTypes2.default.func.isRequired, yearFormat: CustomPropTypes.dateFormat, disabled: _propTypes2.default.bool }, _temp2); function getDecadeYears(_date) { var days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], date = _dates2.default.add(_dates2.default.startOf(_date, 'decade'), -2, 'year'); return days.map(function () { return date = _dates2.default.add(date, 1, 'year'); }); } exports.default = DecadeView; module.exports = exports['default']; /***/ }), /* 99 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _temp2; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _CalendarView = __webpack_require__(34); var _CalendarView2 = _interopRequireDefault(_CalendarView); var _dates = __webpack_require__(14); var _dates2 = _interopRequireDefault(_dates); var _localizers = __webpack_require__(6); var _ = __webpack_require__(8); var _Props = __webpack_require__(4); var Props = _interopRequireWildcard(_Props); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } 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; } var CenturyView = (_temp2 = _class = function (_React$Component) { _inherits(CenturyView, _React$Component); function CenturyView() { var _temp, _this, _ret; _classCallCheck(this, CenturyView); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.renderRow = function (row, rowIdx) { var _this$props = _this.props, focused = _this$props.focused, activeId = _this$props.activeId, disabled = _this$props.disabled, onChange = _this$props.onChange, value = _this$props.value, today = _this$props.today, culture = _this$props.culture, min = _this$props.min, decadeFormat = _this$props.decadeFormat, max = _this$props.max; decadeFormat = _localizers.date.getFormat('decade', decadeFormat); return _react2.default.createElement( _CalendarView2.default.Row, { key: rowIdx }, row.map(function (date, colIdx) { var label = _localizers.date.format(_dates2.default.startOf(date, 'decade'), decadeFormat, culture); return _react2.default.createElement( _CalendarView2.default.Cell, { key: colIdx, unit: 'decade', activeId: activeId, label: label, date: date, now: today, min: min, max: max, onChange: onChange, focused: focused, selected: value, disabled: disabled }, label ); }) ); }, _temp), _possibleConstructorReturn(_this, _ret); } CenturyView.prototype.render = function render() { var _props = this.props, focused = _props.focused, activeId = _props.activeId; return _react2.default.createElement( _CalendarView2.default, _extends({}, Props.omitOwn(this), { activeId: activeId }), _react2.default.createElement( _CalendarView2.default.Body, null, (0, _.chunk)(getCenturyDecades(focused), 4).map(this.renderRow) ) ); }; return CenturyView; }(_react2.default.Component), _class.propTypes = { activeId: _propTypes2.default.string, culture: _propTypes2.default.string, today: _propTypes2.default.instanceOf(Date), value: _propTypes2.default.instanceOf(Date), focused: _propTypes2.default.instanceOf(Date), min: _propTypes2.default.instanceOf(Date), max: _propTypes2.default.instanceOf(Date), onChange: _propTypes2.default.func.isRequired, decadeFormat: CustomPropTypes.dateFormat, disabled: _propTypes2.default.bool }, _temp2); function getCenturyDecades(_date) { var days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], date = _dates2.default.add(_dates2.default.startOf(_date, 'century'), -20, 'year'); return days.map(function () { return date = _dates2.default.add(date, 10, 'year'); }); } exports.default = CenturyView; module.exports = exports['default']; /***/ }), /* 100 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) { exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _ChildMapping = __webpack_require__(101); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 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; } var values = Object.values || function (obj) { return Object.keys(obj).map(function (k) { return obj[k]; }); }; var propTypes = { /** * `<TransitionGroup>` renders a `<div>` by default. You can change this * behavior by providing a `component` prop. */ component: _propTypes2.default.any, /** * A set of `<Transition>` components, that are toggled `in` and out as they * leave. the `<TransitionGroup>` will inject specific transition props, so * remember to spread them throguh if you are wrapping the `<Transition>` as * with our `<Fade>` example. */ children: _propTypes2.default.node, /** * A convenience prop that enables or disabled appear animations * for all children. Note that specifiying this will override any defaults set * on individual children Transitions. */ appear: _propTypes2.default.bool, /** * A convenience prop that enables or disabled enter animations * for all children. Note that specifiying this will override any defaults set * on individual children Transitions. */ enter: _propTypes2.default.bool, /** * A convenience prop that enables or disabled exit animations * for all children. Note that specifiying this will override any defaults set * on individual children Transitions. */ exit: _propTypes2.default.bool, /** * You may need to apply reactive updates to a child as it is exiting. * This is generally done by using `cloneElement` however in the case of an exiting * child the element has already been removed and not accessible to the consumer. * * If you do need to update a child as it leaves you can provide a `childFactory` * to wrap every child, even the ones that are leaving. * * @type Function(child: ReactElement) -> ReactElement */ childFactory: _propTypes2.default.func }; var defaultProps = { component: 'div', childFactory: function childFactory(child) { return child; } }; /** * The `<TransitionGroup>` component manages a set of `<Transition>` components * in a list. Like with the `<Transition>` component, `<TransitionGroup>`, is a * state machine for managing the mounting and unmounting of components over * time. * * Consider the example below using the `Fade` CSS transition from before. * As items are removed or added to the TodoList the `in` prop is toggled * automatically by the `<TransitionGroup>`. You can use _any_ `<Transition>` * component in a `<TransitionGroup>`, not just css. * * ```jsx * import TransitionGroup from 'react-transition-group/TransitionGroup'; * * class TodoList extends React.Component { * constructor(props) { * super(props) * this.state = {items: ['hello', 'world', 'click', 'me']} * } * handleAdd() { * const newItems = this.state.items.concat([ * prompt('Enter some text') * ]); * this.setState({ items: newItems }); * } * handleRemove(i) { * let newItems = this.state.items.slice(); * newItems.splice(i, 1); * this.setState({items: newItems}); * } * render() { * return ( * <div> * <button onClick={() => this.handleAdd()}>Add Item</button> * <TransitionGroup> * {this.state.items.map((item, i) => ( * <FadeTransition key={item}> * <div> * {item}{' '} * <button onClick={() => this.handleRemove(i)}> * remove * </button> * </div> * </FadeTransition> * ))} * </TransitionGroup> * </div> * ); * } * } * ``` * * Note that `<TransitionGroup>` does not define any animation behavior! * Exactly _how_ a list item animates is up to the individual `<Transition>` * components. This means you can mix and match animations across different * list items. */ var TransitionGroup = function (_React$Component) { _inherits(TransitionGroup, _React$Component); function TransitionGroup(props, context) { _classCallCheck(this, TransitionGroup); // Initial children should all be entering, dependent on appear var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context)); _this.handleExited = function (key, node, originalHandler) { var currentChildMapping = (0, _ChildMapping.getChildMapping)(_this.props.children); if (key in currentChildMapping) return; if (originalHandler) originalHandler(node); _this.setState(function (state) { var children = _extends({}, state.children); delete children[key]; return { children: children }; }); }; _this.state = { children: (0, _ChildMapping.getChildMapping)(props.children, function (child) { var onExited = function onExited(node) { _this.handleExited(child.key, node, child.props.onExited); }; return (0, _react.cloneElement)(child, { onExited: onExited, in: true, appear: _this.getProp(child, 'appear'), enter: _this.getProp(child, 'enter'), exit: _this.getProp(child, 'exit') }); }) }; return _this; } TransitionGroup.prototype.getChildContext = function getChildContext() { return { transitionGroup: { isMounting: !this.appeared } }; }; // use child config unless explictly set by the Group TransitionGroup.prototype.getProp = function getProp(child, prop) { var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.props; return props[prop] != null ? props[prop] : child.props[prop]; }; TransitionGroup.prototype.componentDidMount = function componentDidMount() { this.appeared = true; }; TransitionGroup.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { var _this2 = this; var prevChildMapping = this.state.children; var nextChildMapping = (0, _ChildMapping.getChildMapping)(nextProps.children); var children = (0, _ChildMapping.mergeChildMappings)(prevChildMapping, nextChildMapping); Object.keys(children).forEach(function (key) { var child = children[key]; if (!(0, _react.isValidElement)(child)) return; var onExited = function onExited(node) { _this2.handleExited(child.key, node, child.props.onExited); }; var hasPrev = key in prevChildMapping; var hasNext = key in nextChildMapping; var prevChild = prevChildMapping[key]; var isLeaving = (0, _react.isValidElement)(prevChild) && !prevChild.props.in; // item is new (entering) if (hasNext && (!hasPrev || isLeaving)) { // console.log('entering', key) children[key] = (0, _react.cloneElement)(child, { onExited: onExited, in: true, exit: _this2.getProp(child, 'exit', nextProps), enter: _this2.getProp(child, 'enter', nextProps) }); } // item is old (exiting) else if (!hasNext && hasPrev && !isLeaving) { // console.log('leaving', key) children[key] = (0, _react.cloneElement)(child, { in: false }); } // item hasn't changed transition states // copy over the last transition props; else if (hasNext && hasPrev && (0, _react.isValidElement)(prevChild)) { // console.log('unchanged', key) children[key] = (0, _react.cloneElement)(child, { onExited: onExited, in: prevChild.props.in, exit: _this2.getProp(child, 'exit', nextProps), enter: _this2.getProp(child, 'enter', nextProps) }); } }); this.setState({ children: children }); }; TransitionGroup.prototype.render = function render() { var _props = this.props, Component = _props.component, childFactory = _props.childFactory, props = _objectWithoutProperties(_props, ['component', 'childFactory']); var children = this.state.children; delete props.appear; delete props.enter; delete props.exit; return _react2.default.createElement( Component, props, values(children).map(childFactory) ); }; return TransitionGroup; }(_react2.default.Component); TransitionGroup.childContextTypes = { transitionGroup: _propTypes2.default.object.isRequired }; TransitionGroup.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {}; TransitionGroup.defaultProps = defaultProps; exports.default = TransitionGroup; module.exports = exports['default']; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), /* 101 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.getChildMapping = getChildMapping; exports.mergeChildMappings = mergeChildMappings; var _react = __webpack_require__(0); /** * Given `this.props.children`, return an object mapping key to child. * * @param {*} children `this.props.children` * @return {object} Mapping of key to child */ function getChildMapping(children, mapFn) { var mapper = function mapper(child) { return mapFn && (0, _react.isValidElement)(child) ? mapFn(child) : child; }; var result = Object.create(null); if (children) _react.Children.map(children, function (c) { return c; }).forEach(function (child) { // run the map function here instead so that the key is the computed one result[child.key] = mapper(child); }); return result; } /** * When you're adding or removing children some may be added or removed in the * same render pass. We want to show *both* since we want to simultaneously * animate elements in and out. This function takes a previous set of keys * and a new set of keys and merges them with its best guess of the correct * ordering. In the future we may expose some of the utilities in * ReactMultiChild to make this easy, but for now React itself does not * directly have this concept of the union of prevChildren and nextChildren * so we implement it here. * * @param {object} prev prev children as returned from * `ReactTransitionChildMapping.getChildMapping()`. * @param {object} next next children as returned from * `ReactTransitionChildMapping.getChildMapping()`. * @return {object} a key set that contains all keys in `prev` and all keys * in `next` in a reasonable order. */ function mergeChildMappings(prev, next) { prev = prev || {}; next = next || {}; function getValueForKey(key) { return key in next ? next[key] : prev[key]; } // For each key of `next`, the list of keys to insert before that key in // the combined list var nextKeysPending = Object.create(null); var pendingKeys = []; for (var prevKey in prev) { if (prevKey in next) { if (pendingKeys.length) { nextKeysPending[prevKey] = pendingKeys; pendingKeys = []; } } else { pendingKeys.push(prevKey); } } var i = void 0; var childMapping = {}; for (var nextKey in next) { if (nextKeysPending[nextKey]) { for (i = 0; i < nextKeysPending[nextKey].length; i++) { var pendingNextKey = nextKeysPending[nextKey][i]; childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey); } } childMapping[nextKey] = getValueForKey(nextKey); } // Finally, add the keys which didn't appear before any key in `next` for (i = 0; i < pendingKeys.length; i++) { childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]); } return childMapping; } /***/ }), /* 102 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _DateTimePicker = __webpack_require__(44); var _DateTimePicker2 = _interopRequireDefault(_DateTimePicker); 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; } var propTypes = { open: _propTypes2.default.bool, defaultOpen: _propTypes2.default.bool, onToggle: _propTypes2.default.func }; var DatePicker = function (_React$Component) { _inherits(DatePicker, _React$Component); function DatePicker(props, context) { _classCallCheck(this, DatePicker); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context)); _this.handleToggle = function (open) { _this.toggleState = !!open; if (_this.props.onToggle) _this.props.onToggle(_this.toggleState);else _this.forceUpdate(); }; _this.toggleState = props.defaultOpen; return _this; } DatePicker.prototype.render = function render() { var open = this.props.open; open = open === undefined ? this.toggleState : open; return _react2.default.createElement(_DateTimePicker2.default, _extends({}, this.props, { time: false, open: open ? 'date' : open, onToggle: this.handleToggle })); }; return DatePicker; }(_react2.default.Component); DatePicker.propTypes = propTypes; exports.default = DatePicker; module.exports = exports['default']; /***/ }), /* 103 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.default = deprecated; var _warning = __webpack_require__(104); var _warning2 = _interopRequireDefault(_warning); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var warned = {}; function deprecated(validator, reason) { return function validate(props, propName, componentName, location, propFullName) { var componentNameSafe = componentName || '<<anonymous>>'; var propFullNameSafe = propFullName || propName; if (props[propName] != null) { var messageKey = componentName + '.' + propName; (0, _warning2.default)(warned[messageKey], 'The ' + location + ' `' + propFullNameSafe + '` of ' + ('`' + componentNameSafe + '` is deprecated. ' + reason + '.')); warned[messageKey] = true; } for (var _len = arguments.length, args = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) { args[_key - 5] = arguments[_key]; } return validator.apply(undefined, [props, propName, componentName, location, propFullName].concat(args)); }; } /* eslint-disable no-underscore-dangle */ function _resetWarned() { warned = {}; } deprecated._resetWarned = _resetWarned; /* eslint-enable no-underscore-dangle */ /***/ }), /* 104 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) {/** * 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. */ /** * 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 = function() {}; if (process.env.NODE_ENV !== 'production') { warning = function(condition, format, args) { var len = arguments.length; args = new Array(len > 2 ? len - 2 : 0); for (var key = 2; key < len; key++) { args[key - 2] = arguments[key]; } 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 (!condition) { var argIndex = 0; var message = 'Warning: ' + format.replace(/%s/g, function() { return args[argIndex++]; }); if (typeof console !== 'undefined') { console.error(message); } try { // 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; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), /* 105 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _temp, _initialiseProps; var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(5); var _Input = __webpack_require__(43); var _Input2 = _interopRequireDefault(_Input); var _localizers = __webpack_require__(6); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); var _Props = __webpack_require__(4); var Props = _interopRequireWildcard(_Props); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } 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; } var DateTimePickerInput = (_temp = _class = function (_React$Component) { _inherits(DateTimePickerInput, _React$Component); function DateTimePickerInput() { _classCallCheck(this, DateTimePickerInput); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var _this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))); _initialiseProps.call(_this); var _this$props = _this.props, value = _this$props.value, editing = _this$props.editing, editFormat = _this$props.editFormat, format = _this$props.format, culture = _this$props.culture; _this.state = { textValue: formatDate(value, editing && editFormat ? editFormat : format, culture) }; return _this; } DateTimePickerInput.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { var value = nextProps.value, editing = nextProps.editing, editFormat = nextProps.editFormat, format = nextProps.format, culture = nextProps.culture; this.setState({ textValue: formatDate(value, editing && editFormat ? editFormat : format, culture) }); }; DateTimePickerInput.prototype.render = function render() { var _props = this.props, disabled = _props.disabled, readOnly = _props.readOnly; var textValue = this.state.textValue; var props = Props.omitOwn(this); return _react2.default.createElement(_Input2.default, _extends({}, props, { type: 'text', className: 'rw-widget-input', value: textValue, disabled: disabled, readOnly: readOnly, onChange: this.handleChange, onBlur: this.handleBlur })); }; DateTimePickerInput.prototype.focus = function focus() { (0, _reactDom.findDOMNode)(this).focus(); }; return DateTimePickerInput; }(_react2.default.Component), _class.propTypes = { format: CustomPropTypes.dateFormat.isRequired, editing: _propTypes2.default.bool, editFormat: CustomPropTypes.dateFormat, parse: _propTypes2.default.func.isRequired, value: _propTypes2.default.instanceOf(Date), onChange: _propTypes2.default.func.isRequired, onBlur: _propTypes2.default.func, culture: _propTypes2.default.string, disabled: CustomPropTypes.disabled, readOnly: CustomPropTypes.disabled }, _initialiseProps = function _initialiseProps() { var _this2 = this; this.handleChange = function (_ref) { var value = _ref.target.value; _this2._needsFlush = true; _this2.setState({ textValue: value }); }; this.handleBlur = function (event) { var _props2 = _this2.props, format = _props2.format, culture = _props2.culture, parse = _props2.parse, onChange = _props2.onChange, onBlur = _props2.onBlur; onBlur && onBlur(event); if (_this2._needsFlush) { var date = parse(event.target.value); _this2._needsFlush = false; onChange(date, formatDate(date, format, culture)); } }; }, _temp); exports.default = DateTimePickerInput; function isValid(d) { return !isNaN(d.getTime()); } function formatDate(date, format, culture) { var val = ''; if (date instanceof Date && isValid(date)) val = _localizers.date.format(date, format, culture); return val; } module.exports = exports['default']; /***/ }), /* 106 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _temp; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactComponentManagers = __webpack_require__(9); var _List = __webpack_require__(23); var _List2 = _interopRequireDefault(_List); var _dates = __webpack_require__(14); var _dates2 = _interopRequireDefault(_dates); var _listDataManager = __webpack_require__(20); var _listDataManager2 = _interopRequireDefault(_listDataManager); var _localizers = __webpack_require__(6); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); var _Props = __webpack_require__(4); var Props = _interopRequireWildcard(_Props); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } 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; } var format = function format(props) { return _localizers.date.getFormat('time', props.format); }; var TimeList = (_temp = _class = function (_React$Component) { _inherits(TimeList, _React$Component); function TimeList() { _classCallCheck(this, TimeList); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var _this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))); _this.handleKeyDown = function (e) { var key = e.key; var focusedItem = _this.state.focusedItem; var list = _this.list; if (key === 'End') { e.preventDefault(); _this.setState({ focusedItem: list.last() }); } else if (key === 'Home') { e.preventDefault(); _this.setState({ focusedItem: list.first() }); } else if (key === 'Enter') { _this.props.onSelect(focusedItem); } else if (key === 'ArrowDown') { e.preventDefault(); _this.setState({ focusedItem: list.next(focusedItem) }); } else if (key === 'ArrowUp') { e.preventDefault(); _this.setState({ focusedItem: list.prev(focusedItem) }); } }; _this.handleKeyPress = function (e) { e.preventDefault(); _this.search(String.fromCharCode(e.which), function (item) { !_this.unmounted && _this.setState({ focusedItem: item }); }); }; _this.scrollTo = function () { _this.refs.list.move && _this.refs.list.move(); }; _this.accessors = { text: function text(item) { return item.label; }, value: function value(item) { return item.date; } }; _this.timeouts = (0, _reactComponentManagers.timeoutManager)(_this); _this.list = (0, _listDataManager2.default)(_this, { getListDataState: _List2.default.getListDataState, accessors: _this.accessors }); _this.state = _this.getStateFromProps(_this.props); return _this; } TimeList.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { this.setState(this.getStateFromProps(nextProps)); }; TimeList.prototype.componentWillUnmount = function componentWillUnmount() { this.unmounted = true; }; TimeList.prototype.getStateFromProps = function getStateFromProps() { var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props; var value = props.value, currentDate = props.currentDate; var data = this.getDates(props); var selectedItem = this.getClosestDate(data, value || currentDate); this.list.setData(data); return { dates: data, selectedItem: this.list.nextEnabled(selectedItem), focusedItem: this.list.nextEnabled(selectedItem || data[0]) }; }; TimeList.prototype.render = function render() { var onSelect = this.props.onSelect; var _state = this.state, selectedItem = _state.selectedItem, focusedItem = _state.focusedItem; var props = Props.omitOwn(this); var listProps = this.list.defaultProps(); return _react2.default.createElement(_List2.default, _extends({ ref: 'list' }, props, listProps, { onSelect: onSelect, textAccessor: this.accessors.text, valueAccessor: this.accessors.value, selectedItem: selectedItem, focusedItem: focusedItem })); }; TimeList.prototype.getClosestDate = function getClosestDate(times, date) { var roundTo = 1000 * 60 * this.props.step, inst = null, label; if (!date) return null; date = new Date(Math.floor(date.getTime() / roundTo) * roundTo); label = _localizers.date.format(date, format(this.props), this.props.culture); times.some(function (time) { if (time.label === label) return inst = time; }); return inst; }; TimeList.prototype.getDates = function getDates() { var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props; var times = []; var values = this.getBounds(props); var start = values.min; var startDay = _dates2.default.date(start); while (_dates2.default.date(start) === startDay && _dates2.default.lte(start, values.max)) { times.push({ date: start, label: _localizers.date.format(start, format(props), props.culture) }); start = _dates2.default.add(start, props.step || 30, 'minutes'); } return times; }; TimeList.prototype.getBounds = function getBounds(props) { var value = props.value || props.currentDate || _dates2.default.today(), useDate = props.preserveDate, min = props.min, max = props.max, start, end; //compare just the time regradless of whether they fall on the same day if (!useDate) { start = _dates2.default.startOf(_dates2.default.merge(new Date(), min, props.currentDate), 'minutes'); end = _dates2.default.startOf(_dates2.default.merge(new Date(), max, props.currentDate), 'minutes'); if (_dates2.default.lte(end, start) && _dates2.default.gt(max, min, 'day')) end = _dates2.default.tomorrow(); return { min: start, max: end }; } start = _dates2.default.today(); end = _dates2.default.tomorrow(); //date parts are equal return { min: _dates2.default.eq(value, min, 'day') ? _dates2.default.merge(start, min, props.currentDate) : start, max: _dates2.default.eq(value, max, 'day') ? _dates2.default.merge(start, max, props.currentDate) : end }; }; TimeList.prototype.search = function search(character, cb) { var _this2 = this; var word = ((this._searchTerm || '') + character).toLowerCase(); this._searchTerm = word; this.timeouts.set('search', function () { var item = _this2.list.next(_this2.state.focusedItem, word); _this2._searchTerm = ''; if (item) cb(item); }, this.props.delay); }; return TimeList; }(_react2.default.Component), _class.propTypes = { value: _propTypes2.default.instanceOf(Date), step: _propTypes2.default.number, min: _propTypes2.default.instanceOf(Date), max: _propTypes2.default.instanceOf(Date), currentDate: _propTypes2.default.instanceOf(Date), itemComponent: CustomPropTypes.elementType, format: CustomPropTypes.dateFormat, onSelect: _propTypes2.default.func, preserveDate: _propTypes2.default.bool, culture: _propTypes2.default.string, delay: _propTypes2.default.number }, _class.defaultProps = { step: 30, onSelect: function onSelect() {}, min: new Date(1900, 0, 1), max: new Date(2099, 11, 31), preserveDate: true, delay: 300 }, _temp); exports.default = TimeList; module.exports = exports['default']; /***/ }), /* 107 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _DateTimePicker = __webpack_require__(44); var _DateTimePicker2 = _interopRequireDefault(_DateTimePicker); 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; } var propTypes = { open: _propTypes2.default.bool, defaultOpen: _propTypes2.default.bool, onToggle: _propTypes2.default.func }; var TimePicker = function (_React$Component) { _inherits(TimePicker, _React$Component); function TimePicker(props, context) { _classCallCheck(this, TimePicker); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context)); _this.handleToggle = function (open) { _this.toggleState = !!open; if (_this.props.onToggle) _this.props.onToggle(_this.toggleState);else _this.forceUpdate(); }; _this.toggleState = props.defaultOpen; return _this; } TimePicker.prototype.render = function render() { var open = this.props.open; open = open === undefined ? this.toggleState : open; return _react2.default.createElement(_DateTimePicker2.default, _extends({}, this.props, { date: false, open: open ? 'time' : open, onToggle: this.handleToggle })); }; return TimePicker; }(_react2.default.Component); TimePicker.propTypes = propTypes; exports.default = TimePicker; module.exports = exports['default']; /***/ }), /* 108 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _class3, _temp; var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(5); var _uncontrollable = __webpack_require__(15); var _uncontrollable2 = _interopRequireDefault(_uncontrollable); var _Widget = __webpack_require__(16); var _Widget2 = _interopRequireDefault(_Widget); var _WidgetPicker = __webpack_require__(21); var _WidgetPicker2 = _interopRequireDefault(_WidgetPicker); var _Select = __webpack_require__(22); var _Select2 = _interopRequireDefault(_Select); var _NumberInput = __webpack_require__(109); var _NumberInput2 = _interopRequireDefault(_NumberInput); var _Button = __webpack_require__(19); var _Button2 = _interopRequireDefault(_Button); var _messages = __webpack_require__(12); var _Props = __webpack_require__(4); var Props = _interopRequireWildcard(_Props); var _focusManager = __webpack_require__(17); var _focusManager2 = _interopRequireDefault(_focusManager); var _interaction = __webpack_require__(13); var _widgetHelpers = __webpack_require__(10); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); var _constants = __webpack_require__(35); var _withRightToLeft = __webpack_require__(18); var _withRightToLeft2 = _interopRequireDefault(_withRightToLeft); var _localizers = __webpack_require__(6); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _initDefineProp(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } 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; } function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object['ke' + 'ys'](descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object['define' + 'Property'](target, property, desc); desc = null; } return desc; } function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.'); } var format = function format(props) { return _localizers.number.getFormat('default', props.format); }; // my tests in ie11/chrome/FF indicate that keyDown repeats // at about 35ms+/- 5ms after an initial 500ms delay. callback fires on the leading edge function createInterval(callback) { var _fn = void 0; var id, cancel = function cancel() { return clearTimeout(id); }; id = setTimeout(_fn = function fn() { id = setTimeout(_fn, 35); callback(); //fire after everything in case the user cancels on the first call }, 500); return cancel; } function clamp(value, min, max) { max = max == null ? Infinity : max; min = min == null ? -Infinity : min; if (value == null || value === '') return null; return Math.max(Math.min(value, max), min); } /** * --- * localized: true, * shortcuts: * - { key: down arrow, label: decrement value } * - { key: up arrow, label: increment value } * - { key: home, label: set value to minimum value, if finite } * - { key: end, label: set value to maximum value, if finite } * --- * * @public */ var NumberPicker = (0, _withRightToLeft2.default)(_class = (_class2 = (_temp = _class3 = function (_React$Component) { _inherits(NumberPicker, _React$Component); function NumberPicker() { _classCallCheck(this, NumberPicker); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var _this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))); _initDefineProp(_this, 'handleMouseDown', _descriptor, _this); _initDefineProp(_this, 'handleMouseUp', _descriptor2, _this); _initDefineProp(_this, 'handleKeyDown', _descriptor3, _this); _this.handleChange = function (rawValue) { var originalEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var _this$props = _this.props, onChange = _this$props.onChange, lastValue = _this$props.value, min = _this$props.min, max = _this$props.max; var nextValue = clamp(rawValue, min, max); if (lastValue !== nextValue) (0, _widgetHelpers.notify)(onChange, [nextValue, { rawValue: rawValue, lastValue: lastValue, originalEvent: originalEvent }]); }; _this.messages = (0, _messages.getMessages)(_this.props.messages); _this.focusManager = (0, _focusManager2.default)(_this, { willHandle: function willHandle(focused) { if (focused) _this.focus(); } }); _this.state = { focused: false }; return _this; } NumberPicker.prototype.componentWillReceiveProps = function componentWillReceiveProps(_ref) { var messages = _ref.messages; this.messages = (0, _messages.getMessages)(messages); }; NumberPicker.prototype.renderInput = function renderInput(value) { var _props = this.props, placeholder = _props.placeholder, autoFocus = _props.autoFocus, tabIndex = _props.tabIndex, parse = _props.parse, name = _props.name, onKeyPress = _props.onKeyPress, onKeyUp = _props.onKeyUp, min = _props.min, max = _props.max, disabled = _props.disabled, readOnly = _props.readOnly, inputProps = _props.inputProps, format = _props.format, culture = _props.culture; return _react2.default.createElement(_NumberInput2.default, _extends({}, inputProps, { ref: 'input', role: 'spinbutton', tabIndex: tabIndex, value: value, placeholder: placeholder, autoFocus: autoFocus, editing: this.state.focused, format: format, culture: culture, parse: parse, name: name, min: min, max: max, disabled: disabled, readOnly: readOnly, onChange: this.handleChange, onKeyPress: onKeyPress, onKeyUp: onKeyUp })); }; NumberPicker.prototype.render = function render() { var _this2 = this; var _props2 = this.props, className = _props2.className, disabled = _props2.disabled, readOnly = _props2.readOnly, value = _props2.value, min = _props2.min, max = _props2.max; var focused = this.state.focused; var elementProps = Props.pickElementProps(this); value = clamp(value, min, max); return _react2.default.createElement( _Widget2.default, _extends({}, elementProps, { focused: focused, disabled: disabled, readOnly: readOnly, onKeyDown: this.handleKeyDown, onBlur: this.focusManager.handleBlur, onFocus: this.focusManager.handleFocus, className: (0, _classnames2.default)(className, 'rw-number-picker') }), _react2.default.createElement( _WidgetPicker2.default, null, this.renderInput(value), _react2.default.createElement( _Select2.default, { bordered: true }, _react2.default.createElement(_Button2.default, { icon: 'caret-up', onClick: this.handleFocus, disabled: value === max || disabled, label: this.messages.increment({ value: value, min: min, max: max }), onMouseUp: function onMouseUp(e) { return _this2.handleMouseUp(_constants.directions.UP, e); }, onMouseDown: function onMouseDown(e) { return _this2.handleMouseDown(_constants.directions.UP, e); }, onMouseLeave: function onMouseLeave(e) { return _this2.handleMouseUp(_constants.directions.UP, e); } }), _react2.default.createElement(_Button2.default, { icon: 'caret-down', onClick: this.handleFocus, disabled: value === min || disabled, label: this.messages.decrement({ value: value, min: min, max: max }), onMouseUp: function onMouseUp(e) { return _this2.handleMouseUp(_constants.directions.DOWN, e); }, onMouseDown: function onMouseDown(e) { return _this2.handleMouseDown(_constants.directions.DOWN, e); }, onMouseLeave: function onMouseLeave(e) { return _this2.handleMouseUp(_constants.directions.DOWN, e); } }) ) ) ); }; NumberPicker.prototype.focus = function focus() { (0, _reactDom.findDOMNode)(this.refs.input).focus(); }; NumberPicker.prototype.increment = function increment(event) { return this.step(this.props.step, event); }; NumberPicker.prototype.decrement = function decrement(event) { return this.step(-this.props.step, event); }; NumberPicker.prototype.step = function step(amount, event) { var value = (this.props.value || 0) + amount; var decimals = this.props.precision != null ? this.props.precision : _localizers.number.precision(format(this.props)); this.handleChange(decimals != null ? round(value, decimals) : value, event); return value; }; return NumberPicker; }(_react2.default.Component), _class3.propTypes = { value: _propTypes2.default.number, /** * @example ['onChangePicker', [ [1, null] ]] */ onChange: _propTypes2.default.func, /** * The minimum number that the NumberPicker value. * @example ['prop', ['min', 0]] */ min: _propTypes2.default.number, /** * The maximum number that the NumberPicker value. * * @example ['prop', ['max', 0]] */ max: _propTypes2.default.number, /** * Amount to increase or decrease value when using the spinner buttons. * * @example ['prop', ['step', 5]] */ step: _propTypes2.default.number, /** * Specify how precise the `value` should be when typing, incrementing, or decrementing the value. * When empty, precision is parsed from the current `format` and culture. */ precision: _propTypes2.default.number, culture: _propTypes2.default.string, /** * A format string used to display the number value. Localizer dependent, read [localization](/i18n) for more info. * * @example ['prop', { max: 1, min: -1 , defaultValue: 0.2585, format: "{ style: 'percent' }" }] */ format: CustomPropTypes.numberFormat, /** * Determines how the NumberPicker parses a number from the localized string representation. * You can also provide a parser `function` to pair with a custom `format`. */ parse: _propTypes2.default.func, /** @ignore */ tabIndex: _propTypes2.default.any, name: _propTypes2.default.string, placeholder: _propTypes2.default.string, onKeyDown: _propTypes2.default.func, onKeyPress: _propTypes2.default.func, onKeyUp: _propTypes2.default.func, autoFocus: _propTypes2.default.bool, disabled: CustomPropTypes.disabled, readOnly: CustomPropTypes.disabled, inputProps: _propTypes2.default.object, messages: _propTypes2.default.shape({ increment: _propTypes2.default.string, decrement: _propTypes2.default.string }) }, _class3.defaultProps = { value: null, open: false, min: -Infinity, max: Infinity, step: 1 }, _temp), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'handleMouseDown', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this3 = this; return function (direction, event) { var _props3 = _this3.props, min = _props3.min, max = _props3.max; event && event.persist(); var method = direction === _constants.directions.UP ? _this3.increment : _this3.decrement; var value = method.call(_this3, event), atTop = direction === _constants.directions.UP && value === max, atBottom = direction === _constants.directions.DOWN && value === min; if (atTop || atBottom) _this3.handleMouseUp();else if (!_this3._cancelRepeater) { _this3._cancelRepeater = createInterval(function () { _this3.handleMouseDown(direction, event); }); } }; } }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'handleMouseUp', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this4 = this; return function () { _this4._cancelRepeater && _this4._cancelRepeater(); _this4._cancelRepeater = null; }; } }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'handleKeyDown', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this5 = this; return function (event) { var _props4 = _this5.props, min = _props4.min, max = _props4.max, onKeyDown = _props4.onKeyDown; var key = event.key; (0, _widgetHelpers.notify)(onKeyDown, [event]); if (event.defaultPrevented) return; if (key === 'End' && isFinite(max)) _this5.handleChange(max, event);else if (key === 'Home' && isFinite(min)) _this5.handleChange(min, event);else if (key === 'ArrowDown') { event.preventDefault(); _this5.decrement(event); } else if (key === 'ArrowUp') { event.preventDefault(); _this5.increment(event); } }; } })), _class2)) || _class; exports.default = (0, _uncontrollable2.default)(NumberPicker, { value: 'onChange' }, ['focus']); // thank you kendo ui core // https://github.com/telerik/kendo-ui-core/blob/master/src/kendo.core.js#L1036 function round(value, precision) { precision = precision || 0; value = ('' + value).split('e'); value = Math.round(+(value[0] + 'e' + (value[1] ? +value[1] + precision : precision))); value = ('' + value).split('e'); value = +(value[0] + 'e' + (value[1] ? +value[1] - precision : -precision)); return value.toFixed(precision); } module.exports = exports['default']; /***/ }), /* 109 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _temp; var _inDOM = __webpack_require__(11); var _inDOM2 = _interopRequireDefault(_inDOM); var _activeElement = __webpack_require__(27); var _activeElement2 = _interopRequireDefault(_activeElement); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(5); var _Input = __webpack_require__(43); var _Input2 = _interopRequireDefault(_Input); var _Props = __webpack_require__(4); var Props = _interopRequireWildcard(_Props); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); var _localizers = __webpack_require__(6); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } 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; } var getFormat = function getFormat(props) { return _localizers.number.getFormat('default', props.format); }; var isSign = function isSign(val) { return (val || '').trim() === '-'; }; function isPaddedZeros(str, culture) { var localeChar = _localizers.number.decimalChar(null, culture); var _str$split = str.split(localeChar), _ = _str$split[0], decimals = _str$split[1]; return !!(decimals && decimals.match(/0+$/)); } function isAtDelimiter(num, str, culture) { var localeChar = _localizers.number.decimalChar(null, culture), lastIndex = str.length - 1, char = void 0; if (str.length < 1) return false; char = str[lastIndex]; return !!(char === localeChar && str.indexOf(char) === lastIndex); } var NumberPickerInput = (_temp = _class = function (_React$Component) { _inherits(NumberPickerInput, _React$Component); function NumberPickerInput() { _classCallCheck(this, NumberPickerInput); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var _this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))); _this.handleChange = function (event) { var _this$props = _this.props, value = _this$props.value, onChange = _this$props.onChange; var stringValue = event.target.value, numberValue = _this.parseNumber(stringValue); var isIntermediate = _this.isIntermediateValue(numberValue, stringValue); if (stringValue == null || stringValue.trim() === '') { _this.setStringValue(''); onChange(null, event); return; } // order here matters a lot if (isIntermediate) { _this.setStringValue(stringValue); } else if (numberValue !== value) { onChange(numberValue, event); } else if (stringValue != _this.state.stringValue) { _this.setStringValue(stringValue); } }; _this.handleBlur = function (event) { var str = _this.state.stringValue, number = _this.parseNumber(str); // if number is below the min // we need to flush low values and decimal stops, onBlur means i'm done inputing if (_this.isIntermediateValue(number, str)) { if (isNaN(number)) { number = null; } _this.props.onChange(number, event); } }; _this.state = _this.getDefaultState(); return _this; } NumberPickerInput.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { if (_inDOM2.default) { this.tabbedSelection = this.isSelectingAllText(); } this.setState(this.getDefaultState(nextProps)); }; NumberPickerInput.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { if (this.tabbedSelection && !prevProps.editing && this.props.editing) { (0, _reactDom.findDOMNode)(this).select(); } }; NumberPickerInput.prototype.getDefaultState = function getDefaultState() { var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props; var value = props.value, culture = props.culture, editing = props.editing; var decimal = _localizers.number.decimalChar(null, culture), format = getFormat(props); if (value == null || isNaN(value)) value = '';else value = editing ? ('' + value).replace('.', decimal) : _localizers.number.format(value, format, culture); return { stringValue: '' + value }; }; NumberPickerInput.prototype.isSelectingAllText = function isSelectingAllText() { var node = (0, _reactDom.findDOMNode)(this); return (0, _activeElement2.default)() === node && node.selectionStart === 0 && node.selectionEnd === node.value.length; }; NumberPickerInput.prototype.parseNumber = function parseNumber(strVal) { var _props = this.props, culture = _props.culture, userParse = _props.parse; var delimChar = _localizers.number.decimalChar(null, culture); if (userParse) return userParse(strVal, culture); strVal = strVal.replace(delimChar, '.'); strVal = parseFloat(strVal); return strVal; }; NumberPickerInput.prototype.isIntermediateValue = function isIntermediateValue(num, str) { var _props2 = this.props, culture = _props2.culture, min = _props2.min; return !!(num < min || isSign(str) || isAtDelimiter(num, str, culture) || isPaddedZeros(str, culture)); }; // this intermediate state is for when one runs into // the decimal or are typing the number NumberPickerInput.prototype.setStringValue = function setStringValue(stringValue) { this.setState({ stringValue: stringValue }); }; NumberPickerInput.prototype.render = function render() { var _props3 = this.props, disabled = _props3.disabled, readOnly = _props3.readOnly, placeholder = _props3.placeholder, min = _props3.min, max = _props3.max; var value = this.state.stringValue; var props = Props.omitOwn(this); return _react2.default.createElement(_Input2.default, _extends({}, props, { className: 'rw-widget-input', onChange: this.handleChange, onBlur: this.handleBlur, 'aria-valuenow': value, 'aria-valuemin': isFinite(min) ? min : null, 'aria-valuemax': isFinite(max) ? max : null, disabled: disabled, readOnly: readOnly, placeholder: placeholder, value: value })); }; return NumberPickerInput; }(_react2.default.Component), _class.propTypes = { value: _propTypes2.default.number, editing: _propTypes2.default.bool, placeholder: _propTypes2.default.string, format: CustomPropTypes.numberFormat, parse: _propTypes2.default.func, culture: _propTypes2.default.string, min: _propTypes2.default.number, max: _propTypes2.default.number, disabled: CustomPropTypes.disabled, readOnly: CustomPropTypes.disabled, onChange: _propTypes2.default.func.isRequired }, _class.defaultProps = { value: null, editing: false }, _temp); exports.default = NumberPickerInput; module.exports = exports['default']; /***/ }), /* 110 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _class3, _temp; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); var _closest = __webpack_require__(111); var _closest2 = _interopRequireDefault(_closest); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _uncontrollable = __webpack_require__(15); var _uncontrollable2 = _interopRequireDefault(_uncontrollable); var _Widget = __webpack_require__(16); var _Widget2 = _interopRequireDefault(_Widget); var _WidgetPicker = __webpack_require__(21); var _WidgetPicker2 = _interopRequireDefault(_WidgetPicker); var _Select = __webpack_require__(22); var _Select2 = _interopRequireDefault(_Select); var _Popup = __webpack_require__(29); var _Popup2 = _interopRequireDefault(_Popup); var _MultiselectInput = __webpack_require__(112); var _MultiselectInput2 = _interopRequireDefault(_MultiselectInput); var _MultiselectTagList = __webpack_require__(113); var _MultiselectTagList2 = _interopRequireDefault(_MultiselectTagList); var _List = __webpack_require__(23); var _List2 = _interopRequireDefault(_List); var _AddToListOption = __webpack_require__(59); var _AddToListOption2 = _interopRequireDefault(_AddToListOption); var _ = __webpack_require__(8); var _Filter = __webpack_require__(32); var Filter = _interopRequireWildcard(_Filter); var _Props = __webpack_require__(4); var Props = _interopRequireWildcard(_Props); var _messages = __webpack_require__(12); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); var _accessorManager = __webpack_require__(24); var _accessorManager2 = _interopRequireDefault(_accessorManager); var _focusManager = __webpack_require__(17); var _focusManager2 = _interopRequireDefault(_focusManager); var _listDataManager = __webpack_require__(20); var _listDataManager2 = _interopRequireDefault(_listDataManager); var _scrollManager = __webpack_require__(25); var _scrollManager2 = _interopRequireDefault(_scrollManager); var _withRightToLeft = __webpack_require__(18); var _withRightToLeft2 = _interopRequireDefault(_withRightToLeft); var _interaction = __webpack_require__(13); var _widgetHelpers = __webpack_require__(10); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _initDefineProp(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } 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; } function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object['ke' + 'ys'](descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object['define' + 'Property'](target, property, desc); desc = null; } return desc; } function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.'); } var CREATE_OPTION = {}; var ENTER = 13; var INSERT = 'insert'; var REMOVE = 'remove'; var propTypes = _extends({}, Filter.propTypes, { data: _propTypes2.default.array, //-- controlled props -- value: _propTypes2.default.array, /** * @type {function ( * dataItems: ?any[], * metadata: { * dataItem: any, * action: 'insert' | 'remove', * originalEvent: SyntheticEvent, * lastValue: ?any[], * searchTerm: ?string * } * ): void} */ onChange: _propTypes2.default.func, searchTerm: _propTypes2.default.string, /** * @type {function ( * searchTerm: ?string, * metadata: { * action: 'clear' | 'input', * lastSearchTerm: ?string, * originalEvent: SyntheticEvent, * } * ): void} */ onSearch: _propTypes2.default.func, open: _propTypes2.default.bool, onToggle: _propTypes2.default.func, //------------------------------------------- valueField: CustomPropTypes.accessor, textField: CustomPropTypes.accessor, tagComponent: CustomPropTypes.elementType, itemComponent: CustomPropTypes.elementType, listComponent: CustomPropTypes.elementType, groupComponent: CustomPropTypes.elementType, groupBy: CustomPropTypes.accessor, allowCreate: _propTypes2.default.oneOf([true, false, 'onFilter']), /** * * @type { (dataItem: ?any, metadata: { originalEvent: SyntheticEvent }) => void } */ onSelect: _propTypes2.default.func, /** * @type { (searchTerm: string) => void } */ onCreate: _propTypes2.default.func, busy: _propTypes2.default.bool, dropUp: _propTypes2.default.bool, popupTransition: CustomPropTypes.elementType, inputProps: _propTypes2.default.object, listProps: _propTypes2.default.object, autoFocus: _propTypes2.default.bool, placeholder: _propTypes2.default.string, disabled: CustomPropTypes.disabled.acceptsArray, readOnly: CustomPropTypes.disabled, messages: _propTypes2.default.shape({ open: CustomPropTypes.message, emptyList: CustomPropTypes.message, emptyFilter: CustomPropTypes.message, createOption: CustomPropTypes.message, tagsLabel: CustomPropTypes.message, selectedItems: CustomPropTypes.message, noneSelected: CustomPropTypes.message, removeLabel: CustomPropTypes.message }) }); /** * --- * shortcuts: * - { key: left arrow, label: move focus to previous tag } * - { key: right arrow, label: move focus to next tag } * - { key: delete, deselect focused tag } * - { key: backspace, deselect next tag } * - { key: alt + up arrow, label: close Multiselect } * - { key: down arrow, label: open Multiselect, and move focus to next item } * - { key: up arrow, label: move focus to previous item } * - { key: home, label: move focus to first item } * - { key: end, label: move focus to last item } * - { key: enter, label: select focused item } * - { key: ctrl + enter, label: create new tag from current searchTerm } * - { key: any key, label: search list for item starting with key } * --- * * A select listbox alternative. * * @public */ var Multiselect = (0, _withRightToLeft2.default)(_class = (_class2 = (_temp = _class3 = function (_React$Component) { _inherits(Multiselect, _React$Component); function Multiselect() { _classCallCheck(this, Multiselect); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var _this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))); _this.handleFocusDidChange = function (focused) { if (focused) return _this.focus(); _this.close(); _this.clearSearch(); if (_this.refs.tagList) _this.setState({ focusedTag: null }); }; _this.handleDelete = function (dataItem, event) { var _this$props = _this.props, disabled = _this$props.disabled, readOnly = _this$props.readOnly; if (disabled == true || readOnly) return; _this.focus(); _this.change(dataItem, event, REMOVE); }; _this.handleSearchKeyDown = function (e) { if (e.key === 'Backspace' && e.target.value && !_this._deletingText) _this._deletingText = true; }; _this.handleSearchKeyUp = function (e) { if (e.key === 'Backspace' && _this._deletingText) _this._deletingText = false; }; _this.handleInputChange = function (e) { _this.search(e.target.value, e, 'input'); _this.open(); }; _initDefineProp(_this, 'handleClick', _descriptor, _this); _initDefineProp(_this, 'handleDoubleClick', _descriptor2, _this); _initDefineProp(_this, 'handleSelect', _descriptor3, _this); _initDefineProp(_this, 'handleCreate', _descriptor4, _this); _initDefineProp(_this, 'handleKeyDown', _descriptor5, _this); _this.messages = (0, _messages.getMessages)(_this.props.messages); _this.inputId = (0, _widgetHelpers.instanceId)(_this, '_input'); _this.tagsId = (0, _widgetHelpers.instanceId)(_this, '_taglist'); _this.notifyId = (0, _widgetHelpers.instanceId)(_this, '_notify_area'); _this.listId = (0, _widgetHelpers.instanceId)(_this, '_listbox'); _this.createId = (0, _widgetHelpers.instanceId)(_this, '_createlist_option'); _this.activeTagId = (0, _widgetHelpers.instanceId)(_this, '_taglist_active_tag'); _this.activeOptionId = (0, _widgetHelpers.instanceId)(_this, '_listbox_active_option'); _this.list = (0, _listDataManager2.default)(_this); _this.tagList = (0, _listDataManager2.default)(_this, { getStateGetterFromProps: null }); _this.accessors = (0, _accessorManager2.default)(_this); _this.handleScroll = (0, _scrollManager2.default)(_this); _this.focusManager = (0, _focusManager2.default)(_this, { didHandle: _this.handleFocusDidChange }); _this.isDisabled = (0, _interaction.disabledManager)(_this); _this.state = _extends({ focusedTag: null }, _this.getStateFromProps(_this.props)); return _this; } Multiselect.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { this.messages = (0, _messages.getMessages)(nextProps.messages); this.setState(this.getStateFromProps(nextProps)); }; Multiselect.prototype.getStateFromProps = function getStateFromProps(props) { var accessors = this.accessors, list = this.list, tagList = this.tagList; var data = props.data, searchTerm = props.searchTerm, minLength = props.minLength, caseSensitive = props.caseSensitive, filter = props.filter; var values = (0, _.makeArray)(props.value); var dataItems = values.map(function (item) { return accessors.findOrSelf(data, item); }); data = data.filter(function (i) { return !values.some(function (v) { return accessors.matches(i, v); }); }); this._lengthWithoutValues = data.length; data = Filter.filter(data, { filter: filter, searchTerm: searchTerm, minLength: minLength, caseSensitive: caseSensitive, textField: accessors.text }); list.setData(data); tagList.setData(dataItems); var _ref = this.state || {}, focusedItem = _ref.focusedItem, focusedTag = _ref.focusedTag; return { data: data, dataItems: dataItems, focusedTag: list.nextEnabled(~dataItems.indexOf(focusedTag) ? focusedTag : null), focusedItem: list.nextEnabled(~data.indexOf(focusedItem) ? focusedItem : data[0]) }; }; Multiselect.prototype.renderInput = function renderInput(ownedIds) { var _props = this.props, searchTerm = _props.searchTerm, maxLength = _props.maxLength, tabIndex = _props.tabIndex, busy = _props.busy, autoFocus = _props.autoFocus, inputProps = _props.inputProps, open = _props.open; var _state = this.state, focusedItem = _state.focusedItem, focusedTag = _state.focusedTag; var disabled = this.props.disabled === true; var readOnly = this.props.readOnly === true; var active = void 0; if (!open) active = focusedTag ? this.activeTagId : '';else if (focusedItem || this.allowCreate()) active = this.activeOptionId; return _react2.default.createElement(_MultiselectInput2.default, _extends({ ref: 'input' }, inputProps, { autoFocus: autoFocus, tabIndex: tabIndex || 0, role: 'listbox', 'aria-expanded': !!open, 'aria-busy': !!busy, 'aria-owns': ownedIds, 'aria-haspopup': true, 'aria-activedescendant': active || null, value: searchTerm, maxLength: maxLength, disabled: disabled, readOnly: readOnly, placeholder: this.getPlaceholder(), onKeyDown: this.handleSearchKeyDown, onKeyUp: this.handleSearchKeyUp, onChange: this.handleInputChange })); }; Multiselect.prototype.renderList = function renderList(messages) { var inputId = this.inputId, activeOptionId = this.activeOptionId, listId = this.listId, accessors = this.accessors; var open = this.props.open; var focusedItem = this.state.focusedItem; var List = this.props.listComponent; var props = this.list.defaultProps(); return _react2.default.createElement(List, _extends({}, props, { ref: 'list', id: listId, activeId: activeOptionId, valueAccessor: accessors.value, textAccessor: accessors.text, focusedItem: focusedItem, onSelect: this.handleSelect, onMove: this.handleScroll, 'aria-live': 'polite', 'aria-labelledby': inputId, 'aria-hidden': !open, messages: { emptyList: this._lengthWithoutValues ? messages.emptyFilter : messages.emptyList } })); }; Multiselect.prototype.renderNotificationArea = function renderNotificationArea(messages) { var _this2 = this; var _state2 = this.state, focused = _state2.focused, dataItems = _state2.dataItems; var itemLabels = dataItems.map(function (item) { return _this2.accessors.text(item); }); return _react2.default.createElement( 'span', { id: this.notifyId, role: 'status', className: 'rw-sr', 'aria-live': 'assertive', 'aria-atomic': 'true', 'aria-relevant': 'additions removals text' }, focused && (dataItems.length ? messages.selectedItems(itemLabels) : messages.noneSelected()) ); }; Multiselect.prototype.renderTags = function renderTags(messages) { var readOnly = this.props.readOnly; var _state3 = this.state, focusedTag = _state3.focusedTag, dataItems = _state3.dataItems; var Component = this.props.tagComponent; return _react2.default.createElement(_MultiselectTagList2.default, { ref: 'tagList', id: this.tagsId, activeId: this.activeTagId, textAccessor: this.accessors.text, valueAccessor: this.accessors.value, label: messages.tagsLabel(), value: dataItems, readOnly: readOnly, disabled: this.isDisabled(), focusedItem: focusedTag, onDelete: this.handleDelete, valueComponent: Component }); }; Multiselect.prototype.render = function render() { var _this3 = this; var _props2 = this.props, className = _props2.className, busy = _props2.busy, dropUp = _props2.dropUp, open = _props2.open, searchTerm = _props2.searchTerm, popupTransition = _props2.popupTransition; var _state4 = this.state, focused = _state4.focused, focusedItem = _state4.focusedItem, dataItems = _state4.dataItems; var elementProps = Props.pickElementProps(this); var shouldRenderTags = !!dataItems.length, shouldRenderPopup = (0, _widgetHelpers.isFirstFocusedRender)(this) || open, allowCreate = this.allowCreate(); var inputOwns = this.listId + ' ' + this.notifyId + ' ' + (shouldRenderTags ? this.tagsId : '') + (allowCreate ? this.createId : ''); var disabled = this.isDisabled() === true; var readOnly = this.props.readOnly === true; var messages = this.messages; return _react2.default.createElement( _Widget2.default, _extends({}, elementProps, { open: open, dropUp: dropUp, focused: focused, disabled: disabled, readOnly: readOnly, onKeyDown: this.handleKeyDown, onBlur: this.focusManager.handleBlur, onFocus: this.focusManager.handleFocus, className: (0, _classnames2.default)(className, 'rw-multiselect') }), this.renderNotificationArea(messages), _react2.default.createElement( _WidgetPicker2.default, { className: 'rw-widget-input', onClick: this.handleClick, onDoubleClick: this.handleDoubleClick, onTouchEnd: this.handleClick }, _react2.default.createElement( 'div', null, shouldRenderTags && this.renderTags(messages), this.renderInput(inputOwns) ), _react2.default.createElement(_Select2.default, { busy: busy, icon: focused ? 'caret-down' : '', 'aria-hidden': 'true', role: 'presentational', disabled: disabled || readOnly }) ), shouldRenderPopup && _react2.default.createElement( _Popup2.default, { dropUp: dropUp, open: open, transition: popupTransition, onEntering: function onEntering() { return _this3.refs.list.forceUpdate(); } }, _react2.default.createElement( 'div', null, this.renderList(messages), allowCreate && _react2.default.createElement( _AddToListOption2.default, { id: this.createId, searchTerm: searchTerm, onSelect: this.handleCreate, focused: !focusedItem || focusedItem === CREATE_OPTION }, messages.createOption(this.props) ) ) ) ); }; Multiselect.prototype.change = function change(dataItem, originalEvent, action) { var _props3 = this.props, onChange = _props3.onChange, searchTerm = _props3.searchTerm, lastValue = _props3.value; var dataItems = this.state.dataItems; switch (action) { case INSERT: dataItems = dataItems.concat(dataItem); break; case REMOVE: dataItems = dataItems.filter(function (d) { return d !== dataItem; }); break; } (0, _widgetHelpers.notify)(onChange, [dataItems, { action: action, dataItem: dataItem, originalEvent: originalEvent, lastValue: lastValue, searchTerm: searchTerm }]); this.clearSearch(originalEvent); }; Multiselect.prototype.clearSearch = function clearSearch(originalEvent) { this.search('', originalEvent, 'clear'); }; Multiselect.prototype.search = function search(searchTerm, originalEvent) { var action = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'input'; var _props4 = this.props, onSearch = _props4.onSearch, lastSearchTerm = _props4.searchTerm; if (searchTerm !== lastSearchTerm) (0, _widgetHelpers.notify)(onSearch, [searchTerm, { action: action, lastSearchTerm: lastSearchTerm, originalEvent: originalEvent }]); }; Multiselect.prototype.focus = function focus() { if (this.refs.input) this.refs.input.focus(); }; Multiselect.prototype.toggle = function toggle() { this.props.open ? this.close() : this.open(); }; Multiselect.prototype.open = function open() { if (!this.props.open) (0, _widgetHelpers.notify)(this.props.onToggle, true); }; Multiselect.prototype.close = function close() { if (this.props.open) (0, _widgetHelpers.notify)(this.props.onToggle, false); }; Multiselect.prototype.allowCreate = function allowCreate() { var _props5 = this.props, searchTerm = _props5.searchTerm, onCreate = _props5.onCreate, allowCreate = _props5.allowCreate; return !!(onCreate && (allowCreate === true || allowCreate === 'onFilter' && searchTerm) && !this.hasExtactMatch()); }; Multiselect.prototype.hasExtactMatch = function hasExtactMatch() { var _props6 = this.props, searchTerm = _props6.searchTerm, caseSensitive = _props6.caseSensitive; var _state5 = this.state, data = _state5.data, dataItems = _state5.dataItems; var text = this.accessors.text; var lower = function lower(text) { return caseSensitive ? text : text.toLowerCase(); }; var eq = function eq(v) { return lower(text(v)) === lower(searchTerm); }; // if there is an exact match on textFields: // "john" => { name: "john" }, don't show return dataItems.some(eq) || data.some(eq); }; Multiselect.prototype.getPlaceholder = function getPlaceholder() { var _props7 = this.props, value = _props7.value, placeholder = _props7.placeholder; return (value && value.length ? '' : placeholder) || ''; }; return Multiselect; }(_react2.default.Component), _class3.propTypes = propTypes, _class3.defaultProps = { data: [], allowCreate: 'onFilter', filter: 'startsWith', value: [], searchTerm: '', listComponent: _List2.default }, _temp), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'handleClick', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this4 = this; return function (_ref2) { var target = _ref2.target; _this4.focus(); if ((0, _closest2.default)(target, '.rw-select')) _this4.toggle();else _this4.open(); }; } }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'handleDoubleClick', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this5 = this; return function () { if (!_this5.refs.input) return; _this5.focus(); _this5.refs.input.select(); }; } }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'handleSelect', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this6 = this; return function (dataItem, originalEvent) { if (dataItem === undefined || dataItem === CREATE_OPTION) { _this6.handleCreate(_this6.props.searchTerm, originalEvent); return; } (0, _widgetHelpers.notify)(_this6.props.onSelect, [dataItem, { originalEvent: originalEvent }]); _this6.change(dataItem, originalEvent, INSERT); _this6.focus(); }; } }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'handleCreate', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this7 = this; return function () { var searchTerm = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; var event = arguments[1]; (0, _widgetHelpers.notify)(_this7.props.onCreate, searchTerm); _this7.clearSearch(event); _this7.focus(); }; } }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, 'handleKeyDown', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this8 = this; return function (event) { var _props8 = _this8.props, open = _props8.open, searchTerm = _props8.searchTerm, onKeyDown = _props8.onKeyDown; var key = event.key, keyCode = event.keyCode, altKey = event.altKey, ctrlKey = event.ctrlKey; var _state6 = _this8.state, focusedTag = _state6.focusedTag, focusedItem = _state6.focusedItem; var list = _this8.list, tagList = _this8.tagList; var createIsFocused = focusedItem === CREATE_OPTION; var canCreate = _this8.allowCreate(); var focusTag = function focusTag(tag) { return _this8.setState({ focusedTag: tag }); }; var focusItem = function focusItem(item) { return _this8.setState({ focusedItem: item, focusedTag: null }); }; (0, _widgetHelpers.notify)(onKeyDown, [event]); if (event.defaultPrevented) return; if (key === 'ArrowDown') { event.preventDefault(); if (!open) return _this8.open(); var next = list.next(focusedItem); var creating = createIsFocused || canCreate && focusedItem === next; focusItem(creating ? CREATE_OPTION : next); } else if (key === 'ArrowUp' && (open || altKey)) { event.preventDefault(); if (altKey) return _this8.close(); focusItem(createIsFocused ? list.last() : list.prev(focusedItem)); } else if (key === 'End') { event.preventDefault(); if (open) focusItem(list.last());else focusTag(tagList.last()); } else if (key === 'Home') { event.preventDefault(); if (open) focusItem(list.first());else focusTag(tagList.first()); } // using keyCode to ignore enter for japanese IME else if (open && keyCode === ENTER) { event.preventDefault(); if (ctrlKey && canCreate) return _this8.handleCreate(searchTerm, event); _this8.handleSelect(focusedItem, event); } else if (key === 'Escape') { open ? _this8.close() : tagList && focusTag(null); } else if (!searchTerm && !_this8._deletingText) { if (key === 'ArrowLeft') { focusTag(tagList.prev(focusedTag) || tagList.last()); } else if (key === 'ArrowRight' && focusedTag) { var nextTag = tagList.next(focusedTag); focusTag(nextTag === focusedTag ? null : nextTag); } else if (key === 'Delete' && !tagList.isDisabled(focusedTag)) { _this8.handleDelete(focusedTag, event); } else if (key === 'Backspace') { _this8.handleDelete(tagList.last(), event); } else if (key === ' ' && !open) { event.preventDefault(); _this8.open(); } } }; } })), _class2)) || _class; exports.default = (0, _uncontrollable2.default)(Multiselect, { open: 'onToggle', value: 'onChange', searchTerm: 'onSearch' }, ['focus']); module.exports = exports['default']; /***/ }), /* 111 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = closest; var _matches = __webpack_require__(60); var _matches2 = _interopRequireDefault(_matches); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var isDoc = function isDoc(obj) { return obj != null && obj.nodeType === obj.DOCUMENT_NODE; }; function closest(node, selector, context) { while (node && (isDoc(node) || !(0, _matches2.default)(node, selector))) { node = node !== context && !isDoc(node) ? node.parentNode : undefined; } return node; } module.exports = exports['default']; /***/ }), /* 112 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _temp; var _activeElement = __webpack_require__(27); var _activeElement2 = _interopRequireDefault(_activeElement); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(5); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 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; } var MultiselectInput = (_temp = _class = function (_React$Component) { _inherits(MultiselectInput, _React$Component); function MultiselectInput() { _classCallCheck(this, MultiselectInput); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } MultiselectInput.prototype.render = function render() { var _props = this.props, disabled = _props.disabled, readOnly = _props.readOnly, props = _objectWithoutProperties(_props, ['disabled', 'readOnly']); var size = Math.max((props.value || props.placeholder).length, 1) + 1; return _react2.default.createElement('input', _extends({}, props, { size: size, className: 'rw-input-reset', autoComplete: 'off', 'aria-disabled': disabled, 'aria-readonly': readOnly, disabled: disabled, readOnly: readOnly })); }; MultiselectInput.prototype.select = function select() { (0, _reactDom.findDOMNode)(this).select(); }; MultiselectInput.prototype.focus = function focus() { var node = (0, _reactDom.findDOMNode)(this); if ((0, _activeElement2.default)() === node) return; node.focus(); }; return MultiselectInput; }(_react2.default.Component), _class.propTypes = { value: _propTypes2.default.string, placeholder: _propTypes2.default.string, maxLength: _propTypes2.default.number, onChange: _propTypes2.default.func.isRequired, disabled: CustomPropTypes.disabled, readOnly: CustomPropTypes.disabled }, _temp); exports.default = MultiselectInput; module.exports = exports['default']; /***/ }), /* 113 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _class, _temp2; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _MultiselectTag = __webpack_require__(114); var _MultiselectTag2 = _interopRequireDefault(_MultiselectTag); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); var _dataHelpers = __webpack_require__(33); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } 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; } // disabled === true || [1, 2, 3, etc] var isDisabled = function isDisabled(item, list, value) { return !!(Array.isArray(list) ? ~(0, _dataHelpers.dataIndexOf)(list, item, value) : list); }; var MultiselectTagList = (_temp2 = _class = function (_React$Component) { _inherits(MultiselectTagList, _React$Component); function MultiselectTagList() { var _temp, _this, _ret; _classCallCheck(this, MultiselectTagList); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleDelete = function (item, event) { if (_this.props.disabled !== true) _this.props.onDelete(item, event); }, _temp), _possibleConstructorReturn(_this, _ret); } MultiselectTagList.prototype.render = function render() { var _this2 = this; var _props = this.props, id = _props.id, value = _props.value, activeId = _props.activeId, valueAccessor = _props.valueAccessor, textAccessor = _props.textAccessor, label = _props.label, disabled = _props.disabled, focusedItem = _props.focusedItem, ValueComponent = _props.valueComponent; return _react2.default.createElement( 'ul', { id: id, tabIndex: '-1', role: 'listbox', 'aria-label': label, className: 'rw-multiselect-taglist' }, value.map(function (item, i) { var isFocused = focusedItem === item; return _react2.default.createElement( _MultiselectTag2.default, { key: i, id: isFocused ? activeId : null, value: item, focused: isFocused, onClick: _this2.handleDelete, disabled: isDisabled(item, disabled, valueAccessor) }, ValueComponent ? _react2.default.createElement(ValueComponent, { item: item }) : _react2.default.createElement( 'span', null, textAccessor(item) ) ); }) ); }; return MultiselectTagList; }(_react2.default.Component), _class.propTypes = { id: _propTypes2.default.string.isRequired, activeId: _propTypes2.default.string.isRequired, label: _propTypes2.default.string, value: _propTypes2.default.array, focusedItem: _propTypes2.default.any, valueAccessor: _propTypes2.default.func.isRequired, textAccessor: _propTypes2.default.func.isRequired, onDelete: _propTypes2.default.func.isRequired, valueComponent: _propTypes2.default.func, disabled: CustomPropTypes.disabled.acceptsArray }, _temp2); exports.default = MultiselectTagList; module.exports = exports['default']; /***/ }), /* 114 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _class, _temp2; var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _Button = __webpack_require__(19); var _Button2 = _interopRequireDefault(_Button); 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; } var MultiselectTag = (_temp2 = _class = function (_React$Component) { _inherits(MultiselectTag, _React$Component); function MultiselectTag() { var _temp, _this, _ret; _classCallCheck(this, MultiselectTag); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.onClick = function (event) { var _this$props = _this.props, value = _this$props.value, disabled = _this$props.disabled, onClick = _this$props.onClick; if (!disabled) onClick(value, event); }, _temp), _possibleConstructorReturn(_this, _ret); } MultiselectTag.prototype.renderDelete = function renderDelete() { var _props = this.props, label = _props.label, disabled = _props.disabled, readOnly = _props.readOnly; return _react2.default.createElement( _Button2.default, { variant: 'select', onClick: this.onClick, className: 'rw-multiselect-tag-btn', disabled: disabled || readOnly, 'aria-label': label || 'Remove item' }, _react2.default.createElement( 'span', { 'aria-hidden': 'true' }, '\xD7' ) ); }; MultiselectTag.prototype.render = function render() { var _props2 = this.props, id = _props2.id, children = _props2.children, focused = _props2.focused, disabled = _props2.disabled; var tabIndex = disabled ? undefined : '-1'; return _react2.default.createElement( 'li', { id: id, role: 'option', tabIndex: tabIndex, className: (0, _classnames2.default)('rw-multiselect-tag', disabled && 'rw-state-disabled', focused && !disabled && 'rw-state-focus') }, children, _react2.default.createElement( 'div', null, this.renderDelete() ) ); }; return MultiselectTag; }(_react2.default.Component), _class.propTypes = { id: _propTypes2.default.string, onClick: _propTypes2.default.func.isRequired, focused: _propTypes2.default.bool, disabled: _propTypes2.default.bool, readOnly: _propTypes2.default.bool, label: _propTypes2.default.string, value: _propTypes2.default.any }, _temp2); exports.default = MultiselectTag; module.exports = exports['default']; /***/ }), /* 115 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _desc, _value, _class2, _descriptor, _descriptor2, _class3, _temp; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(5); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(2); var _classnames2 = _interopRequireDefault(_classnames); var _reactComponentManagers = __webpack_require__(9); var _uncontrollable = __webpack_require__(15); var _uncontrollable2 = _interopRequireDefault(_uncontrollable); var _List = __webpack_require__(23); var _List2 = _interopRequireDefault(_List); var _Widget = __webpack_require__(16); var _Widget2 = _interopRequireDefault(_Widget); var _SelectListItem = __webpack_require__(116); var _SelectListItem2 = _interopRequireDefault(_SelectListItem); var _messages = __webpack_require__(12); var _ = __webpack_require__(8); var _Props = __webpack_require__(4); var Props = _interopRequireWildcard(_Props); var _PropTypes = __webpack_require__(3); var CustomPropTypes = _interopRequireWildcard(_PropTypes); var _listDataManager = __webpack_require__(20); var _listDataManager2 = _interopRequireDefault(_listDataManager); var _accessorManager = __webpack_require__(24); var _accessorManager2 = _interopRequireDefault(_accessorManager); var _focusManager = __webpack_require__(17); var _focusManager2 = _interopRequireDefault(_focusManager); var _scrollManager = __webpack_require__(25); var _scrollManager2 = _interopRequireDefault(_scrollManager); var _withRightToLeft = __webpack_require__(18); var _withRightToLeft2 = _interopRequireDefault(_withRightToLeft); var _interaction = __webpack_require__(13); var _widgetHelpers = __webpack_require__(10); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _initDefineProp(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } 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; } function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object['ke' + 'ys'](descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object['define' + 'Property'](target, property, desc); desc = null; } return desc; } function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.'); } function getFirstValue(data, values) { if (!values.length) return null; for (var idx = 0; idx < data.length; idx++) { if (~values.indexOf(data[idx])) return data[idx]; }return null; } /** * --- * shortcuts: * - { key: down arrow, label: move focus, or select previous option } * - { key: up arrow, label: move focus, or select next option } * - { key: home, label: move focus to first option } * - { key: end, label: move focus to last option } * - { key: spacebar, label: toggle focused option } * - { key: ctrl + a, label: ctoggle select all/select none } * - { key: any key, label: search list for option starting with key } * --- * * A group of radio buttons or checkboxes bound to a dataset. * * @public */ var SelectList = (0, _withRightToLeft2.default)(_class = (_class2 = (_temp = _class3 = function (_React$Component) { _inherits(SelectList, _React$Component); function SelectList() { _classCallCheck(this, SelectList); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var _this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))); _this.handleMouseDown = function () { _this._clicking = true; }; _this.handleFocusChanged = function (focused) { var _this$props = _this.props, data = _this$props.data, disabled = _this$props.disabled; var dataItems = _this.state.dataItems; // the rigamarole here is to avoid flicker went clicking an item and // gaining focus at the same time. if (focused !== _this.state.focused) { if (!focused) _this.setState({ focusedItem: null });else if (focused && !_this._clicking) { var allowed = Array.isArray(disabled) ? dataItems.filter(function (v) { return !_this.accessors.find(disabled, v); }) : dataItems; _this.setState({ focusedItem: getFirstValue(data, allowed) || _this.list.nextEnabled(data[0]) }); } _this._clicking = false; } }; _initDefineProp(_this, 'handleKeyDown', _descriptor, _this); _initDefineProp(_this, 'handleKeyPress', _descriptor2, _this); _this.handleChange = function (item, checked, originalEvent) { var _this$props2 = _this.props, multiple = _this$props2.multiple, onChange = _this$props2.onChange; var lastValue = _this.state.dataItems; _this.setState({ focusedItem: item }); if (!multiple) return (0, _widgetHelpers.notify)(onChange, [checked ? item : null, { originalEvent: originalEvent, lastValue: lastValue, checked: checked }]); var nextValue = checked ? lastValue.concat(item) : lastValue.filter(function (v) { return v !== item; }); (0, _widgetHelpers.notify)(onChange, [nextValue || [], { checked: checked, lastValue: lastValue, originalEvent: originalEvent, dataItem: item }]); }; _this.renderListItem = function (itemProps) { var _this$props3 = _this.props, name = _this$props3.name, multiple = _this$props3.multiple, disabled = _this$props3.disabled, readOnly = _this$props3.readOnly; var dataItems = _this.state.dataItems; return _react2.default.createElement(_SelectListItem2.default, _extends({}, itemProps, { name: name || _this.itemName, type: multiple ? 'checkbox' : 'radio', readOnly: disabled === true || readOnly, onChange: _this.handleChange, onMouseDown: _this.handleMouseDown, checked: !!_this.accessors.find(dataItems, itemProps.dataItem) })); }; (0, _reactComponentManagers.autoFocus)(_this); _this.messages = (0, _messages.getMessages)(_this.props.messages); _this.widgetId = (0, _widgetHelpers.instanceId)(_this, '_widget'); _this.listId = (0, _widgetHelpers.instanceId)(_this, '_listbox'); _this.activeId = (0, _widgetHelpers.instanceId)(_this, '_listbox_active_option'); _this.itemName = (0, _widgetHelpers.instanceId)(_this, '_name'); _this.list = (0, _listDataManager2.default)(_this); _this.accessors = (0, _accessorManager2.default)(_this); _this.timeouts = (0, _reactComponentManagers.timeoutManager)(_this); _this.handleScroll = (0, _scrollManager2.default)(_this, false); _this.focusManager = (0, _focusManager2.default)(_this, { didHandle: _this.handleFocusChanged }); _this.state = _this.getStateFromProps(_this.props); return _this; } SelectList.prototype.getStateFromProps = function getStateFromProps(props) { var accessors = this.accessors, list = this.list; var data = props.data, value = props.value; list.setData(data); return { dataItems: (0, _.makeArray)(value).map(function (item) { return accessors.findOrSelf(data, item); }) }; }; SelectList.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { this.messages = (0, _messages.getMessages)(nextProps.messages); return this.setState(this.getStateFromProps(nextProps)); }; SelectList.prototype.render = function render() { var _props = this.props, className = _props.className, tabIndex = _props.tabIndex, busy = _props.busy; var elementProps = Props.pickElementProps(this); var _state = this.state, focusedItem = _state.focusedItem, focused = _state.focused; var _accessors = this.accessors, value = _accessors.value, text = _accessors.text; var List = this.props.listComponent; var listProps = this.list.defaultProps(); var disabled = this.props.disabled === true, readOnly = this.props.readOnly === true; focusedItem = focused && !disabled && !readOnly && focusedItem; return _react2.default.createElement( _Widget2.default, _extends({}, elementProps, { id: this.widgetId, onBlur: this.focusManager.handleBlur, onFocus: this.focusManager.handleFocus, onKeyDown: this.handleKeyDown, onKeyPress: this.handleKeyPress, focused: focused, disabled: disabled, readOnly: readOnly, role: 'radiogroup', 'aria-busy': !!busy, 'aria-activedescendant': this.activeId, className: (0, _classnames2.default)(className, 'rw-select-list', 'rw-widget-input', 'rw-widget-container', busy && 'rw-loading-mask') }), _react2.default.createElement(List, _extends({}, listProps, { ref: 'list', role: 'radiogroup', tabIndex: tabIndex || '0', id: this.listId, activeId: this.activeId, valueAccessor: value, textAccessor: text, focusedItem: focusedItem, onMove: this.handleScroll, optionComponent: this.renderListItem, messages: { emptyList: this.messages.emptyList } })) ); }; SelectList.prototype.focus = function focus() { (0, _reactDom.findDOMNode)(this.refs.list).focus(); }; SelectList.prototype.selectAll = function selectAll() { var accessors = this.accessors; var _props2 = this.props, data = _props2.data, disabled = _props2.disabled, onChange = _props2.onChange; var values = this.state.dataItems; disabled = Array.isArray(disabled) ? disabled : []; var disabledValues = void 0; var enabledData = data; if (disabled.length) { disabledValues = values.filter(function (v) { return accessors.find(disabled, v); }); enabledData = data.filter(function (v) { return !accessors.find(disabled, v); }); } var nextValues = values.length >= enabledData.length ? values.filter(function (v) { return accessors.find(disabled, v); }) : enabledData.concat(disabledValues); (0, _widgetHelpers.notify)(onChange, [nextValues]); }; SelectList.prototype.search = function search(character, originalEvent) { var _this2 = this; var _searchTerm = this._searchTerm, list = this.list; var word = ((_searchTerm || '') + character).toLowerCase(); var multiple = this.props.multiple; if (!multiple) originalEvent.persist(); if (!character) return; this._searchTerm = word; this.timeouts.set('search', function () { var focusedItem = list.next(_this2.state.focusedItem, word); _this2._searchTerm = ''; if (focusedItem) { !multiple ? _this2.handleChange(focusedItem, true, originalEvent) : _this2.setState({ focusedItem: focusedItem }); } }, this.props.delay); }; return SelectList; }(_react2.default.Component), _class3.propTypes = { data: _propTypes2.default.array, value: _propTypes2.default.oneOfType([_propTypes2.default.any, _propTypes2.default.array]), onChange: _propTypes2.default.func, /** * A handler called when focus shifts on the SelectList. Internally this is used to ensure the focused item is in view. * If you want to define your own "scrollTo" behavior or just disable the default one specify an `onMove` handler. * The handler is called with the relevant DOM nodes needed to implement scroll behavior: the list element, * the element that is currently focused, and a focused value. * * @type {function(list: HTMLELement, focusedNode: HTMLElement, focusedItem: any)} */ onMove: _propTypes2.default.func, /** * Whether or not the SelectList allows multiple selection or not. when `false` the SelectList will * render as a list of radio buttons, and checkboxes when `true`. */ multiple: _propTypes2.default.bool, onKeyDown: _propTypes2.default.func, onKeyPress: _propTypes2.default.func, itemComponent: CustomPropTypes.elementType, listComponent: CustomPropTypes.elementType, valueField: CustomPropTypes.accessor, textField: CustomPropTypes.accessor, busy: _propTypes2.default.bool, delay: _propTypes2.default.number, autoFocus: _propTypes2.default.bool, disabled: CustomPropTypes.disabled.acceptsArray, readOnly: CustomPropTypes.disabled, listProps: _propTypes2.default.object, messages: _propTypes2.default.shape({ emptyList: CustomPropTypes.message }), tabIndex: _propTypes2.default.any, /** * The HTML `name` attribute used to group checkboxes and radio buttons * together. */ name: _propTypes2.default.string }, _class3.defaultProps = { delay: 250, value: [], data: [], listComponent: _List2.default }, _temp), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'handleKeyDown', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this3 = this; return function (event) { var list = _this3.list, accessors = _this3.accessors; var multiple = _this3.props.multiple; var _state2 = _this3.state, dataItems = _state2.dataItems, focusedItem = _state2.focusedItem; var keyCode = event.keyCode, key = event.key, ctrlKey = event.ctrlKey; var change = function change(item) { if (!item) return; var checked = multiple ? !accessors.find(dataItems, item) // toggle value : true; _this3.handleChange(item, checked, event); }; (0, _widgetHelpers.notify)(_this3.props.onKeyDown, [event]); if (event.defaultPrevented) return; if (key === 'End') { event.preventDefault(); focusedItem = list.last(); _this3.setState({ focusedItem: focusedItem }); if (!multiple) change(focusedItem); } else if (key === 'Home') { event.preventDefault(); focusedItem = list.first(); _this3.setState({ focusedItem: focusedItem }); if (!multiple) change(focusedItem); } else if (key === 'Enter' || key === ' ') { event.preventDefault(); change(focusedItem); } else if (key === 'ArrowDown' || key === 'ArrowRight') { event.preventDefault(); focusedItem = list.next(focusedItem); _this3.setState({ focusedItem: focusedItem }); if (!multiple) change(focusedItem); } else if (key === 'ArrowUp' || key === 'ArrowLeft') { event.preventDefault(); focusedItem = list.prev(focusedItem); _this3.setState({ focusedItem: focusedItem }); if (!multiple) change(focusedItem); } else if (multiple && keyCode === 65 && ctrlKey) { event.preventDefault(); _this3.selectAll(); } }; } }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'handleKeyPress', [_interaction.widgetEditable], { enumerable: true, initializer: function initializer() { var _this4 = this; return function (event) { (0, _widgetHelpers.notify)(_this4.props.onKeyPress, [event]); if (event.defaultPrevented) return; _this4.search(String.fromCharCode(event.which), event); }; } })), _class2)) || _class; exports.default = (0, _uncontrollable2.default)(SelectList, { value: 'onChange' }, ['selectAll', 'focus']); module.exports = exports['default']; /***/ }), /* 116 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _class, _temp2; var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); var _ListOption = __webpack_require__(42); var _ListOption2 = _interopRequireDefault(_ListOption); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 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; } var SelectListItem = (_temp2 = _class = function (_React$Component) { _inherits(SelectListItem, _React$Component); function SelectListItem() { var _temp, _this, _ret; _classCallCheck(this, SelectListItem); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleChange = function (e) { var _this$props = _this.props, onChange = _this$props.onChange, disabled = _this$props.disabled, dataItem = _this$props.dataItem; if (!disabled) onChange(dataItem, e.target.checked); }, _temp), _possibleConstructorReturn(_this, _ret); } SelectListItem.prototype.render = function render() { var _props = this.props, children = _props.children, disabled = _props.disabled, readOnly = _props.readOnly, name = _props.name, type = _props.type, checked = _props.checked, onMouseDown = _props.onMouseDown, props = _objectWithoutProperties(_props, ['children', 'disabled', 'readOnly', 'name', 'type', 'checked', 'onMouseDown']); delete props.onChange; return _react2.default.createElement( _ListOption2.default, _extends({}, props, { role: type, disabled: disabled, 'aria-checked': !!checked }), _react2.default.createElement( 'label', { onMouseDown: onMouseDown, className: 'rw-select-list-label' }, _react2.default.createElement('input', { name: name, type: type, tabIndex: '-1', checked: checked, disabled: disabled || !!readOnly, role: 'presentation', className: 'rw-select-list-input', onChange: this.handleChange }), children ) ); }; return SelectListItem; }(_react2.default.Component), _class.propTypes = { type: _propTypes2.default.string.isRequired, name: _propTypes2.default.string.isRequired, disabled: _propTypes2.default.bool, readOnly: _propTypes2.default.bool, dataItem: _propTypes2.default.any, checked: _propTypes2.default.bool.isRequired, onChange: _propTypes2.default.func.isRequired, onMouseDown: _propTypes2.default.func.isRequired }, _temp2); exports.default = SelectListItem; module.exports = exports['default']; /***/ }) /******/ ]); }); //# sourceMappingURL=react-widgets.js.map
define( [ "./selector-sizzle" ], function() { "use strict"; } );
/*syn@0.3.0#key*/ var syn = require('./synthetic.js'); require('./typeable.js'); require('./browsers.js'); var h = syn.helpers, formElExp = /input|textarea/i, supportsSelection = function (el) { var result; try { result = el.selectionStart !== undefined && el.selectionStart !== null; } catch (e) { result = false; } return result; }, getSelection = function (el) { var real, r, start; if (supportsSelection(el)) { if (document.activeElement && document.activeElement !== el && el.selectionStart === el.selectionEnd && el.selectionStart === 0) { return { start: el.value.length, end: el.value.length }; } return { start: el.selectionStart, end: el.selectionEnd }; } else { try { if (el.nodeName.toLowerCase() === 'input') { real = h.getWindow(el).document.selection.createRange(); r = el.createTextRange(); r.setEndPoint('EndToStart', real); start = r.text.length; return { start: start, end: start + real.text.length }; } else { real = h.getWindow(el).document.selection.createRange(); r = real.duplicate(); var r2 = real.duplicate(), r3 = real.duplicate(); r2.collapse(); r3.collapse(false); r2.moveStart('character', -1); r3.moveStart('character', -1); r.moveToElementText(el); r.setEndPoint('EndToEnd', real); start = r.text.length - real.text.length; var end = r.text.length; if (start !== 0 && r2.text === '') { start += 2; } if (end !== 0 && r3.text === '') { end += 2; } return { start: start, end: end }; } } catch (e) { var prop = formElExp.test(el.nodeName) ? 'value' : 'textContent'; return { start: el[prop].length, end: el[prop].length }; } } }, getFocusable = function (el) { var document = h.getWindow(el).document, res = []; var els = document.getElementsByTagName('*'), len = els.length; for (var i = 0; i < len; i++) { if (syn.isFocusable(els[i]) && els[i] !== document.documentElement) { res.push(els[i]); } } return res; }, textProperty = function () { var el = document.createElement('span'); return el.textContent != null ? 'textContent' : 'innerText'; }(), getText = function (el) { if (formElExp.test(el.nodeName)) { return el.value; } return el[textProperty]; }, setText = function (el, value) { if (formElExp.test(el.nodeName)) { el.value = value; } else { el[textProperty] = value; } }; h.extend(syn, { keycodes: { '\b': 8, '\t': 9, '\r': 13, 'shift': 16, 'ctrl': 17, 'alt': 18, 'pause-break': 19, 'caps': 20, 'escape': 27, 'num-lock': 144, 'scroll-lock': 145, 'print': 44, 'page-up': 33, 'page-down': 34, 'end': 35, 'home': 36, 'left': 37, 'up': 38, 'right': 39, 'down': 40, 'insert': 45, 'delete': 46, ' ': 32, '0': 48, '1': 49, '2': 50, '3': 51, '4': 52, '5': 53, '6': 54, '7': 55, '8': 56, '9': 57, 'a': 65, 'b': 66, 'c': 67, 'd': 68, 'e': 69, 'f': 70, 'g': 71, 'h': 72, 'i': 73, 'j': 74, 'k': 75, 'l': 76, 'm': 77, 'n': 78, 'o': 79, 'p': 80, 'q': 81, 'r': 82, 's': 83, 't': 84, 'u': 85, 'v': 86, 'w': 87, 'x': 88, 'y': 89, 'z': 90, 'num0': 96, 'num1': 97, 'num2': 98, 'num3': 99, 'num4': 100, 'num5': 101, 'num6': 102, 'num7': 103, 'num8': 104, 'num9': 105, '*': 106, '+': 107, 'subtract': 109, 'decimal': 110, 'divide': 111, ';': 186, '=': 187, ',': 188, 'dash': 189, '-': 189, 'period': 190, '.': 190, 'forward-slash': 191, '/': 191, '`': 192, '[': 219, '\\': 220, ']': 221, '\'': 222, 'left window key': 91, 'right window key': 92, 'select key': 93, 'f1': 112, 'f2': 113, 'f3': 114, 'f4': 115, 'f5': 116, 'f6': 117, 'f7': 118, 'f8': 119, 'f9': 120, 'f10': 121, 'f11': 122, 'f12': 123 }, selectText: function (el, start, end) { if (supportsSelection(el)) { if (!end) { syn.__tryFocus(el); el.setSelectionRange(start, start); } else { el.selectionStart = start; el.selectionEnd = end; } } else if (el.createTextRange) { var r = el.createTextRange(); r.moveStart('character', start); end = end || start; r.moveEnd('character', end - el.value.length); r.select(); } }, getText: function (el) { if (syn.typeable.test(el)) { var sel = getSelection(el); return el.value.substring(sel.start, sel.end); } var win = syn.helpers.getWindow(el); if (win.getSelection) { return win.getSelection().toString(); } else if (win.document.getSelection) { return win.document.getSelection().toString(); } else { return win.document.selection.createRange().text; } }, getSelection: getSelection }); h.extend(syn.key, { data: function (key) { if (syn.key.browser[key]) { return syn.key.browser[key]; } for (var kind in syn.key.kinds) { if (h.inArray(key, syn.key.kinds[kind]) > -1) { return syn.key.browser[kind]; } } return syn.key.browser.character; }, isSpecial: function (keyCode) { var specials = syn.key.kinds.special; for (var i = 0; i < specials.length; i++) { if (syn.keycodes[specials[i]] === keyCode) { return specials[i]; } } }, options: function (key, event) { var keyData = syn.key.data(key); if (!keyData[event]) { return null; } var charCode = keyData[event][0], keyCode = keyData[event][1], result = {}; if (keyCode === 'key') { result.keyCode = syn.keycodes[key]; } else if (keyCode === 'char') { result.keyCode = key.charCodeAt(0); } else { result.keyCode = keyCode; } if (charCode === 'char') { result.charCode = key.charCodeAt(0); } else if (charCode !== null) { result.charCode = charCode; } if (result.keyCode) { result.which = result.keyCode; } else { result.which = result.charCode; } return result; }, kinds: { special: [ 'shift', 'ctrl', 'alt', 'caps' ], specialChars: ['\b'], navigation: [ 'page-up', 'page-down', 'end', 'home', 'left', 'up', 'right', 'down', 'insert', 'delete' ], 'function': [ 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12' ] }, getDefault: function (key) { if (syn.key.defaults[key]) { return syn.key.defaults[key]; } for (var kind in syn.key.kinds) { if (h.inArray(key, syn.key.kinds[kind]) > -1 && syn.key.defaults[kind]) { return syn.key.defaults[kind]; } } return syn.key.defaults.character; }, defaults: { 'character': function (options, scope, key, force, sel) { if (/num\d+/.test(key)) { key = key.match(/\d+/)[0]; } if (force || !syn.support.keyCharacters && syn.typeable.test(this)) { var current = getText(this), before = current.substr(0, sel.start), after = current.substr(sel.end), character = key; setText(this, before + character + after); var charLength = character === '\n' && syn.support.textareaCarriage ? 2 : character.length; syn.selectText(this, before.length + charLength); } }, 'c': function (options, scope, key, force, sel) { if (syn.key.ctrlKey) { syn.key.clipboard = syn.getText(this); } else { syn.key.defaults.character.apply(this, arguments); } }, 'v': function (options, scope, key, force, sel) { if (syn.key.ctrlKey) { syn.key.defaults.character.call(this, options, scope, syn.key.clipboard, true, sel); } else { syn.key.defaults.character.apply(this, arguments); } }, 'a': function (options, scope, key, force, sel) { if (syn.key.ctrlKey) { syn.selectText(this, 0, getText(this).length); } else { syn.key.defaults.character.apply(this, arguments); } }, 'home': function () { syn.onParents(this, function (el) { if (el.scrollHeight !== el.clientHeight) { el.scrollTop = 0; return false; } }); }, 'end': function () { syn.onParents(this, function (el) { if (el.scrollHeight !== el.clientHeight) { el.scrollTop = el.scrollHeight; return false; } }); }, 'page-down': function () { syn.onParents(this, function (el) { if (el.scrollHeight !== el.clientHeight) { var ch = el.clientHeight; el.scrollTop += ch; return false; } }); }, 'page-up': function () { syn.onParents(this, function (el) { if (el.scrollHeight !== el.clientHeight) { var ch = el.clientHeight; el.scrollTop -= ch; return false; } }); }, '\b': function (options, scope, key, force, sel) { if (!syn.support.backspaceWorks && syn.typeable.test(this)) { var current = getText(this), before = current.substr(0, sel.start), after = current.substr(sel.end); if (sel.start === sel.end && sel.start > 0) { setText(this, before.substring(0, before.length - 1) + after); syn.selectText(this, sel.start - 1); } else { setText(this, before + after); syn.selectText(this, sel.start); } } }, 'delete': function (options, scope, key, force, sel) { if (!syn.support.backspaceWorks && syn.typeable.test(this)) { var current = getText(this), before = current.substr(0, sel.start), after = current.substr(sel.end); if (sel.start === sel.end && sel.start <= getText(this).length - 1) { setText(this, before + after.substring(1)); } else { setText(this, before + after); } syn.selectText(this, sel.start); } }, '\r': function (options, scope, key, force, sel) { var nodeName = this.nodeName.toLowerCase(); if (nodeName === 'input') { syn.trigger(this, 'change', {}); } if (!syn.support.keypressSubmits && nodeName === 'input') { var form = syn.closest(this, 'form'); if (form) { syn.trigger(form, 'submit', {}); } } if (!syn.support.keyCharacters && nodeName === 'textarea') { syn.key.defaults.character.call(this, options, scope, '\n', undefined, sel); } if (!syn.support.keypressOnAnchorClicks && nodeName === 'a') { syn.trigger(this, 'click', {}); } }, '\t': function (options, scope) { var focusEls = getFocusable(this), current = null, i = 0, el, firstNotIndexed, orders = []; for (; i < focusEls.length; i++) { orders.push([ focusEls[i], i ]); } var sort = function (order1, order2) { var el1 = order1[0], el2 = order2[0], tab1 = syn.tabIndex(el1) || 0, tab2 = syn.tabIndex(el2) || 0; if (tab1 === tab2) { return order1[1] - order2[1]; } else { if (tab1 === 0) { return 1; } else if (tab2 === 0) { return -1; } else { return tab1 - tab2; } } }; orders.sort(sort); for (i = 0; i < orders.length; i++) { el = orders[i][0]; if (this === el) { if (!syn.key.shiftKey) { current = orders[i + 1][0]; if (!current) { current = orders[0][0]; } } else { current = orders[i - 1][0]; if (!current) { current = orders[focusEls.length - 1][0]; } } } } if (!current) { current = firstNotIndexed; } else { syn.__tryFocus(current); } return current; }, 'left': function (options, scope, key, force, sel) { if (syn.typeable.test(this)) { if (syn.key.shiftKey) { syn.selectText(this, sel.start === 0 ? 0 : sel.start - 1, sel.end); } else { syn.selectText(this, sel.start === 0 ? 0 : sel.start - 1); } } }, 'right': function (options, scope, key, force, sel) { if (syn.typeable.test(this)) { if (syn.key.shiftKey) { syn.selectText(this, sel.start, sel.end + 1 > getText(this).length ? getText(this).length : sel.end + 1); } else { syn.selectText(this, sel.end + 1 > getText(this).length ? getText(this).length : sel.end + 1); } } }, 'up': function () { if (/select/i.test(this.nodeName)) { this.selectedIndex = this.selectedIndex ? this.selectedIndex - 1 : 0; } }, 'down': function () { if (/select/i.test(this.nodeName)) { syn.changeOnBlur(this, 'selectedIndex', this.selectedIndex); this.selectedIndex = this.selectedIndex + 1; } }, 'shift': function () { return null; }, 'ctrl': function () { return null; } } }); h.extend(syn.create, { keydown: { setup: function (type, options, element) { if (h.inArray(options, syn.key.kinds.special) !== -1) { syn.key[options + 'Key'] = element; } } }, keypress: { setup: function (type, options, element) { if (syn.support.keyCharacters && !syn.support.keysOnNotFocused) { syn.__tryFocus(element); } } }, keyup: { setup: function (type, options, element) { if (h.inArray(options, syn.key.kinds.special) !== -1) { syn.key[options + 'Key'] = null; } } }, key: { options: function (type, options, element) { options = typeof options !== 'object' ? { character: options } : options; options = h.extend({}, options); if (options.character) { h.extend(options, syn.key.options(options.character, type)); delete options.character; } options = h.extend({ ctrlKey: !!syn.key.ctrlKey, altKey: !!syn.key.altKey, shiftKey: !!syn.key.shiftKey, metaKey: !!syn.key.metaKey }, options); return options; }, event: function (type, options, element) { var doc = h.getWindow(element).document || document, event; if (doc.createEvent) { try { event = doc.createEvent('KeyEvents'); event.initKeyEvent(type, true, true, window, options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.keyCode, options.charCode); } catch (e) { event = h.createBasicStandardEvent(type, options, doc); } event.synthetic = true; return event; } else { try { event = h.createEventObject.apply(this, arguments); h.extend(event, options); } catch (e) { } return event; } } } }); var convert = { 'enter': '\r', 'backspace': '\b', 'tab': '\t', 'space': ' ' }; h.extend(syn.init.prototype, { _key: function (element, options, callback) { if (/-up$/.test(options) && h.inArray(options.replace('-up', ''), syn.key.kinds.special) !== -1) { syn.trigger(element, 'keyup', options.replace('-up', '')); return callback(true, element); } var activeElement = h.getWindow(element).document.activeElement, caret = syn.typeable.test(element) && getSelection(element), key = convert[options] || options, runDefaults = syn.trigger(element, 'keydown', key), getDefault = syn.key.getDefault, prevent = syn.key.browser.prevent, defaultResult, keypressOptions = syn.key.options(key, 'keypress'); if (runDefaults) { if (!keypressOptions) { defaultResult = getDefault(key).call(element, keypressOptions, h.getWindow(element), key, undefined, caret); } else { if (activeElement !== h.getWindow(element).document.activeElement) { element = h.getWindow(element).document.activeElement; } runDefaults = syn.trigger(element, 'keypress', keypressOptions); if (runDefaults) { defaultResult = getDefault(key).call(element, keypressOptions, h.getWindow(element), key, undefined, caret); } } } else { if (keypressOptions && h.inArray('keypress', prevent.keydown) === -1) { if (activeElement !== h.getWindow(element).document.activeElement) { element = h.getWindow(element).document.activeElement; } syn.trigger(element, 'keypress', keypressOptions); } } if (defaultResult && defaultResult.nodeName) { element = defaultResult; } if (defaultResult !== null) { syn.schedule(function () { if (syn.support.oninput) { syn.trigger(element, 'input', syn.key.options(key, 'input')); } syn.trigger(element, 'keyup', syn.key.options(key, 'keyup')); callback(runDefaults, element); }, 1); } else { callback(runDefaults, element); } return element; }, _type: function (element, options, callback) { var parts = (options + '').match(/(\[[^\]]+\])|([^\[])/g), self = this, runNextPart = function (runDefaults, el) { var part = parts.shift(); if (!part) { callback(runDefaults, el); return; } el = el || element; if (part.length > 1) { part = part.substr(1, part.length - 2); } self._key(el, part, runNextPart); }; runNextPart(); } });
๏ปฟ/* Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'colorbutton', 'bg', { auto: 'ะะฒั‚ะพะผะฐั‚ะธั‡ะฝะพ', bgColorTitle: 'ะคะพะฝะพะฒ ั†ะฒัั‚', colors: { '000': 'ะงะตั€ะฝะพ', '800000': 'ะšะตัั‚ะตะฝัะฒะพ', '8B4513': 'ะกะฒะตั‚ะปะพะบะฐั„ัะฒะพ', '2F4F4F': 'Dark Slate Gray', '008080': 'Teal', '000080': 'Navy', '4B0082': 'ะ˜ะฝะดะธะณะพ', '696969': 'ะขัŠะผะฝะพ ัะธะฒะพ', B22222: 'ะžะณะฝะตะฝะพ ั‡ะตั€ะฒะตะฝะพ', A52A2A: 'ะšะฐั„ัะฒะพ', DAA520: 'ะ—ะปะฐั‚ะธัั‚ะพ', '006400': 'ะขัŠะผะฝะพ ะทะตะปะตะฝะพ', '40E0D0': 'ะขัŽั€ะบัƒะฐะทะตะฝะพ', '0000CD': 'ะกั€ะตะดะฝะพ ัะธะฝัŒะพ', '800080': 'ะŸัƒั€ะฟัƒั€ะฝะพ', '808080': 'ะกะธะฒะพ', F00: 'ะงะตั€ะฒะตะฝะพ', FF8C00: 'ะขัŠะผะฝะพ ะพั€ะฐะฝะถะตะฒะพ', FFD700: 'ะ—ะปะฐั‚ะฝะพ', '008000': 'ะ—ะตะปะตะฝะพ', '0FF': 'ะกะฒะตั‚ะปะพ ัะธะฝัŒะพ', '00F': 'Blue', EE82EE: 'Violet', A9A9A9: 'Dim Gray', FFA07A: 'Light Salmon', FFA500: 'Orange', FFFF00: 'Yellow', '00FF00': 'Lime', AFEEEE: 'Pale Turquoise', ADD8E6: 'Light Blue', DDA0DD: 'Plum', D3D3D3: 'Light Grey', FFF0F5: 'Lavender Blush', FAEBD7: 'Antique White', FFFFE0: 'Light Yellow', F0FFF0: 'Honeydew', F0FFFF: 'Azure', F0F8FF: 'Alice Blue', E6E6FA: 'Lavender', FFF: 'White' }, more: 'ะžั‰ะต ั†ะฒะตั‚ะพะฒะต', panelTitle: 'ะฆะฒะตั‚ะพะฒะต', textColorTitle: 'ะฆะฒัั‚ ะฝะฐ ัˆั€ะธั„ั‚' } );
/*! * <%= meta.title %> v<%= meta.version %> Google Calendar Plugin * Docs & License: <%= meta.homepage %> * (c) <%= meta.copyright %> */ (function(factory) { if (typeof define === 'function' && define.amd) { define([ 'jquery' ], factory); } else { factory(jQuery); } })(function($) { var API_BASE = 'https://www.googleapis.com/calendar/v3/calendars'; var fc = $.fullCalendar; var applyAll = fc.applyAll; fc.sourceNormalizers.push(function(sourceOptions) { var googleCalendarId = sourceOptions.googleCalendarId; var url = sourceOptions.url; var match; // if the Google Calendar ID hasn't been explicitly defined if (!googleCalendarId && url) { // detect if the ID was specified as a single string. // will match calendars like "asdf1234@calendar.google.com" in addition to person email calendars. if ((match = /^[^\/]+@([^\/\.]+\.)*(google|googlemail|gmail)\.com$/.test(url))) { googleCalendarId = url; } // try to scrape it out of a V1 or V3 API feed URL else if ( (match = /^https:\/\/www.googleapis.com\/calendar\/v3\/calendars\/([^\/]*)/.exec(url)) || (match = /^https?:\/\/www.google.com\/calendar\/feeds\/([^\/]*)/.exec(url)) ) { googleCalendarId = decodeURIComponent(match[1]); } if (googleCalendarId) { sourceOptions.googleCalendarId = googleCalendarId; } } if (googleCalendarId) { // is this a Google Calendar? // make each Google Calendar source uneditable by default if (sourceOptions.editable == null) { sourceOptions.editable = false; } // We want removeEventSource to work, but it won't know about the googleCalendarId primitive. // Shoehorn it into the url, which will function as the unique primitive. Won't cause side effects. // This hack is obsolete since 2.2.3, but keep it so this plugin file is compatible with old versions. sourceOptions.url = googleCalendarId; } }); fc.sourceFetchers.push(function(sourceOptions, start, end, timezone) { if (sourceOptions.googleCalendarId) { return transformOptions(sourceOptions, start, end, timezone, this); // `this` is the calendar } }); function transformOptions(sourceOptions, start, end, timezone, calendar) { var url = API_BASE + '/' + encodeURIComponent(sourceOptions.googleCalendarId) + '/events?callback=?'; // jsonp var apiKey = sourceOptions.googleCalendarApiKey || calendar.options.googleCalendarApiKey; var success = sourceOptions.success; var data; var timezoneArg; // populated when a specific timezone. escaped to Google's liking function reportError(message, apiErrorObjs) { var errorObjs = apiErrorObjs || [ { message: message } ]; // to be passed into error handlers var consoleObj = window.console; var consoleWarnFunc = consoleObj ? (consoleObj.warn || consoleObj.log) : null; // call error handlers (sourceOptions.googleCalendarError || $.noop).apply(calendar, errorObjs); (calendar.options.googleCalendarError || $.noop).apply(calendar, errorObjs); // print error to debug console if (consoleWarnFunc) { consoleWarnFunc.apply(consoleObj, [ message ].concat(apiErrorObjs || [])); } } if (!apiKey) { reportError("Specify a googleCalendarApiKey. See http://fullcalendar.io/docs/google_calendar/"); return {}; // an empty source to use instead. won't fetch anything. } // The API expects an ISO8601 datetime with a time and timezone part. // Since the calendar's timezone offset isn't always known, request the date in UTC and pad it by a day on each // side, guaranteeing we will receive all events in the desired range, albeit a superset. // .utc() will set a zone and give it a 00:00:00 time. if (!start.hasZone()) { start = start.clone().utc().add(-1, 'day'); } if (!end.hasZone()) { end = end.clone().utc().add(1, 'day'); } // when sending timezone names to Google, only accepts underscores, not spaces if (timezone && timezone != 'local') { timezoneArg = timezone.replace(' ', '_'); } data = $.extend({}, sourceOptions.data || {}, { key: apiKey, timeMin: start.format(), timeMax: end.format(), timeZone: timezoneArg, singleEvents: true, maxResults: 9999 }); return $.extend({}, sourceOptions, { googleCalendarId: null, // prevents source-normalizing from happening again url: url, data: data, startParam: false, // `false` omits this parameter. we already included it above endParam: false, // same timezoneParam: false, // same success: function(data) { var events = []; var successArgs; var successRes; if (data.error) { reportError('Google Calendar API: ' + data.error.message, data.error.errors); } else if (data.items) { $.each(data.items, function(i, entry) { var url = entry.htmlLink; // make the URLs for each event show times in the correct timezone if (timezoneArg) { url = injectQsComponent(url, 'ctz=' + timezoneArg); } events.push({ id: entry.id, title: entry.summary, start: entry.start.dateTime || entry.start.date, // try timed. will fall back to all-day end: entry.end.dateTime || entry.end.date, // same url: url, location: entry.location, description: entry.description }); }); // call the success handler(s) and allow it to return a new events array successArgs = [ events ].concat(Array.prototype.slice.call(arguments, 1)); // forward other jq args successRes = applyAll(success, this, successArgs); if ($.isArray(successRes)) { return successRes; } } return events; } }); } // Injects a string like "arg=value" into the querystring of a URL function injectQsComponent(url, component) { // inject it after the querystring but before the fragment return url.replace(/(\?.*?)?(#|$)/, function(whole, qs, hash) { return (qs ? qs + '&' : '?') + component + hash; }); } });
/** * * Send a sequence of key strokes to an element. * * @param {String} ID ID of a WebElement JSON object to route the command to * @param {String|String[]} value The sequence of keys to type. An array must be provided. The server should flatten the array items to a single string to be typed. * * @see https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value * @type protocol * */ var unicodeChars = require('../utils/unicodeChars'), ErrorHandler = require('../utils/ErrorHandler.js'); module.exports = function elementIdValue (id, value) { if(typeof id !== 'string' && typeof id !== 'number') { throw new ErrorHandler.ProtocolError('number or type of arguments don\'t agree with elementIdValue protocol command'); } var requestPath = '/session/:sessionId/element/:id/value', key = []; requestPath = requestPath.replace(/:id/gi, id); if(typeof value === 'string') { // replace key with corresponding unicode character key = checkUnicode(value); } else if(value instanceof Array) { value.forEach(function(charSet) { key = key.concat(checkUnicode(charSet)); }); } else { throw new ErrorHandler.ProtocolError('number or type of arguments don\'t agree with elementIdValue protocol command'); } var data = {'value': key}; return this.requestHandler.create(requestPath, data); }; /*! * check for unicode character or split string into literals * @param {String} value text * @return {Array} set of characters or unicode symbols */ function checkUnicode(value) { return unicodeChars.hasOwnProperty(value) ? [unicodeChars[value]] : value.split(''); }
/*! * GMaps.js v0.3.1 * http://hpneo.github.com/gmaps/ * * Copyright 2012, Gustavo Leon * Released under the MIT License. */ if(window.google && window.google.maps){ var GMaps = (function(global) { "use strict"; var doc = document; var getElementById = function(id, context) { var ele if('jQuery' in global && context){ ele = $("#"+id.replace('#', ''), context)[0] } else { ele = doc.getElementById(id.replace('#', '')); }; return ele; }; var GMaps = function(options) { var self = this; var events_that_hide_context_menu = ['bounds_changed', 'center_changed', 'click', 'dblclick', 'drag', 'dragend', 'dragstart', 'idle', 'maptypeid_changed', 'projection_changed', 'resize', 'tilesloaded', 'zoom_changed']; var events_that_doesnt_hide_context_menu = ['mousemove', 'mouseout', 'mouseover']; window.context_menu = {}; if (typeof(options.el) === 'string' || typeof(options.div) === 'string') { this.el = getElementById(options.el || options.div, options.context); } else { this.el = options.el || options.div; }; if (typeof(this.el) === 'undefined' || this.el === null) { throw 'No element defined.'; } this.el.style.width = options.width || this.el.scrollWidth || this.el.offsetWidth; this.el.style.height = options.height || this.el.scrollHeight || this.el.offsetHeight; this.controls = []; this.overlays = []; this.layers = []; // array with kml and ft layers, can be as many this.singleLayers = {}; // object with the other layers, only one per layer this.markers = []; this.polylines = []; this.routes = []; this.polygons = []; this.infoWindow = null; this.overlay_el = null; this.zoom = options.zoom || 15; this.registered_events = {}; var markerClusterer = options.markerClusterer; //'Hybrid', 'Roadmap', 'Satellite' or 'Terrain' var mapType; if (options.mapType) { mapType = google.maps.MapTypeId[options.mapType.toUpperCase()]; } else { mapType = google.maps.MapTypeId.ROADMAP; } var map_center = new google.maps.LatLng(options.lat, options.lng); delete options.el; delete options.lat; delete options.lng; delete options.mapType; delete options.width; delete options.height; delete options.markerClusterer; var zoomControlOpt = options.zoomControlOpt || { style: 'DEFAULT', position: 'TOP_LEFT' }; var zoomControl = options.zoomControl || true, zoomControlStyle = zoomControlOpt.style || 'DEFAULT', zoomControlPosition = zoomControlOpt.position || 'TOP_LEFT', panControl = options.panControl || true, mapTypeControl = options.mapTypeControl || true, scaleControl = options.scaleControl || true, streetViewControl = options.streetViewControl || true, overviewMapControl = overviewMapControl || true; var map_options = {}; var map_base_options = { zoom: this.zoom, center: map_center, mapTypeId: mapType }; var map_controls_options = { panControl: panControl, zoomControl: zoomControl, zoomControlOptions: { style: google.maps.ZoomControlStyle[zoomControlStyle], // DEFAULT LARGE SMALL position: google.maps.ControlPosition[zoomControlPosition] }, mapTypeControl: mapTypeControl, scaleControl: scaleControl, streetViewControl: streetViewControl, overviewMapControl: overviewMapControl } if(options.disableDefaultUI != true) map_base_options = extend_object(map_base_options, map_controls_options); map_options = extend_object(map_base_options, options); for(var i = 0; i < events_that_hide_context_menu.length; i++) { delete map_options[events_that_hide_context_menu[i]]; } for(var i = 0; i < events_that_doesnt_hide_context_menu.length; i++) { delete map_options[events_that_doesnt_hide_context_menu[i]]; } this.map = new google.maps.Map(this.el, map_options); if(markerClusterer) { this.markerClusterer = markerClusterer.apply(this, [this.map]); } // finds absolute position of an element var findAbsolutePosition = function(obj) { var curleft = 0; var curtop = 0; if (obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while (obj = obj.offsetParent); } return [curleft,curtop]; //returns an array } // Context menus var buildContextMenuHTML = function(control, e) { var html = ''; var options = window.context_menu[control]; for (var i in options){ if (options.hasOwnProperty(i)){ var option = options[i]; html += '<li><a id="' + control + '_' + i + '" href="#">' + option.title + '</a></li>'; } } if(!getElementById('gmaps_context_menu')) return; var context_menu_element = getElementById('gmaps_context_menu'); context_menu_element.innerHTML = html; var context_menu_items = context_menu_element.getElementsByTagName('a'); var context_menu_items_count = context_menu_items.length; for(var i = 0; i < context_menu_items_count; i++){ var context_menu_item = context_menu_items[i]; var assign_menu_item_action = function(ev){ ev.preventDefault(); options[this.id.replace(control + '_', '')].action.apply(self, [e]); self.hideContextMenu(); }; google.maps.event.clearListeners(context_menu_item, 'click'); google.maps.event.addDomListenerOnce(context_menu_item, 'click', assign_menu_item_action, false); } var position = findAbsolutePosition.apply(this, [self.el]); var left = position[0] + e.pixel.x - 15; var top = position[1] + e.pixel.y- 15; context_menu_element.style.left = left + "px"; context_menu_element.style.top = top + "px"; context_menu_element.style.display = 'block'; }; var buildContextMenu = function(control, e) { if (control === 'marker') { e.pixel = {}; var overlay = new google.maps.OverlayView(); overlay.setMap(self.map); overlay.draw = function() { var projection = overlay.getProjection(); var position = e.marker.getPosition(); e.pixel = projection.fromLatLngToContainerPixel(position); buildContextMenuHTML(control, e); }; } else { buildContextMenuHTML(control, e); } }; this.setContextMenu = function(options) { window.context_menu[options.control] = {}; for (var i in options.options){ if (options.options.hasOwnProperty(i)){ var option = options.options[i]; window.context_menu[options.control][option.name] = { title: option.title, action: option.action }; } } var ul = doc.createElement('ul'); ul.id = 'gmaps_context_menu'; ul.style.display = 'none'; ul.style.position = 'absolute'; ul.style.minWidth = '100px'; ul.style.background = 'white'; ul.style.listStyle = 'none'; ul.style.padding = '8px'; ul.style.boxShadow = '2px 2px 6px #ccc'; doc.body.appendChild(ul); var context_menu_element = getElementById('gmaps_context_menu'); google.maps.event.addDomListener(context_menu_element, 'mouseout', function(ev) { if(!ev.relatedTarget || !this.contains(ev.relatedTarget)){ window.setTimeout(function(){ context_menu_element.style.display = 'none'; }, 400); } }, false); }; this.hideContextMenu = function() { var context_menu_element = getElementById('gmaps_context_menu'); if(context_menu_element) context_menu_element.style.display = 'none'; }; //Events var setupListener = function(object, name) { google.maps.event.addListener(object, name, function(e){ if(e == undefined) { e = this; } options[name].apply(this, [e]); self.hideContextMenu(); }); } for (var ev = 0; ev < events_that_hide_context_menu.length; ev++) { var name = events_that_hide_context_menu[ev]; if (name in options) { setupListener(this.map, name); } } for (var ev = 0; ev < events_that_doesnt_hide_context_menu.length; ev++) { var name = events_that_doesnt_hide_context_menu[ev]; if (name in options) { setupListener(this.map, name); } } google.maps.event.addListener(this.map, 'rightclick', function(e) { if (options.rightclick) { options.rightclick.apply(this, [e]); } if(window.context_menu['map'] != undefined) { buildContextMenu('map', e); } }); this.refresh = function() { google.maps.event.trigger(this.map, 'resize'); }; this.fitZoom = function() { var latLngs = []; var markers_length = this.markers.length; for(var i=0; i < markers_length; i++) { latLngs.push(this.markers[i].getPosition()); } this.fitLatLngBounds(latLngs); }; this.fitLatLngBounds = function(latLngs) { var total = latLngs.length; var bounds = new google.maps.LatLngBounds(); for(var i=0; i < total; i++) { bounds.extend(latLngs[i]); } this.map.fitBounds(bounds); }; // Map methods this.setCenter = function(lat, lng, callback) { this.map.panTo(new google.maps.LatLng(lat, lng)); if (callback) { callback(); } }; this.getElement = function() { return this.el; }; this.zoomIn = function(value) { value = value || 1; this.zoom = this.map.getZoom() + value; this.map.setZoom(this.zoom); }; this.zoomOut = function(value) { value = value || 1; this.zoom = this.map.getZoom() - value; this.map.setZoom(this.zoom); }; var native_methods = []; for(var method in this.map){ if(typeof(this.map[method]) == 'function' && !this[method]){ native_methods.push(method); } } for(var i=0; i < native_methods.length; i++){ (function(gmaps, scope, method_name) { gmaps[method_name] = function(){ return scope[method_name].apply(scope, arguments); }; })(this, this.map, native_methods[i]); } this.createControl = function(options) { var control = doc.createElement('div'); control.style.cursor = 'pointer'; control.style.fontFamily = 'Arial, sans-serif'; control.style.fontSize = '13px'; control.style.boxShadow = 'rgba(0, 0, 0, 0.398438) 0px 2px 4px'; for(var option in options.style) control.style[option] = options.style[option]; if(options.id) { control.id = options.id; } if(options.classes) { control.className = options.classes; } if(options.content) { control.innerHTML = options.content; } for (var ev in options.events) { (function(object, name) { google.maps.event.addDomListener(object, name, function(){ options.events[name].apply(this, [this]); }); })(control, ev); } control.index = 1; return control; }; this.addControl = function(options) { var position = google.maps.ControlPosition[options.position.toUpperCase()]; delete options.position; var control = this.createControl(options); this.controls.push(control); this.map.controls[position].push(control); return control; }; // Markers this.createMarker = function(options) { if ((options.hasOwnProperty('lat') && options.hasOwnProperty('lng')) || options.position) { var self = this; var details = options.details; var fences = options.fences; var outside = options.outside; var base_options = { position: new google.maps.LatLng(options.lat, options.lng), map: null }; delete options.lat; delete options.lng; delete options.fences; delete options.outside; var marker_options = extend_object(base_options, options); var marker = new google.maps.Marker(marker_options); marker.fences = fences; if (options.infoWindow) { marker.infoWindow = new google.maps.InfoWindow(options.infoWindow); var info_window_events = ['closeclick', 'content_changed', 'domready', 'position_changed', 'zindex_changed']; for (var ev = 0; ev < info_window_events.length; ev++) { (function(object, name) { if (options.infoWindow[name]) { google.maps.event.addListener(object, name, function(e){ options.infoWindow[name].apply(this, [e]); }); } })(marker.infoWindow, info_window_events[ev]); } } var marker_events = ['animation_changed', 'clickable_changed', 'cursor_changed', 'draggable_changed', 'flat_changed', 'icon_changed', 'position_changed', 'shadow_changed', 'shape_changed', 'title_changed', 'visible_changed', 'zindex_changed']; var marker_events_with_mouse = ['dblclick', 'drag', 'dragend', 'dragstart', 'mousedown', 'mouseout', 'mouseover', 'mouseup']; for (var ev = 0; ev < marker_events.length; ev++) { (function(object, name) { if (options[name]) { google.maps.event.addListener(object, name, function(){ options[name].apply(this, [this]); }); } })(marker, marker_events[ev]); } for (var ev = 0; ev < marker_events_with_mouse.length; ev++) { (function(map, object, name) { if (options[name]) { google.maps.event.addListener(object, name, function(me){ if(!me.pixel){ me.pixel = map.getProjection().fromLatLngToPoint(me.latLng) } options[name].apply(this, [me]); }); } })(this.map, marker, marker_events_with_mouse[ev]); } google.maps.event.addListener(marker, 'click', function() { this.details = details; if (options.click) { options.click.apply(this, [this]); } if (marker.infoWindow) { self.hideInfoWindows(); marker.infoWindow.open(self.map, marker); } }); google.maps.event.addListener(marker, 'rightclick', function(e) { e.marker = this; if (options.rightclick) { options.rightclick.apply(this, [e]); } if (window.context_menu['marker'] != undefined) { buildContextMenu('marker', e); } }); if (marker.fences) { google.maps.event.addListener(marker, 'dragend', function() { self.checkMarkerGeofence(marker, function(m, f) { outside(m, f); }); }); } return marker; } else { throw 'No latitude or longitude defined.'; } }; this.addMarker = function(options) { var marker; if(options.hasOwnProperty('gm_accessors_')) { // Native google.maps.Marker object marker = options; } else { if ((options.hasOwnProperty('lat') && options.hasOwnProperty('lng')) || options.position) { marker = this.createMarker(options); } else { throw 'No latitude or longitude defined.'; } } marker.setMap(this.map); if(this.markerClusterer) { this.markerClusterer.addMarker(marker); } this.markers.push(marker); GMaps.fire('marker_added', marker, this); return marker; }; this.addMarkers = function(array) { for (var i=0, marker; marker=array[i]; i++) { this.addMarker(marker); } return this.markers; }; this.hideInfoWindows = function() { for (var i=0, marker; marker=this.markers[i]; i++){ if (marker.infoWindow){ marker.infoWindow.close(); } } }; this.removeMarker = function(marker) { for(var i = 0; i < this.markers.length; i++) { if(this.markers[i] === marker) { this.markers[i].setMap(null); this.markers.splice(i, 1); GMaps.fire('marker_removed', marker, this); break; } } return marker; }; this.removeMarkers = function(collection) { var collection = (collection || this.markers); for(var i=0;i < this.markers.length; i++){ if(this.markers[i] === collection[i]) this.markers[i].setMap(null); } var new_markers = []; for(var i=0;i < this.markers.length; i++){ if(this.markers[i].getMap() != null) new_markers.push(this.markers[i]); } this.markers = new_markers; }; // Overlays this.drawOverlay = function(options) { var overlay = new google.maps.OverlayView(); overlay.setMap(self.map); var auto_show = true; if(options.auto_show != null) auto_show = options.auto_show; overlay.onAdd = function() { var el = doc.createElement('div'); el.style.borderStyle = "none"; el.style.borderWidth = "0px"; el.style.position = "absolute"; el.style.zIndex = 100; el.innerHTML = options.content; overlay.el = el; var panes = this.getPanes(); if (!options.layer) { options.layer = 'overlayLayer'; } var overlayLayer = panes[options.layer]; overlayLayer.appendChild(el); var stop_overlay_events = ['contextmenu', 'DOMMouseScroll', 'dblclick', 'mousedown']; for (var ev = 0; ev < stop_overlay_events.length; ev++) { (function(object, name) { google.maps.event.addDomListener(object, name, function(e){ if(navigator.userAgent.toLowerCase().indexOf('msie') != -1 && document.all) { e.cancelBubble = true; e.returnValue = false; } else { e.stopPropagation(); } }); })(el, stop_overlay_events[ev]); } google.maps.event.trigger(this, 'ready'); }; overlay.draw = function() { var projection = this.getProjection(); var pixel = projection.fromLatLngToDivPixel(new google.maps.LatLng(options.lat, options.lng)); options.horizontalOffset = options.horizontalOffset || 0; options.verticalOffset = options.verticalOffset || 0; var el = overlay.el; var content = el.children[0]; var content_height = content.clientHeight; var content_width = content.clientWidth; switch (options.verticalAlign) { case 'top': el.style.top = (pixel.y - content_height + options.verticalOffset) + 'px'; break; default: case 'middle': el.style.top = (pixel.y - (content_height / 2) + options.verticalOffset) + 'px'; break; case 'bottom': el.style.top = (pixel.y + options.verticalOffset) + 'px'; break; } switch (options.horizontalAlign) { case 'left': el.style.left = (pixel.x - content_width + options.horizontalOffset) + 'px'; break; default: case 'center': el.style.left = (pixel.x - (content_width / 2) + options.horizontalOffset) + 'px'; break; case 'right': el.style.left = (pixel.x + options.horizontalOffset) + 'px'; break; } el.style.display = auto_show ? 'block' : 'none'; if(!auto_show){ options.show.apply(this, [el]); } }; overlay.onRemove = function() { var el = overlay.el; if(options.remove){ options.remove.apply(this, [el]); } else { overlay.el.parentNode.removeChild(overlay.el); overlay.el = null; } }; self.overlays.push(overlay); return overlay; }; this.removeOverlay = function(overlay) { for(var i = 0; i < this.overlays.length; i++) { if(this.overlays[i] === overlay) { this.overlays[i].setMap(null); this.overlays.splice(i, 1); break; } } }; this.removeOverlays = function() { for (var i=0, item; item=self.overlays[i]; i++){ item.setMap(null); } self.overlays = []; }; // Geometry this.drawPolyline = function(options) { var path = []; var points = options.path; if (points.length){ if (points[0][0] === undefined){ path = points; } else { for (var i=0, latlng; latlng=points[i]; i++){ path.push(new google.maps.LatLng(latlng[0], latlng[1])); } } } var polyline_options = { map: this.map, path: path, strokeColor: options.strokeColor, strokeOpacity: options.strokeOpacity, strokeWeight: options.strokeWeight, geodesic: options.geodesic, clickable: true, editable: false, visible: true }; if(options.hasOwnProperty("clickable")) polyline_options.clickable = options.clickable; if(options.hasOwnProperty("editable")) polyline_options.editable = options.editable; if(options.hasOwnProperty("icons")) polyline_options.icons = options.icons; if(options.hasOwnProperty("zIndex")) polyline_options.zIndex = options.zIndex; var polyline = new google.maps.Polyline(polyline_options); var polyline_events = ['click', 'dblclick', 'mousedown', 'mousemove', 'mouseout', 'mouseover', 'mouseup', 'rightclick']; for (var ev = 0; ev < polyline_events.length; ev++) { (function(object, name) { if (options[name]) { google.maps.event.addListener(object, name, function(e){ options[name].apply(this, [e]); }); } })(polyline, polyline_events[ev]); } this.polylines.push(polyline); GMaps.fire('polyline_added', polyline, this); return polyline; }; this.removePolyline = function(polyline) { for(var i = 0; i < this.polylines.length; i++) { if(this.polylines[i] === polyline) { this.polylines[i].setMap(null); this.polylines.splice(i, 1); GMaps.fire('polyline_removed', polyline, this); break; } } }; this.removePolylines = function() { for (var i=0, item; item=self.polylines[i]; i++){ item.setMap(null); } self.polylines = []; }; this.drawCircle = function(options) { options = extend_object({ map: this.map, center: new google.maps.LatLng(options.lat, options.lng) }, options); delete options.lat; delete options.lng; var polygon = new google.maps.Circle(options); var polygon_events = ['click', 'dblclick', 'mousedown', 'mousemove', 'mouseout', 'mouseover', 'mouseup', 'rightclick']; for (var ev = 0; ev < polygon_events.length; ev++) { (function(object, name) { if (options[name]) { google.maps.event.addListener(object, name, function(e){ options[name].apply(this, [e]); }); } })(polygon, polygon_events[ev]); } this.polygons.push(polygon); return polygon; }; this.drawRectangle = function(options) { options = extend_object({ map: this.map }, options); var latLngBounds = new google.maps.LatLngBounds( new google.maps.LatLng(options.bounds[0][0], options.bounds[0][1]), new google.maps.LatLng(options.bounds[1][0], options.bounds[1][1]) ); options.bounds = latLngBounds; var polygon = new google.maps.Rectangle(options); var polygon_events = ['click', 'dblclick', 'mousedown', 'mousemove', 'mouseout', 'mouseover', 'mouseup', 'rightclick']; for (var ev = 0; ev < polygon_events.length; ev++) { (function(object, name) { if (options[name]) { google.maps.event.addListener(object, name, function(e){ options[name].apply(this, [e]); }); } })(polygon, polygon_events[ev]); } this.polygons.push(polygon); return polygon; }; this.drawPolygon = function(options) { var useGeoJSON = false; if(options.hasOwnProperty("useGeoJSON")) useGeoJSON = options.useGeoJSON; delete options.useGeoJSON; options = extend_object({ map: this.map }, options); if(useGeoJSON == false) options.paths = [options.paths.slice(0)]; if(options.paths.length > 0) { if(options.paths[0].length > 0) { options.paths = array_flat(array_map(options.paths, arrayToLatLng, useGeoJSON)); } } var polygon = new google.maps.Polygon(options); var polygon_events = ['click', 'dblclick', 'mousedown', 'mousemove', 'mouseout', 'mouseover', 'mouseup', 'rightclick']; for (var ev = 0; ev < polygon_events.length; ev++) { (function(object, name) { if (options[name]) { google.maps.event.addListener(object, name, function(e){ options[name].apply(this, [e]); }); } })(polygon, polygon_events[ev]); } this.polygons.push(polygon); GMaps.fire('polygon_added', polygon, this); return polygon; }; this.removePolygon = function(polygon) { for(var i = 0; i < this.polygons.length; i++) { if(this.polygons[i] === polygon) { this.polygons[i].setMap(null); this.polygons.splice(i, 1); GMaps.fire('polygon_removed', polygon, this); break; } } }; this.removePolygons = function() { for (var i=0, item; item=self.polygons[i]; i++){ item.setMap(null); } self.polygons = []; }; // Fusion Tables this.getFromFusionTables = function(options) { var events = options.events; delete options.events; var fusion_tables_options = options; var layer = new google.maps.FusionTablesLayer(fusion_tables_options); for (var ev in events) { (function(object, name) { google.maps.event.addListener(object, name, function(e){ events[name].apply(this, [e]); }); })(layer, ev); } this.layers.push(layer); return layer; }; this.loadFromFusionTables = function(options) { var layer = this.getFromFusionTables(options); layer.setMap(this.map); return layer; }; // KML this.getFromKML = function(options) { var url = options.url; var events = options.events; delete options.url; delete options.events; var kml_options = options; var layer = new google.maps.KmlLayer(url, kml_options); for (var ev in events) { (function(object, name) { google.maps.event.addListener(object, name, function(e){ events[name].apply(this, [e]); }); })(layer, ev); } this.layers.push(layer); return layer; }; this.loadFromKML = function(options) { var layer = this.getFromKML(options); layer.setMap(this.map); return layer; }; // Routes var travelMode, unitSystem; this.getRoutes = function(options) { switch (options.travelMode) { case 'bicycling': travelMode = google.maps.TravelMode.BICYCLING; break; case 'transit': travelMode = google.maps.TravelMode.TRANSIT; break; case 'driving': travelMode = google.maps.TravelMode.DRIVING; break; // case 'walking': default: travelMode = google.maps.TravelMode.WALKING; break; } if (options.unitSystem === 'imperial') { unitSystem = google.maps.UnitSystem.IMPERIAL; } else { unitSystem = google.maps.UnitSystem.METRIC; } var base_options = { avoidHighways: false, avoidTolls: false, optimizeWaypoints: false, waypoints: [] }; var request_options = extend_object(base_options, options); request_options.origin = /string/.test(typeof options.origin) ? options.origin : new google.maps.LatLng(options.origin[0], options.origin[1]); request_options.destination = new google.maps.LatLng(options.destination[0], options.destination[1]); request_options.travelMode = travelMode; request_options.unitSystem = unitSystem; delete request_options.callback; var self = this; var service = new google.maps.DirectionsService(); service.route(request_options, function(result, status) { if (status === google.maps.DirectionsStatus.OK) { for (var r in result.routes) { if (result.routes.hasOwnProperty(r)) { self.routes.push(result.routes[r]); } } } if (options.callback) { options.callback(self.routes); } }); }; this.removeRoutes = function() { this.routes = []; }; this.getElevations = function(options) { options = extend_object({ locations: [], path : false, samples : 256 }, options); if(options.locations.length > 0) { if(options.locations[0].length > 0) { options.locations = array_flat(array_map([options.locations], arrayToLatLng, false)); } } var callback = options.callback; delete options.callback; var service = new google.maps.ElevationService(); //location request if (!options.path) { delete options.path; delete options.samples; service.getElevationForLocations(options, function(result, status){ if (callback && typeof(callback) === "function") { callback(result, status); } }); //path request } else { var pathRequest = { path : options.locations, samples : options.samples }; service.getElevationAlongPath(pathRequest, function(result, status){ if (callback && typeof(callback) === "function") { callback(result, status); } }); } }; // Alias for the method "drawRoute" this.cleanRoute = this.removePolylines; this.drawRoute = function(options) { var self = this; this.getRoutes({ origin: options.origin, destination: options.destination, travelMode: options.travelMode, waypoints: options.waypoints, unitSystem: options.unitSystem, callback: function(e) { if (e.length > 0) { self.drawPolyline({ path: e[e.length - 1].overview_path, strokeColor: options.strokeColor, strokeOpacity: options.strokeOpacity, strokeWeight: options.strokeWeight }); if (options.callback) { options.callback(e[e.length - 1]); } } } }); }; this.travelRoute = function(options) { if (options.origin && options.destination) { this.getRoutes({ origin: options.origin, destination: options.destination, travelMode: options.travelMode, waypoints : options.waypoints, callback: function(e) { //start callback if (e.length > 0 && options.start) { options.start(e[e.length - 1]); } //step callback if (e.length > 0 && options.step) { var route = e[e.length - 1]; if (route.legs.length > 0) { var steps = route.legs[0].steps; for (var i=0, step; step=steps[i]; i++) { step.step_number = i; options.step(step, (route.legs[0].steps.length - 1)); } } } //end callback if (e.length > 0 && options.end) { options.end(e[e.length - 1]); } } }); } else if (options.route) { if (options.route.legs.length > 0) { var steps = options.route.legs[0].steps; for (var i=0, step; step=steps[i]; i++) { step.step_number = i; options.step(step); } } } }; this.drawSteppedRoute = function(options) { if (options.origin && options.destination) { this.getRoutes({ origin: options.origin, destination: options.destination, travelMode: options.travelMode, waypoints : options.waypoints, callback: function(e) { //start callback if (e.length > 0 && options.start) { options.start(e[e.length - 1]); } //step callback if (e.length > 0 && options.step) { var route = e[e.length - 1]; if (route.legs.length > 0) { var steps = route.legs[0].steps; for (var i=0, step; step=steps[i]; i++) { step.step_number = i; self.drawPolyline({ path: step.path, strokeColor: options.strokeColor, strokeOpacity: options.strokeOpacity, strokeWeight: options.strokeWeight }); options.step(step, (route.legs[0].steps.length - 1)); } } } //end callback if (e.length > 0 && options.end) { options.end(e[e.length - 1]); } } }); } else if (options.route) { if (options.route.legs.length > 0) { var steps = options.route.legs[0].steps; for (var i=0, step; step=steps[i]; i++) { step.step_number = i; self.drawPolyline({ path: step.path, strokeColor: options.strokeColor, strokeOpacity: options.strokeOpacity, strokeWeight: options.strokeWeight }); options.step(step); } } } }; // Geofence this.checkGeofence = function(lat, lng, fence) { return fence.containsLatLng(new google.maps.LatLng(lat, lng)); }; this.checkMarkerGeofence = function(marker, outside_callback) { if (marker.fences) { for (var i=0, fence; fence=marker.fences[i]; i++) { var pos = marker.getPosition(); if (!self.checkGeofence(pos.lat(), pos.lng(), fence)) { outside_callback(marker, fence); } } } }; // Layers this.addLayer = function(layerName, options) { //var default_layers = ['weather', 'clouds', 'traffic', 'transit', 'bicycling', 'panoramio', 'places']; options = options || {}; var layer; switch(layerName) { case 'weather': this.singleLayers.weather = layer = new google.maps.weather.WeatherLayer(); break; case 'clouds': this.singleLayers.clouds = layer = new google.maps.weather.CloudLayer(); break; case 'traffic': this.singleLayers.traffic = layer = new google.maps.TrafficLayer(); break; case 'transit': this.singleLayers.transit = layer = new google.maps.TransitLayer(); break; case 'bicycling': this.singleLayers.bicycling = layer = new google.maps.BicyclingLayer(); break; case 'panoramio': this.singleLayers.panoramio = layer = new google.maps.panoramio.PanoramioLayer(); layer.setTag(options.filter); delete options.filter; //click event if(options.click) { google.maps.event.addListener(layer, 'click', function(event) { options.click(event); delete options.click; }); } break; case 'places': this.singleLayers.places = layer = new google.maps.places.PlacesService(this.map); //search and nearbySearch callback, Both are the same if(options.search || options.nearbySearch) { var placeSearchRequest = { bounds : options.bounds || null, keyword : options.keyword || null, location : options.location || null, name : options.name || null, radius : options.radius || null, rankBy : options.rankBy || null, types : options.types || null }; if(options.search) { layer.search(placeSearchRequest, options.search); } if(options.nearbySearch) { layer.nearbySearch(placeSearchRequest, options.nearbySearch); } } //textSearch callback if(options.textSearch) { var textSearchRequest = { bounds : options.bounds || null, location : options.location || null, query : options.query || null, radius : options.radius || null }; layer.textSearch(textSearchRequest, options.textSearch); } break; } if(layer !== undefined) { if(typeof layer.setOptions == 'function') { layer.setOptions(options); } if(typeof layer.setMap == 'function') { layer.setMap(this.map); } return layer; } }; this.removeLayer = function(layerName) { if(this.singleLayers[layerName] !== undefined) { this.singleLayers[layerName].setMap(null); delete this.singleLayers[layerName]; } }; // Static Maps this.toImage = function(options) { var options = options || {}; var static_map_options = {}; static_map_options['size'] = options['size'] || [this.el.clientWidth, this.el.clientHeight]; static_map_options['lat'] = this.getCenter().lat(); static_map_options['lng'] = this.getCenter().lng(); if(this.markers.length > 0) { static_map_options['markers'] = []; for(var i=0; i < this.markers.length; i++) { static_map_options['markers'].push({ lat: this.markers[i].getPosition().lat(), lng: this.markers[i].getPosition().lng() }); } } if(this.polylines.length > 0) { var polyline = this.polylines[0]; static_map_options['polyline'] = {}; static_map_options['polyline']['path'] = google.maps.geometry.encoding.encodePath(polyline.getPath()); static_map_options['polyline']['strokeColor'] = polyline.strokeColor static_map_options['polyline']['strokeOpacity'] = polyline.strokeOpacity static_map_options['polyline']['strokeWeight'] = polyline.strokeWeight } return GMaps.staticMapURL(static_map_options); }; // Map Types this.addMapType = function(mapTypeId, options) { if(options.hasOwnProperty("getTileUrl") && typeof(options["getTileUrl"]) == "function") { options.tileSize = options.tileSize || new google.maps.Size(256, 256); var mapType = new google.maps.ImageMapType(options); this.map.mapTypes.set(mapTypeId, mapType); } else { throw "'getTileUrl' function required."; } }; this.addOverlayMapType = function(options) { if(options.hasOwnProperty("getTile") && typeof(options["getTile"]) == "function") { var overlayMapTypeIndex = options.index; delete options.index; this.map.overlayMapTypes.insertAt(overlayMapTypeIndex, options); } else { throw "'getTile' function required."; } }; this.removeOverlayMapType = function(overlayMapTypeIndex) { this.map.overlayMapTypes.removeAt(overlayMapTypeIndex); }; // Styles this.addStyle = function(options) { var styledMapType = new google.maps.StyledMapType(options.styles, options.styledMapName); this.map.mapTypes.set(options.mapTypeId, styledMapType); }; this.setStyle = function(mapTypeId) { this.map.setMapTypeId(mapTypeId); }; // StreetView this.createPanorama = function(streetview_options) { if (!streetview_options.hasOwnProperty('lat') || !streetview_options.hasOwnProperty('lng')) { streetview_options.lat = this.getCenter().lat(); streetview_options.lng = this.getCenter().lng(); } this.panorama = GMaps.createPanorama(streetview_options); this.map.setStreetView(this.panorama); return this.panorama; }; // Events this.on = function(event_name, handler) { return GMaps.on(event_name, this, handler); }; this.off = function(event_name) { GMaps.off(event_name, this); }; }; GMaps.createPanorama = function(options) { var el = getElementById(options.el, options.context); options.position = new google.maps.LatLng(options.lat, options.lng); delete options.el; delete options.context; delete options.lat; delete options.lng; var streetview_events = ['closeclick', 'links_changed', 'pano_changed', 'position_changed', 'pov_changed', 'resize', 'visible_changed']; var streetview_options = extend_object({visible : true}, options); for(var i = 0; i < streetview_events.length; i++) { delete streetview_options[streetview_events[i]]; } var panorama = new google.maps.StreetViewPanorama(el, streetview_options); for(var i = 0; i < streetview_events.length; i++) { (function(object, name) { if (options[name]) { google.maps.event.addListener(object, name, function(){ options[name].apply(this); }); } })(panorama, streetview_events[i]); } return panorama; }; GMaps.Route = function(options) { this.map = options.map; this.route = options.route; this.step_count = 0; this.steps = this.route.legs[0].steps; this.steps_length = this.steps.length; this.polyline = this.map.drawPolyline({ path: new google.maps.MVCArray(), strokeColor: options.strokeColor, strokeOpacity: options.strokeOpacity, strokeWeight: options.strokeWeight }).getPath(); this.back = function() { if (this.step_count > 0) { this.step_count--; var path = this.route.legs[0].steps[this.step_count].path; for (var p in path){ if (path.hasOwnProperty(p)){ this.polyline.pop(); } } } }; this.forward = function() { if (this.step_count < this.steps_length) { var path = this.route.legs[0].steps[this.step_count].path; for (var p in path){ if (path.hasOwnProperty(p)){ this.polyline.push(path[p]); } } this.step_count++; } }; }; // Geolocation (Modern browsers only) GMaps.geolocate = function(options) { var complete_callback = options.always || options.complete; if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { options.success(position); if (complete_callback) { complete_callback(); } }, function(error) { options.error(error); if (complete_callback) { complete_callback(); } }, options.options); } else { options.not_supported(); if (complete_callback) { complete_callback(); } } }; // Geocoding GMaps.geocode = function(options) { this.geocoder = new google.maps.Geocoder(); var callback = options.callback; if (options.hasOwnProperty('lat') && options.hasOwnProperty('lng')) { options.latLng = new google.maps.LatLng(options.lat, options.lng); } delete options.lat; delete options.lng; delete options.callback; this.geocoder.geocode(options, function(results, status) { callback(results, status); }); }; // Static maps GMaps.staticMapURL = function(options){ var parameters = []; var data; var static_root = 'http://maps.googleapis.com/maps/api/staticmap'; if (options.url){ static_root = options.url; delete options.url; } static_root += '?'; var markers = options.markers; delete options.markers; if (!markers && options.marker){ markers = [options.marker]; delete options.marker; } var polyline = options.polyline; delete options.polyline; /** Map options **/ if (options.center){ parameters.push('center=' + options.center); delete options.center; } else if (options.address){ parameters.push('center=' + options.address); delete options.address; } else if (options.lat){ parameters.push(['center=', options.lat, ',', options.lng].join('')); delete options.lat; delete options.lng; } else if (options.visible){ var visible = encodeURI(options.visible.join('|')); parameters.push('visible=' + visible); } var size = options.size; if (size){ if (size.join){ size = size.join('x'); } delete options.size; } else { size = '630x300'; } parameters.push('size=' + size); if (!options.zoom){ options.zoom = 15; } var sensor = options.hasOwnProperty('sensor') ? !!options.sensor : true; delete options.sensor; parameters.push('sensor=' + sensor); for (var param in options){ if (options.hasOwnProperty(param)){ parameters.push(param + '=' + options[param]); } } /** Markers **/ if (markers){ var marker, loc; for (var i=0; data=markers[i]; i++){ marker = []; if (data.size && data.size !== 'normal'){ marker.push('size:' + data.size); } else if (data.icon){ marker.push('icon:' + encodeURI(data.icon)); } if (data.color){ marker.push('color:' + data.color.replace('#', '0x')); } if (data.label){ marker.push('label:' + data.label[0].toUpperCase()); } loc = (data.address ? data.address : data.lat + ',' + data.lng); if (marker.length || i === 0){ marker.push(loc); marker = marker.join('|'); parameters.push('markers=' + encodeURI(marker)); } // New marker without styles else { marker = parameters.pop() + encodeURI('|' + loc); parameters.push(marker); } } } /** Polylines **/ function parseColor(color, opacity){ if (color[0] === '#'){ color = color.replace('#', '0x'); if (opacity){ opacity = parseFloat(opacity); opacity = Math.min(1, Math.max(opacity, 0)); if (opacity === 0){ return '0x00000000'; } opacity = (opacity * 255).toString(16); if (opacity.length === 1){ opacity += opacity; } color = color.slice(0,8) + opacity; } } return color; } if (polyline){ data = polyline; polyline = []; if (data.strokeWeight){ polyline.push('weight:' + parseInt(data.strokeWeight, 10)); } if (data.strokeColor){ var color = parseColor(data.strokeColor, data.strokeOpacity); polyline.push('color:' + color); } if (data.fillColor){ var fillcolor = parseColor(data.fillColor, data.fillOpacity); polyline.push('fillcolor:' + fillcolor); } var path = data.path; if (path.join){ for (var j=0, pos; pos=path[j]; j++){ polyline.push(pos.join(',')); } } else { polyline.push('enc:' + path); } polyline = polyline.join('|'); parameters.push('path=' + encodeURI(polyline)); } parameters = parameters.join('&'); return static_root + parameters; }; // Events GMaps.custom_events = ['marker_added', 'marker_removed', 'polyline_added', 'polyline_removed', 'polygon_added', 'polygon_removed', 'geolocated', 'geolocation_failed']; GMaps.on = function(event_name, object, handler) { if (GMaps.custom_events.indexOf(event_name) == -1) { return google.maps.event.addListener(object, event_name, handler); } else { var registered_event = { handler : handler, eventName : event_name }; object.registered_events[event_name] = object.registered_events[event_name] || []; object.registered_events[event_name].push(registered_event); return registered_event; } }; GMaps.off = function(event_name, object) { if (GMaps.custom_events.indexOf(event_name) == -1) { google.maps.event.clearListeners(object, event_name); } else { object.registered_events[event_name] = []; } }; GMaps.fire = function(event_name, object, scope) { if (GMaps.custom_events.indexOf(event_name) == -1) { google.maps.event.trigger(object, event_name, Array.prototype.slice.apply(arguments).slice(2)); } else { if(event_name in scope.registered_events) { var firing_events = scope.registered_events[event_name]; for(var i = 0; i < firing_events.length; i++) { (function(handler, scope, object) { handler.apply(scope, [object]); })(firing_events[i]['handler'], scope, object); } } } }; //========================== // Polygon containsLatLng // https://github.com/tparkin/Google-Maps-Point-in-Polygon // Poygon getBounds extension - google-maps-extensions // http://code.google.com/p/google-maps-extensions/source/browse/google.maps.Polygon.getBounds.js if (!google.maps.Polygon.prototype.getBounds) { google.maps.Polygon.prototype.getBounds = function(latLng) { var bounds = new google.maps.LatLngBounds(); var paths = this.getPaths(); var path; for (var p = 0; p < paths.getLength(); p++) { path = paths.getAt(p); for (var i = 0; i < path.getLength(); i++) { bounds.extend(path.getAt(i)); } } return bounds; }; } if (!google.maps.Polygon.prototype.containsLatLng) { // Polygon containsLatLng - method to determine if a latLng is within a polygon google.maps.Polygon.prototype.containsLatLng = function(latLng) { // Exclude points outside of bounds as there is no way they are in the poly var bounds = this.getBounds(); if (bounds !== null && !bounds.contains(latLng)) { return false; } // Raycast point in polygon method var inPoly = false; var numPaths = this.getPaths().getLength(); for (var p = 0; p < numPaths; p++) { var path = this.getPaths().getAt(p); var numPoints = path.getLength(); var j = numPoints - 1; for (var i = 0; i < numPoints; i++) { var vertex1 = path.getAt(i); var vertex2 = path.getAt(j); if (vertex1.lng() < latLng.lng() && vertex2.lng() >= latLng.lng() || vertex2.lng() < latLng.lng() && vertex1.lng() >= latLng.lng()) { if (vertex1.lat() + (latLng.lng() - vertex1.lng()) / (vertex2.lng() - vertex1.lng()) * (vertex2.lat() - vertex1.lat()) < latLng.lat()) { inPoly = !inPoly; } } j = i; } } return inPoly; }; } google.maps.LatLngBounds.prototype.containsLatLng = function(latLng) { return this.contains(latLng); }; google.maps.Marker.prototype.setFences = function(fences) { this.fences = fences; }; google.maps.Marker.prototype.addFence = function(fence) { this.fences.push(fence); }; return GMaps; }(this)); var coordsToLatLngs = function(coords, useGeoJSON) { var first_coord = coords[0]; var second_coord = coords[1]; if(useGeoJSON) { first_coord = coords[1]; second_coord = coords[0]; } return new google.maps.LatLng(first_coord, second_coord); }; var arrayToLatLng = function(coords, useGeoJSON) { for(var i=0; i < coords.length; i++) { if(coords[i].length > 0 && typeof(coords[i][0]) != "number") { coords[i] = arrayToLatLng(coords[i], useGeoJSON); } else { coords[i] = coordsToLatLngs(coords[i], useGeoJSON); } } return coords; }; var extend_object = function(obj, new_obj) { if(obj === new_obj) return obj; for(var name in new_obj) { obj[name] = new_obj[name]; } return obj; }; var replace_object = function(obj, replace) { if(obj === replace) return obj; for(var name in replace) { if(obj[name] != undefined) obj[name] = replace[name]; } return obj; }; var array_map = function(array, callback) { var original_callback_params = Array.prototype.slice.call(arguments, 2); if (Array.prototype.map && array.map === Array.prototype.map) { return Array.prototype.map.call(array, function(item) { callback_params = original_callback_params; callback_params.splice(0, 0, item); return callback.apply(this, callback_params); }); } else { var array_return = []; var array_length = array.length; for(var i = 0; i < array_length; i++) { callback_params = original_callback_params; callback_params = callback_params.splice(0, 0, array[i]); array_return.push(callback.apply(this, callback_params)); } return array_return; } }; var array_flat = function(array) { new_array = []; for(var i=0; i < array.length; i++) { new_array = new_array.concat(array[i]); } return new_array; }; } else { throw 'Google Maps API is required. Please register the following JavaScript library http://maps.google.com/maps/api/js?sensor=true.' }
import {findDOMNode} from '../../../find-dom-node'; const React = window.React; export class CodeEditor extends React.Component { shouldComponentUpdate() { return false; } componentDidMount() { this.textarea = findDOMNode(this); // Important: CodeMirror incorrectly lays out the editor // if it executes before CSS has loaded // https://github.com/graphql/graphiql/issues/33#issuecomment-318188555 Promise.all([ import('codemirror'), import('codemirror/mode/jsx/jsx'), import('codemirror/lib/codemirror.css'), import('./codemirror-paraiso-dark.css'), ]).then(([CodeMirror]) => this.install(CodeMirror)); } install(CodeMirror) { if (!this.textarea) { return; } const {onChange} = this.props; this.editor = CodeMirror.fromTextArea(this.textarea, { mode: 'jsx', theme: 'paraiso-dark', lineNumbers: true, }); this.editor.on('change', function(doc) { onChange(doc.getValue()); }); } componentWillUnmount() { if (this.editor) { this.editor.toTextArea(); } } render() { return ( <textarea defaultValue={this.props.code} autoComplete="off" hidden={true} /> ); } } /** * Prevent IE9 from raising an error on an unrecognized element: * See https://github.com/facebook/react/issues/13610 */ const supportsDetails = !( document.createElement('details') instanceof HTMLUnknownElement ); export class CodeError extends React.Component { render() { const {error, className} = this.props; if (!error) { return null; } if (supportsDetails) { const [summary, ...body] = error.message.split(/\n+/g); if (body.length >= 0) { return <div className={className}>{summary}</div>; } return ( <details className={className}> <summary>{summary}</summary> {body.join('\n')} </details> ); } return <div className={className}>{error.message}</div>; } }
(function ($) { $.fn.rating = function () { var element; // A private function to highlight a star corresponding to a given value function _paintValue(ratingInput, value) { var selectedStar = $(ratingInput).find('[data-value=' + value + ']'); selectedStar.removeClass('glyphicon-star-empty').addClass('glyphicon-star'); selectedStar.prevAll('[data-value]').removeClass('glyphicon-star-empty').addClass('glyphicon-star'); selectedStar.nextAll('[data-value]').removeClass('glyphicon-star').addClass('glyphicon-star-empty'); } // A private function to remove the selected rating function _clearValue(ratingInput) { var self = $(ratingInput); self.find('[data-value]').removeClass('glyphicon-star').addClass('glyphicon-star-empty'); self.find('.rating-clear').hide(); self.find('input').val('').trigger('change'); } // Iterate and transform all selected inputs for (element = this.length - 1; element >= 0; element--) { var el, i, ratingInputs, originalInput = $(this[element]), max = originalInput.data('max') || 5, min = originalInput.data('min') || 0, clearable = originalInput.data('clearable') || null, stars = ''; // HTML element construction for (i = min; i <= max; i++) { // Create <max> empty stars stars += ['<span class="glyphicon glyphicon-star-empty" data-value="', i, '"></span>'].join(''); } // Add a clear link if clearable option is set if (clearable) { stars += [ ' <a class="rating-clear" style="display:none;" href="javascript:void">', '<span class="glyphicon glyphicon-remove"></span> ', clearable, '</a>'].join(''); } el = [ // Rating widget is wrapped inside a div '<div class="rating-input">', stars, // Value will be hold in a hidden input with same name and id than original input so the form will still work '<input type="hidden" name="', originalInput.attr('name'), '" value="', originalInput.val(), '" id="', originalInput.attr('id'), '" />', '</div>'].join(''); // Replace original inputs HTML with the new one originalInput.replaceWith(el); } // Give live to the newly generated widgets $('.rating-input') // Highlight stars on hovering .on('mouseenter', '[data-value]', function () { var self = $(this); _paintValue(self.closest('.rating-input'), self.data('value')); }) // View current value while mouse is out .on('mouseleave', '[data-value]', function () { var self = $(this); var val = self.siblings('input').val(); if (val) { _paintValue(self.closest('.rating-input'), val); } else { _clearValue(self.closest('.rating-input')); } }) // Set the selected value to the hidden field .on('click', '[data-value]', function (e) { var self = $(this); var val = self.data('value'); self.siblings('input').val(val).trigger('change'); self.siblings('.rating-clear').show(); e.preventDefault(); false }) // Remove value on clear .on('click', '.rating-clear', function (e) { _clearValue($(this).closest('.rating-input')); e.preventDefault(); false }) // Initialize view with default value .each(function () { var val = $(this).find('input').val(); if (val) { _paintValue(this, val); $(this).find('.rating-clear').show(); } }); }; // Auto apply conversion of number fields with class 'rating' into rating-fields $(function () { if ($('input.rating[type=number]').length > 0) { $('input.rating[type=number]').rating(); } }); }(jQuery));
;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"), require("./sha384"), require("./hmac")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./x64-core", "./sha512", "./sha384", "./hmac"], factory); } else { // Global (browser) factory(); } }(this, function (CryptoJS) { return CryptoJS.HmacSHA384; }));
/*! lowdb v0.12.4 */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["low"] = factory(); else root["low"] = factory(); })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // Entry point for standalone build var index = __webpack_require__(1); index.localStorage = __webpack_require__(5); module.exports = index; /***/ }, /* 1 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var lodash = __webpack_require__(2); var isPromise = __webpack_require__(4); // Returns a lodash chain that calls .value() // automatically after the first .method() // // It also returns a promise or value // // For example: // lowChain(_, array, save).method() // // is the same as: // _.chain(array).method().value() function lowChain(_, array, save) { var chain = _.chain(array); _.functionsIn(chain).forEach(function (method) { chain[method] = _.flow(chain[method], function (arg) { var v = undefined; if (arg) { v = _.isFunction(arg.value) ? arg.value() : arg; } var s = save(); if (s) return s.then(function () { return Promise.resolve(v); }); return v; }); }); return chain; } function low(source) { var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; var writeOnChange = arguments.length <= 2 || arguments[2] === undefined ? true : arguments[2]; // Create a fresh copy of lodash var _ = lodash.runInContext(); if (source) { if (options.storage) { (function () { var storage = options.storage; if (storage.read) { db.read = function () { var s = arguments.length <= 0 || arguments[0] === undefined ? source : arguments[0]; var res = storage.read(s, db.deserialize); if (isPromise(res)) { return res.then(function (obj) { db.object = obj; db._checksum = JSON.stringify(db.object); return db; }); } db.object = res; db._checksum = JSON.stringify(db.object); return db; }; } if (storage.write) { db.write = function () { var dest = arguments.length <= 0 || arguments[0] === undefined ? source : arguments[0]; return storage.write(dest, db.object, db.serialize); }; } })(); } if (options.format) { var format = options.format; db.serialize = format.serialize; db.deserialize = format.deserialize; } } // Modify value function to call save before returning result _.prototype.value = _.wrap(_.prototype.value, function (value) { var v = value.apply(this); var s = _save(); if (s) return s.then(function () { return Promise.resolve(v); }); return v; }); // Return a promise or nothing in sync mode or if the database hasn't changed function _save() { if (db.source && db.write && writeOnChange) { var str = JSON.stringify(db.object); if (str !== db._checksum) { db._checksum = str; return db.write(db.source, db.object); } } } function db(key) { var array = db.object[key] = db.object[key] || []; var short = lowChain(_, array, _save); short.chain = function () { return _.chain(array); }; return short; } // Expose db._ = _; db.object = {}; db.source = source; // Init if (db.read) { return db.read(); } else { return db; } } module.exports = low; /***/ }, /* 2 */ /***/ function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {/** * @license * lodash 4.5.0 (Custom Build) <https://lodash.com/> * Build: `lodash -d -o ./foo/lodash.js` * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ ;(function() { /** Used as a safe reference for `undefined` in pre-ES5 environments. */ var undefined; /** Used as the semantic version number. */ var VERSION = '4.5.0'; /** Used to compose bitmasks for wrapper metadata. */ var BIND_FLAG = 1, BIND_KEY_FLAG = 2, CURRY_BOUND_FLAG = 4, CURRY_FLAG = 8, CURRY_RIGHT_FLAG = 16, PARTIAL_FLAG = 32, PARTIAL_RIGHT_FLAG = 64, ARY_FLAG = 128, REARG_FLAG = 256, FLIP_FLAG = 512; /** Used to compose bitmasks for comparison styles. */ var UNORDERED_COMPARE_FLAG = 1, PARTIAL_COMPARE_FLAG = 2; /** Used as default options for `_.truncate`. */ var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = '...'; /** Used to detect hot functions by number of calls within a span of milliseconds. */ var HOT_COUNT = 150, HOT_SPAN = 16; /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; /** Used to indicate the type of lazy iteratees. */ var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3; /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 1.7976931348623157e+308, NAN = 0 / 0; /** Used as references for the maximum length and index of an array. */ var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; /** Used as the internal argument placeholder. */ var PLACEHOLDER = '__lodash_placeholder__'; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', mapTag = '[object Map]', numberTag = '[object Number]', objectTag = '[object Object]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', symbolTag = '[object Symbol]', weakMapTag = '[object WeakMap]', weakSetTag = '[object WeakSet]'; var arrayBufferTag = '[object ArrayBuffer]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; /** 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 HTML entities and HTML characters. */ var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g, reUnescapedHtml = /[&<>"'`]/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source); /** Used to match template delimiters. */ var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g; /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; /** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source); /** Used to match leading and trailing whitespace. */ var reTrim = /^\s+|\s+$/g, reTrimStart = /^\s+/, reTrimEnd = /\s+$/; /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; /** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; /** Used to match `RegExp` flags from their coerced string values. */ var reFlags = /\w*$/; /** Used to detect hexadecimal string values. */ var reHasHexPrefix = /^0x/i; /** Used to detect bad signed hexadecimal string values. */ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; /** Used to detect binary string values. */ var reIsBinary = /^0b[01]+$/i; /** Used to detect host constructors (Safari > 5). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; /** Used to match latin-1 supplementary letters (excluding mathematical operators). */ var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g; /** Used to ensure capturing order of template delimiters. */ var reNoMatch = /($^)/; /** Used to match unescaped characters in compiled string literals. */ var reUnescapedString = /['\n\r\u2028\u2029\\]/g; /** Used to compose unicode character classes. */ var rsAstralRange = '\\ud800-\\udfff', rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', rsComboSymbolsRange = '\\u20d0-\\u20f0', rsDingbatRange = '\\u2700-\\u27bf', rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', rsQuoteRange = '\\u2018\\u2019\\u201c\\u201d', rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', rsVarRange = '\\ufe0e\\ufe0f', rsBreakRange = rsMathOpRange + rsNonCharRange + rsQuoteRange + rsSpaceRange; /** Used to compose unicode capture groups. */ var rsAstral = '[' + rsAstralRange + ']', rsBreak = '[' + rsBreakRange + ']', rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', rsDigits = '\\d+', rsDingbat = '[' + rsDingbatRange + ']', rsLower = '[' + rsLowerRange + ']', rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', rsFitz = '\\ud83c[\\udffb-\\udfff]', rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', rsNonAstral = '[^' + rsAstralRange + ']', rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', rsUpper = '[' + rsUpperRange + ']', rsZWJ = '\\u200d'; /** Used to compose unicode regexes. */ var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')', rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')', reOptMod = rsModifier + '?', rsOptVar = '[' + rsVarRange + ']?', rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; /** * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). */ var reComboMark = RegExp(rsCombo, 'g'); /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); /** Used to match non-compound words composed of alphanumeric characters. */ var reBasicWord = /[a-zA-Z0-9]+/g; /** Used to match complex or compound words. */ var reComplexWord = RegExp([ rsUpper + '?' + rsLower + '+(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', rsUpperMisc + '+(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')', rsUpper + '?' + rsLowerMisc + '+', rsUpper + '+', rsDigits, rsEmoji ].join('|'), 'g'); /** Used to detect strings that need a more robust regexp to match words. */ var reHasComplexWord = /[a-z][A-Z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; /** Used to assign default `context` object properties. */ var contextProps = [ 'Array', 'Buffer', 'Date', 'Error', 'Float32Array', 'Float64Array', 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' ]; /** Used to make template sourceURLs easier to identify. */ var templateCounter = -1; /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; /** Used to map latin-1 supplementary letters to basic latin letters. */ var deburredLetters = { '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', '\xc7': 'C', '\xe7': 'c', '\xd0': 'D', '\xf0': 'd', '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', '\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', '\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', '\xd1': 'N', '\xf1': 'n', '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', '\xc6': 'Ae', '\xe6': 'ae', '\xde': 'Th', '\xfe': 'th', '\xdf': 'ss' }; /** Used to map characters to HTML entities. */ var htmlEscapes = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;', '`': '&#96;' }; /** Used to map HTML entities to characters. */ var htmlUnescapes = { '&amp;': '&', '&lt;': '<', '&gt;': '>', '&quot;': '"', '&#39;': "'", '&#96;': '`' }; /** Used to determine if values are of the language type `Object`. */ var objectTypes = { 'function': true, 'object': true }; /** Used to escape characters for inclusion in compiled string literals. */ var stringEscapes = { '\\': '\\', "'": "'", '\n': 'n', '\r': 'r', '\u2028': 'u2028', '\u2029': 'u2029' }; /** Built-in method references without a dependency on `root`. */ var freeParseFloat = parseFloat, freeParseInt = parseInt; /** Detect free variable `exports`. */ var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : undefined; /** Detect free variable `module`. */ var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : undefined; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : undefined; /** Detect free variable `global` from Node.js. */ var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); /** Detect free variable `self`. */ var freeSelf = checkGlobal(objectTypes[typeof self] && self); /** Detect free variable `window`. */ var freeWindow = checkGlobal(objectTypes[typeof window] && window); /** Detect `this` as the global object. */ var thisGlobal = checkGlobal(objectTypes[typeof this] && this); /** * Used as a reference to the global object. * * The `this` value is used if it's the global object to avoid Greasemonkey's * restricted `window` object, otherwise the `window` object is used. */ var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); /*--------------------------------------------------------------------------*/ /** * Adds the key-value `pair` to `map`. * * @private * @param {Object} map The map to modify. * @param {Array} pair The key-value pair to add. * @returns {Object} Returns `map`. */ function addMapEntry(map, pair) { map.set(pair[0], pair[1]); return map; } /** * Adds `value` to `set`. * * @private * @param {Object} set The set to modify. * @param {*} value The value to add. * @returns {Object} Returns `set`. */ function addSetEntry(set, value) { set.add(value); return set; } /** * A faster alternative to `Function#apply`, this function invokes `func` * with the `this` binding of `thisArg` and the arguments of `args`. * * @private * @param {Function} func The function to invoke. * @param {*} thisArg The `this` binding of `func`. * @param {...*} args The arguments to invoke `func` with. * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { var length = args.length; switch (length) { case 0: return func.call(thisArg); case 1: return func.call(thisArg, args[0]); case 2: return func.call(thisArg, args[0], args[1]); case 3: return func.call(thisArg, args[0], args[1], args[2]); } return func.apply(thisArg, args); } /** * A specialized version of `baseAggregator` for arrays. * * @private * @param {Array} array The array to iterate over. * @param {Function} setter The function to set `accumulator` values. * @param {Function} iteratee The iteratee to transform keys. * @param {Object} accumulator The initial aggregated object. * @returns {Function} Returns `accumulator`. */ function arrayAggregator(array, setter, iteratee, accumulator) { var index = -1, length = array.length; while (++index < length) { var value = array[index]; setter(accumulator, value, iteratee(value), array); } return accumulator; } /** * Creates a new array concatenating `array` with `other`. * * @private * @param {Array} array The first array to concatenate. * @param {Array} other The second array to concatenate. * @returns {Array} Returns the new concatenated array. */ function arrayConcat(array, other) { var index = -1, length = array.length, othIndex = -1, othLength = other.length, result = Array(length + othLength); while (++index < length) { result[index] = array[index]; } while (++othIndex < othLength) { result[index++] = other[othIndex]; } return result; } /** * A specialized version of `_.forEach` for arrays without support for * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEach(array, iteratee) { var index = -1, length = array.length; while (++index < length) { if (iteratee(array[index], index, array) === false) { break; } } return array; } /** * A specialized version of `_.forEachRight` for arrays without support for * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEachRight(array, iteratee) { var length = array.length; while (length--) { if (iteratee(array[length], length, array) === false) { break; } } return array; } /** * A specialized version of `_.every` for arrays without support for * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`. */ function arrayEvery(array, predicate) { var index = -1, length = array.length; while (++index < length) { if (!predicate(array[index], index, array)) { return false; } } return true; } /** * A specialized version of `_.filter` for arrays without support for * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { var index = -1, length = array.length, resIndex = -1, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result[++resIndex] = value; } } return result; } /** * A specialized version of `_.includes` for arrays without support for * specifying an index to search from. * * @private * @param {Array} array The array to search. * @param {*} target The value to search for. * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludes(array, value) { return !!array.length && baseIndexOf(array, value, 0) > -1; } /** * A specialized version of `_.includesWith` for arrays without support for * specifying an index to search from. * * @private * @param {Array} array The array to search. * @param {*} target The value to search for. * @param {Function} comparator The comparator invoked per element. * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludesWith(array, value, comparator) { var index = -1, length = array.length; while (++index < length) { if (comparator(value, array[index])) { return true; } } return false; } /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, length = array.length, result = Array(length); while (++index < length) { result[index] = iteratee(array[index], index, array); } return result; } /** * Appends the elements of `values` to `array`. * * @private * @param {Array} array The array to modify. * @param {Array} values The values to append. * @returns {Array} Returns `array`. */ function arrayPush(array, values) { var index = -1, length = values.length, offset = array.length; while (++index < length) { array[offset + index] = values[index]; } return array; } /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the first element of `array` as the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduce(array, iteratee, accumulator, initAccum) { var index = -1, length = array.length; if (initAccum && length) { accumulator = array[++index]; } while (++index < length) { accumulator = iteratee(accumulator, array[index], index, array); } return accumulator; } /** * A specialized version of `_.reduceRight` for arrays without support for * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the last element of `array` as the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduceRight(array, iteratee, accumulator, initAccum) { var length = array.length; if (initAccum && length) { accumulator = array[--length]; } while (length--) { accumulator = iteratee(accumulator, array[length], length, array); } return accumulator; } /** * A specialized version of `_.some` for arrays without support for iteratee * shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. */ function arraySome(array, predicate) { var index = -1, length = array.length; while (++index < length) { if (predicate(array[index], index, array)) { return true; } } return false; } /** * The base implementation of methods like `_.max` and `_.min` which accepts a * `comparator` to determine the extremum value. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The iteratee invoked per iteration. * @param {Function} comparator The comparator used to compare values. * @returns {*} Returns the extremum value. */ function baseExtremum(array, iteratee, comparator) { var index = -1, length = array.length; while (++index < length) { var value = array[index], current = iteratee(value); if (current != null && (computed === undefined ? current === current : comparator(current, computed) )) { var computed = current, result = value; } } return result; } /** * The base implementation of methods like `_.find` and `_.findKey`, without * support for iteratee shorthands, which iterates over `collection` using * `eachFunc`. * * @private * @param {Array|Object} collection The collection to search. * @param {Function} predicate The function invoked per iteration. * @param {Function} eachFunc The function to iterate over `collection`. * @param {boolean} [retKey] Specify returning the key of the found element instead of the element itself. * @returns {*} Returns the found element or its key, else `undefined`. */ function baseFind(collection, predicate, eachFunc, retKey) { var result; eachFunc(collection, function(value, key, collection) { if (predicate(value, key, collection)) { result = retKey ? key : value; return false; } }); return result; } /** * The base implementation of `_.findIndex` and `_.findLastIndex` without * support for iteratee shorthands. * * @private * @param {Array} array The array to search. * @param {Function} predicate The function invoked per iteration. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {number} Returns the index of the matched value, else `-1`. */ function baseFindIndex(array, predicate, fromRight) { var length = array.length, index = fromRight ? length : -1; while ((fromRight ? index-- : ++index < length)) { if (predicate(array[index], index, array)) { return index; } } return -1; } /** * The base implementation of `_.indexOf` without `fromIndex` bounds checks. * * @private * @param {Array} array The array to search. * @param {*} value The value to search for. * @param {number} fromIndex The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOf(array, value, fromIndex) { if (value !== value) { return indexOfNaN(array, fromIndex); } var index = fromIndex - 1, length = array.length; while (++index < length) { if (array[index] === value) { return index; } } return -1; } /** * The base implementation of `_.reduce` and `_.reduceRight`, without support * for iteratee shorthands, which iterates over `collection` using `eachFunc`. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} accumulator The initial value. * @param {boolean} initAccum Specify using the first or last element of `collection` as the initial value. * @param {Function} eachFunc The function to iterate over `collection`. * @returns {*} Returns the accumulated value. */ function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { eachFunc(collection, function(value, index, collection) { accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection); }); return accumulator; } /** * The base implementation of `_.sortBy` which uses `comparer` to define * the sort order of `array` and replaces criteria objects with their * corresponding values. * * @private * @param {Array} array The array to sort. * @param {Function} comparer The function to define sort order. * @returns {Array} Returns `array`. */ function baseSortBy(array, comparer) { var length = array.length; array.sort(comparer); while (length--) { array[length] = array[length].value; } return array; } /** * The base implementation of `_.sum` without support for iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {number} Returns the sum. */ function baseSum(array, iteratee) { var result, index = -1, length = array.length; while (++index < length) { var current = iteratee(array[index]); if (current !== undefined) { result = result === undefined ? current : (result + current); } } return result; } /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. * * @private * @param {number} n The number of times to invoke `iteratee`. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the array of results. */ function baseTimes(n, iteratee) { var index = -1, result = Array(n); while (++index < n) { result[index] = iteratee(index); } return result; } /** * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array * of key-value pairs for `object` corresponding to the property names of `props`. * * @private * @param {Object} object The object to query. * @param {Array} props The property names to get values for. * @returns {Object} Returns the new array of key-value pairs. */ function baseToPairs(object, props) { return arrayMap(props, function(key) { return [key, object[key]]; }); } /** * The base implementation of `_.unary` without support for storing wrapper metadata. * * @private * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new function. */ function baseUnary(func) { return function(value) { return func(value); }; } /** * The base implementation of `_.values` and `_.valuesIn` which creates an * array of `object` property values corresponding to the property names * of `props`. * * @private * @param {Object} object The object to query. * @param {Array} props The property names to get values for. * @returns {Object} Returns the array of property values. */ function baseValues(object, props) { return arrayMap(props, function(key) { return object[key]; }); } /** * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol * that is not found in the character symbols. * * @private * @param {Array} strSymbols The string symbols to inspect. * @param {Array} chrSymbols The character symbols to find. * @returns {number} Returns the index of the first unmatched string symbol. */ function charsStartIndex(strSymbols, chrSymbols) { var index = -1, length = strSymbols.length; while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} return index; } /** * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol * that is not found in the character symbols. * * @private * @param {Array} strSymbols The string symbols to inspect. * @param {Array} chrSymbols The character symbols to find. * @returns {number} Returns the index of the last unmatched string symbol. */ function charsEndIndex(strSymbols, chrSymbols) { var index = strSymbols.length; while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} return index; } /** * Checks if `value` is a global object. * * @private * @param {*} value The value to check. * @returns {null|Object} Returns `value` if it's a global object, else `null`. */ function checkGlobal(value) { return (value && value.Object === Object) ? value : null; } /** * Compares values to sort them in ascending order. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {number} Returns the sort order indicator for `value`. */ function compareAscending(value, other) { if (value !== other) { var valIsNull = value === null, valIsUndef = value === undefined, valIsReflexive = value === value; var othIsNull = other === null, othIsUndef = other === undefined, othIsReflexive = other === other; if ((value > other && !othIsNull) || !valIsReflexive || (valIsNull && !othIsUndef && othIsReflexive) || (valIsUndef && othIsReflexive)) { return 1; } if ((value < other && !valIsNull) || !othIsReflexive || (othIsNull && !valIsUndef && valIsReflexive) || (othIsUndef && valIsReflexive)) { return -1; } } return 0; } /** * Used by `_.orderBy` to compare multiple properties of a value to another * and stable sort them. * * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, * specify an order of "desc" for descending or "asc" for ascending sort order * of corresponding values. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {boolean[]|string[]} orders The order to sort by for each property. * @returns {number} Returns the sort order indicator for `object`. */ function compareMultiple(object, other, orders) { var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length; while (++index < length) { var result = compareAscending(objCriteria[index], othCriteria[index]); if (result) { if (index >= ordersLength) { return result; } var order = orders[index]; return result * (order == 'desc' ? -1 : 1); } } // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications // that causes it, under certain circumstances, to provide the same value for // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 // for more details. // // This also ensures a stable sort in V8 and other engines. // See https://code.google.com/p/v8/issues/detail?id=90 for more details. return object.index - other.index; } /** * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters. * * @private * @param {string} letter The matched letter to deburr. * @returns {string} Returns the deburred letter. */ function deburrLetter(letter) { return deburredLetters[letter]; } /** * Used by `_.escape` to convert characters to HTML entities. * * @private * @param {string} chr The matched character to escape. * @returns {string} Returns the escaped character. */ function escapeHtmlChar(chr) { return htmlEscapes[chr]; } /** * Used by `_.template` to escape characters for inclusion in compiled string literals. * * @private * @param {string} chr The matched character to escape. * @returns {string} Returns the escaped character. */ function escapeStringChar(chr) { return '\\' + stringEscapes[chr]; } /** * Gets the index at which the first occurrence of `NaN` is found in `array`. * * @private * @param {Array} array The array to search. * @param {number} fromIndex The index to search from. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {number} Returns the index of the matched `NaN`, else `-1`. */ function indexOfNaN(array, fromIndex, fromRight) { var length = array.length, index = fromIndex + (fromRight ? 0 : -1); while ((fromRight ? index-- : ++index < length)) { var other = array[index]; if (other !== other) { return index; } } return -1; } /** * Checks if `value` is a host object in IE < 9. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a host object, else `false`. */ function isHostObject(value) { // Many host objects are `Object` objects that can coerce to strings // despite having improperly defined `toString` methods. var result = false; if (value != null && typeof value.toString != 'function') { try { result = !!(value + ''); } catch (e) {} } return result; } /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; length = length == null ? MAX_SAFE_INTEGER : length; return value > -1 && value % 1 == 0 && value < length; } /** * Converts `iterator` to an array. * * @private * @param {Object} iterator The iterator to convert. * @returns {Array} Returns the converted array. */ function iteratorToArray(iterator) { var data, result = []; while (!(data = iterator.next()).done) { result.push(data.value); } return result; } /** * Converts `map` to an array. * * @private * @param {Object} map The map to convert. * @returns {Array} Returns the converted array. */ function mapToArray(map) { var index = -1, result = Array(map.size); map.forEach(function(value, key) { result[++index] = [key, value]; }); return result; } /** * Replaces all `placeholder` elements in `array` with an internal placeholder * and returns an array of their indexes. * * @private * @param {Array} array The array to modify. * @param {*} placeholder The placeholder to replace. * @returns {Array} Returns the new array of placeholder indexes. */ function replaceHolders(array, placeholder) { var index = -1, length = array.length, resIndex = -1, result = []; while (++index < length) { if (array[index] === placeholder) { array[index] = PLACEHOLDER; result[++resIndex] = index; } } return result; } /** * Converts `set` to an array. * * @private * @param {Object} set The set to convert. * @returns {Array} Returns the converted array. */ function setToArray(set) { var index = -1, result = Array(set.size); set.forEach(function(value) { result[++index] = value; }); return result; } /** * Gets the number of symbols in `string`. * * @private * @param {string} string The string to inspect. * @returns {number} Returns the string size. */ function stringSize(string) { if (!(string && reHasComplexSymbol.test(string))) { return string.length; } var result = reComplexSymbol.lastIndex = 0; while (reComplexSymbol.test(string)) { result++; } return result; } /** * Converts `string` to an array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the converted array. */ function stringToArray(string) { return string.match(reComplexSymbol); } /** * Used by `_.unescape` to convert HTML entities to characters. * * @private * @param {string} chr The matched character to unescape. * @returns {string} Returns the unescaped character. */ function unescapeHtmlChar(chr) { return htmlUnescapes[chr]; } /*--------------------------------------------------------------------------*/ /** * Create a new pristine `lodash` function using the `context` object. * * @static * @memberOf _ * @category Util * @param {Object} [context=root] The context object. * @returns {Function} Returns a new `lodash` function. * @example * * _.mixin({ 'foo': _.constant('foo') }); * * var lodash = _.runInContext(); * lodash.mixin({ 'bar': lodash.constant('bar') }); * * _.isFunction(_.foo); * // => true * _.isFunction(_.bar); * // => false * * lodash.isFunction(lodash.foo); * // => false * lodash.isFunction(lodash.bar); * // => true * * // Use `context` to mock `Date#getTime` use in `_.now`. * var mock = _.runInContext({ * 'Date': function() { * return { 'getTime': getTimeMock }; * } * }); * * // Create a suped-up `defer` in Node.js. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; */ function runInContext(context) { context = context ? _.defaults({}, context, _.pick(root, contextProps)) : root; /** Built-in constructor references. */ var Date = context.Date, Error = context.Error, Math = context.Math, RegExp = context.RegExp, TypeError = context.TypeError; /** Used for built-in method references. */ var arrayProto = context.Array.prototype, objectProto = context.Object.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = context.Function.prototype.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Used to generate unique IDs. */ var idCounter = 0; /** Used to infer the `Object` constructor. */ var objectCtorString = funcToString.call(Object); /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Used to restore the original `_` reference in `_.noConflict`. */ var oldDash = root._; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ var Buffer = moduleExports ? context.Buffer : undefined, Reflect = context.Reflect, Symbol = context.Symbol, Uint8Array = context.Uint8Array, clearTimeout = context.clearTimeout, enumerate = Reflect ? Reflect.enumerate : undefined, getPrototypeOf = Object.getPrototypeOf, getOwnPropertySymbols = Object.getOwnPropertySymbols, iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined, objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, setTimeout = context.setTimeout, splice = arrayProto.splice; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeCeil = Math.ceil, nativeFloor = Math.floor, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = Object.keys, nativeMax = Math.max, nativeMin = Math.min, nativeParseInt = context.parseInt, nativeRandom = Math.random, nativeReverse = arrayProto.reverse; /* Built-in method references that are verified to be native. */ var Map = getNative(context, 'Map'), Set = getNative(context, 'Set'), WeakMap = getNative(context, 'WeakMap'), nativeCreate = getNative(Object, 'create'); /** Used to store function metadata. */ var metaMap = WeakMap && new WeakMap; /** Used to detect maps, sets, and weakmaps. */ var mapCtorString = Map ? funcToString.call(Map) : '', setCtorString = Set ? funcToString.call(Set) : '', weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : ''; /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = Symbol ? symbolProto.valueOf : undefined, symbolToString = Symbol ? symbolProto.toString : undefined; /** Used to lookup unminified function names. */ var realNames = {}; /*------------------------------------------------------------------------*/ /** * Creates a `lodash` object which wraps `value` to enable implicit method * chaining. Methods that operate on and return arrays, collections, and * functions can be chained together. Methods that retrieve a single value or * may return a primitive value will automatically end the chain sequence and * return the unwrapped value. Otherwise, the value must be unwrapped with * `_#value`. * * Explicit chaining, which must be unwrapped with `_#value` in all cases, * may be enabled using `_.chain`. * * The execution of chained methods is lazy, that is, it's deferred until * `_#value` is implicitly or explicitly called. * * Lazy evaluation allows several methods to support shortcut fusion. Shortcut * fusion is an optimization to merge iteratee calls; this avoids the creation * of intermediate arrays and can greatly reduce the number of iteratee executions. * Sections of a chain sequence qualify for shortcut fusion if the section is * applied to an array of at least two hundred elements and any iteratees * accept only one argument. The heuristic for whether a section qualifies * for shortcut fusion is subject to change. * * Chaining is supported in custom builds as long as the `_#value` method is * directly or indirectly included in the build. * * In addition to lodash methods, wrappers have `Array` and `String` methods. * * The wrapper `Array` methods are: * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` * * The wrapper `String` methods are: * `replace` and `split` * * The wrapper methods that support shortcut fusion are: * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` * * The chainable wrapper methods are: * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, `difference`, * `differenceBy`, `differenceWith`, `drop`, `dropRight`, `dropRightWhile`, * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flattenDepth`, * `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, `functionsIn`, * `groupBy`, `initial`, `intersection`, `intersectionBy`, `intersectionWith`, * `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, `keys`, `keysIn`, * `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, `memoize`, * `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, `nthArg`, * `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, `overEvery`, * `overSome`, `partial`, `partialRight`, `partition`, `pick`, `pickBy`, `plant`, * `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, `pullAt`, `push`, * `range`, `rangeRight`, `rearg`, `reject`, `remove`, `rest`, `reverse`, * `sampleSize`, `set`, `setWith`, `shuffle`, `slice`, `sort`, `sortBy`, * `splice`, `spread`, `tail`, `take`, `takeRight`, `takeRightWhile`, * `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, `toPairs`, `toPairsIn`, * `toPath`, `toPlainObject`, `transform`, `unary`, `union`, `unionBy`, * `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, `unshift`, `unzip`, * `unzipWith`, `values`, `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, * `xorWith`, `zip`, `zipObject`, `zipObjectDeep`, and `zipWith` * * The wrapper methods that are **not** chainable by default are: * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `endsWith`, `eq`, * `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, * `findLastIndex`, `findLastKey`, `floor`, `forEach`, `forEachRight`, `forIn`, * `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, `hasIn`, * `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, `isArguments`, * `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, * `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, * `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`, * `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, * `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`, * `isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`, * `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`, * `lt`, `lte`, `max`, `maxBy`, `mean`, `min`, `minBy`, `noConflict`, `noop`, * `now`, `pad`, `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, * `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `sample`, * `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, * `sortedLastIndex`, `sortedLastIndexBy`, `startCase`, `startsWith`, `subtract`, * `sum`, `sumBy`, `template`, `times`, `toLower`, `toInteger`, `toLength`, * `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, `trimEnd`, * `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, `upperFirst`, * `value`, and `words` * * @name _ * @constructor * @category Seq * @param {*} value The value to wrap in a `lodash` instance. * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * function square(n) { * return n * n; * } * * var wrapped = _([1, 2, 3]); * * // Returns an unwrapped value. * wrapped.reduce(_.add); * // => 6 * * // Returns a wrapped value. * var squares = wrapped.map(square); * * _.isArray(squares); * // => false * * _.isArray(squares.value()); * // => true */ function lodash(value) { if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { if (value instanceof LodashWrapper) { return value; } if (hasOwnProperty.call(value, '__wrapped__')) { return wrapperClone(value); } } return new LodashWrapper(value); } /** * The function whose prototype all chaining wrappers inherit from. * * @private */ function baseLodash() { // No operation performed. } /** * The base constructor for creating `lodash` wrapper objects. * * @private * @param {*} value The value to wrap. * @param {boolean} [chainAll] Enable chaining for all wrapper methods. */ function LodashWrapper(value, chainAll) { this.__wrapped__ = value; this.__actions__ = []; this.__chain__ = !!chainAll; this.__index__ = 0; this.__values__ = undefined; } /** * By default, the template delimiters used by lodash are like 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': reEscape, /** * Used to detect code to be evaluated. * * @memberOf _.templateSettings * @type {RegExp} */ 'evaluate': reEvaluate, /** * 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 } }; /*------------------------------------------------------------------------*/ /** * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. * * @private * @constructor * @param {*} value The value to wrap. */ function LazyWrapper(value) { this.__wrapped__ = value; this.__actions__ = []; this.__dir__ = 1; this.__filtered__ = false; this.__iteratees__ = []; this.__takeCount__ = MAX_ARRAY_LENGTH; this.__views__ = []; } /** * Creates a clone of the lazy wrapper object. * * @private * @name clone * @memberOf LazyWrapper * @returns {Object} Returns the cloned `LazyWrapper` object. */ function lazyClone() { var result = new LazyWrapper(this.__wrapped__); result.__actions__ = copyArray(this.__actions__); result.__dir__ = this.__dir__; result.__filtered__ = this.__filtered__; result.__iteratees__ = copyArray(this.__iteratees__); result.__takeCount__ = this.__takeCount__; result.__views__ = copyArray(this.__views__); return result; } /** * Reverses the direction of lazy iteration. * * @private * @name reverse * @memberOf LazyWrapper * @returns {Object} Returns the new reversed `LazyWrapper` object. */ function lazyReverse() { if (this.__filtered__) { var result = new LazyWrapper(this); result.__dir__ = -1; result.__filtered__ = true; } else { result = this.clone(); result.__dir__ *= -1; } return result; } /** * Extracts the unwrapped value from its lazy wrapper. * * @private * @name value * @memberOf LazyWrapper * @returns {*} Returns the unwrapped value. */ function lazyValue() { var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : (start - 1), iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) { return baseWrapperValue(array, this.__actions__); } var result = []; outer: while (length-- && resIndex < takeCount) { index += dir; var iterIndex = -1, value = array[index]; while (++iterIndex < iterLength) { var data = iteratees[iterIndex], iteratee = data.iteratee, type = data.type, computed = iteratee(value); if (type == LAZY_MAP_FLAG) { value = computed; } else if (!computed) { if (type == LAZY_FILTER_FLAG) { continue outer; } else { break outer; } } } result[resIndex++] = value; } return result; } /*------------------------------------------------------------------------*/ /** * Creates an hash object. * * @private * @constructor * @returns {Object} Returns the new hash object. */ function Hash() {} /** * Removes `key` and its value from the hash. * * @private * @param {Object} hash The hash to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(hash, key) { return hashHas(hash, key) && delete hash[key]; } /** * Gets the hash value for `key`. * * @private * @param {Object} hash The hash to query. * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function hashGet(hash, key) { if (nativeCreate) { var result = hash[key]; return result === HASH_UNDEFINED ? undefined : result; } return hasOwnProperty.call(hash, key) ? hash[key] : undefined; } /** * Checks if a hash value for `key` exists. * * @private * @param {Object} hash The hash to query. * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function hashHas(hash, key) { return nativeCreate ? hash[key] !== undefined : hasOwnProperty.call(hash, key); } /** * Sets the hash `key` to `value`. * * @private * @param {Object} hash The hash to modify. * @param {string} key The key of the value to set. * @param {*} value The value to set. */ function hashSet(hash, key, value) { hash[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; } /*------------------------------------------------------------------------*/ /** * Creates a map cache object to store key-value pairs. * * @private * @constructor * @param {Array} [values] The values to cache. */ function MapCache(values) { var index = -1, length = values ? values.length : 0; this.clear(); while (++index < length) { var entry = values[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the map. * * @private * @name clear * @memberOf MapCache */ function mapClear() { this.__data__ = { 'hash': new Hash, 'map': Map ? new Map : [], 'string': new Hash }; } /** * Removes `key` and its value from the map. * * @private * @name delete * @memberOf MapCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapDelete(key) { var data = this.__data__; if (isKeyable(key)) { return hashDelete(typeof key == 'string' ? data.string : data.hash, key); } return Map ? data.map['delete'](key) : assocDelete(data.map, key); } /** * Gets the map value for `key`. * * @private * @name get * @memberOf MapCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function mapGet(key) { var data = this.__data__; if (isKeyable(key)) { return hashGet(typeof key == 'string' ? data.string : data.hash, key); } return Map ? data.map.get(key) : assocGet(data.map, key); } /** * Checks if a map value for `key` exists. * * @private * @name has * @memberOf MapCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapHas(key) { var data = this.__data__; if (isKeyable(key)) { return hashHas(typeof key == 'string' ? data.string : data.hash, key); } return Map ? data.map.has(key) : assocHas(data.map, key); } /** * Sets the map `key` to `value`. * * @private * @name set * @memberOf MapCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the map cache object. */ function mapSet(key, value) { var data = this.__data__; if (isKeyable(key)) { hashSet(typeof key == 'string' ? data.string : data.hash, key, value); } else if (Map) { data.map.set(key, value); } else { assocSet(data.map, key, value); } return this; } /*------------------------------------------------------------------------*/ /** * * Creates a set cache object to store unique values. * * @private * @constructor * @param {Array} [values] The values to cache. */ function SetCache(values) { var index = -1, length = values ? values.length : 0; this.__data__ = new MapCache; while (++index < length) { this.push(values[index]); } } /** * Checks if `value` is in `cache`. * * @private * @param {Object} cache The set cache to search. * @param {*} value The value to search for. * @returns {number} Returns `true` if `value` is found, else `false`. */ function cacheHas(cache, value) { var map = cache.__data__; if (isKeyable(value)) { var data = map.__data__, hash = typeof value == 'string' ? data.string : data.hash; return hash[value] === HASH_UNDEFINED; } return map.has(value); } /** * Adds `value` to the set cache. * * @private * @name push * @memberOf SetCache * @param {*} value The value to cache. */ function cachePush(value) { var map = this.__data__; if (isKeyable(value)) { var data = map.__data__, hash = typeof value == 'string' ? data.string : data.hash; hash[value] = HASH_UNDEFINED; } else { map.set(value, HASH_UNDEFINED); } } /*------------------------------------------------------------------------*/ /** * Creates a stack cache object to store key-value pairs. * * @private * @constructor * @param {Array} [values] The values to cache. */ function Stack(values) { var index = -1, length = values ? values.length : 0; this.clear(); while (++index < length) { var entry = values[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the stack. * * @private * @name clear * @memberOf Stack */ function stackClear() { this.__data__ = { 'array': [], 'map': null }; } /** * Removes `key` and its value from the stack. * * @private * @name delete * @memberOf Stack * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function stackDelete(key) { var data = this.__data__, array = data.array; return array ? assocDelete(array, key) : data.map['delete'](key); } /** * Gets the stack value for `key`. * * @private * @name get * @memberOf Stack * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function stackGet(key) { var data = this.__data__, array = data.array; return array ? assocGet(array, key) : data.map.get(key); } /** * Checks if a stack value for `key` exists. * * @private * @name has * @memberOf Stack * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function stackHas(key) { var data = this.__data__, array = data.array; return array ? assocHas(array, key) : data.map.has(key); } /** * Sets the stack `key` to `value`. * * @private * @name set * @memberOf Stack * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the stack cache object. */ function stackSet(key, value) { var data = this.__data__, array = data.array; if (array) { if (array.length < (LARGE_ARRAY_SIZE - 1)) { assocSet(array, key, value); } else { data.array = null; data.map = new MapCache(array); } } var map = data.map; if (map) { map.set(key, value); } return this; } /*------------------------------------------------------------------------*/ /** * Removes `key` and its value from the associative array. * * @private * @param {Array} array The array to query. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function assocDelete(array, key) { var index = assocIndexOf(array, key); if (index < 0) { return false; } var lastIndex = array.length - 1; if (index == lastIndex) { array.pop(); } else { splice.call(array, index, 1); } return true; } /** * Gets the associative array value for `key`. * * @private * @param {Array} array The array to query. * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function assocGet(array, key) { var index = assocIndexOf(array, key); return index < 0 ? undefined : array[index][1]; } /** * Checks if an associative array value for `key` exists. * * @private * @param {Array} array The array to query. * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function assocHas(array, key) { return assocIndexOf(array, key) > -1; } /** * Gets the index at which the first occurrence of `key` is found in `array` * of key-value pairs. * * @private * @param {Array} array The array to search. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } /** * Sets the associative array `key` to `value`. * * @private * @param {Array} array The array to modify. * @param {string} key The key of the value to set. * @param {*} value The value to set. */ function assocSet(array, key, value) { var index = assocIndexOf(array, key); if (index < 0) { array.push([key, value]); } else { array[index][1] = value; } } /*------------------------------------------------------------------------*/ /** * Used by `_.defaults` to customize its `_.assignIn` use. * * @private * @param {*} objValue The destination value. * @param {*} srcValue The source value. * @param {string} key The key of the property to assign. * @param {Object} object The parent object of `objValue`. * @returns {*} Returns the value to assign. */ function assignInDefaults(objValue, srcValue, key, object) { if (objValue === undefined || (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { return srcValue; } return objValue; } /** * This function is like `assignValue` except that it doesn't assign `undefined` values. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignMergeValue(object, key, value) { if ((value !== undefined && !eq(object[key], value)) || (typeof key == 'number' && value === undefined && !(key in object))) { object[key] = value; } } /** * Assigns `value` to `key` of `object` if the existing value is not equivalent * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignValue(object, key, value) { var objValue = object[key]; if ((!eq(objValue, value) || (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) || (value === undefined && !(key in object))) { object[key] = value; } } /** * Aggregates elements of `collection` on `accumulator` with keys transformed * by `iteratee` and values set by `setter`. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} setter The function to set `accumulator` values. * @param {Function} iteratee The iteratee to transform keys. * @param {Object} accumulator The initial aggregated object. * @returns {Function} Returns `accumulator`. */ function baseAggregator(collection, setter, iteratee, accumulator) { baseEach(collection, function(value, key, collection) { setter(accumulator, value, iteratee(value), collection); }); return accumulator; } /** * The base implementation of `_.assign` without support for multiple sources * or `customizer` functions. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @returns {Object} Returns `object`. */ function baseAssign(object, source) { return object && copyObject(source, keys(source), object); } /** * The base implementation of `_.at` without support for individual paths. * * @private * @param {Object} object The object to iterate over. * @param {string[]} paths The property paths of elements to pick. * @returns {Array} Returns the new array of picked elements. */ function baseAt(object, paths) { var index = -1, isNil = object == null, length = paths.length, result = Array(length); while (++index < length) { result[index] = isNil ? undefined : get(object, paths[index]); } return result; } /** * Casts `value` to an empty array if it's not an array like object. * * @private * @param {*} value The value to inspect. * @returns {Array} Returns the array-like object. */ function baseCastArrayLikeObject(value) { return isArrayLikeObject(value) ? value : []; } /** * Casts `value` to `identity` if it's not a function. * * @private * @param {*} value The value to inspect. * @returns {Array} Returns the array-like object. */ function baseCastFunction(value) { return typeof value == 'function' ? value : identity; } /** * Casts `value` to a path array if it's not one. * * @private * @param {*} value The value to inspect. * @returns {Array} Returns the cast property path array. */ function baseCastPath(value) { return isArray(value) ? value : stringToPath(value); } /** * The base implementation of `_.clamp` which doesn't coerce arguments to numbers. * * @private * @param {number} number The number to clamp. * @param {number} [lower] The lower bound. * @param {number} upper The upper bound. * @returns {number} Returns the clamped number. */ function baseClamp(number, lower, upper) { if (number === number) { if (upper !== undefined) { number = number <= upper ? number : upper; } if (lower !== undefined) { number = number >= lower ? number : lower; } } return number; } /** * The base implementation of `_.clone` and `_.cloneDeep` which tracks * traversed objects. * * @private * @param {*} value The value to clone. * @param {boolean} [isDeep] Specify a deep clone. * @param {Function} [customizer] The function to customize cloning. * @param {string} [key] The key of `value`. * @param {Object} [object] The parent object of `value`. * @param {Object} [stack] Tracks traversed objects and their clone counterparts. * @returns {*} Returns the cloned value. */ function baseClone(value, isDeep, customizer, key, object, stack) { var result; if (customizer) { result = object ? customizer(value, key, object, stack) : customizer(value); } if (result !== undefined) { return result; } if (!isObject(value)) { return value; } var isArr = isArray(value); if (isArr) { result = initCloneArray(value); if (!isDeep) { return copyArray(value, result); } } else { var tag = getTag(value), isFunc = tag == funcTag || tag == genTag; if (isBuffer(value)) { return cloneBuffer(value, isDeep); } if (tag == objectTag || tag == argsTag || (isFunc && !object)) { if (isHostObject(value)) { return object ? value : {}; } result = initCloneObject(isFunc ? {} : value); if (!isDeep) { return copySymbols(value, baseAssign(result, value)); } } else { if (!cloneableTags[tag]) { return object ? value : {}; } result = initCloneByTag(value, tag, isDeep); } } // Check for circular references and return its corresponding clone. stack || (stack = new Stack); var stacked = stack.get(value); if (stacked) { return stacked; } stack.set(value, result); // Recursively populate clone (susceptible to call stack limits). (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) { assignValue(result, key, baseClone(subValue, isDeep, customizer, key, value, stack)); }); return isArr ? result : copySymbols(value, result); } /** * The base implementation of `_.conforms` which doesn't clone `source`. * * @private * @param {Object} source The object of property predicates to conform to. * @returns {Function} Returns the new function. */ function baseConforms(source) { var props = keys(source), length = props.length; return function(object) { if (object == null) { return !length; } var index = length; while (index--) { var key = props[index], predicate = source[key], value = object[key]; if ((value === undefined && !(key in Object(object))) || !predicate(value)) { return false; } } return true; }; } /** * The base implementation of `_.create` without support for assigning * properties to the created object. * * @private * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ function baseCreate(proto) { return isObject(proto) ? objectCreate(proto) : {}; } /** * The base implementation of `_.delay` and `_.defer` which accepts an array * of `func` arguments. * * @private * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay invocation. * @param {Object} args The arguments to provide to `func`. * @returns {number} Returns the timer id. */ function baseDelay(func, wait, args) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return setTimeout(function() { func.apply(undefined, args); }, wait); } /** * The base implementation of methods like `_.difference` without support for * excluding multiple arrays or iteratee shorthands. * * @private * @param {Array} array The array to inspect. * @param {Array} values The values to exclude. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of filtered values. */ function baseDifference(array, values, iteratee, comparator) { var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length; if (!length) { return result; } if (iteratee) { values = arrayMap(values, baseUnary(iteratee)); } if (comparator) { includes = arrayIncludesWith; isCommon = false; } else if (values.length >= LARGE_ARRAY_SIZE) { includes = cacheHas; isCommon = false; values = new SetCache(values); } outer: while (++index < length) { var value = array[index], computed = iteratee ? iteratee(value) : value; if (isCommon && computed === computed) { var valuesIndex = valuesLength; while (valuesIndex--) { if (values[valuesIndex] === computed) { continue outer; } } result.push(value); } else if (!includes(values, computed, comparator)) { result.push(value); } } return result; } /** * The base implementation of `_.forEach` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array|Object} Returns `collection`. */ var baseEach = createBaseEach(baseForOwn); /** * The base implementation of `_.forEachRight` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array|Object} Returns `collection`. */ var baseEachRight = createBaseEach(baseForOwnRight, true); /** * The base implementation of `_.every` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false` */ function baseEvery(collection, predicate) { var result = true; baseEach(collection, function(value, index, collection) { result = !!predicate(value, index, collection); return result; }); return result; } /** * The base implementation of `_.fill` without an iteratee call guard. * * @private * @param {Array} array The array to fill. * @param {*} value The value to fill `array` with. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns `array`. */ function baseFill(array, value, start, end) { var length = array.length; start = toInteger(start); if (start < 0) { start = -start > length ? 0 : (length + start); } end = (end === undefined || end > length) ? length : toInteger(end); if (end < 0) { end += length; } end = start > end ? 0 : toLength(end); while (start < end) { array[start++] = value; } return array; } /** * The base implementation of `_.filter` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function baseFilter(collection, predicate) { var result = []; baseEach(collection, function(value, index, collection) { if (predicate(value, index, collection)) { result.push(value); } }); return result; } /** * The base implementation of `_.flatten` with support for restricting flattening. * * @private * @param {Array} array The array to flatten. * @param {number} depth The maximum recursion depth. * @param {boolean} [isStrict] Restrict flattening to arrays-like objects. * @param {Array} [result=[]] The initial result value. * @returns {Array} Returns the new flattened array. */ function baseFlatten(array, depth, isStrict, result) { result || (result = []); var index = -1, length = array.length; while (++index < length) { var value = array[index]; if (depth > 0 && isArrayLikeObject(value) && (isStrict || isArray(value) || isArguments(value))) { if (depth > 1) { // Recursively flatten arrays (susceptible to call stack limits). baseFlatten(value, depth - 1, isStrict, result); } else { arrayPush(result, value); } } else if (!isStrict) { result[result.length] = value; } } return result; } /** * The base implementation of `baseForIn` and `baseForOwn` which iterates * over `object` properties returned by `keysFunc` invoking `iteratee` for * each property. Iteratee functions may exit iteration early by explicitly * returning `false`. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ var baseFor = createBaseFor(); /** * This function is like `baseFor` except that it iterates over properties * in the opposite order. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ var baseForRight = createBaseFor(true); /** * The base implementation of `_.forIn` without support for iteratee shorthands. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function baseForIn(object, iteratee) { return object == null ? object : baseFor(object, iteratee, keysIn); } /** * The base implementation of `_.forOwn` without support for iteratee shorthands. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function baseForOwn(object, iteratee) { return object && baseFor(object, iteratee, keys); } /** * The base implementation of `_.forOwnRight` without support for iteratee shorthands. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function baseForOwnRight(object, iteratee) { return object && baseForRight(object, iteratee, keys); } /** * The base implementation of `_.functions` which creates an array of * `object` function property names filtered from `props`. * * @private * @param {Object} object The object to inspect. * @param {Array} props The property names to filter. * @returns {Array} Returns the new array of filtered property names. */ function baseFunctions(object, props) { return arrayFilter(props, function(key) { return isFunction(object[key]); }); } /** * The base implementation of `_.get` without support for default values. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @returns {*} Returns the resolved value. */ function baseGet(object, path) { path = isKey(path, object) ? [path + ''] : baseCastPath(path); var index = 0, length = path.length; while (object != null && index < length) { object = object[path[index++]]; } return (index && index == length) ? object : undefined; } /** * The base implementation of `_.has` without support for deep paths. * * @private * @param {Object} object The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHas(object, key) { // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, // that are composed entirely of index properties, return `false` for // `hasOwnProperty` checks of them. return hasOwnProperty.call(object, key) || (typeof object == 'object' && key in object && getPrototypeOf(object) === null); } /** * The base implementation of `_.hasIn` without support for deep paths. * * @private * @param {Object} object The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHasIn(object, key) { return key in Object(object); } /** * The base implementation of `_.inRange` which doesn't coerce arguments to numbers. * * @private * @param {number} number The number to check. * @param {number} start The start of the range. * @param {number} end The end of the range. * @returns {boolean} Returns `true` if `number` is in the range, else `false`. */ function baseInRange(number, start, end) { return number >= nativeMin(start, end) && number < nativeMax(start, end); } /** * The base implementation of methods like `_.intersection`, without support * for iteratee shorthands, that accepts an array of arrays to inspect. * * @private * @param {Array} arrays The arrays to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of shared values. */ function baseIntersection(arrays, iteratee, comparator) { var includes = comparator ? arrayIncludesWith : arrayIncludes, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), result = []; while (othIndex--) { var array = arrays[othIndex]; if (othIndex && iteratee) { array = arrayMap(array, baseUnary(iteratee)); } caches[othIndex] = !comparator && (iteratee || array.length >= 120) ? new SetCache(othIndex && array) : undefined; } array = arrays[0]; var index = -1, length = array.length, seen = caches[0]; outer: while (++index < length) { var value = array[index], computed = iteratee ? iteratee(value) : value; if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator) )) { var othIndex = othLength; while (--othIndex) { var cache = caches[othIndex]; if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator)) ) { continue outer; } } if (seen) { seen.push(computed); } result.push(value); } } return result; } /** * The base implementation of `_.invert` and `_.invertBy` which inverts * `object` with values transformed by `iteratee` and set by `setter`. * * @private * @param {Object} object The object to iterate over. * @param {Function} setter The function to set `accumulator` values. * @param {Function} iteratee The iteratee to transform values. * @param {Object} accumulator The initial inverted object. * @returns {Function} Returns `accumulator`. */ function baseInverter(object, setter, iteratee, accumulator) { baseForOwn(object, function(value, key, object) { setter(accumulator, iteratee(value), key, object); }); return accumulator; } /** * The base implementation of `_.invoke` without support for individual * method arguments. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the method to invoke. * @param {Array} args The arguments to invoke the method with. * @returns {*} Returns the result of the invoked method. */ function baseInvoke(object, path, args) { if (!isKey(path, object)) { path = baseCastPath(path); object = parent(object, path); path = last(path); } var func = object == null ? object : object[path]; return func == null ? undefined : apply(func, object, args); } /** * The base implementation of `_.isEqual` which supports partial comparisons * and tracks traversed objects. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {Function} [customizer] The function to customize comparisons. * @param {boolean} [bitmask] The bitmask of comparison flags. * The bitmask may be composed of the following flags: * 1 - Unordered comparison * 2 - Partial comparison * @param {Object} [stack] Tracks traversed `value` and `other` objects. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(value, other, customizer, bitmask, stack) { if (value === other) { return true; } if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { return value !== value && other !== other; } return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack); } /** * A specialized version of `baseIsEqual` for arrays and objects which performs * deep comparisons and tracks traversed objects enabling objects with circular * references to be compared. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparisons. * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. * @param {Object} [stack] Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { var objIsArr = isArray(object), othIsArr = isArray(other), objTag = arrayTag, othTag = arrayTag; if (!objIsArr) { objTag = getTag(object); if (objTag == argsTag) { objTag = objectTag; } else if (objTag != objectTag) { objIsArr = isTypedArray(object); } } if (!othIsArr) { othTag = getTag(other); if (othTag == argsTag) { othTag = objectTag; } else if (othTag != objectTag) { othIsArr = isTypedArray(other); } } var objIsObj = objTag == objectTag && !isHostObject(object), othIsObj = othTag == objectTag && !isHostObject(other), isSameTag = objTag == othTag; if (isSameTag && !(objIsArr || objIsObj)) { return equalByTag(object, other, objTag, equalFunc, customizer, bitmask); } var isPartial = bitmask & PARTIAL_COMPARE_FLAG; if (!isPartial) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); if (objIsWrapped || othIsWrapped) { return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, bitmask, stack); } } if (!isSameTag) { return false; } stack || (stack = new Stack); return (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, bitmask, stack); } /** * The base implementation of `_.isMatch` without support for iteratee shorthands. * * @private * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @param {Array} matchData The property names, values, and compare flags to match. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if `object` is a match, else `false`. */ function baseIsMatch(object, source, matchData, customizer) { var index = matchData.length, length = index, noCustomizer = !customizer; if (object == null) { return !length; } object = Object(object); while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) ? data[1] !== object[data[0]] : !(data[0] in object) ) { return false; } } while (++index < length) { data = matchData[index]; var key = data[0], objValue = object[key], srcValue = data[1]; if (noCustomizer && data[2]) { if (objValue === undefined && !(key in object)) { return false; } } else { var stack = new Stack, result = customizer ? customizer(objValue, srcValue, key, object, source, stack) : undefined; if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result )) { return false; } } } return true; } /** * The base implementation of `_.iteratee`. * * @private * @param {*} [value=_.identity] The value to convert to an iteratee. * @returns {Function} Returns the iteratee. */ function baseIteratee(value) { var type = typeof value; if (type == 'function') { return value; } if (value == null) { return identity; } if (type == 'object') { return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); } return property(value); } /** * The base implementation of `_.keys` which doesn't skip the constructor * property of prototypes or treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeys(object) { return nativeKeys(Object(object)); } /** * The base implementation of `_.keysIn` which doesn't skip the constructor * property of prototypes or treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeysIn(object) { object = object == null ? object : Object(object); var result = []; for (var key in object) { result.push(key); } return result; } // Fallback for IE < 9 with es6-shim. if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) { baseKeysIn = function(object) { return iteratorToArray(enumerate(object)); }; } /** * The base implementation of `_.map` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function baseMap(collection, iteratee) { var index = -1, result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value, key, collection) { result[++index] = iteratee(value, key, collection); }); return result; } /** * The base implementation of `_.matches` which doesn't clone `source`. * * @private * @param {Object} source The object of property values to match. * @returns {Function} Returns the new function. */ function baseMatches(source) { var matchData = getMatchData(source); if (matchData.length == 1 && matchData[0][2]) { var key = matchData[0][0], value = matchData[0][1]; return function(object) { if (object == null) { return false; } return object[key] === value && (value !== undefined || (key in Object(object))); }; } return function(object) { return object === source || baseIsMatch(object, source, matchData); }; } /** * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. * * @private * @param {string} path The path of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new function. */ function baseMatchesProperty(path, srcValue) { return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) ? hasIn(object, path) : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); }; } /** * The base implementation of `_.merge` without support for multiple sources. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {number} srcIndex The index of `source`. * @param {Function} [customizer] The function to customize merged values. * @param {Object} [stack] Tracks traversed source values and their merged counterparts. */ function baseMerge(object, source, srcIndex, customizer, stack) { if (object === source) { return; } var props = (isArray(source) || isTypedArray(source)) ? undefined : keysIn(source); arrayEach(props || source, function(srcValue, key) { if (props) { key = srcValue; srcValue = source[key]; } if (isObject(srcValue)) { stack || (stack = new Stack); baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); } else { var newValue = customizer ? customizer(object[key], srcValue, (key + ''), object, source, stack) : undefined; if (newValue === undefined) { newValue = srcValue; } assignMergeValue(object, key, newValue); } }); } /** * A specialized version of `baseMerge` for arrays and objects which performs * deep merges and tracks traversed objects enabling objects with circular * references to be merged. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {string} key The key of the value to merge. * @param {number} srcIndex The index of `source`. * @param {Function} mergeFunc The function to merge values. * @param {Function} [customizer] The function to customize assigned values. * @param {Object} [stack] Tracks traversed source values and their merged counterparts. */ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { var objValue = object[key], srcValue = source[key], stacked = stack.get(srcValue); if (stacked) { assignMergeValue(object, key, stacked); return; } var newValue = customizer ? customizer(objValue, srcValue, (key + ''), object, source, stack) : undefined; var isCommon = newValue === undefined; if (isCommon) { newValue = srcValue; if (isArray(srcValue) || isTypedArray(srcValue)) { if (isArray(objValue)) { newValue = objValue; } else if (isArrayLikeObject(objValue)) { newValue = copyArray(objValue); } else { isCommon = false; newValue = baseClone(srcValue, true); } } else if (isPlainObject(srcValue) || isArguments(srcValue)) { if (isArguments(objValue)) { newValue = toPlainObject(objValue); } else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) { isCommon = false; newValue = baseClone(srcValue, true); } else { newValue = objValue; } } else { isCommon = false; } } stack.set(srcValue, newValue); if (isCommon) { // Recursively merge objects and arrays (susceptible to call stack limits). mergeFunc(newValue, srcValue, srcIndex, customizer, stack); } assignMergeValue(object, key, newValue); } /** * The base implementation of `_.orderBy` without param guards. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. * @param {string[]} orders The sort orders of `iteratees`. * @returns {Array} Returns the new sorted array. */ function baseOrderBy(collection, iteratees, orders) { var index = -1, toIteratee = getIteratee(); iteratees = arrayMap(iteratees.length ? iteratees : Array(1), function(iteratee) { return toIteratee(iteratee); }); var result = baseMap(collection, function(value, key, collection) { var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); }); return { 'criteria': criteria, 'index': ++index, 'value': value }; }); return baseSortBy(result, function(object, other) { return compareMultiple(object, other, orders); }); } /** * The base implementation of `_.pick` without support for individual * property names. * * @private * @param {Object} object The source object. * @param {string[]} props The property names to pick. * @returns {Object} Returns the new object. */ function basePick(object, props) { object = Object(object); return arrayReduce(props, function(result, key) { if (key in object) { result[key] = object[key]; } return result; }, {}); } /** * The base implementation of `_.pickBy` without support for iteratee shorthands. * * @private * @param {Object} object The source object. * @param {Function} predicate The function invoked per property. * @returns {Object} Returns the new object. */ function basePickBy(object, predicate) { var result = {}; baseForIn(object, function(value, key) { if (predicate(value, key)) { result[key] = value; } }); return result; } /** * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. * @returns {Function} Returns the new function. */ function baseProperty(key) { return function(object) { return object == null ? undefined : object[key]; }; } /** * A specialized version of `baseProperty` which supports deep paths. * * @private * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new function. */ function basePropertyDeep(path) { return function(object) { return baseGet(object, path); }; } /** * The base implementation of `_.pullAll`. * * @private * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @returns {Array} Returns `array`. */ function basePullAll(array, values) { return basePullAllBy(array, values); } /** * The base implementation of `_.pullAllBy` without support for iteratee * shorthands. * * @private * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @param {Function} [iteratee] The iteratee invoked per element. * @returns {Array} Returns `array`. */ function basePullAllBy(array, values, iteratee) { var index = -1, length = values.length, seen = array; if (iteratee) { seen = arrayMap(array, function(value) { return iteratee(value); }); } while (++index < length) { var fromIndex = 0, value = values[index], computed = iteratee ? iteratee(value) : value; while ((fromIndex = baseIndexOf(seen, computed, fromIndex)) > -1) { if (seen !== array) { splice.call(seen, fromIndex, 1); } splice.call(array, fromIndex, 1); } } return array; } /** * The base implementation of `_.pullAt` without support for individual * indexes or capturing the removed elements. * * @private * @param {Array} array The array to modify. * @param {number[]} indexes The indexes of elements to remove. * @returns {Array} Returns `array`. */ function basePullAt(array, indexes) { var length = array ? indexes.length : 0, lastIndex = length - 1; while (length--) { var index = indexes[length]; if (lastIndex == length || index != previous) { var previous = index; if (isIndex(index)) { splice.call(array, index, 1); } else if (!isKey(index, array)) { var path = baseCastPath(index), object = parent(array, path); if (object != null) { delete object[last(path)]; } } else { delete array[index]; } } } return array; } /** * The base implementation of `_.random` without support for returning * floating-point numbers. * * @private * @param {number} lower The lower bound. * @param {number} upper The upper bound. * @returns {number} Returns the random number. */ function baseRandom(lower, upper) { return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); } /** * The base implementation of `_.range` and `_.rangeRight` which doesn't * coerce arguments to numbers. * * @private * @param {number} start The start of the range. * @param {number} end The end of the range. * @param {number} step The value to increment or decrement by. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Array} Returns the new array of numbers. */ function baseRange(start, end, step, fromRight) { var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result = Array(length); while (length--) { result[fromRight ? length : ++index] = start; start += step; } return result; } /** * The base implementation of `_.set`. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @param {Function} [customizer] The function to customize path creation. * @returns {Object} Returns `object`. */ function baseSet(object, path, value, customizer) { path = isKey(path, object) ? [path + ''] : baseCastPath(path); var index = -1, length = path.length, lastIndex = length - 1, nested = object; while (nested != null && ++index < length) { var key = path[index]; if (isObject(nested)) { var newValue = value; if (index != lastIndex) { var objValue = nested[key]; newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { newValue = objValue == null ? (isIndex(path[index + 1]) ? [] : {}) : objValue; } } assignValue(nested, key, newValue); } nested = nested[key]; } return object; } /** * The base implementation of `setData` without support for hot loop detection. * * @private * @param {Function} func The function to associate metadata with. * @param {*} data The metadata. * @returns {Function} Returns `func`. */ var baseSetData = !metaMap ? identity : function(func, data) { metaMap.set(func, data); return func; }; /** * The base implementation of `_.slice` without an iteratee call guard. * * @private * @param {Array} array The array to slice. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the slice of `array`. */ function baseSlice(array, start, end) { var index = -1, length = array.length; if (start < 0) { start = -start > length ? 0 : (length + start); } end = end > length ? length : end; if (end < 0) { end += length; } length = start > end ? 0 : ((end - start) >>> 0); start >>>= 0; var result = Array(length); while (++index < length) { result[index] = array[index + start]; } return result; } /** * The base implementation of `_.some` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. */ function baseSome(collection, predicate) { var result; baseEach(collection, function(value, index, collection) { result = predicate(value, index, collection); return !result; }); return !!result; } /** * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which * performs a binary search of `array` to determine the index at which `value` * should be inserted into `array` in order to maintain its sort order. * * @private * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {boolean} [retHighest] Specify returning the highest qualified index. * @returns {number} Returns the index at which `value` should be inserted * into `array`. */ function baseSortedIndex(array, value, retHighest) { var low = 0, high = array ? array.length : low; if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { while (low < high) { var mid = (low + high) >>> 1, computed = array[mid]; if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) { low = mid + 1; } else { high = mid; } } return high; } return baseSortedIndexBy(array, value, identity, retHighest); } /** * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` * which invokes `iteratee` for `value` and each element of `array` to compute * their sort ranking. The iteratee is invoked with one argument; (value). * * @private * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {Function} iteratee The iteratee invoked per element. * @param {boolean} [retHighest] Specify returning the highest qualified index. * @returns {number} Returns the index at which `value` should be inserted into `array`. */ function baseSortedIndexBy(array, value, iteratee, retHighest) { value = iteratee(value); var low = 0, high = array ? array.length : 0, valIsNaN = value !== value, valIsNull = value === null, valIsUndef = value === undefined; while (low < high) { var mid = nativeFloor((low + high) / 2), computed = iteratee(array[mid]), isDef = computed !== undefined, isReflexive = computed === computed; if (valIsNaN) { var setLow = isReflexive || retHighest; } else if (valIsNull) { setLow = isReflexive && isDef && (retHighest || computed != null); } else if (valIsUndef) { setLow = isReflexive && (retHighest || isDef); } else if (computed == null) { setLow = false; } else { setLow = retHighest ? (computed <= value) : (computed < value); } if (setLow) { low = mid + 1; } else { high = mid; } } return nativeMin(high, MAX_ARRAY_INDEX); } /** * The base implementation of `_.sortedUniq`. * * @private * @param {Array} array The array to inspect. * @returns {Array} Returns the new duplicate free array. */ function baseSortedUniq(array) { return baseSortedUniqBy(array); } /** * The base implementation of `_.sortedUniqBy` without support for iteratee * shorthands. * * @private * @param {Array} array The array to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @returns {Array} Returns the new duplicate free array. */ function baseSortedUniqBy(array, iteratee) { var index = 0, length = array.length, value = array[0], computed = iteratee ? iteratee(value) : value, seen = computed, resIndex = 0, result = [value]; while (++index < length) { value = array[index], computed = iteratee ? iteratee(value) : value; if (!eq(computed, seen)) { seen = computed; result[++resIndex] = value; } } return result; } /** * The base implementation of `_.uniqBy` without support for iteratee shorthands. * * @private * @param {Array} array The array to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new duplicate free array. */ function baseUniq(array, iteratee, comparator) { var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result; if (comparator) { isCommon = false; includes = arrayIncludesWith; } else if (length >= LARGE_ARRAY_SIZE) { var set = iteratee ? null : createSet(array); if (set) { return setToArray(set); } isCommon = false; includes = cacheHas; seen = new SetCache; } else { seen = iteratee ? [] : result; } outer: while (++index < length) { var value = array[index], computed = iteratee ? iteratee(value) : value; if (isCommon && computed === computed) { var seenIndex = seen.length; while (seenIndex--) { if (seen[seenIndex] === computed) { continue outer; } } if (iteratee) { seen.push(computed); } result.push(value); } else if (!includes(seen, computed, comparator)) { if (seen !== result) { seen.push(computed); } result.push(value); } } return result; } /** * The base implementation of `_.unset`. * * @private * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to unset. * @returns {boolean} Returns `true` if the property is deleted, else `false`. */ function baseUnset(object, path) { path = isKey(path, object) ? [path + ''] : baseCastPath(path); object = parent(object, path); var key = last(path); return (object != null && has(object, key)) ? delete object[key] : true; } /** * The base implementation of methods like `_.dropWhile` and `_.takeWhile` * without support for iteratee shorthands. * * @private * @param {Array} array The array to query. * @param {Function} predicate The function invoked per iteration. * @param {boolean} [isDrop] Specify dropping elements instead of taking them. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Array} Returns the slice of `array`. */ function baseWhile(array, predicate, isDrop, fromRight) { var length = array.length, index = fromRight ? length : -1; while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {} return isDrop ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); } /** * The base implementation of `wrapperValue` which returns the result of * performing a sequence of actions on the unwrapped `value`, where each * successive action is supplied the return value of the previous. * * @private * @param {*} value The unwrapped value. * @param {Array} actions Actions to perform to resolve the unwrapped value. * @returns {*} Returns the resolved value. */ function baseWrapperValue(value, actions) { var result = value; if (result instanceof LazyWrapper) { result = result.value(); } return arrayReduce(actions, function(result, action) { return action.func.apply(action.thisArg, arrayPush([result], action.args)); }, result); } /** * The base implementation of methods like `_.xor`, without support for * iteratee shorthands, that accepts an array of arrays to inspect. * * @private * @param {Array} arrays The arrays to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of values. */ function baseXor(arrays, iteratee, comparator) { var index = -1, length = arrays.length; while (++index < length) { var result = result ? arrayPush( baseDifference(result, arrays[index], iteratee, comparator), baseDifference(arrays[index], result, iteratee, comparator) ) : arrays[index]; } return (result && result.length) ? baseUniq(result, iteratee, comparator) : []; } /** * This base implementation of `_.zipObject` which assigns values using `assignFunc`. * * @private * @param {Array} props The property names. * @param {Array} values The property values. * @param {Function} assignFunc The function to assign values. * @returns {Object} Returns the new object. */ function baseZipObject(props, values, assignFunc) { var index = -1, length = props.length, valsLength = values.length, result = {}; while (++index < length) { assignFunc(result, props[index], index < valsLength ? values[index] : undefined); } return result; } /** * Creates a clone of `buffer`. * * @private * @param {Buffer} buffer The buffer to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Buffer} Returns the cloned buffer. */ function cloneBuffer(buffer, isDeep) { if (isDeep) { return buffer.slice(); } var Ctor = buffer.constructor, result = new Ctor(buffer.length); buffer.copy(result); return result; } /** * Creates a clone of `arrayBuffer`. * * @private * @param {ArrayBuffer} arrayBuffer The array buffer to clone. * @returns {ArrayBuffer} Returns the cloned array buffer. */ function cloneArrayBuffer(arrayBuffer) { var Ctor = arrayBuffer.constructor, result = new Ctor(arrayBuffer.byteLength), view = new Uint8Array(result); view.set(new Uint8Array(arrayBuffer)); return result; } /** * Creates a clone of `map`. * * @private * @param {Object} map The map to clone. * @returns {Object} Returns the cloned map. */ function cloneMap(map) { var Ctor = map.constructor; return arrayReduce(mapToArray(map), addMapEntry, new Ctor); } /** * Creates a clone of `regexp`. * * @private * @param {Object} regexp The regexp to clone. * @returns {Object} Returns the cloned regexp. */ function cloneRegExp(regexp) { var Ctor = regexp.constructor, result = new Ctor(regexp.source, reFlags.exec(regexp)); result.lastIndex = regexp.lastIndex; return result; } /** * Creates a clone of `set`. * * @private * @param {Object} set The set to clone. * @returns {Object} Returns the cloned set. */ function cloneSet(set) { var Ctor = set.constructor; return arrayReduce(setToArray(set), addSetEntry, new Ctor); } /** * Creates a clone of the `symbol` object. * * @private * @param {Object} symbol The symbol object to clone. * @returns {Object} Returns the cloned symbol object. */ function cloneSymbol(symbol) { return Symbol ? Object(symbolValueOf.call(symbol)) : {}; } /** * Creates a clone of `typedArray`. * * @private * @param {Object} typedArray The typed array to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { var arrayBuffer = typedArray.buffer, buffer = isDeep ? cloneArrayBuffer(arrayBuffer) : arrayBuffer, Ctor = typedArray.constructor; return new Ctor(buffer, typedArray.byteOffset, typedArray.length); } /** * Creates an array that is the composition of partially applied arguments, * placeholders, and provided arguments into a single array of arguments. * * @private * @param {Array|Object} args The provided arguments. * @param {Array} partials The arguments to prepend to those provided. * @param {Array} holders The `partials` placeholder indexes. * @returns {Array} Returns the new array of composed arguments. */ function composeArgs(args, partials, holders) { var holdersLength = holders.length, argsIndex = -1, argsLength = nativeMax(args.length - holdersLength, 0), leftIndex = -1, leftLength = partials.length, result = Array(leftLength + argsLength); while (++leftIndex < leftLength) { result[leftIndex] = partials[leftIndex]; } while (++argsIndex < holdersLength) { result[holders[argsIndex]] = args[argsIndex]; } while (argsLength--) { result[leftIndex++] = args[argsIndex++]; } return result; } /** * This function is like `composeArgs` except that the arguments composition * is tailored for `_.partialRight`. * * @private * @param {Array|Object} args The provided arguments. * @param {Array} partials The arguments to append to those provided. * @param {Array} holders The `partials` placeholder indexes. * @returns {Array} Returns the new array of composed arguments. */ function composeArgsRight(args, partials, holders) { var holdersIndex = -1, holdersLength = holders.length, argsIndex = -1, argsLength = nativeMax(args.length - holdersLength, 0), rightIndex = -1, rightLength = partials.length, result = Array(argsLength + rightLength); while (++argsIndex < argsLength) { result[argsIndex] = args[argsIndex]; } var offset = argsIndex; while (++rightIndex < rightLength) { result[offset + rightIndex] = partials[rightIndex]; } while (++holdersIndex < holdersLength) { result[offset + holders[holdersIndex]] = args[argsIndex++]; } return result; } /** * Copies the values of `source` to `array`. * * @private * @param {Array} source The array to copy values from. * @param {Array} [array=[]] The array to copy values to. * @returns {Array} Returns `array`. */ function copyArray(source, array) { var index = -1, length = source.length; array || (array = Array(length)); while (++index < length) { array[index] = source[index]; } return array; } /** * Copies properties of `source` to `object`. * * @private * @param {Object} source The object to copy properties from. * @param {Array} props The property names to copy. * @param {Object} [object={}] The object to copy properties to. * @returns {Object} Returns `object`. */ function copyObject(source, props, object) { return copyObjectWith(source, props, object); } /** * This function is like `copyObject` except that it accepts a function to * customize copied values. * * @private * @param {Object} source The object to copy properties from. * @param {Array} props The property names to copy. * @param {Object} [object={}] The object to copy properties to. * @param {Function} [customizer] The function to customize copied values. * @returns {Object} Returns `object`. */ function copyObjectWith(source, props, object, customizer) { object || (object = {}); var index = -1, length = props.length; while (++index < length) { var key = props[index]; var newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key]; assignValue(object, key, newValue); } return object; } /** * Copies own symbol properties of `source` to `object`. * * @private * @param {Object} source The object to copy symbols from. * @param {Object} [object={}] The object to copy symbols to. * @returns {Object} Returns `object`. */ function copySymbols(source, object) { return copyObject(source, getSymbols(source), object); } /** * Creates a function like `_.groupBy`. * * @private * @param {Function} setter The function to set accumulator values. * @param {Function} [initializer] The accumulator object initializer. * @returns {Function} Returns the new aggregator function. */ function createAggregator(setter, initializer) { return function(collection, iteratee) { var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {}; return func(collection, setter, getIteratee(iteratee), accumulator); }; } /** * Creates a function like `_.assign`. * * @private * @param {Function} assigner The function to assign values. * @returns {Function} Returns the new assigner function. */ function createAssigner(assigner) { return rest(function(object, sources) { var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined, guard = length > 2 ? sources[2] : undefined; customizer = typeof customizer == 'function' ? (length--, customizer) : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; length = 1; } object = Object(object); while (++index < length) { var source = sources[index]; if (source) { assigner(object, source, index, customizer); } } return object; }); } /** * Creates a `baseEach` or `baseEachRight` function. * * @private * @param {Function} eachFunc The function to iterate over a collection. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base function. */ function createBaseEach(eachFunc, fromRight) { return function(collection, iteratee) { if (collection == null) { return collection; } if (!isArrayLike(collection)) { return eachFunc(collection, iteratee); } var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection); while ((fromRight ? index-- : ++index < length)) { if (iteratee(iterable[index], index, iterable) === false) { break; } } return collection; }; } /** * Creates a base function for methods like `_.forIn`. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base function. */ function createBaseFor(fromRight) { return function(object, iteratee, keysFunc) { var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length; while (length--) { var key = props[fromRight ? length : ++index]; if (iteratee(iterable[key], key, iterable) === false) { break; } } return object; }; } /** * Creates a function that wraps `func` to invoke it with the optional `this` * binding of `thisArg`. * * @private * @param {Function} func The function to wrap. * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. * @param {*} [thisArg] The `this` binding of `func`. * @returns {Function} Returns the new wrapped function. */ function createBaseWrapper(func, bitmask, thisArg) { var isBind = bitmask & BIND_FLAG, Ctor = createCtorWrapper(func); function wrapper() { var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return fn.apply(isBind ? thisArg : this, arguments); } return wrapper; } /** * Creates a function like `_.lowerFirst`. * * @private * @param {string} methodName The name of the `String` case method to use. * @returns {Function} Returns the new function. */ function createCaseFirst(methodName) { return function(string) { string = toString(string); var strSymbols = reHasComplexSymbol.test(string) ? stringToArray(string) : undefined; var chr = strSymbols ? strSymbols[0] : string.charAt(0), trailing = strSymbols ? strSymbols.slice(1).join('') : string.slice(1); return chr[methodName]() + trailing; }; } /** * Creates a function like `_.camelCase`. * * @private * @param {Function} callback The function to combine each word. * @returns {Function} Returns the new compounder function. */ function createCompounder(callback) { return function(string) { return arrayReduce(words(deburr(string)), callback, ''); }; } /** * Creates a function that produces an instance of `Ctor` regardless of * whether it was invoked as part of a `new` expression or by `call` or `apply`. * * @private * @param {Function} Ctor The constructor to wrap. * @returns {Function} Returns the new wrapped function. */ function createCtorWrapper(Ctor) { return function() { // Use a `switch` statement to work with class constructors. // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist // for more details. var args = arguments; switch (args.length) { case 0: return new Ctor; case 1: return new Ctor(args[0]); case 2: return new Ctor(args[0], args[1]); case 3: return new Ctor(args[0], args[1], args[2]); case 4: return new Ctor(args[0], args[1], args[2], args[3]); case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); } var thisBinding = baseCreate(Ctor.prototype), result = Ctor.apply(thisBinding, args); // Mimic the constructor's `return` behavior. // See https://es5.github.io/#x13.2.2 for more details. return isObject(result) ? result : thisBinding; }; } /** * Creates a function that wraps `func` to enable currying. * * @private * @param {Function} func The function to wrap. * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. * @param {number} arity The arity of `func`. * @returns {Function} Returns the new wrapped function. */ function createCurryWrapper(func, bitmask, arity) { var Ctor = createCtorWrapper(func); function wrapper() { var length = arguments.length, index = length, args = Array(length), fn = (this && this !== root && this instanceof wrapper) ? Ctor : func, placeholder = lodash.placeholder || wrapper.placeholder; while (index--) { args[index] = arguments[index]; } var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) ? [] : replaceHolders(args, placeholder); length -= holders.length; return length < arity ? createRecurryWrapper(func, bitmask, createHybridWrapper, placeholder, undefined, args, holders, undefined, undefined, arity - length) : apply(fn, this, args); } return wrapper; } /** * Creates a `_.flow` or `_.flowRight` function. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new flow function. */ function createFlow(fromRight) { return rest(function(funcs) { funcs = baseFlatten(funcs, 1); var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru; if (fromRight) { funcs.reverse(); } while (index--) { var func = funcs[index]; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } if (prereq && !wrapper && getFuncName(func) == 'wrapper') { var wrapper = new LodashWrapper([], true); } } index = wrapper ? index : length; while (++index < length) { func = funcs[index]; var funcName = getFuncName(func), data = funcName == 'wrapper' ? getData(func) : undefined; if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1 ) { wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); } else { wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func); } } return function() { var args = arguments, value = args[0]; if (wrapper && args.length == 1 && isArray(value) && value.length >= LARGE_ARRAY_SIZE) { return wrapper.plant(value).value(); } var index = 0, result = length ? funcs[index].apply(this, args) : value; while (++index < length) { result = funcs[index].call(this, result); } return result; }; }); } /** * Creates a function that wraps `func` to invoke it with optional `this` * binding of `thisArg`, partial application, and currying. * * @private * @param {Function|string} func The function or method name to wrap. * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. * @param {*} [thisArg] The `this` binding of `func`. * @param {Array} [partials] The arguments to prepend to those provided to the new function. * @param {Array} [holders] The `partials` placeholder indexes. * @param {Array} [partialsRight] The arguments to append to those provided to the new function. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. * @param {Array} [argPos] The argument positions of the new function. * @param {number} [ary] The arity cap of `func`. * @param {number} [arity] The arity of `func`. * @returns {Function} Returns the new wrapped function. */ function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { var isAry = bitmask & ARY_FLAG, isBind = bitmask & BIND_FLAG, isBindKey = bitmask & BIND_KEY_FLAG, isCurry = bitmask & CURRY_FLAG, isCurryRight = bitmask & CURRY_RIGHT_FLAG, isFlip = bitmask & FLIP_FLAG, Ctor = isBindKey ? undefined : createCtorWrapper(func); function wrapper() { var length = arguments.length, index = length, args = Array(length); while (index--) { args[index] = arguments[index]; } if (partials) { args = composeArgs(args, partials, holders); } if (partialsRight) { args = composeArgsRight(args, partialsRight, holdersRight); } if (isCurry || isCurryRight) { var placeholder = lodash.placeholder || wrapper.placeholder, argsHolders = replaceHolders(args, placeholder); length -= argsHolders.length; if (length < arity) { return createRecurryWrapper( func, bitmask, createHybridWrapper, placeholder, thisArg, args, argsHolders, argPos, ary, arity - length ); } } var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func; if (argPos) { args = reorder(args, argPos); } else if (isFlip && args.length > 1) { args.reverse(); } if (isAry && ary < args.length) { args.length = ary; } if (this && this !== root && this instanceof wrapper) { fn = Ctor || createCtorWrapper(fn); } return fn.apply(thisBinding, args); } return wrapper; } /** * Creates a function like `_.invertBy`. * * @private * @param {Function} setter The function to set accumulator values. * @param {Function} toIteratee The function to resolve iteratees. * @returns {Function} Returns the new inverter function. */ function createInverter(setter, toIteratee) { return function(object, iteratee) { return baseInverter(object, setter, toIteratee(iteratee), {}); }; } /** * Creates a function like `_.over`. * * @private * @param {Function} arrayFunc The function to iterate over iteratees. * @returns {Function} Returns the new invoker function. */ function createOver(arrayFunc) { return rest(function(iteratees) { iteratees = arrayMap(baseFlatten(iteratees, 1), getIteratee()); return rest(function(args) { var thisArg = this; return arrayFunc(iteratees, function(iteratee) { return apply(iteratee, thisArg, args); }); }); }); } /** * Creates the padding for `string` based on `length`. The `chars` string * is truncated if the number of characters exceeds `length`. * * @private * @param {string} string The string to create padding for. * @param {number} [length=0] The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padding for `string`. */ function createPadding(string, length, chars) { length = toInteger(length); var strLength = stringSize(string); if (!length || strLength >= length) { return ''; } var padLength = length - strLength; chars = chars === undefined ? ' ' : (chars + ''); var result = repeat(chars, nativeCeil(padLength / stringSize(chars))); return reHasComplexSymbol.test(chars) ? stringToArray(result).slice(0, padLength).join('') : result.slice(0, padLength); } /** * Creates a function that wraps `func` to invoke it with the optional `this` * binding of `thisArg` and the `partials` prepended to those provided to * the wrapper. * * @private * @param {Function} func The function to wrap. * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. * @param {*} thisArg The `this` binding of `func`. * @param {Array} partials The arguments to prepend to those provided to the new function. * @returns {Function} Returns the new wrapped function. */ function createPartialWrapper(func, bitmask, thisArg, partials) { var isBind = bitmask & BIND_FLAG, Ctor = createCtorWrapper(func); function wrapper() { var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength), fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; while (++leftIndex < leftLength) { args[leftIndex] = partials[leftIndex]; } while (argsLength--) { args[leftIndex++] = arguments[++argsIndex]; } return apply(fn, isBind ? thisArg : this, args); } return wrapper; } /** * Creates a `_.range` or `_.rangeRight` function. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new range function. */ function createRange(fromRight) { return function(start, end, step) { if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { end = step = undefined; } // Ensure the sign of `-0` is preserved. start = toNumber(start); start = start === start ? start : 0; if (end === undefined) { end = start; start = 0; } else { end = toNumber(end) || 0; } step = step === undefined ? (start < end ? 1 : -1) : (toNumber(step) || 0); return baseRange(start, end, step, fromRight); }; } /** * Creates a function that wraps `func` to continue currying. * * @private * @param {Function} func The function to wrap. * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. * @param {Function} wrapFunc The function to create the `func` wrapper. * @param {*} placeholder The placeholder to replace. * @param {*} [thisArg] The `this` binding of `func`. * @param {Array} [partials] The arguments to prepend to those provided to the new function. * @param {Array} [holders] The `partials` placeholder indexes. * @param {Array} [argPos] The argument positions of the new function. * @param {number} [ary] The arity cap of `func`. * @param {number} [arity] The arity of `func`. * @returns {Function} Returns the new wrapped function. */ function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { var isCurry = bitmask & CURRY_FLAG, newArgPos = argPos ? copyArray(argPos) : undefined, newsHolders = isCurry ? holders : undefined, newHoldersRight = isCurry ? undefined : holders, newPartials = isCurry ? partials : undefined, newPartialsRight = isCurry ? undefined : partials; bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG); bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG); if (!(bitmask & CURRY_BOUND_FLAG)) { bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); } var newData = [ func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, arity ]; var result = wrapFunc.apply(undefined, newData); if (isLaziable(func)) { setData(result, newData); } result.placeholder = placeholder; return result; } /** * Creates a function like `_.round`. * * @private * @param {string} methodName The name of the `Math` method to use when rounding. * @returns {Function} Returns the new round function. */ function createRound(methodName) { var func = Math[methodName]; return function(number, precision) { number = toNumber(number); precision = toInteger(precision); if (precision) { // Shift with exponential notation to avoid floating-point issues. // See [MDN](https://mdn.io/round#Examples) for more details. var pair = (toString(number) + 'e').split('e'), value = func(pair[0] + 'e' + (+pair[1] + precision)); pair = (toString(value) + 'e').split('e'); return +(pair[0] + 'e' + (+pair[1] - precision)); } return func(number); }; } /** * Creates a set of `values`. * * @private * @param {Array} values The values to add to the set. * @returns {Object} Returns the new set. */ var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { return new Set(values); }; /** * Creates a function that either curries or invokes `func` with optional * `this` binding and partially applied arguments. * * @private * @param {Function|string} func The function or method name to wrap. * @param {number} bitmask The bitmask of wrapper flags. * The bitmask may be composed of the following flags: * 1 - `_.bind` * 2 - `_.bindKey` * 4 - `_.curry` or `_.curryRight` of a bound function * 8 - `_.curry` * 16 - `_.curryRight` * 32 - `_.partial` * 64 - `_.partialRight` * 128 - `_.rearg` * 256 - `_.ary` * @param {*} [thisArg] The `this` binding of `func`. * @param {Array} [partials] The arguments to be partially applied. * @param {Array} [holders] The `partials` placeholder indexes. * @param {Array} [argPos] The argument positions of the new function. * @param {number} [ary] The arity cap of `func`. * @param {number} [arity] The arity of `func`. * @returns {Function} Returns the new wrapped function. */ function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { var isBindKey = bitmask & BIND_KEY_FLAG; if (!isBindKey && typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } var length = partials ? partials.length : 0; if (!length) { bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); partials = holders = undefined; } ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); arity = arity === undefined ? arity : toInteger(arity); length -= holders ? holders.length : 0; if (bitmask & PARTIAL_RIGHT_FLAG) { var partialsRight = partials, holdersRight = holders; partials = holders = undefined; } var data = isBindKey ? undefined : getData(func); var newData = [ func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity ]; if (data) { mergeData(newData, data); } func = newData[0]; bitmask = newData[1]; thisArg = newData[2]; partials = newData[3]; holders = newData[4]; arity = newData[9] = newData[9] == null ? (isBindKey ? 0 : func.length) : nativeMax(newData[9] - length, 0); if (!arity && bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG)) { bitmask &= ~(CURRY_FLAG | CURRY_RIGHT_FLAG); } if (!bitmask || bitmask == BIND_FLAG) { var result = createBaseWrapper(func, bitmask, thisArg); } else if (bitmask == CURRY_FLAG || bitmask == CURRY_RIGHT_FLAG) { result = createCurryWrapper(func, bitmask, arity); } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) { result = createPartialWrapper(func, bitmask, thisArg, partials); } else { result = createHybridWrapper.apply(undefined, newData); } var setter = data ? baseSetData : setData; return setter(result, newData); } /** * A specialized version of `baseIsEqualDeep` for arrays with support for * partial deep comparisons. * * @private * @param {Array} array The array to compare. * @param {Array} other The other array to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparisons. * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. * @param {Object} [stack] Tracks traversed `array` and `other` objects. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { var index = -1, isPartial = bitmask & PARTIAL_COMPARE_FLAG, isUnordered = bitmask & UNORDERED_COMPARE_FLAG, arrLength = array.length, othLength = other.length; if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } // Assume cyclic values are equal. var stacked = stack.get(array); if (stacked) { return stacked == other; } var result = true; stack.set(array, other); // Ignore non-index properties. while (++index < arrLength) { var arrValue = array[index], othValue = other[index]; if (customizer) { var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { continue; } result = false; break; } // Recursively compare arrays (susceptible to call stack limits). if (isUnordered) { if (!arraySome(other, function(othValue) { return arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack); })) { result = false; break; } } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { result = false; break; } } stack['delete'](array); return result; } /** * A specialized version of `baseIsEqualDeep` for comparing objects of * the same `toStringTag`. * * **Note:** This function only supports comparing values with tags of * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {string} tag The `toStringTag` of the objects to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparisons. * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalByTag(object, other, tag, equalFunc, customizer, bitmask) { switch (tag) { case arrayBufferTag: if ((object.byteLength != other.byteLength) || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { return false; } return true; case boolTag: case dateTag: // 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 +object == +other; case errorTag: return object.name == other.name && object.message == other.message; case numberTag: // Treat `NaN` vs. `NaN` as equal. return (object != +object) ? other != +other : object == +other; case regexpTag: case stringTag: // Coerce regexes to strings and treat strings primitives and string // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. return object == (other + ''); case mapTag: var convert = mapToArray; case setTag: var isPartial = bitmask & PARTIAL_COMPARE_FLAG; convert || (convert = setToArray); // Recursively compare objects (susceptible to call stack limits). return (isPartial || object.size == other.size) && equalFunc(convert(object), convert(other), customizer, bitmask | UNORDERED_COMPARE_FLAG); case symbolTag: return !!Symbol && (symbolValueOf.call(object) == symbolValueOf.call(other)); } return false; } /** * A specialized version of `baseIsEqualDeep` for objects with support for * partial deep comparisons. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparisons. * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. * @param {Object} [stack] Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { var isPartial = bitmask & PARTIAL_COMPARE_FLAG, objProps = keys(object), objLength = objProps.length, othProps = keys(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } var index = objLength; while (index--) { var key = objProps[index]; if (!(isPartial ? key in other : baseHas(other, key))) { return false; } } // Assume cyclic values are equal. var stacked = stack.get(object); if (stacked) { return stacked == other; } var result = true; stack.set(object, other); var skipCtor = isPartial; while (++index < objLength) { key = objProps[index]; var objValue = object[key], othValue = other[key]; if (customizer) { var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack)) : compared )) { result = false; break; } skipCtor || (skipCtor = key == 'constructor'); } if (result && !skipCtor) { var objCtor = object.constructor, othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal. if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } stack['delete'](object); return result; } /** * Gets metadata for `func`. * * @private * @param {Function} func The function to query. * @returns {*} Returns the metadata for `func`. */ var getData = !metaMap ? noop : function(func) { return metaMap.get(func); }; /** * Gets the name of `func`. * * @private * @param {Function} func The function to query. * @returns {string} Returns the function name. */ function getFuncName(func) { var result = (func.name + ''), array = realNames[result], length = hasOwnProperty.call(realNames, result) ? array.length : 0; while (length--) { var data = array[length], otherFunc = data.func; if (otherFunc == null || otherFunc == func) { return data.name; } } return result; } /** * Gets the appropriate "iteratee" function. If the `_.iteratee` method is * customized this function returns the custom method, otherwise it returns * `baseIteratee`. If arguments are provided the chosen function is invoked * with them and its result is returned. * * @private * @param {*} [value] The value to convert to an iteratee. * @param {number} [arity] The arity of the created iteratee. * @returns {Function} Returns the chosen function or its result. */ function getIteratee() { var result = lodash.iteratee || iteratee; result = result === iteratee ? baseIteratee : result; return arguments.length ? result(arguments[0], arguments[1]) : result; } /** * Gets the "length" property value of `object`. * * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) * that affects Safari on at least iOS 8.1-8.3 ARM64. * * @private * @param {Object} object The object to query. * @returns {*} Returns the "length" value. */ var getLength = baseProperty('length'); /** * Gets the property names, values, and compare flags of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the match data of `object`. */ function getMatchData(object) { var result = toPairs(object), length = result.length; while (length--) { result[length][2] = isStrictComparable(result[length][1]); } return result; } /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = object == null ? undefined : object[key]; return isNative(value) ? value : undefined; } /** * Creates an array of the own symbol properties of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ var getSymbols = getOwnPropertySymbols || function() { return []; }; /** * Gets the `toStringTag` of `value`. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function getTag(value) { return objectToString.call(value); } // Fallback for IE 11 providing `toStringTag` values for maps, sets, and weakmaps. if ((Map && getTag(new Map) != mapTag) || (Set && getTag(new Set) != setTag) || (WeakMap && getTag(new WeakMap) != weakMapTag)) { getTag = function(value) { var result = objectToString.call(value), Ctor = result == objectTag ? value.constructor : null, ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : ''; if (ctorString) { switch (ctorString) { case mapCtorString: return mapTag; case setCtorString: return setTag; case weakMapCtorString: return weakMapTag; } } return result; }; } /** * Gets the view, applying any `transforms` to the `start` and `end` positions. * * @private * @param {number} start The start of the view. * @param {number} end The end of the view. * @param {Array} transforms The transformations to apply to the view. * @returns {Object} Returns an object containing the `start` and `end` * positions of the view. */ function getView(start, end, transforms) { var index = -1, length = transforms.length; while (++index < length) { var data = transforms[index], size = data.size; switch (data.type) { case 'drop': start += size; break; case 'dropRight': end -= size; break; case 'take': end = nativeMin(end, start + size); break; case 'takeRight': start = nativeMax(start, end - size); break; } } return { 'start': start, 'end': end }; } /** * Checks if `path` exists on `object`. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @param {Function} hasFunc The function to check properties. * @returns {boolean} Returns `true` if `path` exists, else `false`. */ function hasPath(object, path, hasFunc) { if (object == null) { return false; } var result = hasFunc(object, path); if (!result && !isKey(path)) { path = baseCastPath(path); object = parent(object, path); if (object != null) { path = last(path); result = hasFunc(object, path); } } var length = object ? object.length : undefined; return result || ( !!length && isLength(length) && isIndex(path, length) && (isArray(object) || isString(object) || isArguments(object)) ); } /** * Initializes an array clone. * * @private * @param {Array} array The array to clone. * @returns {Array} Returns the initialized clone. */ function initCloneArray(array) { var length = array.length, result = array.constructor(length); // Add properties assigned by `RegExp#exec`. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { result.index = array.index; result.input = array.input; } return result; } /** * Initializes an object clone. * * @private * @param {Object} object The object to clone. * @returns {Object} Returns the initialized clone. */ function initCloneObject(object) { if (isPrototype(object)) { return {}; } var Ctor = object.constructor; return baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined); } /** * Initializes an object clone based on its `toStringTag`. * * **Note:** This function only supports cloning values with tags of * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} object The object to clone. * @param {string} tag The `toStringTag` of the object to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the initialized clone. */ function initCloneByTag(object, tag, isDeep) { var Ctor = object.constructor; switch (tag) { case arrayBufferTag: return cloneArrayBuffer(object); case boolTag: case dateTag: return new Ctor(+object); case float32Tag: case float64Tag: case int8Tag: case int16Tag: case int32Tag: case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: return cloneTypedArray(object, isDeep); case mapTag: return cloneMap(object); case numberTag: case stringTag: return new Ctor(object); case regexpTag: return cloneRegExp(object); case setTag: return cloneSet(object); case symbolTag: return cloneSymbol(object); } } /** * Creates an array of index keys for `object` values of arrays, * `arguments` objects, and strings, otherwise `null` is returned. * * @private * @param {Object} object The object to query. * @returns {Array|null} Returns index keys, else `null`. */ function indexKeys(object) { var length = object ? object.length : undefined; if (isLength(length) && (isArray(object) || isString(object) || isArguments(object))) { return baseTimes(length, String); } return null; } /** * Checks if the given arguments are from an iteratee call. * * @private * @param {*} value The potential iteratee value argument. * @param {*} index The potential iteratee index or key argument. * @param {*} object The potential iteratee object argument. * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`. */ function isIterateeCall(value, index, object) { if (!isObject(object)) { return false; } var type = typeof index; if (type == 'number' ? (isArrayLike(object) && isIndex(index, object.length)) : (type == 'string' && index in object)) { return eq(object[index], value); } return false; } /** * Checks if `value` is a property name and not a property path. * * @private * @param {*} value The value to check. * @param {Object} [object] The object to query keys on. * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { if (typeof value == 'number') { return true; } return !isArray(value) && (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object))); } /** * Checks if `value` is suitable for use as unique object key. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ function isKeyable(value) { var type = typeof value; return type == 'number' || type == 'boolean' || (type == 'string' && value != '__proto__') || value == null; } /** * Checks if `func` has a lazy counterpart. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`. */ function isLaziable(func) { var funcName = getFuncName(func), other = lodash[funcName]; if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { return false; } if (func === other) { return true; } var data = getData(other); return !!data && func === data[0]; } /** * Checks if `value` is likely a prototype object. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ function isPrototype(value) { var Ctor = value && value.constructor, proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; return value === proto; } /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` if suitable for strict * equality comparisons, else `false`. */ function isStrictComparable(value) { return value === value && !isObject(value); } /** * Merges the function metadata of `source` into `data`. * * Merging metadata reduces the number of wrappers used to invoke a function. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg` * modify function arguments, making the order in which they are executed important, * preventing the merging of metadata. However, we make an exception for a safe * combined case where curried functions have `_.ary` and or `_.rearg` applied. * * @private * @param {Array} data The destination metadata. * @param {Array} source The source metadata. * @returns {Array} Returns `data`. */ function mergeData(data, source) { var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (BIND_FLAG | BIND_KEY_FLAG | ARY_FLAG); var isCombo = (srcBitmask == ARY_FLAG && (bitmask == CURRY_FLAG)) || (srcBitmask == ARY_FLAG && (bitmask == REARG_FLAG) && (data[7].length <= source[8])) || (srcBitmask == (ARY_FLAG | REARG_FLAG) && (source[7].length <= source[8]) && (bitmask == CURRY_FLAG)); // Exit early if metadata can't be merged. if (!(isCommon || isCombo)) { return data; } // Use source `thisArg` if available. if (srcBitmask & BIND_FLAG) { data[2] = source[2]; // Set when currying a bound function. newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG; } // Compose partial arguments. var value = source[3]; if (value) { var partials = data[3]; data[3] = partials ? composeArgs(partials, value, source[4]) : copyArray(value); data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : copyArray(source[4]); } // Compose partial right arguments. value = source[5]; if (value) { partials = data[5]; data[5] = partials ? composeArgsRight(partials, value, source[6]) : copyArray(value); data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : copyArray(source[6]); } // Use source `argPos` if available. value = source[7]; if (value) { data[7] = copyArray(value); } // Use source `ary` if it's smaller. if (srcBitmask & ARY_FLAG) { data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); } // Use source `arity` if one is not provided. if (data[9] == null) { data[9] = source[9]; } // Use source `func` and merge bitmasks. data[0] = source[0]; data[1] = newBitmask; return data; } /** * Used by `_.defaultsDeep` to customize its `_.merge` use. * * @private * @param {*} objValue The destination value. * @param {*} srcValue The source value. * @param {string} key The key of the property to merge. * @param {Object} object The parent object of `objValue`. * @param {Object} source The parent object of `srcValue`. * @param {Object} [stack] Tracks traversed source values and their merged counterparts. * @returns {*} Returns the value to assign. */ function mergeDefaults(objValue, srcValue, key, object, source, stack) { if (isObject(objValue) && isObject(srcValue)) { stack.set(srcValue, objValue); baseMerge(objValue, srcValue, undefined, mergeDefaults, stack); } return objValue; } /** * Gets the parent value at `path` of `object`. * * @private * @param {Object} object The object to query. * @param {Array} path The path to get the parent value of. * @returns {*} Returns the parent value. */ function parent(object, path) { return path.length == 1 ? object : get(object, baseSlice(path, 0, -1)); } /** * Reorder `array` according to the specified indexes where the element at * the first index is assigned as the first element, the element at * the second index is assigned as the second element, and so on. * * @private * @param {Array} array The array to reorder. * @param {Array} indexes The arranged array indexes. * @returns {Array} Returns `array`. */ function reorder(array, indexes) { var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array); while (length--) { var index = indexes[length]; array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; } return array; } /** * Sets metadata for `func`. * * **Note:** If this function becomes hot, i.e. is invoked a lot in a short * period of time, it will trip its breaker and transition to an identity function * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070) * for more details. * * @private * @param {Function} func The function to associate metadata with. * @param {*} data The metadata. * @returns {Function} Returns `func`. */ var setData = (function() { var count = 0, lastCalled = 0; return function(key, value) { var stamp = now(), remaining = HOT_SPAN - (stamp - lastCalled); lastCalled = stamp; if (remaining > 0) { if (++count >= HOT_COUNT) { return key; } } else { count = 0; } return baseSetData(key, value); }; }()); /** * Converts `string` to a property path array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ function stringToPath(string) { var result = []; toString(string).replace(rePropName, function(match, number, quote, string) { result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); }); return result; } /** * Creates a clone of `wrapper`. * * @private * @param {Object} wrapper The wrapper to clone. * @returns {Object} Returns the cloned wrapper. */ function wrapperClone(wrapper) { if (wrapper instanceof LazyWrapper) { return wrapper.clone(); } var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); result.__actions__ = copyArray(wrapper.__actions__); result.__index__ = wrapper.__index__; result.__values__ = wrapper.__values__; return result; } /*------------------------------------------------------------------------*/ /** * Creates an array of elements split into groups the length of `size`. * If `array` can't be split evenly, the final chunk will be the remaining * elements. * * @static * @memberOf _ * @category Array * @param {Array} array The array to process. * @param {number} [size=0] The length of each chunk. * @returns {Array} Returns the new array containing chunks. * @example * * _.chunk(['a', 'b', 'c', 'd'], 2); * // => [['a', 'b'], ['c', 'd']] * * _.chunk(['a', 'b', 'c', 'd'], 3); * // => [['a', 'b', 'c'], ['d']] */ function chunk(array, size) { size = nativeMax(toInteger(size), 0); var length = array ? array.length : 0; if (!length || size < 1) { return []; } var index = 0, resIndex = -1, result = Array(nativeCeil(length / size)); while (index < length) { result[++resIndex] = baseSlice(array, index, (index += size)); } return result; } /** * Creates an array with all falsey values removed. The values `false`, `null`, * `0`, `""`, `undefined`, and `NaN` are falsey. * * @static * @memberOf _ * @category Array * @param {Array} array The array to compact. * @returns {Array} Returns the 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, resIndex = -1, result = []; while (++index < length) { var value = array[index]; if (value) { result[++resIndex] = value; } } return result; } /** * Creates a new array concatenating `array` with any additional arrays * and/or values. * * @static * @memberOf _ * @category Array * @param {Array} array The array to concatenate. * @param {...*} [values] The values to concatenate. * @returns {Array} Returns the new concatenated array. * @example * * var array = [1]; * var other = _.concat(array, 2, [3], [[4]]); * * console.log(other); * // => [1, 2, 3, [4]] * * console.log(array); * // => [1] */ var concat = rest(function(array, values) { if (!isArray(array)) { array = array == null ? [] : [Object(array)]; } values = baseFlatten(values, 1); return arrayConcat(array, values); }); /** * Creates an array of unique `array` values not included in the other * given arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. * @returns {Array} Returns the new array of filtered values. * @example * * _.difference([3, 2, 1], [4, 2]); * // => [3, 1] */ var difference = rest(function(array, values) { return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, true)) : []; }); /** * This method is like `_.difference` except that it accepts `iteratee` which * is invoked for each element of `array` and `values` to generate the criterion * by which uniqueness is computed. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new array of filtered values. * @example * * _.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], Math.floor); * // => [3.1, 1.3] * * // The `_.property` iteratee shorthand. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); * // => [{ 'x': 2 }] */ var differenceBy = rest(function(array, values) { var iteratee = last(values); if (isArrayLikeObject(iteratee)) { iteratee = undefined; } return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, true), getIteratee(iteratee)) : []; }); /** * This method is like `_.difference` except that it accepts `comparator` * which is invoked to compare elements of `array` to `values`. The comparator * is invoked with two arguments: (arrVal, othVal). * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of filtered values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); * // => [{ 'x': 2, 'y': 1 }] */ var differenceWith = rest(function(array, values) { var comparator = last(values); if (isArrayLikeObject(comparator)) { comparator = undefined; } return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, true), undefined, comparator) : []; }); /** * Creates a slice of `array` with `n` elements dropped from the beginning. * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to drop. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.drop([1, 2, 3]); * // => [2, 3] * * _.drop([1, 2, 3], 2); * // => [3] * * _.drop([1, 2, 3], 5); * // => [] * * _.drop([1, 2, 3], 0); * // => [1, 2, 3] */ function drop(array, n, guard) { var length = array ? array.length : 0; if (!length) { return []; } n = (guard || n === undefined) ? 1 : toInteger(n); return baseSlice(array, n < 0 ? 0 : n, length); } /** * Creates a slice of `array` with `n` elements dropped from the end. * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to drop. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.dropRight([1, 2, 3]); * // => [1, 2] * * _.dropRight([1, 2, 3], 2); * // => [1] * * _.dropRight([1, 2, 3], 5); * // => [] * * _.dropRight([1, 2, 3], 0); * // => [1, 2, 3] */ function dropRight(array, n, guard) { var length = array ? array.length : 0; if (!length) { return []; } n = (guard || n === undefined) ? 1 : toInteger(n); n = length - n; return baseSlice(array, 0, n < 0 ? 0 : n); } /** * Creates a slice of `array` excluding elements dropped from the end. * Elements are dropped until `predicate` returns falsey. The predicate is * invoked with three arguments: (value, index, array). * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * * var users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': false } * ]; * * _.dropRightWhile(users, function(o) { return !o.active; }); * // => objects for ['barney'] * * // The `_.matches` iteratee shorthand. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); * // => objects for ['barney', 'fred'] * * // The `_.matchesProperty` iteratee shorthand. * _.dropRightWhile(users, ['active', false]); * // => objects for ['barney'] * * // The `_.property` iteratee shorthand. * _.dropRightWhile(users, 'active'); * // => objects for ['barney', 'fred', 'pebbles'] */ function dropRightWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3), true, true) : []; } /** * Creates a slice of `array` excluding elements dropped from the beginning. * Elements are dropped until `predicate` returns falsey. The predicate is * invoked with three arguments: (value, index, array). * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * * var users = [ * { 'user': 'barney', 'active': false }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': true } * ]; * * _.dropWhile(users, function(o) { return !o.active; }); * // => objects for ['pebbles'] * * // The `_.matches` iteratee shorthand. * _.dropWhile(users, { 'user': 'barney', 'active': false }); * // => objects for ['fred', 'pebbles'] * * // The `_.matchesProperty` iteratee shorthand. * _.dropWhile(users, ['active', false]); * // => objects for ['pebbles'] * * // The `_.property` iteratee shorthand. * _.dropWhile(users, 'active'); * // => objects for ['barney', 'fred', 'pebbles'] */ function dropWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3), true) : []; } /** * Fills elements of `array` with `value` from `start` up to, but not * including, `end`. * * **Note:** This method mutates `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to fill. * @param {*} value The value to fill `array` with. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns `array`. * @example * * var array = [1, 2, 3]; * * _.fill(array, 'a'); * console.log(array); * // => ['a', 'a', 'a'] * * _.fill(Array(3), 2); * // => [2, 2, 2] * * _.fill([4, 6, 8, 10], '*', 1, 3); * // => [4, '*', '*', 10] */ function fill(array, value, start, end) { var length = array ? array.length : 0; if (!length) { return []; } if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { start = 0; end = length; } return baseFill(array, value, start, end); } /** * This method is like `_.find` except that it returns the index of the first * element `predicate` returns truthy for instead of the element itself. * * @static * @memberOf _ * @category Array * @param {Array} array The array to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {number} Returns the index of the found element, else `-1`. * @example * * var users = [ * { 'user': 'barney', 'active': false }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': true } * ]; * * _.findIndex(users, function(o) { return o.user == 'barney'; }); * // => 0 * * // The `_.matches` iteratee shorthand. * _.findIndex(users, { 'user': 'fred', 'active': false }); * // => 1 * * // The `_.matchesProperty` iteratee shorthand. * _.findIndex(users, ['active', false]); * // => 0 * * // The `_.property` iteratee shorthand. * _.findIndex(users, 'active'); * // => 2 */ function findIndex(array, predicate) { return (array && array.length) ? baseFindIndex(array, getIteratee(predicate, 3)) : -1; } /** * This method is like `_.findIndex` except that it iterates over elements * of `collection` from right to left. * * @static * @memberOf _ * @category Array * @param {Array} array The array to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {number} Returns the index of the found element, else `-1`. * @example * * var users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': false } * ]; * * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); * // => 2 * * // The `_.matches` iteratee shorthand. * _.findLastIndex(users, { 'user': 'barney', 'active': true }); * // => 0 * * // The `_.matchesProperty` iteratee shorthand. * _.findLastIndex(users, ['active', false]); * // => 2 * * // The `_.property` iteratee shorthand. * _.findLastIndex(users, 'active'); * // => 0 */ function findLastIndex(array, predicate) { return (array && array.length) ? baseFindIndex(array, getIteratee(predicate, 3), true) : -1; } /** * Flattens `array` a single level deep. * * @static * @memberOf _ * @category Array * @param {Array} array The array to flatten. * @returns {Array} Returns the new flattened array. * @example * * _.flatten([1, [2, [3, [4]], 5]]); * // => [1, 2, [3, [4]], 5] */ function flatten(array) { var length = array ? array.length : 0; return length ? baseFlatten(array, 1) : []; } /** * Recursively flattens `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to flatten. * @returns {Array} Returns the new flattened array. * @example * * _.flattenDeep([1, [2, [3, [4]], 5]]); * // => [1, 2, 3, 4, 5] */ function flattenDeep(array) { var length = array ? array.length : 0; return length ? baseFlatten(array, INFINITY) : []; } /** * Recursively flatten `array` up to `depth` times. * * @static * @memberOf _ * @category Array * @param {Array} array The array to flatten. * @param {number} [depth=1] The maximum recursion depth. * @returns {Array} Returns the new flattened array. * @example * * var array = [1, [2, [3, [4]], 5]]; * * _.flattenDepth(array, 1); * // => [1, 2, [3, [4]], 5] * * _.flattenDepth(array, 2); * // => [1, 2, 3, [4], 5] */ function flattenDepth(array, depth) { var length = array ? array.length : 0; if (!length) { return []; } depth = depth === undefined ? 1 : toInteger(depth); return baseFlatten(array, depth); } /** * The inverse of `_.toPairs`; this method returns an object composed * from key-value `pairs`. * * @static * @memberOf _ * @category Array * @param {Array} pairs The key-value pairs. * @returns {Object} Returns the new object. * @example * * _.fromPairs([['fred', 30], ['barney', 40]]); * // => { 'fred': 30, 'barney': 40 } */ function fromPairs(pairs) { var index = -1, length = pairs ? pairs.length : 0, result = {}; while (++index < length) { var pair = pairs[index]; result[pair[0]] = pair[1]; } return result; } /** * Gets the first element of `array`. * * @static * @memberOf _ * @alias first * @category Array * @param {Array} array The array to query. * @returns {*} Returns the first element of `array`. * @example * * _.head([1, 2, 3]); * // => 1 * * _.head([]); * // => undefined */ function head(array) { return array ? array[0] : undefined; } /** * Gets the index at which the first occurrence of `value` is found in `array` * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. If `fromIndex` is negative, it's used as the offset * from the end of `array`. * * @static * @memberOf _ * @category Array * @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, else `-1`. * @example * * _.indexOf([1, 2, 1, 2], 2); * // => 1 * * // Search from the `fromIndex`. * _.indexOf([1, 2, 1, 2], 2, 2); * // => 3 */ function indexOf(array, value, fromIndex) { var length = array ? array.length : 0; if (!length) { return -1; } fromIndex = toInteger(fromIndex); if (fromIndex < 0) { fromIndex = nativeMax(length + fromIndex, 0); } return baseIndexOf(array, value, fromIndex); } /** * Gets all but the last element of `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @returns {Array} Returns the slice of `array`. * @example * * _.initial([1, 2, 3]); * // => [1, 2] */ function initial(array) { return dropRight(array, 1); } /** * Creates an array of unique values that are included in all given arrays * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of shared values. * @example * * _.intersection([2, 1], [4, 2], [1, 2]); * // => [2] */ var intersection = rest(function(arrays) { var mapped = arrayMap(arrays, baseCastArrayLikeObject); return (mapped.length && mapped[0] === arrays[0]) ? baseIntersection(mapped) : []; }); /** * This method is like `_.intersection` except that it accepts `iteratee` * which is invoked for each element of each `arrays` to generate the criterion * by which uniqueness is computed. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new array of shared values. * @example * * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); * // => [2.1] * * // The `_.property` iteratee shorthand. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }] */ var intersectionBy = rest(function(arrays) { var iteratee = last(arrays), mapped = arrayMap(arrays, baseCastArrayLikeObject); if (iteratee === last(mapped)) { iteratee = undefined; } else { mapped.pop(); } return (mapped.length && mapped[0] === arrays[0]) ? baseIntersection(mapped, getIteratee(iteratee)) : []; }); /** * This method is like `_.intersection` except that it accepts `comparator` * which is invoked to compare elements of `arrays`. The comparator is invoked * with two arguments: (arrVal, othVal). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of shared values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.intersectionWith(objects, others, _.isEqual); * // => [{ 'x': 1, 'y': 2 }] */ var intersectionWith = rest(function(arrays) { var comparator = last(arrays), mapped = arrayMap(arrays, baseCastArrayLikeObject); if (comparator === last(mapped)) { comparator = undefined; } else { mapped.pop(); } return (mapped.length && mapped[0] === arrays[0]) ? baseIntersection(mapped, undefined, comparator) : []; }); /** * Converts all elements in `array` into a string separated by `separator`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to convert. * @param {string} [separator=','] The element separator. * @returns {string} Returns the joined string. * @example * * _.join(['a', 'b', 'c'], '~'); * // => 'a~b~c' */ function join(array, separator) { return array ? nativeJoin.call(array, separator) : ''; } /** * Gets the last element of `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @returns {*} Returns the last element of `array`. * @example * * _.last([1, 2, 3]); * // => 3 */ function last(array) { var length = array ? array.length : 0; return length ? array[length - 1] : undefined; } /** * This method is like `_.indexOf` except that it iterates over elements of * `array` from right to left. * * @static * @memberOf _ * @category Array * @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, else `-1`. * @example * * _.lastIndexOf([1, 2, 1, 2], 2); * // => 3 * * // Search from the `fromIndex`. * _.lastIndexOf([1, 2, 1, 2], 2, 2); * // => 1 */ function lastIndexOf(array, value, fromIndex) { var length = array ? array.length : 0; if (!length) { return -1; } var index = length; if (fromIndex !== undefined) { index = toInteger(fromIndex); index = (index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1)) + 1; } if (value !== value) { return indexOfNaN(array, index, true); } while (index--) { if (array[index] === value) { return index; } } return -1; } /** * Removes all given values from `array` using * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. * * **Note:** Unlike `_.without`, this method mutates `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to modify. * @param {...*} [values] 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] */ var pull = rest(pullAll); /** * This method is like `_.pull` except that it accepts an array of values to remove. * * **Note:** Unlike `_.difference`, this method mutates `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @returns {Array} Returns `array`. * @example * * var array = [1, 2, 3, 1, 2, 3]; * * _.pullAll(array, [2, 3]); * console.log(array); * // => [1, 1] */ function pullAll(array, values) { return (array && array.length && values && values.length) ? basePullAll(array, values) : array; } /** * This method is like `_.pullAll` except that it accepts `iteratee` which is * invoked for each element of `array` and `values` to generate the criterion * by which uniqueness is computed. The iteratee is invoked with one argument: (value). * * **Note:** Unlike `_.differenceBy`, this method mutates `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns `array`. * @example * * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; * * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); * console.log(array); * // => [{ 'x': 2 }] */ function pullAllBy(array, values, iteratee) { return (array && array.length && values && values.length) ? basePullAllBy(array, values, getIteratee(iteratee)) : array; } /** * Removes elements from `array` corresponding to `indexes` and returns an * array of removed elements. * * **Note:** Unlike `_.at`, this method mutates `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to modify. * @param {...(number|number[])} [indexes] The indexes of elements to remove, * specified individually or in arrays. * @returns {Array} Returns the new array of removed elements. * @example * * var array = [5, 10, 15, 20]; * var evens = _.pullAt(array, 1, 3); * * console.log(array); * // => [5, 15] * * console.log(evens); * // => [10, 20] */ var pullAt = rest(function(array, indexes) { indexes = arrayMap(baseFlatten(indexes, 1), String); var result = baseAt(array, indexes); basePullAt(array, indexes.sort(compareAscending)); return result; }); /** * Removes all elements from `array` that `predicate` returns truthy for * and returns an array of the removed elements. The predicate is invoked with * three arguments: (value, index, array). * * **Note:** Unlike `_.filter`, this method mutates `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to modify. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the new array of removed elements. * @example * * var array = [1, 2, 3, 4]; * var evens = _.remove(array, function(n) { * return n % 2 == 0; * }); * * console.log(array); * // => [1, 3] * * console.log(evens); * // => [2, 4] */ function remove(array, predicate) { var result = []; if (!(array && array.length)) { return result; } var index = -1, indexes = [], length = array.length; predicate = getIteratee(predicate, 3); while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result.push(value); indexes.push(index); } } basePullAt(array, indexes); return result; } /** * Reverses `array` so that the first element becomes the last, the second * element becomes the second to last, and so on. * * **Note:** This method mutates `array` and is based on * [`Array#reverse`](https://mdn.io/Array/reverse). * * @static * @memberOf _ * @category Array * @returns {Array} Returns `array`. * @example * * var array = [1, 2, 3]; * * _.reverse(array); * // => [3, 2, 1] * * console.log(array); * // => [3, 2, 1] */ function reverse(array) { return array ? nativeReverse.call(array) : array; } /** * Creates a slice of `array` from `start` up to, but not including, `end`. * * **Note:** This method is used instead of [`Array#slice`](https://mdn.io/Array/slice) * to ensure dense arrays are returned. * * @static * @memberOf _ * @category Array * @param {Array} array The array to slice. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the slice of `array`. */ function slice(array, start, end) { var length = array ? array.length : 0; if (!length) { return []; } if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { start = 0; end = length; } else { start = start == null ? 0 : toInteger(start); end = end === undefined ? length : toInteger(end); } return baseSlice(array, start, end); } /** * Uses a binary search to determine the lowest index at which `value` should * be inserted into `array` in order to maintain its sort order. * * @static * @memberOf _ * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @returns {number} Returns the index at which `value` should be inserted into `array`. * @example * * _.sortedIndex([30, 50], 40); * // => 1 * * _.sortedIndex([4, 5], 4); * // => 0 */ function sortedIndex(array, value) { return baseSortedIndex(array, value); } /** * This method is like `_.sortedIndex` except that it accepts `iteratee` * which is invoked for `value` and each element of `array` to compute their * sort ranking. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {number} Returns the index at which `value` should be inserted into `array`. * @example * * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; * * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); * // => 1 * * // The `_.property` iteratee shorthand. * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); * // => 0 */ function sortedIndexBy(array, value, iteratee) { return baseSortedIndexBy(array, value, getIteratee(iteratee)); } /** * This method is like `_.indexOf` except that it performs a binary * search on a sorted `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.sortedIndexOf([1, 1, 2, 2], 2); * // => 2 */ function sortedIndexOf(array, value) { var length = array ? array.length : 0; if (length) { var index = baseSortedIndex(array, value); if (index < length && eq(array[index], value)) { return index; } } return -1; } /** * This method is like `_.sortedIndex` except that it returns the highest * index at which `value` should be inserted into `array` in order to * maintain its sort order. * * @static * @memberOf _ * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @returns {number} Returns the index at which `value` should be inserted into `array`. * @example * * _.sortedLastIndex([4, 5], 4); * // => 1 */ function sortedLastIndex(array, value) { return baseSortedIndex(array, value, true); } /** * This method is like `_.sortedLastIndex` except that it accepts `iteratee` * which is invoked for `value` and each element of `array` to compute their * sort ranking. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {number} Returns the index at which `value` should be inserted into `array`. * @example * * // The `_.property` iteratee shorthand. * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); * // => 1 */ function sortedLastIndexBy(array, value, iteratee) { return baseSortedIndexBy(array, value, getIteratee(iteratee), true); } /** * This method is like `_.lastIndexOf` except that it performs a binary * search on a sorted `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.sortedLastIndexOf([1, 1, 2, 2], 2); * // => 3 */ function sortedLastIndexOf(array, value) { var length = array ? array.length : 0; if (length) { var index = baseSortedIndex(array, value, true) - 1; if (eq(array[index], value)) { return index; } } return -1; } /** * This method is like `_.uniq` except that it's designed and optimized * for sorted arrays. * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @returns {Array} Returns the new duplicate free array. * @example * * _.sortedUniq([1, 1, 2]); * // => [1, 2] */ function sortedUniq(array) { return (array && array.length) ? baseSortedUniq(array) : []; } /** * This method is like `_.uniqBy` except that it's designed and optimized * for sorted arrays. * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @returns {Array} Returns the new duplicate free array. * @example * * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); * // => [1.1, 2.3] */ function sortedUniqBy(array, iteratee) { return (array && array.length) ? baseSortedUniqBy(array, getIteratee(iteratee)) : []; } /** * Gets all but the first element of `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @returns {Array} Returns the slice of `array`. * @example * * _.tail([1, 2, 3]); * // => [2, 3] */ function tail(array) { return drop(array, 1); } /** * Creates a slice of `array` with `n` elements taken from the beginning. * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to take. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.take([1, 2, 3]); * // => [1] * * _.take([1, 2, 3], 2); * // => [1, 2] * * _.take([1, 2, 3], 5); * // => [1, 2, 3] * * _.take([1, 2, 3], 0); * // => [] */ function take(array, n, guard) { if (!(array && array.length)) { return []; } n = (guard || n === undefined) ? 1 : toInteger(n); return baseSlice(array, 0, n < 0 ? 0 : n); } /** * Creates a slice of `array` with `n` elements taken from the end. * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to take. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.takeRight([1, 2, 3]); * // => [3] * * _.takeRight([1, 2, 3], 2); * // => [2, 3] * * _.takeRight([1, 2, 3], 5); * // => [1, 2, 3] * * _.takeRight([1, 2, 3], 0); * // => [] */ function takeRight(array, n, guard) { var length = array ? array.length : 0; if (!length) { return []; } n = (guard || n === undefined) ? 1 : toInteger(n); n = length - n; return baseSlice(array, n < 0 ? 0 : n, length); } /** * Creates a slice of `array` with elements taken from the end. Elements are * taken until `predicate` returns falsey. The predicate is invoked with three * arguments: (value, index, array). * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * * var users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': false } * ]; * * _.takeRightWhile(users, function(o) { return !o.active; }); * // => objects for ['fred', 'pebbles'] * * // The `_.matches` iteratee shorthand. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); * // => objects for ['pebbles'] * * // The `_.matchesProperty` iteratee shorthand. * _.takeRightWhile(users, ['active', false]); * // => objects for ['fred', 'pebbles'] * * // The `_.property` iteratee shorthand. * _.takeRightWhile(users, 'active'); * // => [] */ function takeRightWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3), false, true) : []; } /** * Creates a slice of `array` with elements taken from the beginning. Elements * are taken until `predicate` returns falsey. The predicate is invoked with * three arguments: (value, index, array). * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * * var users = [ * { 'user': 'barney', 'active': false }, * { 'user': 'fred', 'active': false}, * { 'user': 'pebbles', 'active': true } * ]; * * _.takeWhile(users, function(o) { return !o.active; }); * // => objects for ['barney', 'fred'] * * // The `_.matches` iteratee shorthand. * _.takeWhile(users, { 'user': 'barney', 'active': false }); * // => objects for ['barney'] * * // The `_.matchesProperty` iteratee shorthand. * _.takeWhile(users, ['active', false]); * // => objects for ['barney', 'fred'] * * // The `_.property` iteratee shorthand. * _.takeWhile(users, 'active'); * // => [] */ function takeWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3)) : []; } /** * Creates an array of unique values, in order, from all given arrays using * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of combined values. * @example * * _.union([2, 1], [4, 2], [1, 2]); * // => [2, 1, 4] */ var union = rest(function(arrays) { return baseUniq(baseFlatten(arrays, 1, true)); }); /** * This method is like `_.union` except that it accepts `iteratee` which is * invoked for each element of each `arrays` to generate the criterion by which * uniqueness is computed. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new array of combined values. * @example * * _.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor); * // => [2.1, 1.2, 4.3] * * // The `_.property` iteratee shorthand. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ var unionBy = rest(function(arrays) { var iteratee = last(arrays); if (isArrayLikeObject(iteratee)) { iteratee = undefined; } return baseUniq(baseFlatten(arrays, 1, true), getIteratee(iteratee)); }); /** * This method is like `_.union` except that it accepts `comparator` which * is invoked to compare elements of `arrays`. The comparator is invoked * with two arguments: (arrVal, othVal). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of combined values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.unionWith(objects, others, _.isEqual); * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] */ var unionWith = rest(function(arrays) { var comparator = last(arrays); if (isArrayLikeObject(comparator)) { comparator = undefined; } return baseUniq(baseFlatten(arrays, 1, true), undefined, comparator); }); /** * Creates a duplicate-free version of an array, using * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons, in which only the first occurrence of each element * is kept. * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @returns {Array} Returns the new duplicate free array. * @example * * _.uniq([2, 1, 2]); * // => [2, 1] */ function uniq(array) { return (array && array.length) ? baseUniq(array) : []; } /** * This method is like `_.uniq` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which * uniqueness is computed. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new duplicate free array. * @example * * _.uniqBy([2.1, 1.2, 2.3], Math.floor); * // => [2.1, 1.2] * * // The `_.property` iteratee shorthand. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ function uniqBy(array, iteratee) { return (array && array.length) ? baseUniq(array, getIteratee(iteratee)) : []; } /** * This method is like `_.uniq` except that it accepts `comparator` which * is invoked to compare elements of `array`. The comparator is invoked with * two arguments: (arrVal, othVal). * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new duplicate free array. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.uniqWith(objects, _.isEqual); * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] */ function uniqWith(array, comparator) { return (array && array.length) ? baseUniq(array, undefined, comparator) : []; } /** * 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 length = 0; array = arrayFilter(array, function(group) { if (isArrayLikeObject(group)) { length = nativeMax(group.length, length); return true; } }); return baseTimes(length, function(index) { return arrayMap(array, baseProperty(index)); }); } /** * This method is like `_.unzip` except that it accepts `iteratee` to specify * how regrouped values should be combined. The iteratee is invoked with the * elements of each group: (...group). * * @static * @memberOf _ * @category Array * @param {Array} array The array of grouped elements to process. * @param {Function} [iteratee=_.identity] The function to combine regrouped values. * @returns {Array} Returns the new array of regrouped elements. * @example * * var zipped = _.zip([1, 2], [10, 20], [100, 200]); * // => [[1, 10, 100], [2, 20, 200]] * * _.unzipWith(zipped, _.add); * // => [3, 30, 300] */ function unzipWith(array, iteratee) { if (!(array && array.length)) { return []; } var result = unzip(array); if (iteratee == null) { return result; } return arrayMap(result, function(group) { return apply(iteratee, undefined, group); }); } /** * Creates an array excluding all given values using * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. * * @static * @memberOf _ * @category Array * @param {Array} array The array to filter. * @param {...*} [values] The values to exclude. * @returns {Array} Returns the new array of filtered values. * @example * * _.without([1, 2, 1, 3], 1, 2); * // => [3] */ var without = rest(function(array, values) { return isArrayLikeObject(array) ? baseDifference(array, values) : []; }); /** * Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) * of the given arrays. * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of values. * @example * * _.xor([2, 1], [4, 2]); * // => [1, 4] */ var xor = rest(function(arrays) { return baseXor(arrayFilter(arrays, isArrayLikeObject)); }); /** * This method is like `_.xor` except that it accepts `iteratee` which is * invoked for each element of each `arrays` to generate the criterion by which * uniqueness is computed. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new array of values. * @example * * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); * // => [1.2, 4.3] * * // The `_.property` iteratee shorthand. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 2 }] */ var xorBy = rest(function(arrays) { var iteratee = last(arrays); if (isArrayLikeObject(iteratee)) { iteratee = undefined; } return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee)); }); /** * This method is like `_.xor` except that it accepts `comparator` which is * invoked to compare elements of `arrays`. The comparator is invoked with * two arguments: (arrVal, othVal). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.xorWith(objects, others, _.isEqual); * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] */ var xorWith = rest(function(arrays) { var comparator = last(arrays); if (isArrayLikeObject(comparator)) { comparator = undefined; } return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); }); /** * 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 _ * @category Array * @param {...Array} [arrays] The arrays to process. * @returns {Array} Returns the new array of grouped elements. * @example * * _.zip(['fred', 'barney'], [30, 40], [true, false]); * // => [['fred', 30, true], ['barney', 40, false]] */ var zip = rest(unzip); /** * This method is like `_.fromPairs` except that it accepts two arrays, * one of property names and one of corresponding values. * * @static * @memberOf _ * @category Array * @param {Array} [props=[]] The property names. * @param {Array} [values=[]] The property values. * @returns {Object} Returns the new object. * @example * * _.zipObject(['a', 'b'], [1, 2]); * // => { 'a': 1, 'b': 2 } */ function zipObject(props, values) { return baseZipObject(props || [], values || [], assignValue); } /** * This method is like `_.zipObject` except that it supports property paths. * * @static * @memberOf _ * @category Array * @param {Array} [props=[]] The property names. * @param {Array} [values=[]] The property values. * @returns {Object} Returns the new object. * @example * * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } */ function zipObjectDeep(props, values) { return baseZipObject(props || [], values || [], baseSet); } /** * This method is like `_.zip` except that it accepts `iteratee` to specify * how grouped values should be combined. The iteratee is invoked with the * elements of each group: (...group). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to process. * @param {Function} [iteratee=_.identity] The function to combine grouped values. * @returns {Array} Returns the new array of grouped elements. * @example * * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { * return a + b + c; * }); * // => [111, 222] */ var zipWith = rest(function(arrays) { var length = arrays.length, iteratee = length > 1 ? arrays[length - 1] : undefined; iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; return unzipWith(arrays, iteratee); }); /*------------------------------------------------------------------------*/ /** * Creates a `lodash` object that wraps `value` with explicit method chaining enabled. * The result of such method chaining must be unwrapped with `_#value`. * * @static * @memberOf _ * @category Seq * @param {*} value The value to wrap. * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 }, * { 'user': 'pebbles', 'age': 1 } * ]; * * var youngest = _ * .chain(users) * .sortBy('age') * .map(function(o) { * return o.user + ' is ' + o.age; * }) * .head() * .value(); * // => 'pebbles is 1' */ function chain(value) { var result = lodash(value); result.__chain__ = true; return result; } /** * This method invokes `interceptor` and returns `value`. The interceptor * is invoked with one argument; (value). The purpose of this method is to * "tap into" a method chain in order to modify intermediate results. * * @static * @memberOf _ * @category Seq * @param {*} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. * @returns {*} Returns `value`. * @example * * _([1, 2, 3]) * .tap(function(array) { * // Mutate input array. * array.pop(); * }) * .reverse() * .value(); * // => [2, 1] */ function tap(value, interceptor) { interceptor(value); return value; } /** * This method is like `_.tap` except that it returns the result of `interceptor`. * The purpose of this method is to "pass thru" values replacing intermediate * results in a method chain. * * @static * @memberOf _ * @category Seq * @param {*} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. * @returns {*} Returns the result of `interceptor`. * @example * * _(' abc ') * .chain() * .trim() * .thru(function(value) { * return [value]; * }) * .value(); * // => ['abc'] */ function thru(value, interceptor) { return interceptor(value); } /** * This method is the wrapper version of `_.at`. * * @name at * @memberOf _ * @category Seq * @param {...(string|string[])} [paths] The property paths of elements to pick, * specified individually or in arrays. * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; * * _(object).at(['a[0].b.c', 'a[1]']).value(); * // => [3, 4] * * _(['a', 'b', 'c']).at(0, 2).value(); * // => ['a', 'c'] */ var wrapperAt = rest(function(paths) { paths = baseFlatten(paths, 1); var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) { return baseAt(object, paths); }; if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) { return this.thru(interceptor); } value = value.slice(start, +start + (length ? 1 : 0)); value.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); return new LodashWrapper(value, this.__chain__).thru(function(array) { if (length && !array.length) { array.push(undefined); } return array; }); }); /** * Enables explicit method chaining on the wrapper object. * * @name chain * @memberOf _ * @category Seq * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 } * ]; * * // A sequence without explicit chaining. * _(users).head(); * // => { 'user': 'barney', 'age': 36 } * * // A sequence with explicit chaining. * _(users) * .chain() * .head() * .pick('user') * .value(); * // => { 'user': 'barney' } */ function wrapperChain() { return chain(this); } /** * Executes the chained sequence and returns the wrapped result. * * @name commit * @memberOf _ * @category Seq * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var array = [1, 2]; * var wrapped = _(array).push(3); * * console.log(array); * // => [1, 2] * * wrapped = wrapped.commit(); * console.log(array); * // => [1, 2, 3] * * wrapped.last(); * // => 3 * * console.log(array); * // => [1, 2, 3] */ function wrapperCommit() { return new LodashWrapper(this.value(), this.__chain__); } /** * This method is the wrapper version of `_.flatMap`. * * @name flatMap * @memberOf _ * @category Seq * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * function duplicate(n) { * return [n, n]; * } * * _([1, 2]).flatMap(duplicate).value(); * // => [1, 1, 2, 2] */ function wrapperFlatMap(iteratee) { return this.map(iteratee).flatten(); } /** * Gets the next value on a wrapped object following the * [iterator protocol](https://mdn.io/iteration_protocols#iterator). * * @name next * @memberOf _ * @category Seq * @returns {Object} Returns the next iterator value. * @example * * var wrapped = _([1, 2]); * * wrapped.next(); * // => { 'done': false, 'value': 1 } * * wrapped.next(); * // => { 'done': false, 'value': 2 } * * wrapped.next(); * // => { 'done': true, 'value': undefined } */ function wrapperNext() { if (this.__values__ === undefined) { this.__values__ = toArray(this.value()); } var done = this.__index__ >= this.__values__.length, value = done ? undefined : this.__values__[this.__index__++]; return { 'done': done, 'value': value }; } /** * Enables the wrapper to be iterable. * * @name Symbol.iterator * @memberOf _ * @category Seq * @returns {Object} Returns the wrapper object. * @example * * var wrapped = _([1, 2]); * * wrapped[Symbol.iterator]() === wrapped; * // => true * * Array.from(wrapped); * // => [1, 2] */ function wrapperToIterator() { return this; } /** * Creates a clone of the chained sequence planting `value` as the wrapped value. * * @name plant * @memberOf _ * @category Seq * @param {*} value The value to plant. * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * function square(n) { * return n * n; * } * * var wrapped = _([1, 2]).map(square); * var other = wrapped.plant([3, 4]); * * other.value(); * // => [9, 16] * * wrapped.value(); * // => [1, 4] */ function wrapperPlant(value) { var result, parent = this; while (parent instanceof baseLodash) { var clone = wrapperClone(parent); clone.__index__ = 0; clone.__values__ = undefined; if (result) { previous.__wrapped__ = clone; } else { result = clone; } var previous = clone; parent = parent.__wrapped__; } previous.__wrapped__ = value; return result; } /** * This method is the wrapper version of `_.reverse`. * * **Note:** This method mutates the wrapped array. * * @name reverse * @memberOf _ * @category Seq * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var array = [1, 2, 3]; * * _(array).reverse().value() * // => [3, 2, 1] * * console.log(array); * // => [3, 2, 1] */ function wrapperReverse() { var value = this.__wrapped__; if (value instanceof LazyWrapper) { var wrapped = value; if (this.__actions__.length) { wrapped = new LazyWrapper(this); } wrapped = wrapped.reverse(); wrapped.__actions__.push({ 'func': thru, 'args': [reverse], 'thisArg': undefined }); return new LodashWrapper(wrapped, this.__chain__); } return this.thru(reverse); } /** * Executes the chained sequence to extract the unwrapped value. * * @name value * @memberOf _ * @alias toJSON, valueOf * @category Seq * @returns {*} Returns the resolved unwrapped value. * @example * * _([1, 2, 3]).value(); * // => [1, 2, 3] */ function wrapperValue() { return baseWrapperValue(this.__wrapped__, this.__actions__); } /*------------------------------------------------------------------------*/ /** * Creates an object composed of keys generated from the results of running * each element of `collection` through `iteratee`. The corresponding value * of each key is the number of times the key was returned by `iteratee`. * The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys. * @returns {Object} Returns the composed aggregate object. * @example * * _.countBy([6.1, 4.2, 6.3], Math.floor); * // => { '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 `predicate` returns truthy for **all** elements of `collection`. * Iteration is stopped once `predicate` returns falsey. The predicate is * invoked with three arguments: (value, index|key, collection). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`. * @example * * _.every([true, 1, null, 'yes'], Boolean); * // => false * * var users = [ * { 'user': 'barney', 'active': false }, * { 'user': 'fred', 'active': false } * ]; * * // The `_.matches` iteratee shorthand. * _.every(users, { 'user': 'barney', 'active': false }); * // => false * * // The `_.matchesProperty` iteratee shorthand. * _.every(users, ['active', false]); * // => true * * // The `_.property` iteratee shorthand. * _.every(users, 'active'); * // => false */ function every(collection, predicate, guard) { var func = isArray(collection) ? arrayEvery : baseEvery; if (guard && isIterateeCall(collection, predicate, guard)) { predicate = undefined; } return func(collection, getIteratee(predicate, 3)); } /** * Iterates over elements of `collection`, returning an array of all elements * `predicate` returns truthy for. The predicate is invoked with three arguments: * (value, index|key, collection). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the new filtered array. * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': true }, * { 'user': 'fred', 'age': 40, 'active': false } * ]; * * _.filter(users, function(o) { return !o.active; }); * // => objects for ['fred'] * * // The `_.matches` iteratee shorthand. * _.filter(users, { 'age': 36, 'active': true }); * // => objects for ['barney'] * * // The `_.matchesProperty` iteratee shorthand. * _.filter(users, ['active', false]); * // => objects for ['fred'] * * // The `_.property` iteratee shorthand. * _.filter(users, 'active'); * // => objects for ['barney'] */ function filter(collection, predicate) { var func = isArray(collection) ? arrayFilter : baseFilter; return func(collection, getIteratee(predicate, 3)); } /** * Iterates over elements of `collection`, returning the first element * `predicate` returns truthy for. The predicate is invoked with three arguments: * (value, index|key, collection). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {*} Returns the matched element, else `undefined`. * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': true }, * { 'user': 'fred', 'age': 40, 'active': false }, * { 'user': 'pebbles', 'age': 1, 'active': true } * ]; * * _.find(users, function(o) { return o.age < 40; }); * // => object for 'barney' * * // The `_.matches` iteratee shorthand. * _.find(users, { 'age': 1, 'active': true }); * // => object for 'pebbles' * * // The `_.matchesProperty` iteratee shorthand. * _.find(users, ['active', false]); * // => object for 'fred' * * // The `_.property` iteratee shorthand. * _.find(users, 'active'); * // => object for 'barney' */ function find(collection, predicate) { predicate = getIteratee(predicate, 3); if (isArray(collection)) { var index = baseFindIndex(collection, predicate); return index > -1 ? collection[index] : undefined; } return baseFind(collection, predicate, baseEach); } /** * This method is like `_.find` except that it iterates over elements of * `collection` from right to left. * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {*} Returns the matched element, else `undefined`. * @example * * _.findLast([1, 2, 3, 4], function(n) { * return n % 2 == 1; * }); * // => 3 */ function findLast(collection, predicate) { predicate = getIteratee(predicate, 3); if (isArray(collection)) { var index = baseFindIndex(collection, predicate, true); return index > -1 ? collection[index] : undefined; } return baseFind(collection, predicate, baseEachRight); } /** * Creates an array of flattened values by running each element in `collection` * through `iteratee` and concating its result to the other mapped values. * The iteratee is invoked with three arguments: (value, index|key, collection). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. * @returns {Array} Returns the new flattened array. * @example * * function duplicate(n) { * return [n, n]; * } * * _.flatMap([1, 2], duplicate); * // => [1, 1, 2, 2] */ function flatMap(collection, iteratee) { return baseFlatten(map(collection, iteratee), 1); } /** * Iterates over elements of `collection` invoking `iteratee` for each element. * The iteratee is invoked with three arguments: (value, index|key, collection). * Iteratee functions may exit iteration early by explicitly returning `false`. * * **Note:** As with other "Collections" methods, objects with a "length" property * are iterated like arrays. To avoid this behavior use `_.forIn` or `_.forOwn` * for object iteration. * * @static * @memberOf _ * @alias each * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array|Object} Returns `collection`. * @example * * _([1, 2]).forEach(function(value) { * console.log(value); * }); * // => logs `1` then `2` * * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { * console.log(key); * }); * // => logs 'a' then 'b' (iteration order is not guaranteed) */ function forEach(collection, iteratee) { return (typeof iteratee == 'function' && isArray(collection)) ? arrayEach(collection, iteratee) : baseEach(collection, baseCastFunction(iteratee)); } /** * This method is like `_.forEach` except that it iterates over elements of * `collection` from right to left. * * @static * @memberOf _ * @alias eachRight * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array|Object} Returns `collection`. * @example * * _.forEachRight([1, 2], function(value) { * console.log(value); * }); * // => logs `2` then `1` */ function forEachRight(collection, iteratee) { return (typeof iteratee == 'function' && isArray(collection)) ? arrayEachRight(collection, iteratee) : baseEachRight(collection, baseCastFunction(iteratee)); } /** * Creates an object composed of keys generated from the results of running * each element of `collection` through `iteratee`. The corresponding value * of each key is an array of elements responsible for generating the key. * The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys. * @returns {Object} Returns the composed aggregate object. * @example * * _.groupBy([6.1, 4.2, 6.3], Math.floor); * // => { '4': [4.2], '6': [6.1, 6.3] } * * // The `_.property` iteratee shorthand. * _.groupBy(['one', 'two', 'three'], 'length'); * // => { '3': ['one', 'two'], '5': ['three'] } */ var groupBy = createAggregator(function(result, value, key) { if (hasOwnProperty.call(result, key)) { result[key].push(value); } else { result[key] = [value]; } }); /** * Checks if `value` is in `collection`. If `collection` is a string it's checked * for a substring of `value`, otherwise [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * is used for equality comparisons. If `fromIndex` is negative, it's used as * the offset from the end of `collection`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to search. * @param {*} value The value to search for. * @param {number} [fromIndex=0] The index to search from. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. * @returns {boolean} Returns `true` if `value` is found, else `false`. * @example * * _.includes([1, 2, 3], 1); * // => true * * _.includes([1, 2, 3], 1, 2); * // => false * * _.includes({ 'user': 'fred', 'age': 40 }, 'fred'); * // => true * * _.includes('pebbles', 'eb'); * // => true */ function includes(collection, value, fromIndex, guard) { collection = isArrayLike(collection) ? collection : values(collection); fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; var length = collection.length; if (fromIndex < 0) { fromIndex = nativeMax(length + fromIndex, 0); } return isString(collection) ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) : (!!length && baseIndexOf(collection, value, fromIndex) > -1); } /** * Invokes the method at `path` of each element in `collection`, returning * an array of the results of each invoked method. Any additional arguments * are provided to each invoked method. If `methodName` is a function it's * invoked for, and `this` bound to, each element in `collection`. * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Array|Function|string} path The path of the method to invoke or * the function invoked per iteration. * @param {...*} [args] The arguments to invoke each method with. * @returns {Array} Returns the array of results. * @example * * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); * // => [[1, 5, 7], [1, 2, 3]] * * _.invokeMap([123, 456], String.prototype.split, ''); * // => [['1', '2', '3'], ['4', '5', '6']] */ var invokeMap = rest(function(collection, path, args) { var index = -1, isFunc = typeof path == 'function', isProp = isKey(path), result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value) { var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined); result[++index] = func ? apply(func, value, args) : baseInvoke(value, path, args); }); return result; }); /** * Creates an object composed of keys generated from the results of running * each element of `collection` through `iteratee`. The corresponding value * of each key is the last element responsible for generating the key. The * iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys. * @returns {Object} Returns the composed aggregate object. * @example * * var array = [ * { 'dir': 'left', 'code': 97 }, * { 'dir': 'right', 'code': 100 } * ]; * * _.keyBy(array, function(o) { * return String.fromCharCode(o.code); * }); * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } * * _.keyBy(array, 'dir'); * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } */ var keyBy = createAggregator(function(result, value, key) { result[key] = value; }); /** * Creates an array of values by running each element in `collection` through * `iteratee`. The iteratee is invoked with three arguments: * (value, index|key, collection). * * Many lodash methods are guarded to work as iteratees for methods like * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. * * The guarded methods are: * `ary`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, `fill`, * `invert`, `parseInt`, `random`, `range`, `rangeRight`, `slice`, `some`, * `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimEnd`, `trimStart`, * and `words` * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. * @returns {Array} Returns the new mapped array. * @example * * function square(n) { * return n * n; * } * * _.map([4, 8], square); * // => [16, 64] * * _.map({ 'a': 4, 'b': 8 }, square); * // => [16, 64] (iteration order is not guaranteed) * * var users = [ * { 'user': 'barney' }, * { 'user': 'fred' } * ]; * * // The `_.property` iteratee shorthand. * _.map(users, 'user'); * // => ['barney', 'fred'] */ function map(collection, iteratee) { var func = isArray(collection) ? arrayMap : baseMap; return func(collection, getIteratee(iteratee, 3)); } /** * This method is like `_.sortBy` except that it allows specifying the sort * orders of the iteratees to sort by. If `orders` is unspecified, all values * are sorted in ascending order. Otherwise, specify an order of "desc" for * descending or "asc" for ascending sort order of corresponding values. * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function[]|Object[]|string[]} [iteratees=[_.identity]] The iteratees to sort by. * @param {string[]} [orders] The sort orders of `iteratees`. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. * @returns {Array} Returns the new sorted array. * @example * * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 34 }, * { 'user': 'fred', 'age': 42 }, * { 'user': 'barney', 'age': 36 } * ]; * * // Sort by `user` in ascending order and by `age` in descending order. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ function orderBy(collection, iteratees, orders, guard) { if (collection == null) { return []; } if (!isArray(iteratees)) { iteratees = iteratees == null ? [] : [iteratees]; } orders = guard ? undefined : orders; if (!isArray(orders)) { orders = orders == null ? [] : [orders]; } return baseOrderBy(collection, iteratees, orders); } /** * Creates an array of elements split into two groups, the first of which * contains elements `predicate` returns truthy for, the second of which * contains elements `predicate` returns falsey for. The predicate is * invoked with one argument: (value). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the array of grouped elements. * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': false }, * { 'user': 'fred', 'age': 40, 'active': true }, * { 'user': 'pebbles', 'age': 1, 'active': false } * ]; * * _.partition(users, function(o) { return o.active; }); * // => objects for [['fred'], ['barney', 'pebbles']] * * // The `_.matches` iteratee shorthand. * _.partition(users, { 'age': 1, 'active': false }); * // => objects for [['pebbles'], ['barney', 'fred']] * * // The `_.matchesProperty` iteratee shorthand. * _.partition(users, ['active', false]); * // => objects for [['barney', 'pebbles'], ['fred']] * * // The `_.property` iteratee shorthand. * _.partition(users, 'active'); * // => objects for [['fred'], ['barney', 'pebbles']] */ var partition = createAggregator(function(result, value, key) { result[key ? 0 : 1].push(value); }, function() { return [[], []]; }); /** * Reduces `collection` to a value which is the accumulated result of running * each element in `collection` through `iteratee`, where each successive * invocation is supplied the return value of the previous. If `accumulator` * is not given the first element of `collection` is used as the initial * value. The iteratee is invoked with four arguments: * (accumulator, value, index|key, collection). * * Many lodash methods are guarded to work as iteratees for methods like * `_.reduce`, `_.reduceRight`, and `_.transform`. * * The guarded methods are: * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, * and `sortBy` * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The initial value. * @returns {*} Returns the accumulated value. * @example * * _.reduce([1, 2], function(sum, n) { * return sum + n; * }, 0); * // => 3 * * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { * (result[value] || (result[value] = [])).push(key); * return result; * }, {}); * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) */ function reduce(collection, iteratee, accumulator) { var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3; return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); } /** * This method is like `_.reduce` except that it iterates over elements of * `collection` from right to left. * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The initial value. * @returns {*} Returns the accumulated value. * @example * * var array = [[0, 1], [2, 3], [4, 5]]; * * _.reduceRight(array, function(flattened, other) { * return flattened.concat(other); * }, []); * // => [4, 5, 2, 3, 0, 1] */ function reduceRight(collection, iteratee, accumulator) { var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3; return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); } /** * The opposite of `_.filter`; this method returns the elements of `collection` * that `predicate` does **not** return truthy for. * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the new filtered array. * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': false }, * { 'user': 'fred', 'age': 40, 'active': true } * ]; * * _.reject(users, function(o) { return !o.active; }); * // => objects for ['fred'] * * // The `_.matches` iteratee shorthand. * _.reject(users, { 'age': 40, 'active': true }); * // => objects for ['barney'] * * // The `_.matchesProperty` iteratee shorthand. * _.reject(users, ['active', false]); * // => objects for ['fred'] * * // The `_.property` iteratee shorthand. * _.reject(users, 'active'); * // => objects for ['barney'] */ function reject(collection, predicate) { var func = isArray(collection) ? arrayFilter : baseFilter; predicate = getIteratee(predicate, 3); return func(collection, function(value, index, collection) { return !predicate(value, index, collection); }); } /** * Gets a random element from `collection`. * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to sample. * @returns {*} Returns the random element. * @example * * _.sample([1, 2, 3, 4]); * // => 2 */ function sample(collection) { var array = isArrayLike(collection) ? collection : values(collection), length = array.length; return length > 0 ? array[baseRandom(0, length - 1)] : undefined; } /** * Gets `n` random elements at unique keys from `collection` up to the * size of `collection`. * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to sample. * @param {number} [n=0] The number of elements to sample. * @returns {Array} Returns the random elements. * @example * * _.sampleSize([1, 2, 3], 2); * // => [3, 1] * * _.sampleSize([1, 2, 3], 4); * // => [2, 3, 1] */ function sampleSize(collection, n) { var index = -1, result = toArray(collection), length = result.length, lastIndex = length - 1; n = baseClamp(toInteger(n), 0, length); while (++index < n) { var rand = baseRandom(index, lastIndex), value = result[rand]; result[rand] = result[index]; result[index] = value; } result.length = n; return result; } /** * Creates an array of shuffled values, using a version of the * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to shuffle. * @returns {Array} Returns the new shuffled array. * @example * * _.shuffle([1, 2, 3, 4]); * // => [4, 1, 3, 2] */ function shuffle(collection) { return sampleSize(collection, MAX_ARRAY_LENGTH); } /** * Gets the size of `collection` by returning its length for array-like * values or the number of own enumerable properties for objects. * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to inspect. * @returns {number} Returns the collection size. * @example * * _.size([1, 2, 3]); * // => 3 * * _.size({ 'a': 1, 'b': 2 }); * // => 2 * * _.size('pebbles'); * // => 7 */ function size(collection) { if (collection == null) { return 0; } if (isArrayLike(collection)) { var result = collection.length; return (result && isString(collection)) ? stringSize(collection) : result; } return keys(collection).length; } /** * Checks if `predicate` returns truthy for **any** element of `collection`. * Iteration is stopped once `predicate` returns truthy. The predicate is * invoked with three arguments: (value, index|key, collection). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. * @example * * _.some([null, 0, 'yes', false], Boolean); * // => true * * var users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false } * ]; * * // The `_.matches` iteratee shorthand. * _.some(users, { 'user': 'barney', 'active': false }); * // => false * * // The `_.matchesProperty` iteratee shorthand. * _.some(users, ['active', false]); * // => true * * // The `_.property` iteratee shorthand. * _.some(users, 'active'); * // => true */ function some(collection, predicate, guard) { var func = isArray(collection) ? arraySome : baseSome; if (guard && isIterateeCall(collection, predicate, guard)) { predicate = undefined; } return func(collection, getIteratee(predicate, 3)); } /** * Creates an array of elements, sorted in ascending order by the results of * running each element in a collection through each iteratee. This method * performs a stable sort, that is, it preserves the original sort order of * equal elements. The iteratees are invoked with one argument: (value). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {...(Function|Function[]|Object|Object[]|string|string[])} [iteratees=[_.identity]] * The iteratees to sort by, specified individually or in arrays. * @returns {Array} Returns the new sorted array. * @example * * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 42 }, * { 'user': 'barney', 'age': 34 } * ]; * * _.sortBy(users, function(o) { return o.user; }); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] * * _.sortBy(users, ['user', 'age']); * // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] * * _.sortBy(users, 'user', function(o) { * return Math.floor(o.age / 10); * }); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ var sortBy = rest(function(collection, iteratees) { if (collection == null) { return []; } var length = iteratees.length; if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { iteratees = []; } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { iteratees.length = 1; } return baseOrderBy(collection, baseFlatten(iteratees, 1), []); }); /*------------------------------------------------------------------------*/ /** * Gets the timestamp of the number of milliseconds that have elapsed since * the Unix epoch (1 January 1970 00:00:00 UTC). * * @static * @memberOf _ * @type {Function} * @category Date * @returns {number} Returns the timestamp. * @example * * _.defer(function(stamp) { * console.log(_.now() - stamp); * }, _.now()); * // => logs the number of milliseconds it took for the deferred function to be invoked */ var now = Date.now; /*------------------------------------------------------------------------*/ /** * The opposite of `_.before`; this method creates a function that invokes * `func` once it's called `n` or more times. * * @static * @memberOf _ * @category Function * @param {number} n The number of calls before `func` is invoked. * @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 the two async saves have completed */ function after(n, func) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } n = toInteger(n); return function() { if (--n < 1) { return func.apply(this, arguments); } }; } /** * Creates a function that accepts up to `n` arguments, ignoring any * additional arguments. * * @static * @memberOf _ * @category Function * @param {Function} func The function to cap arguments for. * @param {number} [n=func.length] The arity cap. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Function} Returns the new function. * @example * * _.map(['6', '8', '10'], _.ary(parseInt, 1)); * // => [6, 8, 10] */ function ary(func, n, guard) { n = guard ? undefined : n; n = (func && n == null) ? func.length : n; return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n); } /** * Creates a function that invokes `func`, with the `this` binding and arguments * of the created function, while it's called less than `n` times. Subsequent * calls to the created function return the result of the last `func` invocation. * * @static * @memberOf _ * @category Function * @param {number} n The number of calls at which `func` is no longer invoked. * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * jQuery(element).on('click', _.before(5, addContactToList)); * // => allows adding up to 4 contacts to the list */ function before(n, func) { var result; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } n = toInteger(n); return function() { if (--n > 0) { result = func.apply(this, arguments); } if (n <= 1) { func = undefined; } return result; }; } /** * Creates a function that invokes `func` with the `this` binding of `thisArg` * and prepends any additional `_.bind` arguments to those provided to the * bound function. * * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for partially applied arguments. * * **Note:** Unlike native `Function#bind` this method doesn't set the "length" * property of bound functions. * * @static * @memberOf _ * @category Function * @param {Function} func The function to bind. * @param {*} thisArg The `this` binding of `func`. * @param {...*} [partials] The arguments to be partially applied. * @returns {Function} Returns the new bound function. * @example * * var greet = function(greeting, punctuation) { * return greeting + ' ' + this.user + punctuation; * }; * * var object = { 'user': 'fred' }; * * var bound = _.bind(greet, object, 'hi'); * bound('!'); * // => 'hi fred!' * * // Bound with placeholders. * var bound = _.bind(greet, object, _, '!'); * bound('hi'); * // => 'hi fred!' */ var bind = rest(function(func, thisArg, partials) { var bitmask = BIND_FLAG; if (partials.length) { var placeholder = lodash.placeholder || bind.placeholder, holders = replaceHolders(partials, placeholder); bitmask |= PARTIAL_FLAG; } return createWrapper(func, bitmask, thisArg, partials, holders); }); /** * Creates a function that 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 may be redefined or don't yet exist. * See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) * for more details. * * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. * * @static * @memberOf _ * @category Function * @param {Object} object The object to invoke the method on. * @param {string} key The key of the method. * @param {...*} [partials] The arguments to be partially applied. * @returns {Function} Returns the new bound function. * @example * * var object = { * 'user': 'fred', * 'greet': function(greeting, punctuation) { * return greeting + ' ' + this.user + punctuation; * } * }; * * var bound = _.bindKey(object, 'greet', 'hi'); * bound('!'); * // => 'hi fred!' * * object.greet = function(greeting, punctuation) { * return greeting + 'ya ' + this.user + punctuation; * }; * * bound('!'); * // => 'hiya fred!' * * // Bound with placeholders. * var bound = _.bindKey(object, 'greet', _, '!'); * bound('hi'); * // => 'hiya fred!' */ var bindKey = rest(function(object, key, partials) { var bitmask = BIND_FLAG | BIND_KEY_FLAG; if (partials.length) { var placeholder = lodash.placeholder || bindKey.placeholder, holders = replaceHolders(partials, placeholder); bitmask |= PARTIAL_FLAG; } return createWrapper(key, bitmask, object, partials, holders); }); /** * Creates a function that accepts arguments of `func` and either invokes * `func` returning its result, if at least `arity` number of arguments have * been provided, or returns a function that accepts the remaining `func` * arguments, and so on. The arity of `func` may be specified if `func.length` * is not sufficient. * * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for provided arguments. * * **Note:** This method doesn't set the "length" property of curried functions. * * @static * @memberOf _ * @category Function * @param {Function} func The function to curry. * @param {number} [arity=func.length] The arity of `func`. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Function} Returns the new curried function. * @example * * var abc = function(a, b, c) { * return [a, b, c]; * }; * * var curried = _.curry(abc); * * curried(1)(2)(3); * // => [1, 2, 3] * * curried(1, 2)(3); * // => [1, 2, 3] * * curried(1, 2, 3); * // => [1, 2, 3] * * // Curried with placeholders. * curried(1)(_, 3)(2); * // => [1, 2, 3] */ function curry(func, arity, guard) { arity = guard ? undefined : arity; var result = createWrapper(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); result.placeholder = lodash.placeholder || curry.placeholder; return result; } /** * This method is like `_.curry` except that arguments are applied to `func` * in the manner of `_.partialRight` instead of `_.partial`. * * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for provided arguments. * * **Note:** This method doesn't set the "length" property of curried functions. * * @static * @memberOf _ * @category Function * @param {Function} func The function to curry. * @param {number} [arity=func.length] The arity of `func`. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Function} Returns the new curried function. * @example * * var abc = function(a, b, c) { * return [a, b, c]; * }; * * var curried = _.curryRight(abc); * * curried(3)(2)(1); * // => [1, 2, 3] * * curried(2, 3)(1); * // => [1, 2, 3] * * curried(1, 2, 3); * // => [1, 2, 3] * * // Curried with placeholders. * curried(3)(1, _)(2); * // => [1, 2, 3] */ function curryRight(func, arity, guard) { arity = guard ? undefined : arity; var result = createWrapper(func, CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); result.placeholder = lodash.placeholder || curryRight.placeholder; return result; } /** * Creates a debounced function that delays invoking `func` until after `wait` * milliseconds have elapsed since the last time the debounced function was * invoked. The debounced function comes with a `cancel` method to cancel * delayed `func` invocations and a `flush` method to immediately invoke them. * Provide an options object to indicate whether `func` should be invoked on * the leading and/or trailing edge of the `wait` timeout. The `func` is invoked * with the last arguments provided to the debounced function. Subsequent calls * to the debounced function return the result of the last `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked * on the trailing edge of the timeout only if the debounced function is * invoked more than once during the `wait` timeout. * * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) * for details over the differences between `_.debounce` and `_.throttle`. * * @static * @memberOf _ * @category Function * @param {Function} func The function to debounce. * @param {number} [wait=0] The number of milliseconds to delay. * @param {Object} [options] The options object. * @param {boolean} [options.leading=false] Specify invoking on the leading * edge of the timeout. * @param {number} [options.maxWait] The maximum time `func` is allowed to be * delayed before it's invoked. * @param {boolean} [options.trailing=true] Specify invoking 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. * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); * * // Invoke `sendMail` when clicked, debouncing subsequent calls. * jQuery(element).on('click', _.debounce(sendMail, 300, { * 'leading': true, * 'trailing': false * })); * * // Ensure `batchLog` is invoked once after 1 second of debounced calls. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); * var source = new EventSource('/stream'); * jQuery(source).on('message', debounced); * * // Cancel the trailing debounced invocation. * jQuery(window).on('popstate', debounced.cancel); */ function debounce(func, wait, options) { var args, maxTimeoutId, result, stamp, thisArg, timeoutId, trailingCall, lastCalled = 0, leading = false, maxWait = false, trailing = true; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } wait = toNumber(wait) || 0; if (isObject(options)) { leading = !!options.leading; maxWait = 'maxWait' in options && nativeMax(toNumber(options.maxWait) || 0, wait); trailing = 'trailing' in options ? !!options.trailing : trailing; } function cancel() { if (timeoutId) { clearTimeout(timeoutId); } if (maxTimeoutId) { clearTimeout(maxTimeoutId); } lastCalled = 0; args = maxTimeoutId = thisArg = timeoutId = trailingCall = undefined; } function complete(isCalled, id) { if (id) { clearTimeout(id); } maxTimeoutId = timeoutId = trailingCall = undefined; if (isCalled) { lastCalled = now(); result = func.apply(thisArg, args); if (!timeoutId && !maxTimeoutId) { args = thisArg = undefined; } } } function delayed() { var remaining = wait - (now() - stamp); if (remaining <= 0 || remaining > wait) { complete(trailingCall, maxTimeoutId); } else { timeoutId = setTimeout(delayed, remaining); } } function flush() { if ((timeoutId && trailingCall) || (maxTimeoutId && trailing)) { result = func.apply(thisArg, args); } cancel(); return result; } function maxDelayed() { complete(trailing, timeoutId); } function debounced() { args = arguments; stamp = now(); thisArg = this; trailingCall = trailing && (timeoutId || !leading); if (maxWait === false) { var leadingCall = leading && !timeoutId; } else { if (!lastCalled && !maxTimeoutId && !leading) { lastCalled = stamp; } var remaining = maxWait - (stamp - lastCalled); var isCalled = (remaining <= 0 || remaining > maxWait) && (leading || maxTimeoutId); if (isCalled) { if (maxTimeoutId) { maxTimeoutId = clearTimeout(maxTimeoutId); } lastCalled = stamp; result = func.apply(thisArg, args); } else if (!maxTimeoutId) { maxTimeoutId = setTimeout(maxDelayed, remaining); } } if (isCalled && timeoutId) { timeoutId = clearTimeout(timeoutId); } else if (!timeoutId && wait !== maxWait) { timeoutId = setTimeout(delayed, wait); } if (leadingCall) { isCalled = true; result = func.apply(thisArg, args); } if (isCalled && !timeoutId && !maxTimeoutId) { args = thisArg = undefined; } return result; } debounced.cancel = cancel; debounced.flush = flush; return debounced; } /** * Defers invoking the `func` until the current call stack has cleared. Any * additional arguments are provided to `func` when it's invoked. * * @static * @memberOf _ * @category Function * @param {Function} func The function to defer. * @param {...*} [args] The arguments to invoke `func` with. * @returns {number} Returns the timer id. * @example * * _.defer(function(text) { * console.log(text); * }, 'deferred'); * // => logs 'deferred' after one or more milliseconds */ var defer = rest(function(func, args) { return baseDelay(func, 1, args); }); /** * Invokes `func` after `wait` milliseconds. Any additional arguments are * provided to `func` when it's invoked. * * @static * @memberOf _ * @category Function * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay invocation. * @param {...*} [args] The arguments to invoke `func` with. * @returns {number} Returns the timer id. * @example * * _.delay(function(text) { * console.log(text); * }, 1000, 'later'); * // => logs 'later' after one second */ var delay = rest(function(func, wait, args) { return baseDelay(func, toNumber(wait) || 0, args); }); /** * Creates a function that invokes `func` with arguments reversed. * * @static * @memberOf _ * @category Function * @param {Function} func The function to flip arguments for. * @returns {Function} Returns the new function. * @example * * var flipped = _.flip(function() { * return _.toArray(arguments); * }); * * flipped('a', 'b', 'c', 'd'); * // => ['d', 'c', 'b', 'a'] */ function flip(func) { return createWrapper(func, FLIP_FLAG); } /** * Creates a function that memoizes the result of `func`. If `resolver` is * provided it determines 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 map cache key. The `func` * is invoked with the `this` binding of the memoized function. * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) * method interface of `delete`, `get`, `has`, and `set`. * * @static * @memberOf _ * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. * @returns {Function} Returns the new memoizing function. * @example * * var object = { 'a': 1, 'b': 2 }; * var other = { 'c': 3, 'd': 4 }; * * var values = _.memoize(_.values); * values(object); * // => [1, 2] * * values(other); * // => [3, 4] * * object.a = 2; * values(object); * // => [1, 2] * * // Modify the result cache. * values.cache.set(object, ['a', 'b']); * values(object); * // => ['a', 'b'] * * // Replace `_.memoize.Cache`. * _.memoize.Cache = WeakMap; */ function memoize(func, resolver) { if (typeof func != 'function' || (resolver && typeof resolver != 'function')) { throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; if (cache.has(key)) { return cache.get(key); } var result = func.apply(this, args); memoized.cache = cache.set(key, result); return result; }; memoized.cache = new memoize.Cache; return memoized; } /** * Creates a function that negates the result of the predicate `func`. The * `func` predicate is invoked with the `this` binding and arguments of the * created function. * * @static * @memberOf _ * @category Function * @param {Function} predicate The predicate to negate. * @returns {Function} Returns the new function. * @example * * function isEven(n) { * return n % 2 == 0; * } * * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); * // => [1, 3, 5] */ function negate(predicate) { if (typeof predicate != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return function() { return !predicate.apply(this, arguments); }; } /** * Creates a function that is restricted to invoking `func` once. Repeat calls * to the function return the value of the first invocation. The `func` is * invoked with the `this` binding and arguments of the created function. * * @static * @memberOf _ * @category Function * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * var initialize = _.once(createApplication); * initialize(); * initialize(); * // `initialize` invokes `createApplication` once */ function once(func) { return before(2, func); } /** * Creates a function that invokes `func` with arguments transformed by * corresponding `transforms`. * * @static * @memberOf _ * @category Function * @param {Function} func The function to wrap. * @param {...(Function|Function[])} [transforms] The functions to transform * arguments, specified individually or in arrays. * @returns {Function} Returns the new function. * @example * * function doubled(n) { * return n * 2; * } * * function square(n) { * return n * n; * } * * var func = _.overArgs(function(x, y) { * return [x, y]; * }, square, doubled); * * func(9, 3); * // => [81, 6] * * func(10, 5); * // => [100, 10] */ var overArgs = rest(function(func, transforms) { transforms = arrayMap(baseFlatten(transforms, 1), getIteratee()); var funcsLength = transforms.length; return rest(function(args) { var index = -1, length = nativeMin(args.length, funcsLength); while (++index < length) { args[index] = transforms[index].call(this, args[index]); } return apply(func, this, args); }); }); /** * Creates a function that invokes `func` with `partial` arguments prepended * to those provided to the new function. This method is like `_.bind` except * it does **not** alter the `this` binding. * * The `_.partial.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. * * **Note:** This method doesn't set the "length" property of partially * applied functions. * * @static * @memberOf _ * @category Function * @param {Function} func The function to partially apply arguments to. * @param {...*} [partials] The arguments to be partially applied. * @returns {Function} Returns the new partially applied function. * @example * * var greet = function(greeting, name) { * return greeting + ' ' + name; * }; * * var sayHelloTo = _.partial(greet, 'hello'); * sayHelloTo('fred'); * // => 'hello fred' * * // Partially applied with placeholders. * var greetFred = _.partial(greet, _, 'fred'); * greetFred('hi'); * // => 'hi fred' */ var partial = rest(function(func, partials) { var placeholder = lodash.placeholder || partial.placeholder, holders = replaceHolders(partials, placeholder); return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders); }); /** * This method is like `_.partial` except that partially applied arguments * are appended to those provided to the new function. * * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. * * **Note:** This method doesn't set the "length" property of partially * applied functions. * * @static * @memberOf _ * @category Function * @param {Function} func The function to partially apply arguments to. * @param {...*} [partials] The arguments to be partially applied. * @returns {Function} Returns the new partially applied function. * @example * * var greet = function(greeting, name) { * return greeting + ' ' + name; * }; * * var greetFred = _.partialRight(greet, 'fred'); * greetFred('hi'); * // => 'hi fred' * * // Partially applied with placeholders. * var sayHelloTo = _.partialRight(greet, 'hello', _); * sayHelloTo('fred'); * // => 'hello fred' */ var partialRight = rest(function(func, partials) { var placeholder = lodash.placeholder || partialRight.placeholder, holders = replaceHolders(partials, placeholder); return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders); }); /** * Creates a function that invokes `func` with arguments arranged according * to the specified indexes where the argument value at the first index is * provided as the first argument, the argument value at the second index is * provided as the second argument, and so on. * * @static * @memberOf _ * @category Function * @param {Function} func The function to rearrange arguments for. * @param {...(number|number[])} indexes The arranged argument indexes, * specified individually or in arrays. * @returns {Function} Returns the new function. * @example * * var rearged = _.rearg(function(a, b, c) { * return [a, b, c]; * }, 2, 0, 1); * * rearged('b', 'c', 'a') * // => ['a', 'b', 'c'] */ var rearg = rest(function(func, indexes) { return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes, 1)); }); /** * Creates a function that invokes `func` with the `this` binding of the * created function and arguments from `start` and beyond provided as an array. * * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters). * * @static * @memberOf _ * @category Function * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @returns {Function} Returns the new function. * @example * * var say = _.rest(function(what, names) { * return what + ' ' + _.initial(names).join(', ') + * (_.size(names) > 1 ? ', & ' : '') + _.last(names); * }); * * say('hello', 'fred', 'barney', 'pebbles'); * // => 'hello fred, barney, & pebbles' */ function rest(func, start) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0); return function() { var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length); while (++index < length) { array[index] = args[start + index]; } switch (start) { case 0: return func.call(this, array); case 1: return func.call(this, args[0], array); case 2: return func.call(this, args[0], args[1], array); } var otherArgs = Array(start + 1); index = -1; while (++index < start) { otherArgs[index] = args[index]; } otherArgs[start] = array; return apply(func, this, otherArgs); }; } /** * Creates a function that invokes `func` with the `this` binding of the created * function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3). * * **Note:** This method is based on the [spread operator](https://mdn.io/spread_operator). * * @static * @memberOf _ * @category Function * @param {Function} func The function to spread arguments over. * @param {number} [start=0] The start position of the spread. * @returns {Function} Returns the new function. * @example * * var say = _.spread(function(who, what) { * return who + ' says ' + what; * }); * * say(['fred', 'hello']); * // => 'fred says hello' * * var numbers = Promise.all([ * Promise.resolve(40), * Promise.resolve(36) * ]); * * numbers.then(_.spread(function(x, y) { * return x + y; * })); * // => a Promise of 76 */ function spread(func, start) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } start = start === undefined ? 0 : nativeMax(toInteger(start), 0); return rest(function(args) { var array = args[start], otherArgs = args.slice(0, start); if (array) { arrayPush(otherArgs, array); } return apply(func, this, otherArgs); }); } /** * Creates a throttled function that only invokes `func` at most once per * every `wait` milliseconds. The throttled function comes with a `cancel` * method to cancel delayed `func` invocations and a `flush` method to * immediately invoke them. Provide an options object to indicate whether * `func` should be invoked on the leading and/or trailing edge of the `wait` * timeout. The `func` is invoked with the last arguments provided to the * throttled function. Subsequent calls to the throttled function return the * result of the last `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked * on the trailing edge of the timeout only if the throttled function is * invoked more than once during the `wait` timeout. * * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) * for details over the differences between `_.throttle` and `_.debounce`. * * @static * @memberOf _ * @category Function * @param {Function} func The function to throttle. * @param {number} [wait=0] The number of milliseconds to throttle invocations to. * @param {Object} [options] The options object. * @param {boolean} [options.leading=true] Specify invoking on the leading * edge of the timeout. * @param {boolean} [options.trailing=true] Specify invoking on the trailing * edge of the timeout. * @returns {Function} Returns the new throttled function. * @example * * // Avoid excessively updating the position while scrolling. * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); * * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); * jQuery(element).on('click', throttled); * * // Cancel the trailing throttled invocation. * jQuery(window).on('popstate', throttled.cancel); */ function throttle(func, wait, options) { var leading = true, trailing = true; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } if (isObject(options)) { leading = 'leading' in options ? !!options.leading : leading; trailing = 'trailing' in options ? !!options.trailing : trailing; } return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing }); } /** * Creates a function that accepts up to one argument, ignoring any * additional arguments. * * @static * @memberOf _ * @category Function * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new function. * @example * * _.map(['6', '8', '10'], _.unary(parseInt)); * // => [6, 8, 10] */ function unary(func) { return ary(func, 1); } /** * Creates a function that provides `value` to the wrapper function as its * first argument. Any additional arguments provided to the function are * appended to those provided to the wrapper function. The wrapper is invoked * with the `this` binding of the created function. * * @static * @memberOf _ * @category Function * @param {*} value The value to wrap. * @param {Function} [wrapper=identity] The wrapper function. * @returns {Function} Returns the new function. * @example * * var p = _.wrap(_.escape, function(func, text) { * return '<p>' + func(text) + '</p>'; * }); * * p('fred, barney, & pebbles'); * // => '<p>fred, barney, &amp; pebbles</p>' */ function wrap(value, wrapper) { wrapper = wrapper == null ? identity : wrapper; return partial(wrapper, value); } /*------------------------------------------------------------------------*/ /** * Casts `value` as an array if it's not one. * * @static * @memberOf _ * @category Lang * @param {*} value The value to inspect. * @returns {Array} Returns the cast array. * @example * * _.castArray(1); * // => [1] * * _.castArray({ 'a': 1 }); * // => [{ 'a': 1 }] * * _.castArray('abc'); * // => ['abc'] * * _.castArray(null); * // => [null] * * _.castArray(undefined); * // => [undefined] * * _.castArray(); * // => [] * * var array = [1, 2, 3]; * console.log(_.castArray(array) === array); * // => true */ function castArray() { if (!arguments.length) { return []; } var value = arguments[0]; return isArray(value) ? value : [value]; } /** * Creates a shallow clone of `value`. * * **Note:** This method is loosely based on the * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) * and supports cloning arrays, array buffers, booleans, date objects, maps, * numbers, `Object` objects, regexes, sets, strings, symbols, and typed * arrays. The own enumerable properties of `arguments` objects are cloned * as plain objects. An empty object is returned for uncloneable values such * as error objects, functions, DOM nodes, and WeakMaps. * * @static * @memberOf _ * @category Lang * @param {*} value The value to clone. * @returns {*} Returns the cloned value. * @example * * var objects = [{ 'a': 1 }, { 'b': 2 }]; * * var shallow = _.clone(objects); * console.log(shallow[0] === objects[0]); * // => true */ function clone(value) { return baseClone(value); } /** * This method is like `_.clone` except that it accepts `customizer` which * is invoked to produce the cloned value. If `customizer` returns `undefined` * cloning is handled by the method instead. The `customizer` is invoked with * up to four arguments; (value [, index|key, object, stack]). * * @static * @memberOf _ * @category Lang * @param {*} value The value to clone. * @param {Function} [customizer] The function to customize cloning. * @returns {*} Returns the cloned value. * @example * * function customizer(value) { * if (_.isElement(value)) { * return value.cloneNode(false); * } * } * * var el = _.cloneWith(document.body, customizer); * * console.log(el === document.body); * // => false * console.log(el.nodeName); * // => 'BODY' * console.log(el.childNodes.length); * // => 0 */ function cloneWith(value, customizer) { return baseClone(value, false, customizer); } /** * This method is like `_.clone` except that it recursively clones `value`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to recursively clone. * @returns {*} Returns the deep cloned value. * @example * * var objects = [{ 'a': 1 }, { 'b': 2 }]; * * var deep = _.cloneDeep(objects); * console.log(deep[0] === objects[0]); * // => false */ function cloneDeep(value) { return baseClone(value, true); } /** * This method is like `_.cloneWith` except that it recursively clones `value`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to recursively clone. * @param {Function} [customizer] The function to customize cloning. * @returns {*} Returns the deep cloned value. * @example * * function customizer(value) { * if (_.isElement(value)) { * return value.cloneNode(true); * } * } * * var el = _.cloneDeepWith(document.body, customizer); * * console.log(el === document.body); * // => false * console.log(el.nodeName); * // => 'BODY' * console.log(el.childNodes.length); * // => 20 */ function cloneDeepWith(value, customizer) { return baseClone(value, true, customizer); } /** * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'user': 'fred' }; * var other = { 'user': 'fred' }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { return value === other || (value !== value && other !== other); } /** * Checks if `value` is greater than `other`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`. * @example * * _.gt(3, 1); * // => true * * _.gt(3, 3); * // => false * * _.gt(1, 3); * // => false */ function gt(value, other) { return value > other; } /** * Checks if `value` is greater than or equal to `other`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`. * @example * * _.gte(3, 1); * // => true * * _.gte(3, 3); * // => true * * _.gte(1, 3); * // => false */ function gte(value, other) { return value >= other; } /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isArguments(function() { return arguments; }()); * // => true * * _.isArguments([1, 2, 3]); * // => false */ function isArguments(value) { // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; /** * Checks if `value` is classified as an `ArrayBuffer` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isArrayBuffer(new ArrayBuffer(2)); * // => true * * _.isArrayBuffer(new Array(2)); * // => false */ function isArrayBuffer(value) { return isObjectLike(value) && objectToString.call(value) == arrayBufferTag; } /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value)); } /** * This method is like `_.isArrayLike` except that it also checks if `value` * is an object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); * // => true * * _.isArrayLikeObject(document.body.children); * // => true * * _.isArrayLikeObject('abc'); * // => false * * _.isArrayLikeObject(_.noop); * // => false */ function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike(value); } /** * Checks if `value` is classified as a boolean primitive or object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isBoolean(false); * // => true * * _.isBoolean(null); * // => false */ function isBoolean(value) { return value === true || value === false || (isObjectLike(value) && objectToString.call(value) == boolTag); } /** * Checks if `value` is a buffer. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. * @example * * _.isBuffer(new Buffer(2)); * // => true * * _.isBuffer(new Uint8Array(2)); * // => false */ var isBuffer = !Buffer ? constant(false) : function(value) { return value instanceof Buffer; }; /** * Checks if `value` is classified as a `Date` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isDate(new Date); * // => true * * _.isDate('Mon April 23 2012'); * // => false */ function isDate(value) { return isObjectLike(value) && objectToString.call(value) == dateTag; } /** * Checks if `value` is likely a DOM element. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. * @example * * _.isElement(document.body); * // => true * * _.isElement('<body>'); * // => false */ function isElement(value) { return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); } /** * Checks if `value` is empty. A value is considered empty unless it's an * `arguments` object, array, string, or jQuery-like collection with a length * greater than `0` or an object with own enumerable properties. * * @static * @memberOf _ * @category Lang * @param {Array|Object|string} value The value to inspect. * @returns {boolean} Returns `true` if `value` is empty, else `false`. * @example * * _.isEmpty(null); * // => true * * _.isEmpty(true); * // => true * * _.isEmpty(1); * // => true * * _.isEmpty([1, 2, 3]); * // => false * * _.isEmpty({ 'a': 1 }); * // => false */ function isEmpty(value) { if (isArrayLike(value) && (isArray(value) || isString(value) || isFunction(value.splice) || isArguments(value))) { return !value.length; } for (var key in value) { if (hasOwnProperty.call(value, key)) { return false; } } return true; } /** * Performs a deep comparison between two values to determine if they are * equivalent. * * **Note:** This method supports comparing arrays, array buffers, booleans, * date objects, error objects, maps, numbers, `Object` objects, regexes, * sets, strings, symbols, and typed arrays. `Object` objects are compared * by their own, not inherited, enumerable properties. Functions and DOM * nodes are **not** supported. * * @static * @memberOf _ * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'user': 'fred' }; * var other = { 'user': 'fred' }; * * _.isEqual(object, other); * // => true * * object === other; * // => false */ function isEqual(value, other) { return baseIsEqual(value, other); } /** * This method is like `_.isEqual` except that it accepts `customizer` which * is invoked to compare values. If `customizer` returns `undefined` comparisons * are handled by the method instead. The `customizer` is invoked with up to * six arguments: (objValue, othValue [, index|key, object, other, stack]). * * @static * @memberOf _ * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * function isGreeting(value) { * return /^h(?:i|ello)$/.test(value); * } * * function customizer(objValue, othValue) { * if (isGreeting(objValue) && isGreeting(othValue)) { * return true; * } * } * * var array = ['hello', 'goodbye']; * var other = ['hi', 'goodbye']; * * _.isEqualWith(array, other, customizer); * // => true */ function isEqualWith(value, other, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; var result = customizer ? customizer(value, other) : undefined; return result === undefined ? baseIsEqual(value, other, customizer) : !!result; } /** * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, * `SyntaxError`, `TypeError`, or `URIError` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an error object, else `false`. * @example * * _.isError(new Error); * // => true * * _.isError(Error); * // => false */ function isError(value) { if (!isObjectLike(value)) { return false; } var Ctor = value.constructor; return (objectToString.call(value) == errorTag) || (typeof Ctor == 'function' && objectToString.call(Ctor.prototype) == errorTag); } /** * Checks if `value` is a finite primitive number. * * **Note:** This method is based on [`Number.isFinite`](https://mdn.io/Number/isFinite). * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. * @example * * _.isFinite(3); * // => true * * _.isFinite(Number.MAX_VALUE); * // => true * * _.isFinite(3.14); * // => true * * _.isFinite(Infinity); * // => false */ function isFinite(value) { return typeof value == 'number' && nativeIsFinite(value); } /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 8 which returns 'object' for typed array constructors, and // PhantomJS 1.9 which returns 'function' for `NodeList` instances. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } /** * Checks if `value` is an integer. * * **Note:** This method is based on [`Number.isInteger`](https://mdn.io/Number/isInteger). * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an integer, else `false`. * @example * * _.isInteger(3); * // => true * * _.isInteger(Number.MIN_VALUE); * // => false * * _.isInteger(Infinity); * // => false * * _.isInteger('3'); * // => false */ function isInteger(value) { return typeof value == 'number' && value == toInteger(value); } /** * Checks if `value` is a valid array-like length. * * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return !!value && (type == 'object' || type == 'function'); } /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return !!value && typeof value == 'object'; } /** * Checks if `value` is classified as a `Map` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isMap(new Map); * // => true * * _.isMap(new WeakMap); * // => false */ function isMap(value) { return isObjectLike(value) && getTag(value) == mapTag; } /** * Performs a partial deep comparison between `object` and `source` to * determine if `object` contains equivalent property values. This method is * equivalent to a `_.matches` function when `source` is partially applied. * * **Note:** This method supports comparing the same values as `_.isEqual`. * * @static * @memberOf _ * @category Lang * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @returns {boolean} Returns `true` if `object` is a match, else `false`. * @example * * var object = { 'user': 'fred', 'age': 40 }; * * _.isMatch(object, { 'age': 40 }); * // => true * * _.isMatch(object, { 'age': 36 }); * // => false */ function isMatch(object, source) { return object === source || baseIsMatch(object, source, getMatchData(source)); } /** * This method is like `_.isMatch` except that it accepts `customizer` which * is invoked to compare values. If `customizer` returns `undefined` comparisons * are handled by the method instead. The `customizer` is invoked with five * arguments: (objValue, srcValue, index|key, object, source). * * @static * @memberOf _ * @category Lang * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if `object` is a match, else `false`. * @example * * function isGreeting(value) { * return /^h(?:i|ello)$/.test(value); * } * * function customizer(objValue, srcValue) { * if (isGreeting(objValue) && isGreeting(srcValue)) { * return true; * } * } * * var object = { 'greeting': 'hello' }; * var source = { 'greeting': 'hi' }; * * _.isMatchWith(object, source, customizer); * // => true */ function isMatchWith(object, source, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; return baseIsMatch(object, source, getMatchData(source), customizer); } /** * Checks if `value` is `NaN`. * * **Note:** This method is not the same as [`isNaN`](https://es5.github.io/#x15.1.2.4) * which returns `true` for `undefined` and other non-numeric values. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. * @example * * _.isNaN(NaN); * // => true * * _.isNaN(new Number(NaN)); * // => true * * isNaN(undefined); * // => true * * _.isNaN(undefined); * // => false */ function isNaN(value) { // An `NaN` primitive is the only value that is not equal to itself. // Perform the `toStringTag` check first to avoid errors with some ActiveX objects in IE. return isNumber(value) && value != +value; } /** * Checks if `value` is a native function. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, else `false`. * @example * * _.isNative(Array.prototype.push); * // => true * * _.isNative(_); * // => false */ function isNative(value) { if (value == null) { return false; } if (isFunction(value)) { return reIsNative.test(funcToString.call(value)); } return isObjectLike(value) && (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); } /** * Checks if `value` is `null`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `null`, else `false`. * @example * * _.isNull(null); * // => true * * _.isNull(void 0); * // => false */ function isNull(value) { return value === null; } /** * Checks if `value` is `null` or `undefined`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is nullish, else `false`. * @example * * _.isNil(null); * // => true * * _.isNil(void 0); * // => true * * _.isNil(NaN); * // => false */ function isNil(value) { return value == null; } /** * Checks if `value` is classified as a `Number` primitive or object. * * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified * as numbers, use the `_.isFinite` method. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isNumber(3); * // => true * * _.isNumber(Number.MIN_VALUE); * // => true * * _.isNumber(Infinity); * // => true * * _.isNumber('3'); * // => false */ function isNumber(value) { return typeof value == 'number' || (isObjectLike(value) && objectToString.call(value) == numberTag); } /** * Checks if `value` is a plain object, that is, an object created by the * `Object` constructor or one with a `[[Prototype]]` of `null`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. * @example * * function Foo() { * this.a = 1; * } * * _.isPlainObject(new Foo); * // => false * * _.isPlainObject([1, 2, 3]); * // => false * * _.isPlainObject({ 'x': 0, 'y': 0 }); * // => true * * _.isPlainObject(Object.create(null)); * // => true */ function isPlainObject(value) { if (!isObjectLike(value) || objectToString.call(value) != objectTag || isHostObject(value)) { return false; } var proto = objectProto; if (typeof value.constructor == 'function') { proto = getPrototypeOf(value); } if (proto === null) { return true; } var Ctor = proto.constructor; return (typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString); } /** * Checks if `value` is classified as a `RegExp` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isRegExp(/abc/); * // => true * * _.isRegExp('/abc/'); * // => false */ function isRegExp(value) { return isObject(value) && objectToString.call(value) == regexpTag; } /** * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 * double precision number which isn't the result of a rounded unsafe integer. * * **Note:** This method is based on [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. * @example * * _.isSafeInteger(3); * // => true * * _.isSafeInteger(Number.MIN_VALUE); * // => false * * _.isSafeInteger(Infinity); * // => false * * _.isSafeInteger('3'); * // => false */ function isSafeInteger(value) { return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is classified as a `Set` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isSet(new Set); * // => true * * _.isSet(new WeakSet); * // => false */ function isSet(value) { return isObjectLike(value) && getTag(value) == setTag; } /** * Checks if `value` is classified as a `String` primitive or object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isString('abc'); * // => true * * _.isString(1); * // => false */ function isString(value) { return typeof value == 'string' || (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); } /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return typeof value == 'symbol' || (isObjectLike(value) && objectToString.call(value) == symbolTag); } /** * Checks if `value` is classified as a typed array. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isTypedArray(new Uint8Array); * // => true * * _.isTypedArray([]); * // => false */ function isTypedArray(value) { return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; } /** * Checks if `value` is `undefined`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. * @example * * _.isUndefined(void 0); * // => true * * _.isUndefined(null); * // => false */ function isUndefined(value) { return value === undefined; } /** * Checks if `value` is classified as a `WeakMap` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isWeakMap(new WeakMap); * // => true * * _.isWeakMap(new Map); * // => false */ function isWeakMap(value) { return isObjectLike(value) && getTag(value) == weakMapTag; } /** * Checks if `value` is classified as a `WeakSet` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isWeakSet(new WeakSet); * // => true * * _.isWeakSet(new Set); * // => false */ function isWeakSet(value) { return isObjectLike(value) && objectToString.call(value) == weakSetTag; } /** * Checks if `value` is less than `other`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is less than `other`, else `false`. * @example * * _.lt(1, 3); * // => true * * _.lt(3, 3); * // => false * * _.lt(3, 1); * // => false */ function lt(value, other) { return value < other; } /** * Checks if `value` is less than or equal to `other`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`. * @example * * _.lte(1, 3); * // => true * * _.lte(3, 3); * // => true * * _.lte(3, 1); * // => false */ function lte(value, other) { return value <= other; } /** * Converts `value` to an array. * * @static * @memberOf _ * @category Lang * @param {*} value The value to convert. * @returns {Array} Returns the converted array. * @example * * _.toArray({ 'a': 1, 'b': 2 }); * // => [1, 2] * * _.toArray('abc'); * // => ['a', 'b', 'c'] * * _.toArray(1); * // => [] * * _.toArray(null); * // => [] */ function toArray(value) { if (!value) { return []; } if (isArrayLike(value)) { return isString(value) ? stringToArray(value) : copyArray(value); } if (iteratorSymbol && value[iteratorSymbol]) { return iteratorToArray(value[iteratorSymbol]()); } var tag = getTag(value), func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); return func(value); } /** * Converts `value` to an integer. * * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). * * @static * @memberOf _ * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. * @example * * _.toInteger(3); * // => 3 * * _.toInteger(Number.MIN_VALUE); * // => 0 * * _.toInteger(Infinity); * // => 1.7976931348623157e+308 * * _.toInteger('3'); * // => 3 */ function toInteger(value) { if (!value) { return value === 0 ? value : 0; } value = toNumber(value); if (value === INFINITY || value === -INFINITY) { var sign = (value < 0 ? -1 : 1); return sign * MAX_INTEGER; } var remainder = value % 1; return value === value ? (remainder ? value - remainder : value) : 0; } /** * Converts `value` to an integer suitable for use as the length of an * array-like object. * * **Note:** This method is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @static * @memberOf _ * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. * @example * * _.toLength(3); * // => 3 * * _.toLength(Number.MIN_VALUE); * // => 0 * * _.toLength(Infinity); * // => 4294967295 * * _.toLength('3'); * // => 3 */ function toLength(value) { return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; } /** * Converts `value` to a number. * * @static * @memberOf _ * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. * @example * * _.toNumber(3); * // => 3 * * _.toNumber(Number.MIN_VALUE); * // => 5e-324 * * _.toNumber(Infinity); * // => Infinity * * _.toNumber('3'); * // => 3 */ function toNumber(value) { if (isObject(value)) { var other = isFunction(value.valueOf) ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; } if (typeof value != 'string') { return value === 0 ? value : +value; } value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : (reIsBadHex.test(value) ? NAN : +value); } /** * Converts `value` to a plain object flattening inherited enumerable * properties of `value` to own properties of the plain object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to convert. * @returns {Object} Returns the converted plain object. * @example * * function Foo() { * this.b = 2; * } * * Foo.prototype.c = 3; * * _.assign({ 'a': 1 }, new Foo); * // => { 'a': 1, 'b': 2 } * * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); * // => { 'a': 1, 'b': 2, 'c': 3 } */ function toPlainObject(value) { return copyObject(value, keysIn(value)); } /** * Converts `value` to a safe integer. A safe integer can be compared and * represented correctly. * * @static * @memberOf _ * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. * @example * * _.toSafeInteger(3); * // => 3 * * _.toSafeInteger(Number.MIN_VALUE); * // => 0 * * _.toSafeInteger(Infinity); * // => 9007199254740991 * * _.toSafeInteger('3'); * // => 3 */ function toSafeInteger(value) { return baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER); } /** * Converts `value` to a string if it's not one. An empty string is returned * for `null` and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ * @category Lang * @param {*} value The value to process. * @returns {string} Returns the string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (value == null) { return ''; } if (isSymbol(value)) { return Symbol ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /*------------------------------------------------------------------------*/ /** * Assigns own enumerable properties of source objects to the destination * object. Source objects are applied from left to right. Subsequent sources * overwrite property assignments of previous sources. * * **Note:** This method mutates `object` and is loosely based on * [`Object.assign`](https://mdn.io/Object/assign). * * @static * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * function Foo() { * this.c = 3; * } * * function Bar() { * this.e = 5; * } * * Foo.prototype.d = 4; * Bar.prototype.f = 6; * * _.assign({ 'a': 1 }, new Foo, new Bar); * // => { 'a': 1, 'c': 3, 'e': 5 } */ var assign = createAssigner(function(object, source) { copyObject(source, keys(source), object); }); /** * This method is like `_.assign` except that it iterates over own and * inherited source properties. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @alias extend * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * function Foo() { * this.b = 2; * } * * function Bar() { * this.d = 4; * } * * Foo.prototype.c = 3; * Bar.prototype.e = 5; * * _.assignIn({ 'a': 1 }, new Foo, new Bar); * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } */ var assignIn = createAssigner(function(object, source) { copyObject(source, keysIn(source), object); }); /** * This method is like `_.assignIn` except that it accepts `customizer` which * is invoked to produce the assigned values. If `customizer` returns `undefined` * assignment is handled by the method instead. The `customizer` is invoked * with five arguments: (objValue, srcValue, key, object, source). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @alias extendWith * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. * @param {Function} [customizer] The function to customize assigned values. * @returns {Object} Returns `object`. * @example * * function customizer(objValue, srcValue) { * return _.isUndefined(objValue) ? srcValue : objValue; * } * * var defaults = _.partialRight(_.assignInWith, customizer); * * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); * // => { 'a': 1, 'b': 2 } */ var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { copyObjectWith(source, keysIn(source), object, customizer); }); /** * This method is like `_.assign` except that it accepts `customizer` which * is invoked to produce the assigned values. If `customizer` returns `undefined` * assignment is handled by the method instead. The `customizer` is invoked * with five arguments: (objValue, srcValue, key, object, source). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. * @param {Function} [customizer] The function to customize assigned values. * @returns {Object} Returns `object`. * @example * * function customizer(objValue, srcValue) { * return _.isUndefined(objValue) ? srcValue : objValue; * } * * var defaults = _.partialRight(_.assignWith, customizer); * * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); * // => { 'a': 1, 'b': 2 } */ var assignWith = createAssigner(function(object, source, srcIndex, customizer) { copyObjectWith(source, keys(source), object, customizer); }); /** * Creates an array of values corresponding to `paths` of `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {...(string|string[])} [paths] The property paths of elements to pick, * specified individually or in arrays. * @returns {Array} Returns the new array of picked elements. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; * * _.at(object, ['a[0].b.c', 'a[1]']); * // => [3, 4] * * _.at(['a', 'b', 'c'], 0, 2); * // => ['a', 'c'] */ var at = rest(function(object, paths) { return baseAt(object, baseFlatten(paths, 1)); }); /** * Creates an object that inherits from the `prototype` object. If a `properties` * object is given its own enumerable properties are assigned to the created object. * * @static * @memberOf _ * @category Object * @param {Object} prototype The object to inherit from. * @param {Object} [properties] The properties to assign to the object. * @returns {Object} Returns the new object. * @example * * function Shape() { * this.x = 0; * this.y = 0; * } * * function Circle() { * Shape.call(this); * } * * Circle.prototype = _.create(Shape.prototype, { * 'constructor': Circle * }); * * var circle = new Circle; * circle instanceof Circle; * // => true * * circle instanceof Shape; * // => true */ function create(prototype, properties) { var result = baseCreate(prototype); return properties ? baseAssign(result, properties) : result; } /** * Assigns own and inherited enumerable properties of source objects to the * destination object for all destination properties that resolve to `undefined`. * Source objects are applied from left to right. Once a property is set, * additional values of the same property are ignored. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); * // => { 'user': 'barney', 'age': 36 } */ var defaults = rest(function(args) { args.push(undefined, assignInDefaults); return apply(assignInWith, undefined, args); }); /** * This method is like `_.defaults` except that it recursively assigns * default properties. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } }); * // => { 'user': { 'name': 'barney', 'age': 36 } } * */ var defaultsDeep = rest(function(args) { args.push(undefined, mergeDefaults); return apply(mergeWith, undefined, args); }); /** * This method is like `_.find` except that it returns the key of the first * element `predicate` returns truthy for instead of the element itself. * * @static * @memberOf _ * @category Object * @param {Object} object The object to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {string|undefined} Returns the key of the matched element, else `undefined`. * @example * * var users = { * 'barney': { 'age': 36, 'active': true }, * 'fred': { 'age': 40, 'active': false }, * 'pebbles': { 'age': 1, 'active': true } * }; * * _.findKey(users, function(o) { return o.age < 40; }); * // => 'barney' (iteration order is not guaranteed) * * // The `_.matches` iteratee shorthand. * _.findKey(users, { 'age': 1, 'active': true }); * // => 'pebbles' * * // The `_.matchesProperty` iteratee shorthand. * _.findKey(users, ['active', false]); * // => 'fred' * * // The `_.property` iteratee shorthand. * _.findKey(users, 'active'); * // => 'barney' */ function findKey(object, predicate) { return baseFind(object, getIteratee(predicate, 3), baseForOwn, true); } /** * This method is like `_.findKey` except that it iterates over elements of * a collection in the opposite order. * * @static * @memberOf _ * @category Object * @param {Object} object The object to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {string|undefined} Returns the key of the matched element, else `undefined`. * @example * * var users = { * 'barney': { 'age': 36, 'active': true }, * 'fred': { 'age': 40, 'active': false }, * 'pebbles': { 'age': 1, 'active': true } * }; * * _.findLastKey(users, function(o) { return o.age < 40; }); * // => returns 'pebbles' assuming `_.findKey` returns 'barney' * * // The `_.matches` iteratee shorthand. * _.findLastKey(users, { 'age': 36, 'active': true }); * // => 'barney' * * // The `_.matchesProperty` iteratee shorthand. * _.findLastKey(users, ['active', false]); * // => 'fred' * * // The `_.property` iteratee shorthand. * _.findLastKey(users, 'active'); * // => 'pebbles' */ function findLastKey(object, predicate) { return baseFind(object, getIteratee(predicate, 3), baseForOwnRight, true); } /** * Iterates over own and inherited enumerable properties of an object invoking * `iteratee` for each property. The iteratee is invoked with three arguments: * (value, key, object). Iteratee functions may exit iteration early by explicitly * returning `false`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns `object`. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forIn(new Foo, function(value, key) { * console.log(key); * }); * // => logs 'a', 'b', then 'c' (iteration order is not guaranteed) */ function forIn(object, iteratee) { return object == null ? object : baseFor(object, baseCastFunction(iteratee), keysIn); } /** * This method is like `_.forIn` except that it iterates over properties of * `object` in the opposite order. * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns `object`. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forInRight(new Foo, function(value, key) { * console.log(key); * }); * // => logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c' */ function forInRight(object, iteratee) { return object == null ? object : baseForRight(object, baseCastFunction(iteratee), keysIn); } /** * Iterates over own enumerable properties of an object invoking `iteratee` * for each property. The iteratee is invoked with three arguments: * (value, key, object). Iteratee functions may exit iteration early by * explicitly returning `false`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns `object`. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forOwn(new Foo, function(value, key) { * console.log(key); * }); * // => logs 'a' then 'b' (iteration order is not guaranteed) */ function forOwn(object, iteratee) { return object && baseForOwn(object, baseCastFunction(iteratee)); } /** * This method is like `_.forOwn` except that it iterates over properties of * `object` in the opposite order. * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns `object`. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forOwnRight(new Foo, function(value, key) { * console.log(key); * }); * // => logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b' */ function forOwnRight(object, iteratee) { return object && baseForOwnRight(object, baseCastFunction(iteratee)); } /** * Creates an array of function property names from own enumerable properties * of `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to inspect. * @returns {Array} Returns the new array of property names. * @example * * function Foo() { * this.a = _.constant('a'); * this.b = _.constant('b'); * } * * Foo.prototype.c = _.constant('c'); * * _.functions(new Foo); * // => ['a', 'b'] */ function functions(object) { return object == null ? [] : baseFunctions(object, keys(object)); } /** * Creates an array of function property names from own and inherited * enumerable properties of `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to inspect. * @returns {Array} Returns the new array of property names. * @example * * function Foo() { * this.a = _.constant('a'); * this.b = _.constant('b'); * } * * Foo.prototype.c = _.constant('c'); * * _.functionsIn(new Foo); * // => ['a', 'b', 'c'] */ function functionsIn(object) { return object == null ? [] : baseFunctions(object, keysIn(object)); } /** * Gets the value at `path` of `object`. If the resolved value is * `undefined` the `defaultValue` is used in its place. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. * @returns {*} Returns the resolved value. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.get(object, 'a[0].b.c'); * // => 3 * * _.get(object, ['a', '0', 'b', 'c']); * // => 3 * * _.get(object, 'a.b.c', 'default'); * // => 'default' */ function get(object, path, defaultValue) { var result = object == null ? undefined : baseGet(object, path); return result === undefined ? defaultValue : result; } /** * Checks if `path` is a direct property of `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * * var object = { 'a': { 'b': { 'c': 3 } } }; * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); * * _.has(object, 'a'); * // => true * * _.has(object, 'a.b.c'); * // => true * * _.has(object, ['a', 'b', 'c']); * // => true * * _.has(other, 'a'); * // => false */ function has(object, path) { return hasPath(object, path, baseHas); } /** * Checks if `path` is a direct or inherited property of `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * * var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); * * _.hasIn(object, 'a'); * // => true * * _.hasIn(object, 'a.b.c'); * // => true * * _.hasIn(object, ['a', 'b', 'c']); * // => true * * _.hasIn(object, 'b'); * // => false */ function hasIn(object, path) { return hasPath(object, path, baseHasIn); } /** * Creates an object composed of the inverted keys and values of `object`. * If `object` contains duplicate values, subsequent values overwrite property * assignments of previous values. * * @static * @memberOf _ * @category Object * @param {Object} object The object to invert. * @returns {Object} Returns the new inverted object. * @example * * var object = { 'a': 1, 'b': 2, 'c': 1 }; * * _.invert(object); * // => { '1': 'c', '2': 'b' } */ var invert = createInverter(function(result, value, key) { result[value] = key; }, constant(identity)); /** * This method is like `_.invert` except that the inverted object is generated * from the results of running each element of `object` through `iteratee`. * The corresponding inverted value of each inverted key is an array of keys * responsible for generating the inverted value. The iteratee is invoked * with one argument: (value). * * @static * @memberOf _ * @category Object * @param {Object} object The object to invert. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Object} Returns the new inverted object. * @example * * var object = { 'a': 1, 'b': 2, 'c': 1 }; * * _.invertBy(object); * // => { '1': ['a', 'c'], '2': ['b'] } * * _.invertBy(object, function(value) { * return 'group' + value; * }); * // => { 'group1': ['a', 'c'], 'group2': ['b'] } */ var invertBy = createInverter(function(result, value, key) { if (hasOwnProperty.call(result, value)) { result[value].push(key); } else { result[value] = [key]; } }, getIteratee); /** * Invokes the method at `path` of `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the method to invoke. * @param {...*} [args] The arguments to invoke the method with. * @returns {*} Returns the result of the invoked method. * @example * * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; * * _.invoke(object, 'a[0].b.c.slice', 1, 3); * // => [2, 3] */ var invoke = rest(baseInvoke); /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) * for more details. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ function keys(object) { var isProto = isPrototype(object); if (!(isProto || isArrayLike(object))) { return baseKeys(object); } var indexes = indexKeys(object), skipIndexes = !!indexes, result = indexes || [], length = result.length; for (var key in object) { if (baseHas(object, key) && !(skipIndexes && (key == 'length' || isIndex(key, length))) && !(isProto && key == 'constructor')) { result.push(key); } } return result; } /** * Creates an array of the own and inherited enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keysIn(new Foo); * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { var index = -1, isProto = isPrototype(object), props = baseKeysIn(object), propsLength = props.length, indexes = indexKeys(object), skipIndexes = !!indexes, result = indexes || [], length = result.length; while (++index < propsLength) { var key = props[index]; if (!(skipIndexes && (key == 'length' || isIndex(key, length))) && !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { result.push(key); } } return result; } /** * The opposite of `_.mapValues`; this method creates an object with the * same values as `object` and keys generated by running each own enumerable * property of `object` through `iteratee`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns the new mapped object. * @example * * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { * return key + value; * }); * // => { 'a1': 1, 'b2': 2 } */ function mapKeys(object, iteratee) { var result = {}; iteratee = getIteratee(iteratee, 3); baseForOwn(object, function(value, key, object) { result[iteratee(value, key, object)] = value; }); return result; } /** * Creates an object with the same keys as `object` and values generated by * running each own enumerable property of `object` through `iteratee`. The * iteratee function is invoked with three arguments: (value, key, object). * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns the new mapped object. * @example * * var users = { * 'fred': { 'user': 'fred', 'age': 40 }, * 'pebbles': { 'user': 'pebbles', 'age': 1 } * }; * * _.mapValues(users, function(o) { return o.age; }); * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) * * // The `_.property` iteratee shorthand. * _.mapValues(users, 'age'); * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) */ function mapValues(object, iteratee) { var result = {}; iteratee = getIteratee(iteratee, 3); baseForOwn(object, function(value, key, object) { result[key] = iteratee(value, key, object); }); return result; } /** * Recursively merges own and inherited enumerable properties of source objects * into the destination object. Source properties that resolve to `undefined` * are skipped if a destination value exists. Array and plain object properties * are merged recursively. Other objects and value types are overridden by * assignment. Source objects are applied from left to right. Subsequent * sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * var users = { * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] * }; * * var ages = { * 'data': [{ 'age': 36 }, { 'age': 40 }] * }; * * _.merge(users, ages); * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } */ var merge = createAssigner(function(object, source, srcIndex) { baseMerge(object, source, srcIndex); }); /** * This method is like `_.merge` except that it accepts `customizer` which * is invoked to produce the merged values of the destination and source * properties. If `customizer` returns `undefined` merging is handled by the * method instead. The `customizer` is invoked with seven arguments: * (objValue, srcValue, key, object, source, stack). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. * @param {Function} customizer The function to customize assigned values. * @returns {Object} Returns `object`. * @example * * function customizer(objValue, srcValue) { * if (_.isArray(objValue)) { * return objValue.concat(srcValue); * } * } * * var object = { * 'fruits': ['apple'], * 'vegetables': ['beet'] * }; * * var other = { * 'fruits': ['banana'], * 'vegetables': ['carrot'] * }; * * _.mergeWith(object, other, customizer); * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } */ var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { baseMerge(object, source, srcIndex, customizer); }); /** * The opposite of `_.pick`; this method creates an object composed of the * own and inherited enumerable properties of `object` that are not omitted. * * @static * @memberOf _ * @category Object * @param {Object} object The source object. * @param {...(string|string[])} [props] The property names to omit, specified * individually or in arrays. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.omit(object, ['a', 'c']); * // => { 'b': '2' } */ var omit = rest(function(object, props) { if (object == null) { return {}; } props = arrayMap(baseFlatten(props, 1), String); return basePick(object, baseDifference(keysIn(object), props)); }); /** * The opposite of `_.pickBy`; this method creates an object composed of the * own and inherited enumerable properties of `object` that `predicate` * doesn't return truthy for. * * @static * @memberOf _ * @category Object * @param {Object} object The source object. * @param {Function|Object|string} [predicate=_.identity] The function invoked per property. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.omitBy(object, _.isNumber); * // => { 'b': '2' } */ function omitBy(object, predicate) { predicate = getIteratee(predicate, 2); return basePickBy(object, function(value, key) { return !predicate(value, key); }); } /** * Creates an object composed of the picked `object` properties. * * @static * @memberOf _ * @category Object * @param {Object} object The source object. * @param {...(string|string[])} [props] The property names to pick, specified * individually or in arrays. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.pick(object, ['a', 'c']); * // => { 'a': 1, 'c': 3 } */ var pick = rest(function(object, props) { return object == null ? {} : basePick(object, baseFlatten(props, 1)); }); /** * Creates an object composed of the `object` properties `predicate` returns * truthy for. The predicate is invoked with two arguments: (value, key). * * @static * @memberOf _ * @category Object * @param {Object} object The source object. * @param {Function|Object|string} [predicate=_.identity] The function invoked per property. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.pickBy(object, _.isNumber); * // => { 'a': 1, 'c': 3 } */ function pickBy(object, predicate) { return object == null ? {} : basePickBy(object, getIteratee(predicate, 2)); } /** * This method is like `_.get` except that if the resolved value is a function * it's invoked with the `this` binding of its parent object and its result * is returned. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to resolve. * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. * @returns {*} Returns the resolved value. * @example * * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; * * _.result(object, 'a[0].b.c1'); * // => 3 * * _.result(object, 'a[0].b.c2'); * // => 4 * * _.result(object, 'a[0].b.c3', 'default'); * // => 'default' * * _.result(object, 'a[0].b.c3', _.constant('default')); * // => 'default' */ function result(object, path, defaultValue) { if (!isKey(path, object)) { path = baseCastPath(path); var result = get(object, path); object = parent(object, path); } else { result = object == null ? undefined : object[path]; } if (result === undefined) { result = defaultValue; } return isFunction(result) ? result.call(object) : result; } /** * Sets the value at `path` of `object`. If a portion of `path` doesn't exist * it's created. Arrays are created for missing index properties while objects * are created for all other missing properties. Use `_.setWith` to customize * `path` creation. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @returns {Object} Returns `object`. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.set(object, 'a[0].b.c', 4); * console.log(object.a[0].b.c); * // => 4 * * _.set(object, 'x[0].y.z', 5); * console.log(object.x[0].y.z); * // => 5 */ function set(object, path, value) { return object == null ? object : baseSet(object, path, value); } /** * This method is like `_.set` except that it accepts `customizer` which is * invoked to produce the objects of `path`. If `customizer` returns `undefined` * path creation is handled by the method instead. The `customizer` is invoked * with three arguments: (nsValue, key, nsObject). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @param {Function} [customizer] The function to customize assigned values. * @returns {Object} Returns `object`. * @example * * _.setWith({ '0': { 'length': 2 } }, '[0][1][2]', 3, Object); * // => { '0': { '1': { '2': 3 }, 'length': 2 } } */ function setWith(object, path, value, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; return object == null ? object : baseSet(object, path, value, customizer); } /** * Creates an array of own enumerable key-value pairs for `object` which * can be consumed by `_.fromPairs`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the new array of key-value pairs. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.toPairs(new Foo); * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) */ function toPairs(object) { return baseToPairs(object, keys(object)); } /** * Creates an array of own and inherited enumerable key-value pairs for * `object` which can be consumed by `_.fromPairs`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the new array of key-value pairs. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.toPairsIn(new Foo); * // => [['a', 1], ['b', 2], ['c', 1]] (iteration order is not guaranteed) */ function toPairsIn(object) { return baseToPairs(object, keysIn(object)); } /** * An alternative to `_.reduce`; this method transforms `object` to a new * `accumulator` object which is the result of running each of its own enumerable * properties through `iteratee`, with each invocation potentially mutating * the `accumulator` object. The iteratee is invoked with four arguments: * (accumulator, value, key, object). Iteratee functions may exit iteration * early by explicitly returning `false`. * * @static * @memberOf _ * @category Object * @param {Array|Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The custom accumulator value. * @returns {*} Returns the accumulated value. * @example * * _.transform([2, 3, 4], function(result, n) { * result.push(n *= n); * return n % 2 == 0; * }, []); * // => [4, 9] * * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { * (result[value] || (result[value] = [])).push(key); * }, {}); * // => { '1': ['a', 'c'], '2': ['b'] } */ function transform(object, iteratee, accumulator) { var isArr = isArray(object) || isTypedArray(object); iteratee = getIteratee(iteratee, 4); if (accumulator == null) { if (isArr || isObject(object)) { var Ctor = object.constructor; if (isArr) { accumulator = isArray(object) ? new Ctor : []; } else { accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined); } } else { accumulator = {}; } } (isArr ? arrayEach : baseForOwn)(object, function(value, index, object) { return iteratee(accumulator, value, index, object); }); return accumulator; } /** * Removes the property at `path` of `object`. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to unset. * @returns {boolean} Returns `true` if the property is deleted, else `false`. * @example * * var object = { 'a': [{ 'b': { 'c': 7 } }] }; * _.unset(object, 'a[0].b.c'); * // => true * * console.log(object); * // => { 'a': [{ 'b': {} }] }; * * _.unset(object, 'a[0].b.c'); * // => true * * console.log(object); * // => { 'a': [{ 'b': {} }] }; */ function unset(object, path) { return object == null ? true : baseUnset(object, path); } /** * Creates an array of the own enumerable property values of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property values. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.values(new Foo); * // => [1, 2] (iteration order is not guaranteed) * * _.values('hi'); * // => ['h', 'i'] */ function values(object) { return object ? baseValues(object, keys(object)) : []; } /** * Creates an array of the own and inherited enumerable property values of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property values. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.valuesIn(new Foo); * // => [1, 2, 3] (iteration order is not guaranteed) */ function valuesIn(object) { return object == null ? [] : baseValues(object, keysIn(object)); } /*------------------------------------------------------------------------*/ /** * Clamps `number` within the inclusive `lower` and `upper` bounds. * * @static * @memberOf _ * @category Number * @param {number} number The number to clamp. * @param {number} [lower] The lower bound. * @param {number} upper The upper bound. * @returns {number} Returns the clamped number. * @example * * _.clamp(-10, -5, 5); * // => -5 * * _.clamp(10, -5, 5); * // => 5 */ function clamp(number, lower, upper) { if (upper === undefined) { upper = lower; lower = undefined; } if (upper !== undefined) { upper = toNumber(upper); upper = upper === upper ? upper : 0; } if (lower !== undefined) { lower = toNumber(lower); lower = lower === lower ? lower : 0; } return baseClamp(toNumber(number), lower, upper); } /** * Checks if `n` is between `start` and up to but not including, `end`. If * `end` is not specified it's set to `start` with `start` then set to `0`. * If `start` is greater than `end` the params are swapped to support * negative ranges. * * @static * @memberOf _ * @category Number * @param {number} number The number to check. * @param {number} [start=0] The start of the range. * @param {number} end The end of the range. * @returns {boolean} Returns `true` if `number` is in the range, else `false`. * @example * * _.inRange(3, 2, 4); * // => true * * _.inRange(4, 8); * // => true * * _.inRange(4, 2); * // => false * * _.inRange(2, 2); * // => false * * _.inRange(1.2, 2); * // => true * * _.inRange(5.2, 4); * // => false * * _.inRange(-3, -2, -6); * // => true */ function inRange(number, start, end) { start = toNumber(start) || 0; if (end === undefined) { end = start; start = 0; } else { end = toNumber(end) || 0; } number = toNumber(number); return baseInRange(number, start, end); } /** * Produces a random number between the inclusive `lower` and `upper` bounds. * If only one argument is provided a number between `0` and the given number * is returned. If `floating` is `true`, or either `lower` or `upper` are floats, * a floating-point number is returned instead of an integer. * * **Note:** JavaScript follows the IEEE-754 standard for resolving * floating-point values which can produce unexpected results. * * @static * @memberOf _ * @category Number * @param {number} [lower=0] The lower bound. * @param {number} [upper=1] The upper bound. * @param {boolean} [floating] Specify returning a floating-point number. * @returns {number} Returns the 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(lower, upper, floating) { if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { upper = floating = undefined; } if (floating === undefined) { if (typeof upper == 'boolean') { floating = upper; upper = undefined; } else if (typeof lower == 'boolean') { floating = lower; lower = undefined; } } if (lower === undefined && upper === undefined) { lower = 0; upper = 1; } else { lower = toNumber(lower) || 0; if (upper === undefined) { upper = lower; lower = 0; } else { upper = toNumber(upper) || 0; } } if (lower > upper) { var temp = lower; lower = upper; upper = temp; } if (floating || lower % 1 || upper % 1) { var rand = nativeRandom(); return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); } return baseRandom(lower, upper); } /*------------------------------------------------------------------------*/ /** * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the camel cased string. * @example * * _.camelCase('Foo Bar'); * // => 'fooBar' * * _.camelCase('--foo-bar'); * // => 'fooBar' * * _.camelCase('__foo_bar__'); * // => 'fooBar' */ var camelCase = createCompounder(function(result, word, index) { word = word.toLowerCase(); return result + (index ? capitalize(word) : word); }); /** * Converts the first character of `string` to upper case and the remaining * to lower case. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to capitalize. * @returns {string} Returns the capitalized string. * @example * * _.capitalize('FRED'); * // => 'Fred' */ function capitalize(string) { return upperFirst(toString(string).toLowerCase()); } /** * Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) * to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to deburr. * @returns {string} Returns the deburred string. * @example * * _.deburr('dรฉjร  vu'); * // => 'deja vu' */ function deburr(string) { string = toString(string); return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, ''); } /** * Checks if `string` ends with the given target string. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to search. * @param {string} [target] The string to search for. * @param {number} [position=string.length] The position to search from. * @returns {boolean} Returns `true` if `string` ends with `target`, else `false`. * @example * * _.endsWith('abc', 'c'); * // => true * * _.endsWith('abc', 'b'); * // => false * * _.endsWith('abc', 'b', 2); * // => true */ function endsWith(string, target, position) { string = toString(string); target = typeof target == 'string' ? target : (target + ''); var length = string.length; position = position === undefined ? length : baseClamp(toInteger(position), 0, length); position -= target.length; return position >= 0 && string.indexOf(target, position) == position; } /** * Converts the characters "&", "<", ">", '"', "'", and "\`" in `string` to * their corresponding HTML entities. * * **Note:** No other characters are escaped. To escape additional * characters use a third-party library like [_he_](https://mths.be/he). * * Though the ">" character is escaped for symmetry, characters like * ">" and "/" don't need escaping in HTML and have no special meaning * unless they're part of a tag or unquoted attribute value. * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) * (under "semi-related fun fact") for more details. * * Backticks are escaped because in IE < 9, they can break out of * attribute values or HTML comments. See [#59](https://html5sec.org/#59), * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/) * for more details. * * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping) * to reduce XSS vectors. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to escape. * @returns {string} Returns the escaped string. * @example * * _.escape('fred, barney, & pebbles'); * // => 'fred, barney, &amp; pebbles' */ function escape(string) { string = toString(string); return (string && reHasUnescapedHtml.test(string)) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string; } /** * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to escape. * @returns {string} Returns the escaped string. * @example * * _.escapeRegExp('[lodash](https://lodash.com/)'); * // => '\[lodash\]\(https://lodash\.com/\)' */ function escapeRegExp(string) { string = toString(string); return (string && reHasRegExpChar.test(string)) ? string.replace(reRegExpChar, '\\$&') : string; } /** * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the kebab cased string. * @example * * _.kebabCase('Foo Bar'); * // => 'foo-bar' * * _.kebabCase('fooBar'); * // => 'foo-bar' * * _.kebabCase('__foo_bar__'); * // => 'foo-bar' */ var kebabCase = createCompounder(function(result, word, index) { return result + (index ? '-' : '') + word.toLowerCase(); }); /** * Converts `string`, as space separated words, to lower case. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the lower cased string. * @example * * _.lowerCase('--Foo-Bar'); * // => 'foo bar' * * _.lowerCase('fooBar'); * // => 'foo bar' * * _.lowerCase('__FOO_BAR__'); * // => 'foo bar' */ var lowerCase = createCompounder(function(result, word, index) { return result + (index ? ' ' : '') + word.toLowerCase(); }); /** * Converts the first character of `string` to lower case. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the converted string. * @example * * _.lowerFirst('Fred'); * // => 'fred' * * _.lowerFirst('FRED'); * // => 'fRED' */ var lowerFirst = createCaseFirst('toLowerCase'); /** * Converts the first character of `string` to upper case. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the converted string. * @example * * _.upperFirst('fred'); * // => 'Fred' * * _.upperFirst('FRED'); * // => 'FRED' */ var upperFirst = createCaseFirst('toUpperCase'); /** * Pads `string` on the left and right sides if it's shorter than `length`. * Padding characters are truncated if they can't be evenly divided by `length`. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padded string. * @example * * _.pad('abc', 8); * // => ' abc ' * * _.pad('abc', 8, '_-'); * // => '_-abc_-_' * * _.pad('abc', 3); * // => 'abc' */ function pad(string, length, chars) { string = toString(string); length = toInteger(length); var strLength = stringSize(string); if (!length || strLength >= length) { return string; } var mid = (length - strLength) / 2, leftLength = nativeFloor(mid), rightLength = nativeCeil(mid); return createPadding('', leftLength, chars) + string + createPadding('', rightLength, chars); } /** * Pads `string` on the right side if it's shorter than `length`. Padding * characters are truncated if they exceed `length`. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padded string. * @example * * _.padEnd('abc', 6); * // => 'abc ' * * _.padEnd('abc', 6, '_-'); * // => 'abc_-_' * * _.padEnd('abc', 3); * // => 'abc' */ function padEnd(string, length, chars) { string = toString(string); return string + createPadding(string, length, chars); } /** * Pads `string` on the left side if it's shorter than `length`. Padding * characters are truncated if they exceed `length`. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padded string. * @example * * _.padStart('abc', 6); * // => ' abc' * * _.padStart('abc', 6, '_-'); * // => '_-_abc' * * _.padStart('abc', 3); * // => 'abc' */ function padStart(string, length, chars) { string = toString(string); return createPadding(string, length, chars) + string; } /** * Converts `string` to an integer of the specified radix. If `radix` is * `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal, * in which case a `radix` of `16` is used. * * **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#x15.1.2.2) * of `parseInt`. * * @static * @memberOf _ * @category String * @param {string} string The string to convert. * @param {number} [radix=10] The radix to interpret `value` by. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {number} Returns the converted integer. * @example * * _.parseInt('08'); * // => 8 * * _.map(['6', '08', '10'], _.parseInt); * // => [6, 8, 10] */ function parseInt(string, radix, guard) { // Chrome fails to trim leading <BOM> whitespace characters. // See https://code.google.com/p/v8/issues/detail?id=3109 for more details. if (guard || radix == null) { radix = 0; } else if (radix) { radix = +radix; } string = toString(string).replace(reTrim, ''); return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10)); } /** * Repeats the given string `n` times. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to repeat. * @param {number} [n=0] The number of times to repeat the string. * @returns {string} Returns the repeated string. * @example * * _.repeat('*', 3); * // => '***' * * _.repeat('abc', 2); * // => 'abcabc' * * _.repeat('abc', 0); * // => '' */ function repeat(string, n) { string = toString(string); n = toInteger(n); var result = ''; if (!string || n < 1 || n > MAX_SAFE_INTEGER) { return result; } // Leverage the exponentiation by squaring algorithm for a faster repeat. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. do { if (n % 2) { result += string; } n = nativeFloor(n / 2); string += string; } while (n); return result; } /** * Replaces matches for `pattern` in `string` with `replacement`. * * **Note:** This method is based on [`String#replace`](https://mdn.io/String/replace). * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to modify. * @param {RegExp|string} pattern The pattern to replace. * @param {Function|string} replacement The match replacement. * @returns {string} Returns the modified string. * @example * * _.replace('Hi Fred', 'Fred', 'Barney'); * // => 'Hi Barney' */ function replace() { var args = arguments, string = toString(args[0]); return args.length < 3 ? string : string.replace(args[1], args[2]); } /** * Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case). * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the snake cased string. * @example * * _.snakeCase('Foo Bar'); * // => 'foo_bar' * * _.snakeCase('fooBar'); * // => 'foo_bar' * * _.snakeCase('--foo-bar'); * // => 'foo_bar' */ var snakeCase = createCompounder(function(result, word, index) { return result + (index ? '_' : '') + word.toLowerCase(); }); /** * Splits `string` by `separator`. * * **Note:** This method is based on [`String#split`](https://mdn.io/String/split). * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to split. * @param {RegExp|string} separator The separator pattern to split by. * @param {number} [limit] The length to truncate results to. * @returns {Array} Returns the new array of string segments. * @example * * _.split('a-b-c', '-', 2); * // => ['a', 'b'] */ function split(string, separator, limit) { return toString(string).split(separator, limit); } /** * Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the start cased string. * @example * * _.startCase('--foo-bar'); * // => 'Foo Bar' * * _.startCase('fooBar'); * // => 'Foo Bar' * * _.startCase('__foo_bar__'); * // => 'Foo Bar' */ var startCase = createCompounder(function(result, word, index) { return result + (index ? ' ' : '') + capitalize(word); }); /** * Checks if `string` starts with the given target string. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to search. * @param {string} [target] The string to search for. * @param {number} [position=0] The position to search from. * @returns {boolean} Returns `true` if `string` starts with `target`, else `false`. * @example * * _.startsWith('abc', 'a'); * // => true * * _.startsWith('abc', 'b'); * // => false * * _.startsWith('abc', 'b', 1); * // => true */ function startsWith(string, target, position) { string = toString(string); position = baseClamp(toInteger(position), 0, string.length); return string.lastIndexOf(target, position) == position; } /** * Creates a compiled template function that can interpolate data properties * in "interpolate" delimiters, HTML-escape interpolated data properties in * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data * properties may be accessed as free variables in the template. If a setting * object is given it takes precedence over `_.templateSettings` values. * * **Note:** In the development build `_.template` utilizes * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) * for easier debugging. * * For more information on precompiling templates see * [lodash's custom builds documentation](https://lodash.com/custom-builds). * * For more information on Chrome extension sandboxes see * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). * * @static * @memberOf _ * @category String * @param {string} [string=''] The template string. * @param {Object} [options] The options object. * @param {RegExp} [options.escape] The HTML "escape" delimiter. * @param {RegExp} [options.evaluate] The "evaluate" delimiter. * @param {Object} [options.imports] An object to import into the template as free variables. * @param {RegExp} [options.interpolate] The "interpolate" delimiter. * @param {string} [options.sourceURL] The sourceURL of the template's compiled source. * @param {string} [options.variable] The data object variable name. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Function} Returns the compiled template function. * @example * * // Use the "interpolate" delimiter to create a compiled template. * var compiled = _.template('hello <%= user %>!'); * compiled({ 'user': 'fred' }); * // => 'hello fred!' * * // Use the HTML "escape" delimiter to escape data property values. * var compiled = _.template('<b><%- value %></b>'); * compiled({ 'value': '<script>' }); * // => '<b>&lt;script&gt;</b>' * * // Use the "evaluate" delimiter to execute JavaScript and generate HTML. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>'); * compiled({ 'users': ['fred', 'barney'] }); * // => '<li>fred</li><li>barney</li>' * * // Use the internal `print` function in "evaluate" delimiters. * var compiled = _.template('<% print("hello " + user); %>!'); * compiled({ 'user': 'barney' }); * // => 'hello barney!' * * // Use the ES delimiter as an alternative to the default "interpolate" delimiter. * var compiled = _.template('hello ${ user }!'); * compiled({ 'user': 'pebbles' }); * // => 'hello pebbles!' * * // Use custom template delimiters. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g; * var compiled = _.template('hello {{ user }}!'); * compiled({ 'user': 'mustache' }); * // => 'hello mustache!' * * // Use backslashes to treat delimiters as plain text. * var compiled = _.template('<%= "\\<%- value %\\>" %>'); * compiled({ 'value': 'ignored' }); * // => '<%- value %>' * * // Use the `imports` option to import `jQuery` as `jq`. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>'; * var compiled = _.template(text, { 'imports': { 'jq': jQuery } }); * compiled({ 'users': ['fred', 'barney'] }); * // => '<li>fred</li><li>barney</li>' * * // Use the `sourceURL` option to specify a custom sourceURL for the template. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' }); * compiled(data); * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector * * // Use the `variable` option to ensure a with-statement isn't used in the compiled template. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' }); * compiled.source; * // => function(data) { * // var __t, __p = ''; * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!'; * // return __p; * // } * * // Use the `source` property to inline compiled templates for meaningful * // line numbers in error messages and stack traces. * fs.writeFileSync(path.join(cwd, 'jst.js'), '\ * var JST = {\ * "main": ' + _.template(mainText).source + '\ * };\ * '); */ function template(string, options, guard) { // 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; if (guard && isIterateeCall(string, options, guard)) { options = undefined; } string = toString(string); options = assignInWith({}, options, settings, assignInDefaults); var imports = assignInWith({}, options.imports, settings.imports, assignInDefaults), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys); var isEscaping, 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'); // Use a sourceURL for easier debugging. var sourceURL = '//# sourceURL=' + ('sourceURL' in options ? options.sourceURL : ('lodash.templateSources[' + (++templateCounter) + ']') ) + '\n'; string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { interpolateValue || (interpolateValue = esTemplateValue); // Escape characters that can't be included in string literals. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar); // Replace delimiters with snippets. if (escapeValue) { isEscaping = true; 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 needs `match` returned 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; if (!variable) { source = 'with (obj) {\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 || 'obj') + ') {\n' + (variable ? '' : 'obj || (obj = {});\n' ) + "var __t, __p = ''" + (isEscaping ? ', __e = _.escape' : '' ) + (isEvaluating ? ', __j = Array.prototype.join;\n' + "function print() { __p += __j.call(arguments, '') }\n" : ';\n' ) + source + 'return __p\n}'; var result = attempt(function() { return Function(importsKeys, sourceURL + 'return ' + source) .apply(undefined, importsValues); }); // Provide the compiled function's source by its `toString` method or // the `source` property as a convenience for inlining compiled templates. result.source = source; if (isError(result)) { throw result; } return result; } /** * Converts `string`, as a whole, to lower case. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the lower cased string. * @example * * _.toLower('--Foo-Bar'); * // => '--foo-bar' * * _.toLower('fooBar'); * // => 'foobar' * * _.toLower('__FOO_BAR__'); * // => '__foo_bar__' */ function toLower(value) { return toString(value).toLowerCase(); } /** * Converts `string`, as a whole, to upper case. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the upper cased string. * @example * * _.toUpper('--foo-bar'); * // => '--FOO-BAR' * * _.toUpper('fooBar'); * // => 'FOOBAR' * * _.toUpper('__foo_bar__'); * // => '__FOO_BAR__' */ function toUpper(value) { return toString(value).toUpperCase(); } /** * Removes leading and trailing whitespace or specified characters from `string`. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {string} Returns the trimmed string. * @example * * _.trim(' abc '); * // => 'abc' * * _.trim('-_-abc-_-', '_-'); * // => 'abc' * * _.map([' foo ', ' bar '], _.trim); * // => ['foo', 'bar'] */ function trim(string, chars, guard) { string = toString(string); if (!string) { return string; } if (guard || chars === undefined) { return string.replace(reTrim, ''); } chars = (chars + ''); if (!chars) { return string; } var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars); return strSymbols .slice(charsStartIndex(strSymbols, chrSymbols), charsEndIndex(strSymbols, chrSymbols) + 1) .join(''); } /** * Removes trailing whitespace or specified characters from `string`. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {string} Returns the trimmed string. * @example * * _.trimEnd(' abc '); * // => ' abc' * * _.trimEnd('-_-abc-_-', '_-'); * // => '-_-abc' */ function trimEnd(string, chars, guard) { string = toString(string); if (!string) { return string; } if (guard || chars === undefined) { return string.replace(reTrimEnd, ''); } chars = (chars + ''); if (!chars) { return string; } var strSymbols = stringToArray(string); return strSymbols .slice(0, charsEndIndex(strSymbols, stringToArray(chars)) + 1) .join(''); } /** * Removes leading whitespace or specified characters from `string`. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {string} Returns the trimmed string. * @example * * _.trimStart(' abc '); * // => 'abc ' * * _.trimStart('-_-abc-_-', '_-'); * // => 'abc-_-' */ function trimStart(string, chars, guard) { string = toString(string); if (!string) { return string; } if (guard || chars === undefined) { return string.replace(reTrimStart, ''); } chars = (chars + ''); if (!chars) { return string; } var strSymbols = stringToArray(string); return strSymbols .slice(charsStartIndex(strSymbols, stringToArray(chars))) .join(''); } /** * Truncates `string` if it's longer than the given maximum string length. * The last characters of the truncated string are replaced with the omission * string which defaults to "...". * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to truncate. * @param {Object} [options=({})] The options object. * @param {number} [options.length=30] The maximum string length. * @param {string} [options.omission='...'] The string to indicate text is omitted. * @param {RegExp|string} [options.separator] The separator pattern to truncate to. * @returns {string} Returns the truncated string. * @example * * _.truncate('hi-diddly-ho there, neighborino'); * // => 'hi-diddly-ho there, neighbo...' * * _.truncate('hi-diddly-ho there, neighborino', { * 'length': 24, * 'separator': ' ' * }); * // => 'hi-diddly-ho there,...' * * _.truncate('hi-diddly-ho there, neighborino', { * 'length': 24, * 'separator': /,? +/ * }); * // => 'hi-diddly-ho there...' * * _.truncate('hi-diddly-ho there, neighborino', { * 'omission': ' [...]' * }); * // => 'hi-diddly-ho there, neig [...]' */ function truncate(string, options) { var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; if (isObject(options)) { var separator = 'separator' in options ? options.separator : separator; length = 'length' in options ? toInteger(options.length) : length; omission = 'omission' in options ? toString(options.omission) : omission; } string = toString(string); var strLength = string.length; if (reHasComplexSymbol.test(string)) { var strSymbols = stringToArray(string); strLength = strSymbols.length; } if (length >= strLength) { return string; } var end = length - stringSize(omission); if (end < 1) { return omission; } var result = strSymbols ? strSymbols.slice(0, end).join('') : string.slice(0, end); if (separator === undefined) { return result + omission; } if (strSymbols) { end += (result.length - end); } if (isRegExp(separator)) { if (string.slice(end).search(separator)) { var match, substring = result; if (!separator.global) { separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g'); } separator.lastIndex = 0; while ((match = separator.exec(substring))) { var newEnd = match.index; } result = result.slice(0, newEnd === undefined ? end : newEnd); } } else if (string.indexOf(separator, end) != end) { var index = result.lastIndexOf(separator); if (index > -1) { result = result.slice(0, index); } } return result + omission; } /** * The inverse of `_.escape`; this method converts the HTML entities * `&amp;`, `&lt;`, `&gt;`, `&quot;`, `&#39;`, and `&#96;` in `string` to their * corresponding characters. * * **Note:** No other HTML entities are unescaped. To unescape additional HTML * entities use a third-party library like [_he_](https://mths.be/he). * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to unescape. * @returns {string} Returns the unescaped string. * @example * * _.unescape('fred, barney, &amp; pebbles'); * // => 'fred, barney, & pebbles' */ function unescape(string) { string = toString(string); return (string && reHasEscapedHtml.test(string)) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string; } /** * Converts `string`, as space separated words, to upper case. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the upper cased string. * @example * * _.upperCase('--foo-bar'); * // => 'FOO BAR' * * _.upperCase('fooBar'); * // => 'FOO BAR' * * _.upperCase('__foo_bar__'); * // => 'FOO BAR' */ var upperCase = createCompounder(function(result, word, index) { return result + (index ? ' ' : '') + word.toUpperCase(); }); /** * Splits `string` into an array of its words. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to inspect. * @param {RegExp|string} [pattern] The pattern to match words. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Array} Returns the words of `string`. * @example * * _.words('fred, barney, & pebbles'); * // => ['fred', 'barney', 'pebbles'] * * _.words('fred, barney, & pebbles', /[^, ]+/g); * // => ['fred', 'barney', '&', 'pebbles'] */ function words(string, pattern, guard) { string = toString(string); pattern = guard ? undefined : pattern; if (pattern === undefined) { pattern = reHasComplexWord.test(string) ? reComplexWord : reBasicWord; } return string.match(pattern) || []; } /*------------------------------------------------------------------------*/ /** * Attempts to invoke `func`, returning either the result or the caught error * object. Any additional arguments are provided to `func` when it's invoked. * * @static * @memberOf _ * @category Util * @param {Function} func The function to attempt. * @returns {*} Returns the `func` result or error object. * @example * * // Avoid throwing errors for invalid selectors. * var elements = _.attempt(function(selector) { * return document.querySelectorAll(selector); * }, '>_>'); * * if (_.isError(elements)) { * elements = []; * } */ var attempt = rest(function(func, args) { try { return apply(func, undefined, args); } catch (e) { return isError(e) ? e : new Error(e); } }); /** * Binds methods of an object to the object itself, overwriting the existing * method. * * **Note:** This method doesn't set the "length" property of bound functions. * * @static * @memberOf _ * @category Util * @param {Object} object The object to bind and assign the bound methods to. * @param {...(string|string[])} methodNames The object method names to bind, * specified individually or in arrays. * @returns {Object} Returns `object`. * @example * * var view = { * 'label': 'docs', * 'onClick': function() { * console.log('clicked ' + this.label); * } * }; * * _.bindAll(view, 'onClick'); * jQuery(element).on('click', view.onClick); * // => logs 'clicked docs' when clicked */ var bindAll = rest(function(object, methodNames) { arrayEach(baseFlatten(methodNames, 1), function(key) { object[key] = bind(object[key], object); }); return object; }); /** * Creates a function that iterates over `pairs` invoking the corresponding * function of the first predicate to return truthy. The predicate-function * pairs are invoked with the `this` binding and arguments of the created * function. * * @static * @memberOf _ * @category Util * @param {Array} pairs The predicate-function pairs. * @returns {Function} Returns the new function. * @example * * var func = _.cond([ * [_.matches({ 'a': 1 }), _.constant('matches A')], * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')], * [_.constant(true), _.constant('no match')] * ]); * * func({ 'a': 1, 'b': 2 }); * // => 'matches A' * * func({ 'a': 0, 'b': 1 }); * // => 'matches B' * * func({ 'a': '1', 'b': '2' }); * // => 'no match' */ function cond(pairs) { var length = pairs ? pairs.length : 0, toIteratee = getIteratee(); pairs = !length ? [] : arrayMap(pairs, function(pair) { if (typeof pair[1] != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return [toIteratee(pair[0]), pair[1]]; }); return rest(function(args) { var index = -1; while (++index < length) { var pair = pairs[index]; if (apply(pair[0], this, args)) { return apply(pair[1], this, args); } } }); } /** * Creates a function that invokes the predicate properties of `source` with * the corresponding property values of a given object, returning `true` if * all predicates return truthy, else `false`. * * @static * @memberOf _ * @category Util * @param {Object} source The object of property predicates to conform to. * @returns {Function} Returns the new function. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 } * ]; * * _.filter(users, _.conforms({ 'age': _.partial(_.gt, _, 38) })); * // => [{ 'user': 'fred', 'age': 40 }] */ function conforms(source) { return baseConforms(baseClone(source, true)); } /** * Creates a function that returns `value`. * * @static * @memberOf _ * @category Util * @param {*} value The value to return from the new function. * @returns {Function} Returns the new function. * @example * * var object = { 'user': 'fred' }; * var getter = _.constant(object); * * getter() === object; * // => true */ function constant(value) { return function() { return value; }; } /** * Creates a function that returns the result of invoking the given functions * with the `this` binding of the created function, where each successive * invocation is supplied the return value of the previous. * * @static * @memberOf _ * @category Util * @param {...(Function|Function[])} [funcs] Functions to invoke. * @returns {Function} Returns the new function. * @example * * function square(n) { * return n * n; * } * * var addSquare = _.flow(_.add, square); * addSquare(1, 2); * // => 9 */ var flow = createFlow(); /** * This method is like `_.flow` except that it creates a function that * invokes the given functions from right to left. * * @static * @memberOf _ * @category Util * @param {...(Function|Function[])} [funcs] Functions to invoke. * @returns {Function} Returns the new function. * @example * * function square(n) { * return n * n; * } * * var addSquare = _.flowRight(square, _.add); * addSquare(1, 2); * // => 9 */ var flowRight = createFlow(true); /** * This method returns the first argument given to it. * * @static * @memberOf _ * @category Util * @param {*} value Any value. * @returns {*} Returns `value`. * @example * * var object = { 'user': 'fred' }; * * _.identity(object) === object; * // => true */ function identity(value) { return value; } /** * Creates a function that invokes `func` with the arguments of the created * function. If `func` is a property name the created callback returns the * property value for a given element. If `func` is an object the created * callback returns `true` for elements that contain the equivalent object * properties, otherwise it returns `false`. * * @static * @memberOf _ * @category Util * @param {*} [func=_.identity] The value to convert to a callback. * @returns {Function} Returns the callback. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 } * ]; * * // Create custom iteratee shorthands. * _.iteratee = _.wrap(_.iteratee, function(callback, func) { * var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func); * return !p ? callback(func) : function(object) { * return (p[2] == '>' ? object[p[1]] > p[3] : object[p[1]] < p[3]); * }; * }); * * _.filter(users, 'age > 36'); * // => [{ 'user': 'fred', 'age': 40 }] */ function iteratee(func) { return baseIteratee(typeof func == 'function' ? func : baseClone(func, true)); } /** * Creates a function that performs a partial deep comparison between a given * object and `source`, returning `true` if the given object has equivalent * property values, else `false`. The created function is equivalent to * `_.isMatch` with a `source` partially applied. * * **Note:** This method supports comparing the same values as `_.isEqual`. * * @static * @memberOf _ * @category Util * @param {Object} source The object of property values to match. * @returns {Function} Returns the new function. * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': true }, * { 'user': 'fred', 'age': 40, 'active': false } * ]; * * _.filter(users, _.matches({ 'age': 40, 'active': false })); * // => [{ 'user': 'fred', 'age': 40, 'active': false }] */ function matches(source) { return baseMatches(baseClone(source, true)); } /** * Creates a function that performs a partial deep comparison between the * value at `path` of a given object to `srcValue`, returning `true` if the * object value is equivalent, else `false`. * * **Note:** This method supports comparing the same values as `_.isEqual`. * * @static * @memberOf _ * @category Util * @param {Array|string} path The path of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new function. * @example * * var users = [ * { 'user': 'barney' }, * { 'user': 'fred' } * ]; * * _.find(users, _.matchesProperty('user', 'fred')); * // => { 'user': 'fred' } */ function matchesProperty(path, srcValue) { return baseMatchesProperty(path, baseClone(srcValue, true)); } /** * Creates a function that invokes the method at `path` of a given object. * Any additional arguments are provided to the invoked method. * * @static * @memberOf _ * @category Util * @param {Array|string} path The path of the method to invoke. * @param {...*} [args] The arguments to invoke the method with. * @returns {Function} Returns the new function. * @example * * var objects = [ * { 'a': { 'b': { 'c': _.constant(2) } } }, * { 'a': { 'b': { 'c': _.constant(1) } } } * ]; * * _.map(objects, _.method('a.b.c')); * // => [2, 1] * * _.invokeMap(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c'); * // => [1, 2] */ var method = rest(function(path, args) { return function(object) { return baseInvoke(object, path, args); }; }); /** * The opposite of `_.method`; this method creates a function that invokes * the method at a given path of `object`. Any additional arguments are * provided to the invoked method. * * @static * @memberOf _ * @category Util * @param {Object} object The object to query. * @param {...*} [args] The arguments to invoke the method with. * @returns {Function} Returns the new function. * @example * * var array = _.times(3, _.constant), * object = { 'a': array, 'b': array, 'c': array }; * * _.map(['a[2]', 'c[0]'], _.methodOf(object)); * // => [2, 0] * * _.map([['a', '2'], ['c', '0']], _.methodOf(object)); * // => [2, 0] */ var methodOf = rest(function(object, args) { return function(path) { return baseInvoke(object, path, args); }; }); /** * Adds all own enumerable function properties of a source object to the * destination object. If `object` is a function then methods are added to * its prototype as well. * * **Note:** Use `_.runInContext` to create a pristine `lodash` function to * avoid conflicts caused by modifying the original. * * @static * @memberOf _ * @category Util * @param {Function|Object} [object=lodash] The destination object. * @param {Object} source The object of functions to add. * @param {Object} [options] The options object. * @param {boolean} [options.chain=true] Specify whether the functions added * are chainable. * @returns {Function|Object} Returns `object`. * @example * * function vowels(string) { * return _.filter(string, function(v) { * return /[aeiou]/i.test(v); * }); * } * * _.mixin({ 'vowels': vowels }); * _.vowels('fred'); * // => ['e'] * * _('fred').vowels().value(); * // => ['e'] * * _.mixin({ 'vowels': vowels }, { 'chain': false }); * _('fred').vowels(); * // => ['e'] */ function mixin(object, source, options) { var props = keys(source), methodNames = baseFunctions(source, props); if (options == null && !(isObject(source) && (methodNames.length || !props.length))) { options = source; source = object; object = this; methodNames = baseFunctions(source, keys(source)); } var chain = (isObject(options) && 'chain' in options) ? options.chain : true, isFunc = isFunction(object); arrayEach(methodNames, function(methodName) { var func = source[methodName]; object[methodName] = func; if (isFunc) { object.prototype[methodName] = function() { var chainAll = this.__chain__; if (chain || chainAll) { var result = object(this.__wrapped__), actions = result.__actions__ = copyArray(this.__actions__); actions.push({ 'func': func, 'args': arguments, 'thisArg': object }); result.__chain__ = chainAll; return result; } return func.apply(object, arrayPush([this.value()], arguments)); }; } }); return object; } /** * Reverts the `_` variable to its previous value and returns a reference to * the `lodash` function. * * @static * @memberOf _ * @category Util * @returns {Function} Returns the `lodash` function. * @example * * var lodash = _.noConflict(); */ function noConflict() { if (root._ === this) { root._ = oldDash; } return this; } /** * A no-operation function that returns `undefined` regardless of the * arguments it receives. * * @static * @memberOf _ * @category Util * @example * * var object = { 'user': 'fred' }; * * _.noop(object) === undefined; * // => true */ function noop() { // No operation performed. } /** * Creates a function that returns its nth argument. * * @static * @memberOf _ * @category Util * @param {number} [n=0] The index of the argument to return. * @returns {Function} Returns the new function. * @example * * var func = _.nthArg(1); * * func('a', 'b', 'c'); * // => 'b' */ function nthArg(n) { n = toInteger(n); return function() { return arguments[n]; }; } /** * Creates a function that invokes `iteratees` with the arguments provided * to the created function and returns their results. * * @static * @memberOf _ * @category Util * @param {...(Function|Function[])} iteratees The iteratees to invoke. * @returns {Function} Returns the new function. * @example * * var func = _.over(Math.max, Math.min); * * func(1, 2, 3, 4); * // => [4, 1] */ var over = createOver(arrayMap); /** * Creates a function that checks if **all** of the `predicates` return * truthy when invoked with the arguments provided to the created function. * * @static * @memberOf _ * @category Util * @param {...(Function|Function[])} predicates The predicates to check. * @returns {Function} Returns the new function. * @example * * var func = _.overEvery(Boolean, isFinite); * * func('1'); * // => true * * func(null); * // => false * * func(NaN); * // => false */ var overEvery = createOver(arrayEvery); /** * Creates a function that checks if **any** of the `predicates` return * truthy when invoked with the arguments provided to the created function. * * @static * @memberOf _ * @category Util * @param {...(Function|Function[])} predicates The predicates to check. * @returns {Function} Returns the new function. * @example * * var func = _.overSome(Boolean, isFinite); * * func('1'); * // => true * * func(null); * // => true * * func(NaN); * // => false */ var overSome = createOver(arraySome); /** * Creates a function that returns the value at `path` of a given object. * * @static * @memberOf _ * @category Util * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new function. * @example * * var objects = [ * { 'a': { 'b': { 'c': 2 } } }, * { 'a': { 'b': { 'c': 1 } } } * ]; * * _.map(objects, _.property('a.b.c')); * // => [2, 1] * * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); * // => [1, 2] */ function property(path) { return isKey(path) ? baseProperty(path) : basePropertyDeep(path); } /** * The opposite of `_.property`; this method creates a function that returns * the value at a given path of `object`. * * @static * @memberOf _ * @category Util * @param {Object} object The object to query. * @returns {Function} Returns the new function. * @example * * var array = [0, 1, 2], * object = { 'a': array, 'b': array, 'c': array }; * * _.map(['a[2]', 'c[0]'], _.propertyOf(object)); * // => [2, 0] * * _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); * // => [2, 0] */ function propertyOf(object) { return function(path) { return object == null ? undefined : baseGet(object, path); }; } /** * Creates an array of numbers (positive and/or negative) progressing from * `start` up to, but not including, `end`. A step of `-1` is used if a negative * `start` is specified without an `end` or `step`. If `end` is not specified * it's set to `start` with `start` then set to `0`. * * **Note:** JavaScript follows the IEEE-754 standard for resolving * floating-point values which can produce unexpected results. * * @static * @memberOf _ * @category Util * @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 the new array of numbers. * @example * * _.range(4); * // => [0, 1, 2, 3] * * _.range(-4); * // => [0, -1, -2, -3] * * _.range(1, 5); * // => [1, 2, 3, 4] * * _.range(0, 20, 5); * // => [0, 5, 10, 15] * * _.range(0, -4, -1); * // => [0, -1, -2, -3] * * _.range(1, 4, 0); * // => [1, 1, 1] * * _.range(0); * // => [] */ var range = createRange(); /** * This method is like `_.range` except that it populates values in * descending order. * * @static * @memberOf _ * @category Util * @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 the new array of numbers. * @example * * _.rangeRight(4); * // => [3, 2, 1, 0] * * _.rangeRight(-4); * // => [-3, -2, -1, 0] * * _.rangeRight(1, 5); * // => [4, 3, 2, 1] * * _.rangeRight(0, 20, 5); * // => [15, 10, 5, 0] * * _.rangeRight(0, -4, -1); * // => [-3, -2, -1, 0] * * _.rangeRight(1, 4, 0); * // => [1, 1, 1] * * _.rangeRight(0); * // => [] */ var rangeRight = createRange(true); /** * Invokes the iteratee function `n` times, returning an array of the results * of each invocation. The iteratee is invoked with one argument; (index). * * @static * @memberOf _ * @category Util * @param {number} n The number of times to invoke `iteratee`. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array} Returns the array of results. * @example * * _.times(3, String); * // => ['0', '1', '2'] * * _.times(4, _.constant(true)); * // => [true, true, true, true] */ function times(n, iteratee) { n = toInteger(n); if (n < 1 || n > MAX_SAFE_INTEGER) { return []; } var index = MAX_ARRAY_LENGTH, length = nativeMin(n, MAX_ARRAY_LENGTH); iteratee = baseCastFunction(iteratee); n -= MAX_ARRAY_LENGTH; var result = baseTimes(length, iteratee); while (++index < n) { iteratee(index); } return result; } /** * Converts `value` to a property path array. * * @static * @memberOf _ * @category Util * @param {*} value The value to convert. * @returns {Array} Returns the new property path array. * @example * * _.toPath('a.b.c'); * // => ['a', 'b', 'c'] * * _.toPath('a[0].b.c'); * // => ['a', '0', 'b', 'c'] * * var path = ['a', 'b', 'c'], * newPath = _.toPath(path); * * console.log(newPath); * // => ['a', 'b', 'c'] * * console.log(path === newPath); * // => false */ function toPath(value) { return isArray(value) ? arrayMap(value, String) : stringToPath(value); } /** * Generates a unique ID. If `prefix` is given the ID is appended to it. * * @static * @memberOf _ * @category Util * @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 toString(prefix) + id; } /*------------------------------------------------------------------------*/ /** * Adds two numbers. * * @static * @memberOf _ * @category Math * @param {number} augend The first number in an addition. * @param {number} addend The second number in an addition. * @returns {number} Returns the total. * @example * * _.add(6, 4); * // => 10 */ function add(augend, addend) { var result; if (augend === undefined && addend === undefined) { return 0; } if (augend !== undefined) { result = augend; } if (addend !== undefined) { result = result === undefined ? addend : (result + addend); } return result; } /** * Computes `number` rounded up to `precision`. * * @static * @memberOf _ * @category Math * @param {number} number The number to round up. * @param {number} [precision=0] The precision to round up to. * @returns {number} Returns the rounded up number. * @example * * _.ceil(4.006); * // => 5 * * _.ceil(6.004, 2); * // => 6.01 * * _.ceil(6040, -2); * // => 6100 */ var ceil = createRound('ceil'); /** * Computes `number` rounded down to `precision`. * * @static * @memberOf _ * @category Math * @param {number} number The number to round down. * @param {number} [precision=0] The precision to round down to. * @returns {number} Returns the rounded down number. * @example * * _.floor(4.006); * // => 4 * * _.floor(0.046, 2); * // => 0.04 * * _.floor(4060, -2); * // => 4000 */ var floor = createRound('floor'); /** * Computes the maximum value of `array`. If `array` is empty or falsey * `undefined` is returned. * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @returns {*} Returns the maximum value. * @example * * _.max([4, 2, 8, 6]); * // => 8 * * _.max([]); * // => undefined */ function max(array) { return (array && array.length) ? baseExtremum(array, identity, gt) : undefined; } /** * This method is like `_.max` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which * the value is ranked. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {*} Returns the maximum value. * @example * * var objects = [{ 'n': 1 }, { 'n': 2 }]; * * _.maxBy(objects, function(o) { return o.n; }); * // => { 'n': 2 } * * // The `_.property` iteratee shorthand. * _.maxBy(objects, 'n'); * // => { 'n': 2 } */ function maxBy(array, iteratee) { return (array && array.length) ? baseExtremum(array, getIteratee(iteratee), gt) : undefined; } /** * Computes the mean of the values in `array`. * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @returns {number} Returns the mean. * @example * * _.mean([4, 2, 8, 6]); * // => 5 */ function mean(array) { return sum(array) / (array ? array.length : 0); } /** * Computes the minimum value of `array`. If `array` is empty or falsey * `undefined` is returned. * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @returns {*} Returns the minimum value. * @example * * _.min([4, 2, 8, 6]); * // => 2 * * _.min([]); * // => undefined */ function min(array) { return (array && array.length) ? baseExtremum(array, identity, lt) : undefined; } /** * This method is like `_.min` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which * the value is ranked. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {*} Returns the minimum value. * @example * * var objects = [{ 'n': 1 }, { 'n': 2 }]; * * _.minBy(objects, function(o) { return o.n; }); * // => { 'n': 1 } * * // The `_.property` iteratee shorthand. * _.minBy(objects, 'n'); * // => { 'n': 1 } */ function minBy(array, iteratee) { return (array && array.length) ? baseExtremum(array, getIteratee(iteratee), lt) : undefined; } /** * Computes `number` rounded to `precision`. * * @static * @memberOf _ * @category Math * @param {number} number The number to round. * @param {number} [precision=0] The precision to round to. * @returns {number} Returns the rounded number. * @example * * _.round(4.006); * // => 4 * * _.round(4.006, 2); * // => 4.01 * * _.round(4060, -2); * // => 4100 */ var round = createRound('round'); /** * Subtract two numbers. * * @static * @memberOf _ * @category Math * @param {number} minuend The first number in a subtraction. * @param {number} subtrahend The second number in a subtraction. * @returns {number} Returns the difference. * @example * * _.subtract(6, 4); * // => 2 */ function subtract(minuend, subtrahend) { var result; if (minuend === undefined && subtrahend === undefined) { return 0; } if (minuend !== undefined) { result = minuend; } if (subtrahend !== undefined) { result = result === undefined ? subtrahend : (result - subtrahend); } return result; } /** * Computes the sum of the values in `array`. * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @returns {number} Returns the sum. * @example * * _.sum([4, 2, 8, 6]); * // => 20 */ function sum(array) { return (array && array.length) ? baseSum(array, identity) : 0; } /** * This method is like `_.sum` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the value to be summed. * The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {number} Returns the sum. * @example * * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; * * _.sumBy(objects, function(o) { return o.n; }); * // => 20 * * // The `_.property` iteratee shorthand. * _.sumBy(objects, 'n'); * // => 20 */ function sumBy(array, iteratee) { return (array && array.length) ? baseSum(array, getIteratee(iteratee)) : 0; } /*------------------------------------------------------------------------*/ // Ensure wrappers are instances of `baseLodash`. lodash.prototype = baseLodash.prototype; LodashWrapper.prototype = baseCreate(baseLodash.prototype); LodashWrapper.prototype.constructor = LodashWrapper; LazyWrapper.prototype = baseCreate(baseLodash.prototype); LazyWrapper.prototype.constructor = LazyWrapper; // Avoid inheriting from `Object.prototype` when possible. Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto; // Add functions to the `MapCache`. MapCache.prototype.clear = mapClear; MapCache.prototype['delete'] = mapDelete; MapCache.prototype.get = mapGet; MapCache.prototype.has = mapHas; MapCache.prototype.set = mapSet; // Add functions to the `SetCache`. SetCache.prototype.push = cachePush; // Add functions to the `Stack` cache. Stack.prototype.clear = stackClear; Stack.prototype['delete'] = stackDelete; Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; // Assign cache to `_.memoize`. memoize.Cache = MapCache; // Add functions that return wrapped values when chaining. lodash.after = after; lodash.ary = ary; lodash.assign = assign; lodash.assignIn = assignIn; lodash.assignInWith = assignInWith; lodash.assignWith = assignWith; lodash.at = at; lodash.before = before; lodash.bind = bind; lodash.bindAll = bindAll; lodash.bindKey = bindKey; lodash.castArray = castArray; lodash.chain = chain; lodash.chunk = chunk; lodash.compact = compact; lodash.concat = concat; lodash.cond = cond; lodash.conforms = conforms; lodash.constant = constant; lodash.countBy = countBy; lodash.create = create; lodash.curry = curry; lodash.curryRight = curryRight; lodash.debounce = debounce; lodash.defaults = defaults; lodash.defaultsDeep = defaultsDeep; lodash.defer = defer; lodash.delay = delay; lodash.difference = difference; lodash.differenceBy = differenceBy; lodash.differenceWith = differenceWith; lodash.drop = drop; lodash.dropRight = dropRight; lodash.dropRightWhile = dropRightWhile; lodash.dropWhile = dropWhile; lodash.fill = fill; lodash.filter = filter; lodash.flatMap = flatMap; lodash.flatten = flatten; lodash.flattenDeep = flattenDeep; lodash.flattenDepth = flattenDepth; lodash.flip = flip; lodash.flow = flow; lodash.flowRight = flowRight; lodash.fromPairs = fromPairs; lodash.functions = functions; lodash.functionsIn = functionsIn; lodash.groupBy = groupBy; lodash.initial = initial; lodash.intersection = intersection; lodash.intersectionBy = intersectionBy; lodash.intersectionWith = intersectionWith; lodash.invert = invert; lodash.invertBy = invertBy; lodash.invokeMap = invokeMap; lodash.iteratee = iteratee; lodash.keyBy = keyBy; lodash.keys = keys; lodash.keysIn = keysIn; lodash.map = map; lodash.mapKeys = mapKeys; lodash.mapValues = mapValues; lodash.matches = matches; lodash.matchesProperty = matchesProperty; lodash.memoize = memoize; lodash.merge = merge; lodash.mergeWith = mergeWith; lodash.method = method; lodash.methodOf = methodOf; lodash.mixin = mixin; lodash.negate = negate; lodash.nthArg = nthArg; lodash.omit = omit; lodash.omitBy = omitBy; lodash.once = once; lodash.orderBy = orderBy; lodash.over = over; lodash.overArgs = overArgs; lodash.overEvery = overEvery; lodash.overSome = overSome; lodash.partial = partial; lodash.partialRight = partialRight; lodash.partition = partition; lodash.pick = pick; lodash.pickBy = pickBy; lodash.property = property; lodash.propertyOf = propertyOf; lodash.pull = pull; lodash.pullAll = pullAll; lodash.pullAllBy = pullAllBy; lodash.pullAt = pullAt; lodash.range = range; lodash.rangeRight = rangeRight; lodash.rearg = rearg; lodash.reject = reject; lodash.remove = remove; lodash.rest = rest; lodash.reverse = reverse; lodash.sampleSize = sampleSize; lodash.set = set; lodash.setWith = setWith; lodash.shuffle = shuffle; lodash.slice = slice; lodash.sortBy = sortBy; lodash.sortedUniq = sortedUniq; lodash.sortedUniqBy = sortedUniqBy; lodash.split = split; lodash.spread = spread; lodash.tail = tail; lodash.take = take; lodash.takeRight = takeRight; lodash.takeRightWhile = takeRightWhile; lodash.takeWhile = takeWhile; lodash.tap = tap; lodash.throttle = throttle; lodash.thru = thru; lodash.toArray = toArray; lodash.toPairs = toPairs; lodash.toPairsIn = toPairsIn; lodash.toPath = toPath; lodash.toPlainObject = toPlainObject; lodash.transform = transform; lodash.unary = unary; lodash.union = union; lodash.unionBy = unionBy; lodash.unionWith = unionWith; lodash.uniq = uniq; lodash.uniqBy = uniqBy; lodash.uniqWith = uniqWith; lodash.unset = unset; lodash.unzip = unzip; lodash.unzipWith = unzipWith; lodash.values = values; lodash.valuesIn = valuesIn; lodash.without = without; lodash.words = words; lodash.wrap = wrap; lodash.xor = xor; lodash.xorBy = xorBy; lodash.xorWith = xorWith; lodash.zip = zip; lodash.zipObject = zipObject; lodash.zipObjectDeep = zipObjectDeep; lodash.zipWith = zipWith; // Add aliases. lodash.extend = assignIn; lodash.extendWith = assignInWith; // Add functions to `lodash.prototype`. mixin(lodash, lodash); /*------------------------------------------------------------------------*/ // Add functions that return unwrapped values when chaining. lodash.add = add; lodash.attempt = attempt; lodash.camelCase = camelCase; lodash.capitalize = capitalize; lodash.ceil = ceil; lodash.clamp = clamp; lodash.clone = clone; lodash.cloneDeep = cloneDeep; lodash.cloneDeepWith = cloneDeepWith; lodash.cloneWith = cloneWith; lodash.deburr = deburr; lodash.endsWith = endsWith; lodash.eq = eq; lodash.escape = escape; lodash.escapeRegExp = escapeRegExp; lodash.every = every; lodash.find = find; lodash.findIndex = findIndex; lodash.findKey = findKey; lodash.findLast = findLast; lodash.findLastIndex = findLastIndex; lodash.findLastKey = findLastKey; lodash.floor = floor; lodash.forEach = forEach; lodash.forEachRight = forEachRight; lodash.forIn = forIn; lodash.forInRight = forInRight; lodash.forOwn = forOwn; lodash.forOwnRight = forOwnRight; lodash.get = get; lodash.gt = gt; lodash.gte = gte; lodash.has = has; lodash.hasIn = hasIn; lodash.head = head; lodash.identity = identity; lodash.includes = includes; lodash.indexOf = indexOf; lodash.inRange = inRange; lodash.invoke = invoke; lodash.isArguments = isArguments; lodash.isArray = isArray; lodash.isArrayBuffer = isArrayBuffer; lodash.isArrayLike = isArrayLike; lodash.isArrayLikeObject = isArrayLikeObject; lodash.isBoolean = isBoolean; lodash.isBuffer = isBuffer; lodash.isDate = isDate; lodash.isElement = isElement; lodash.isEmpty = isEmpty; lodash.isEqual = isEqual; lodash.isEqualWith = isEqualWith; lodash.isError = isError; lodash.isFinite = isFinite; lodash.isFunction = isFunction; lodash.isInteger = isInteger; lodash.isLength = isLength; lodash.isMap = isMap; lodash.isMatch = isMatch; lodash.isMatchWith = isMatchWith; lodash.isNaN = isNaN; lodash.isNative = isNative; lodash.isNil = isNil; lodash.isNull = isNull; lodash.isNumber = isNumber; lodash.isObject = isObject; lodash.isObjectLike = isObjectLike; lodash.isPlainObject = isPlainObject; lodash.isRegExp = isRegExp; lodash.isSafeInteger = isSafeInteger; lodash.isSet = isSet; lodash.isString = isString; lodash.isSymbol = isSymbol; lodash.isTypedArray = isTypedArray; lodash.isUndefined = isUndefined; lodash.isWeakMap = isWeakMap; lodash.isWeakSet = isWeakSet; lodash.join = join; lodash.kebabCase = kebabCase; lodash.last = last; lodash.lastIndexOf = lastIndexOf; lodash.lowerCase = lowerCase; lodash.lowerFirst = lowerFirst; lodash.lt = lt; lodash.lte = lte; lodash.max = max; lodash.maxBy = maxBy; lodash.mean = mean; lodash.min = min; lodash.minBy = minBy; lodash.noConflict = noConflict; lodash.noop = noop; lodash.now = now; lodash.pad = pad; lodash.padEnd = padEnd; lodash.padStart = padStart; lodash.parseInt = parseInt; lodash.random = random; lodash.reduce = reduce; lodash.reduceRight = reduceRight; lodash.repeat = repeat; lodash.replace = replace; lodash.result = result; lodash.round = round; lodash.runInContext = runInContext; lodash.sample = sample; lodash.size = size; lodash.snakeCase = snakeCase; lodash.some = some; lodash.sortedIndex = sortedIndex; lodash.sortedIndexBy = sortedIndexBy; lodash.sortedIndexOf = sortedIndexOf; lodash.sortedLastIndex = sortedLastIndex; lodash.sortedLastIndexBy = sortedLastIndexBy; lodash.sortedLastIndexOf = sortedLastIndexOf; lodash.startCase = startCase; lodash.startsWith = startsWith; lodash.subtract = subtract; lodash.sum = sum; lodash.sumBy = sumBy; lodash.template = template; lodash.times = times; lodash.toInteger = toInteger; lodash.toLength = toLength; lodash.toLower = toLower; lodash.toNumber = toNumber; lodash.toSafeInteger = toSafeInteger; lodash.toString = toString; lodash.toUpper = toUpper; lodash.trim = trim; lodash.trimEnd = trimEnd; lodash.trimStart = trimStart; lodash.truncate = truncate; lodash.unescape = unescape; lodash.uniqueId = uniqueId; lodash.upperCase = upperCase; lodash.upperFirst = upperFirst; // Add aliases. lodash.each = forEach; lodash.eachRight = forEachRight; lodash.first = head; mixin(lodash, (function() { var source = {}; baseForOwn(lodash, function(func, methodName) { if (!hasOwnProperty.call(lodash.prototype, methodName)) { source[methodName] = func; } }); return source; }()), { 'chain': false }); /*------------------------------------------------------------------------*/ /** * The semantic version number. * * @static * @memberOf _ * @type {string} */ lodash.VERSION = VERSION; // Assign default placeholders. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) { lodash[methodName].placeholder = lodash; }); // Add `LazyWrapper` methods for `_.drop` and `_.take` variants. arrayEach(['drop', 'take'], function(methodName, index) { LazyWrapper.prototype[methodName] = function(n) { var filtered = this.__filtered__; if (filtered && !index) { return new LazyWrapper(this); } n = n === undefined ? 1 : nativeMax(toInteger(n), 0); var result = this.clone(); if (filtered) { result.__takeCount__ = nativeMin(n, result.__takeCount__); } else { result.__views__.push({ 'size': nativeMin(n, MAX_ARRAY_LENGTH), 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') }); } return result; }; LazyWrapper.prototype[methodName + 'Right'] = function(n) { return this.reverse()[methodName](n).reverse(); }; }); // Add `LazyWrapper` methods that accept an `iteratee` value. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) { var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; LazyWrapper.prototype[methodName] = function(iteratee) { var result = this.clone(); result.__iteratees__.push({ 'iteratee': getIteratee(iteratee, 3), 'type': type }); result.__filtered__ = result.__filtered__ || isFilter; return result; }; }); // Add `LazyWrapper` methods for `_.head` and `_.last`. arrayEach(['head', 'last'], function(methodName, index) { var takeName = 'take' + (index ? 'Right' : ''); LazyWrapper.prototype[methodName] = function() { return this[takeName](1).value()[0]; }; }); // Add `LazyWrapper` methods for `_.initial` and `_.tail`. arrayEach(['initial', 'tail'], function(methodName, index) { var dropName = 'drop' + (index ? '' : 'Right'); LazyWrapper.prototype[methodName] = function() { return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); }; }); LazyWrapper.prototype.compact = function() { return this.filter(identity); }; LazyWrapper.prototype.find = function(predicate) { return this.filter(predicate).head(); }; LazyWrapper.prototype.findLast = function(predicate) { return this.reverse().find(predicate); }; LazyWrapper.prototype.invokeMap = rest(function(path, args) { if (typeof path == 'function') { return new LazyWrapper(this); } return this.map(function(value) { return baseInvoke(value, path, args); }); }); LazyWrapper.prototype.reject = function(predicate) { predicate = getIteratee(predicate, 3); return this.filter(function(value) { return !predicate(value); }); }; LazyWrapper.prototype.slice = function(start, end) { start = toInteger(start); var result = this; if (result.__filtered__ && (start > 0 || end < 0)) { return new LazyWrapper(result); } if (start < 0) { result = result.takeRight(-start); } else if (start) { result = result.drop(start); } if (end !== undefined) { end = toInteger(end); result = end < 0 ? result.dropRight(-end) : result.take(end - start); } return result; }; LazyWrapper.prototype.takeRightWhile = function(predicate) { return this.reverse().takeWhile(predicate).reverse(); }; LazyWrapper.prototype.toArray = function() { return this.take(MAX_ARRAY_LENGTH); }; // Add `LazyWrapper` methods to `lodash.prototype`. baseForOwn(LazyWrapper.prototype, function(func, methodName) { var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName], retUnwrapped = isTaker || /^find/.test(methodName); if (!lodashFunc) { return; } lodash.prototype[methodName] = function() { var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee = args[0], useLazy = isLazy || isArray(value); var interceptor = function(value) { var result = lodashFunc.apply(lodash, arrayPush([value], args)); return (isTaker && chainAll) ? result[0] : result; }; if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) { // Avoid lazy use if the iteratee has a "length" value other than `1`. isLazy = useLazy = false; } var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid; if (!retUnwrapped && useLazy) { value = onlyLazy ? value : new LazyWrapper(this); var result = func.apply(value, args); result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); return new LodashWrapper(result, chainAll); } if (isUnwrapped && onlyLazy) { return func.apply(this, args); } result = this.thru(interceptor); return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result; }; }); // Add `Array` and `String` methods to `lodash.prototype`. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', retUnwrapped = /^(?:pop|shift)$/.test(methodName); lodash.prototype[methodName] = function() { var args = arguments; if (retUnwrapped && !this.__chain__) { return func.apply(this.value(), args); } return this[chainName](function(value) { return func.apply(value, args); }); }; }); // Map minified function names to their real names. baseForOwn(LazyWrapper.prototype, function(func, methodName) { var lodashFunc = lodash[methodName]; if (lodashFunc) { var key = (lodashFunc.name + ''), names = realNames[key] || (realNames[key] = []); names.push({ 'name': methodName, 'func': lodashFunc }); } }); realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{ 'name': 'wrapper', 'func': undefined }]; // Add functions to the lazy wrapper. LazyWrapper.prototype.clone = lazyClone; LazyWrapper.prototype.reverse = lazyReverse; LazyWrapper.prototype.value = lazyValue; // Add chaining functions to the `lodash` wrapper. lodash.prototype.at = wrapperAt; lodash.prototype.chain = wrapperChain; lodash.prototype.commit = wrapperCommit; lodash.prototype.flatMap = wrapperFlatMap; lodash.prototype.next = wrapperNext; lodash.prototype.plant = wrapperPlant; lodash.prototype.reverse = wrapperReverse; lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; if (iteratorSymbol) { lodash.prototype[iteratorSymbol] = wrapperToIterator; } return lodash; } /*--------------------------------------------------------------------------*/ // Export lodash. var _ = runInContext(); // Expose lodash on the free variable `window` or `self` when available. This // prevents errors in cases where lodash is loaded by a script tag in the presence // of an AMD loader. See http://requirejs.org/docs/errors.html#mismatch for more details. (freeWindow || freeSelf || {})._ = _; // Some AMD build optimizers like r.js check for condition patterns like the following: if (true) { // Define as an anonymous module so, through path mapping, it can be // referenced as the "underscore" module. !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { return _; }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } // Check for `exports` after `define` in case a build optimizer adds an `exports` object. else if (freeExports && freeModule) { // Export for Node.js. if (moduleExports) { (freeModule.exports = _)._ = _; } // Export for CommonJS support. freeExports._ = _; } else { // Export to the global object. root._ = _; } }.call(this)); /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)(module), (function() { return this; }()))) /***/ }, /* 3 */ /***/ function(module, exports) { module.exports = function(module) { if(!module.webpackPolyfill) { module.deprecate = function() {}; module.paths = []; // module.parent = undefined by default module.children = []; module.webpackPolyfill = 1; } return module; } /***/ }, /* 4 */ /***/ function(module, exports) { module.exports = isPromise; function isPromise(obj) { return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function'; } /***/ }, /* 5 */ /***/ function(module, exports) { 'use strict'; /* global localStorage */ module.exports = { read: function read(source) { var deserialize = arguments.length <= 1 || arguments[1] === undefined ? JSON.parse : arguments[1]; var data = localStorage.getItem(source); if (data) { return deserialize(data); } else { localStorage.setItem(source, '{}'); return {}; } }, write: function write(dest, obj) { var serialize = arguments.length <= 2 || arguments[2] === undefined ? JSON.stringify : arguments[2]; return localStorage.setItem(dest, serialize(obj)); } }; /***/ } /******/ ]) }); ;
/* Office JavaScript API library */ /* Version: 16.0.3825.1000 */ /* Copyright (c) Microsoft Corporation. All rights reserved. */ /* Your use of this file is governed by the Microsoft Services Agreement http://go.microsoft.com/fwlink/?LinkId=266419. */ var OSF = OSF || {}; OSF.HostSpecificFileVersion = "16.00"; OSF.SupportedLocales = { "ar-sa": true, "bg-bg": true, "ca-es": true, "cs-cz": true, "da-dk": true, "de-de": true, "el-gr": true, "en-us": true, "es-es": true, "et-ee": true, "eu-es": true, "fi-fi": true, "fr-fr": true, "gl-es": true, "he-il": true, "hi-in": true, "hr-hr": true, "hu-hu": true, "id-id": true, "it-it": true, "ja-jp": true, "kk-kz": true, "ko-kr": true, "lt-lt": true, "lv-lv": true, "ms-my": true, "nb-no": true, "nl-nl": true, "pl-pl": true, "pt-br": true, "pt-pt": true, "ro-ro": true, "ru-ru": true, "sk-sk": true, "sl-si": true, "sr-cyrl-cs": true, "sr-cyrl-rs": true, "sr-latn-cs": true, "sr-latn-rs": true, "sv-se": true, "th-th": true, "tr-tr": true, "uk-ua": true, "vi-vn": true, "zh-cn": true, "zh-tw": true }; OSF.AssociatedLocales = { ar: "ar-sa", bg: "bg-bg", ca: "ca-es", cs: "cs-cz", da: "da-dk", de: "de-de", el: "el-gr", en: "en-us", es: "es-es", et: "et-ee", eu: "eu-es", fi: "fi-fi", fr: "fr-fr", gl: "gl-es", he: "he-il", hi: "hi-in", hr: "hr-hr", hu: "hu-hu", id: "id-id", it: "it-it", ja: "ja-jp", kk: "kk-kz", ko: "ko-kr", lt: "lt-lt", lv: "lv-lv", ms: "ms-my", nb: "nb-no", nl: "nl-nl", pl: "pl-pl", pt: "pt-br", ro: "ro-ro", ru: "ru-ru", sk: "sk-sk", sl: "sl-si", sr: "sr-cyrl-cs", sv: "sv-se", th: "th-th", tr: "tr-tr", uk: "uk-ua", vi: "vi-vn", zh: "zh-cn" }; OSF.ConstantNames = { HostSpecificFallbackVersion: OSF.HostSpecificFileVersion, OfficeJS: "office.js", OfficeDebugJS: "office.debug.js", DefaultLocale: "en-us", LocaleStringLoadingTimeout: 2000, OfficeStringJS: "office_strings.debug.js", O15InitHelper: "o15apptofilemappingtable.debug.js", SupportedLocales: OSF.SupportedLocales, AssociatedLocales: OSF.AssociatedLocales }; OSF.InitializationHelper = function OSF_InitializationHelper(hostInfo, webAppState, context, settings, hostFacade) { this._hostInfo = hostInfo; this._webAppState = webAppState; this._context = context; this._settings = settings; this._hostFacade = hostFacade; }; OSF.InitializationHelper.prototype.getAppContext = function OSF_InitializationHelper$getAppContext(wnd, gotAppContext) { }; OSF.InitializationHelper.prototype.setAgaveHostCommunication = function OSF_InitializationHelper$setAgaveHostCommunication() { }; OSF.InitializationHelper.prototype.prepareRightBeforeWebExtensionInitialize = function OSF_InitializationHelper$prepareRightBeforeWebExtensionInitialize(appContext) { }; OSF.InitializationHelper.prototype.loadAppSpecificScriptAndCreateOM = function OSF_InitializationHelper$loadAppSpecificScriptAndCreateOM(appContext, appReady, basePath) { }; OSF._OfficeAppFactory = (function OSF__OfficeAppFactory() { var _setNamespace = function OSF_OUtil$_setNamespace(name, parent) { if (parent && name && !parent[name]) { parent[name] = {}; } }; _setNamespace("Office", window); _setNamespace("Microsoft", window); _setNamespace("Office", Microsoft); _setNamespace("WebExtension", Microsoft.Office); window.Office = Microsoft.Office.WebExtension; var _context = {}; var _settings = {}; var _hostFacade = {}; var _WebAppState = { id: null, webAppUrl: null, conversationID: null, clientEndPoint: null, wnd: window.parent, focused: false }; var _hostInfo = { isO15: true, isRichClient: true, hostType: "", hostPlatform: "", hostSpecificFileVersion: "" }; var _initializationHelper = {}; var _appInstanceId = null; var _windowLocationHash = window.location.hash; var _parseHostInfo = function OSF__OfficeAppFactory$_parseHostInfo() { var hostInfoValue; var hostInfo = "_host_Info="; var searchString = window.location.search; if (searchString) { var hostInfoParts = searchString.split(hostInfo); if (hostInfoParts.length > 1) { var hostInfoValueRestString = hostInfoParts[1]; var separatorRegex = new RegExp("/[&#]/g"); var hostInfoValueParts = hostInfoValueRestString.split(separatorRegex); if (hostInfoValueParts.length > 0) { hostInfoValue = hostInfoValueParts[0]; } } } return hostInfoValue; }; var _loadScript = function OSF_OUtil$_loadScript(url, callback, timeoutInMs) { var loadedScripts = {}; var defaultScriptLoadingTimeout = 30000; if (url && callback) { var doc = window.document; var loadedScriptEntry = loadedScripts[url]; if (!loadedScriptEntry) { var script = doc.createElement("script"); script.type = "text/javascript"; loadedScriptEntry = { loaded: false, pendingCallbacks: [callback], timer: null }; loadedScripts[url] = loadedScriptEntry; var onLoadCallback = function OSF_OUtil_loadScript$onLoadCallback() { if (loadedScriptEntry.timer != null) { clearTimeout(loadedScriptEntry.timer); delete loadedScriptEntry.timer; } loadedScriptEntry.loaded = true; var pendingCallbackCount = loadedScriptEntry.pendingCallbacks.length; for (var i = 0; i < pendingCallbackCount; i++) { var currentCallback = loadedScriptEntry.pendingCallbacks.shift(); currentCallback(); } }; var onLoadError = function OSF_OUtil_loadScript$onLoadError() { delete loadedScripts[url]; if (loadedScriptEntry.timer != null) { clearTimeout(loadedScriptEntry.timer); delete loadedScriptEntry.timer; } var pendingCallbackCount = loadedScriptEntry.pendingCallbacks.length; for (var i = 0; i < pendingCallbackCount; i++) { var currentCallback = loadedScriptEntry.pendingCallbacks.shift(); currentCallback(); } }; if (script.readyState) { script.onreadystatechange = function () { if (script.readyState == "loaded" || script.readyState == "complete") { script.onreadystatechange = null; onLoadCallback(); } }; } else { script.onload = onLoadCallback; } script.onerror = onLoadError; timeoutInMs = timeoutInMs || defaultScriptLoadingTimeout; loadedScriptEntry.timer = setTimeout(onLoadError, timeoutInMs); script.src = url; doc.getElementsByTagName("head")[0].appendChild(script); } else if (loadedScriptEntry.loaded) { callback(); } else { loadedScriptEntry.pendingCallbacks.push(callback); } } }; var _retrieveHostInfo = function OSF__OfficeAppFactory$_retrieveHostInfo() { var hostInfoValue = _parseHostInfo(); var getSessionStorage = function OSF__OfficeAppFactory$_retrieveHostInfo$getSessionStorage() { var osfSessionStorage = null; try { if (window.sessionStorage) { osfSessionStorage = window.sessionStorage; } } catch (ex) { } return osfSessionStorage; }; var osfSessionStorage = getSessionStorage(); if (!hostInfoValue && osfSessionStorage && osfSessionStorage.getItem("hostInfoValue")) { hostInfoValue = osfSessionStorage.getItem("hostInfoValue"); } if (hostInfoValue) { _hostInfo.isO15 = false; var items = hostInfoValue.split("$"); if (typeof items[2] == "undefined") { items = hostInfoValue.split("|"); } _hostInfo.hostType = items[0]; _hostInfo.hostPlatform = items[1]; _hostInfo.hostSpecificFileVersion = items[2]; var hostSpecificFileVersionValue = parseFloat(_hostInfo.hostSpecificFileVersion); if (hostSpecificFileVersionValue > OSF.ConstantNames.HostSpecificFallbackVersion) { _hostInfo.hostSpecificFileVersion = OSF.ConstantNames.HostSpecificFallbackVersion.toString(); } if (osfSessionStorage) { try { osfSessionStorage.setItem("hostInfoValue", hostInfoValue); } catch (e) { } } } else { _hostInfo.isO15 = true; } }; var getAppContextAsync = function OSF__OfficeAppFactory$getAppContextAsync(wnd, gotAppContext) { _initializationHelper.getAppContext(wnd, gotAppContext); }; var initialize = function OSF__OfficeAppFactory$initialize() { _retrieveHostInfo(); var getScriptBase = function OSF__OfficeAppFactory_initialize$getScriptBase(scriptSrc, scriptNameToCheck) { var scriptBase, indexOfJS, scriptSrcLowerCase; scriptSrcLowerCase = scriptSrc.toLowerCase(); indexOfJS = scriptSrcLowerCase.indexOf(scriptNameToCheck); if (indexOfJS >= 0 && indexOfJS === (scriptSrc.length - scriptNameToCheck.length) && (indexOfJS === 0 || scriptSrc.charAt(indexOfJS - 1) === '/' || scriptSrc.charAt(indexOfJS - 1) === '\\')) { scriptBase = scriptSrc.substring(0, indexOfJS); } return scriptBase; }; var scripts = document.getElementsByTagName("script"); var scriptsCount = scripts.length; var officeScripts = [OSF.ConstantNames.OfficeJS, OSF.ConstantNames.OfficeDebugJS]; var officeScriptsCount = officeScripts.length; var i, j, basePath; for (i = 0; !basePath && i < scriptsCount; i++) { if (scripts[i].src) { for (j = 0; !basePath && j < officeScriptsCount; j++) { basePath = getScriptBase(scripts[i].src, officeScripts[j]); } } } if (!basePath) throw "Office Web Extension script library file name should be " + OSF.ConstantNames.OfficeJS + " or " + OSF.ConstantNames.OfficeDebugJS + "."; var numberOfTimeForMsAjaxTries = 500; var timerId; var loadLocaleStringsAndAppSpecificCode = function OSF__OfficeAppFactory_initialize$loadLocaleStringsAndAppSpecificCode() { if (typeof (Sys) !== 'undefined' && typeof (Type) !== 'undefined' && Sys.StringBuilder && typeof (Sys.StringBuilder) === "function" && Type.registerNamespace && typeof (Type.registerNamespace) === "function" && Type.registerClass && typeof (Type.registerClass) === "function") { _initializationHelper = new OSF.InitializationHelper(_hostInfo, _WebAppState, _context, _settings, _hostFacade); _initializationHelper.setAgaveHostCommunication(); getAppContextAsync(_WebAppState.wnd, function (appContext) { _appInstanceId = appContext._appInstanceId; var postLoadLocaleStringInitialization = function OSF__OfficeAppFactory_initialize$postLoadLocaleStringInitialization() { var retryNumber = 100; var t; function appReady() { if (Microsoft.Office.WebExtension.initialize != undefined) { _initializationHelper.prepareRightBeforeWebExtensionInitialize(appContext); if (t != undefined) window.clearTimeout(t); } else if (retryNumber == 0) { clearTimeout(t); throw "Office.js has not been fully loaded yet. Please try again later or make sure to add your initialization code on the Office.initialize function."; } else { retryNumber--; t = window.setTimeout(appReady, 100); } } ; _initializationHelper.loadAppSpecificScriptAndCreateOM(appContext, appReady, basePath); }; var getSupportedLocale = function OSF__OfficeAppFactory_initialize$getSupportedLocale(locale) { if (!locale) { return OSF.ConstantNames.DefaultLocale; } var supportedLocale; locale = locale.toLowerCase(); if (locale in OSF.ConstantNames.SupportedLocales) { supportedLocale = locale; } else { var localeParts = locale.split('-', 1); if (localeParts && localeParts.length > 0) { supportedLocale = OSF.ConstantNames.AssociatedLocales[localeParts[0]]; } } if (!supportedLocale) { supportedLocale = OSF.ConstantNames.DefaultLocale; } return supportedLocale; }; var fallbackLocaleTried = false; var loadLocaleStringCallback = function OSF__OfficeAppFactory_initialize$loadLocaleStringCallback() { if (typeof Strings == 'undefined' || typeof Strings.OfficeOM == 'undefined') { if (!fallbackLocaleTried) { fallbackLocaleTried = true; var fallbackLocaleStringFile = basePath + OSF.ConstantNames.DefaultLocale + "/" + OSF.ConstantNames.OfficeStringJS; _loadScript(fallbackLocaleStringFile, loadLocaleStringCallback); } else { throw "Neither the locale, " + appContext.get_appUILocale().toLowerCase() + ", provided by the host app nor the fallback locale " + OSF.ConstantNames.DefaultLocale + " are supported."; } } else { fallbackLocaleTried = false; postLoadLocaleStringInitialization(); } }; var localeStringFile = OSF.OUtil.formatString("{0}{1}/{2}", basePath, getSupportedLocale(appContext.get_appUILocale()), OSF.ConstantNames.OfficeStringJS); _loadScript(localeStringFile, loadLocaleStringCallback, OSF.ConstantNames.LocaleStringLoadingTimeout); }); } else if (numberOfTimeForMsAjaxTries === 0) { clearTimeout(timerId); throw "MicrosoftAjax.js is not loaded successfully."; } else { numberOfTimeForMsAjaxTries--; timerId = window.setTimeout(loadLocaleStringsAndAppSpecificCode, 100); } }; if (_hostInfo.isO15) { _loadScript(basePath + OSF.ConstantNames.O15InitHelper, loadLocaleStringsAndAppSpecificCode); } else { var hostSpecificFileName; hostSpecificFileName = _hostInfo.hostType + "-" + _hostInfo.hostPlatform + "-" + _hostInfo.hostSpecificFileVersion + ".debug.js"; _loadScript(basePath + hostSpecificFileName.toLowerCase(), loadLocaleStringsAndAppSpecificCode); } window.confirm = function OSF__OfficeAppFactory_initialize$confirm(message) { throw 'Function window.confirm is not supported.'; return false; }; window.alert = function OSF__OfficeAppFactory_initialize$alert(message) { throw 'Function window.alert is not supported.'; }; window.prompt = function OSF__OfficeAppFactory_initialize$prompt(message, defaultvalue) { throw 'Function window.prompt is not supported.'; return null; }; window.history.replaceState = null; window.history.pushState = null; }; initialize(); return { getId: function OSF__OfficeAppFactory$getId() { return _WebAppState.id; }, getClientEndPoint: function OSF__OfficeAppFactory$getClientEndPoint() { return _WebAppState.clientEndPoint; }, getContext: function OSF__OfficeAppFactory$getContext() { return _context; }, setContext: function OSF__OfficeAppFactory$setContext(context) { _context = context; }, getHostFacade: function OSF__OfficeAppFactory$getHostFacade() { return _hostFacade; }, setHostFacade: function setHostFacade(hostFacade) { _hostFacade = hostFacade; }, getInitializationHelper: function OSF__OfficeAppFactory$getInitializationHelper() { return _initializationHelper; }, getCachedSessionSettingsKey: function OSF__OfficeAppFactory$getCachedSessionSettingsKey() { return (_WebAppState.conversationID != null ? _WebAppState.conversationID : _appInstanceId) + "CachedSessionSettings"; }, getWebAppState: function OSF__OfficeAppFactory$getWebAppState() { return _WebAppState; }, getWindowLocationHash: function OSF__OfficeAppFactory$getHash() { return _windowLocationHash; } }; })();
/** * Way data is stored for this database * For a Node.js/Node Webkit database it's the file system * For a browser-side database it's localforage which chooses the best option depending on user browser (IndexedDB then WebSQL then localStorage) * * This version is the Node.js/Node Webkit version * It's essentially fs, mkdirp and crash safe write and read functions */ var fs = require('fs') , mkdirp = require('mkdirp') , async = require('async') , path = require('path') , storage = {} ; storage.exists = fs.exists; storage.rename = fs.rename; storage.writeFile = fs.writeFile; storage.unlink = fs.unlink; storage.appendFile = fs.appendFile; storage.readFile = fs.readFile; storage.mkdirp = mkdirp; /** * Explicit name ... */ storage.ensureFileDoesntExist = function (file, callback) { storage.exists(file, function (exists) { if (!exists) { return callback(null); } storage.unlink(file, function (err) { return callback(err); }); }); }; /** * Flush data in OS buffer to storage if corresponding option is set * @param {String} options.filename * @param {Boolean} options.isDir Optional, defaults to false * If options is a string, it is assumed that the flush of the file (not dir) called options was requested */ storage.flushToStorage = function (options, callback) { var filename, flags; if (typeof options === 'string') { filename = options; flags = 'r+'; } else { filename = options.filename; flags = options.isDir ? 'r' : 'r+'; } // Windows can't fsync (FlushFileBuffers) directories. We can live with this as it cannot cause 100% dataloss // except in the very rare event of the first time database is loaded and a crash happens if (flags === 'r' && (process.platform === 'win32' || process.platform === 'win64')) { return callback(null); } fs.open(filename, flags, function (err, fd) { if (err) { return callback(err); } fs.fsync(fd, function (errFS) { fs.close(fd, function (errC) { if (errFS || errC) { var e = new Error('Failed to flush to storage'); e.errorOnFsync = errFS; e.errorOnClose = errC; return callback(e); } else { return callback(null); } }); }); }); }; /** * Fully write or rewrite the datafile, immune to crashes during the write operation (data will not be lost) * @param {String} filename * @param {String} data * @param {Function} cb Optional callback, signature: err */ storage.crashSafeWriteFile = function (filename, data, cb) { var callback = cb || function () {} , tempFilename = filename + '~'; async.waterfall([ async.apply(storage.flushToStorage, { filename: path.dirname(filename), isDir: true }) , function (cb) { storage.exists(filename, function (exists) { if (exists) { storage.flushToStorage(filename, function (err) { return cb(err); }); } else { return cb(); } }); } , function (cb) { storage.writeFile(tempFilename, data, function (err) { return cb(err); }); } , async.apply(storage.flushToStorage, tempFilename) , function (cb) { storage.rename(tempFilename, filename, function (err) { return cb(err); }); } , async.apply(storage.flushToStorage, { filename: path.dirname(filename), isDir: true }) ], function (err) { return callback(err); }) }; /** * Ensure the datafile contains all the data, even if there was a crash during a full file write * @param {String} filename * @param {Function} callback signature: err */ storage.ensureDatafileIntegrity = function (filename, callback) { var tempFilename = filename + '~'; storage.exists(filename, function (filenameExists) { // Write was successful if (filenameExists) { return callback(null); } storage.exists(tempFilename, function (oldFilenameExists) { // New database if (!oldFilenameExists) { return storage.writeFile(filename, '', 'utf8', function (err) { callback(err); }); } // Write failed, use old version storage.rename(tempFilename, filename, function (err) { return callback(err); }); }); }); }; // Interface module.exports = storage;
/** * ag-grid - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v5.0.3 * @link http://www.ag-grid.com/ * @license MIT */ var utils_1 = require('../utils'); var TabbedLayout = (function () { function TabbedLayout(params) { var _this = this; this.items = []; this.params = params; this.eGui = document.createElement('div'); this.eGui.innerHTML = TabbedLayout.TEMPLATE; this.eHeader = this.eGui.querySelector('#tabHeader'); this.eBody = this.eGui.querySelector('#tabBody'); utils_1.Utils.addCssClass(this.eGui, params.cssClass); if (params.items) { params.items.forEach(function (item) { return _this.addItem(item); }); } } TabbedLayout.prototype.setAfterAttachedParams = function (params) { this.afterAttachedParams = params; }; TabbedLayout.prototype.getMinWidth = function () { var eDummyContainer = document.createElement('span'); // position fixed, so it isn't restricted to the boundaries of the parent eDummyContainer.style.position = 'fixed'; // we put the dummy into the body container, so it will inherit all the // css styles that the real cells are inheriting this.eGui.appendChild(eDummyContainer); var minWidth = 0; this.items.forEach(function (itemWrapper) { utils_1.Utils.removeAllChildren(eDummyContainer); var eClone = itemWrapper.tabbedItem.body.cloneNode(true); eDummyContainer.appendChild(eClone); if (minWidth < eDummyContainer.offsetWidth) { minWidth = eDummyContainer.offsetWidth; } }); this.eGui.removeChild(eDummyContainer); return minWidth; }; TabbedLayout.prototype.showFirstItem = function () { if (this.items.length > 0) { this.showItemWrapper(this.items[0]); } }; TabbedLayout.prototype.addItem = function (item) { var eHeaderButton = document.createElement('span'); eHeaderButton.appendChild(item.title); utils_1.Utils.addCssClass(eHeaderButton, 'ag-tab'); this.eHeader.appendChild(eHeaderButton); var wrapper = { tabbedItem: item, eHeaderButton: eHeaderButton }; this.items.push(wrapper); eHeaderButton.addEventListener('click', this.showItemWrapper.bind(this, wrapper)); }; TabbedLayout.prototype.showItem = function (tabbedItem) { var itemWrapper = utils_1.Utils.find(this.items, function (itemWrapper) { return itemWrapper.tabbedItem === tabbedItem; }); if (itemWrapper) { this.showItemWrapper(itemWrapper); } }; TabbedLayout.prototype.showItemWrapper = function (wrapper) { if (this.params.onItemClicked) { this.params.onItemClicked({ item: wrapper.tabbedItem }); } if (this.activeItem === wrapper) { utils_1.Utils.callIfPresent(this.params.onActiveItemClicked); return; } utils_1.Utils.removeAllChildren(this.eBody); this.eBody.appendChild(wrapper.tabbedItem.body); if (this.activeItem) { utils_1.Utils.removeCssClass(this.activeItem.eHeaderButton, 'ag-tab-selected'); } utils_1.Utils.addCssClass(wrapper.eHeaderButton, 'ag-tab-selected'); this.activeItem = wrapper; if (wrapper.tabbedItem.afterAttachedCallback) { wrapper.tabbedItem.afterAttachedCallback(this.afterAttachedParams); } }; TabbedLayout.prototype.getGui = function () { return this.eGui; }; TabbedLayout.TEMPLATE = '<div>' + '<div id="tabHeader" class="ag-tab-header"></div>' + '<div id="tabBody" class="ag-tab-body"></div>' + '</div>'; return TabbedLayout; })(); exports.TabbedLayout = TabbedLayout;
"no use strict"; !(function(window) { if (typeof window.window != "undefined" && window.document) return; if (window.require && window.define) return; if (!window.console) { window.console = function() { var msgs = Array.prototype.slice.call(arguments, 0); postMessage({type: "log", data: msgs}); }; window.console.error = window.console.warn = window.console.log = window.console.trace = window.console; } window.window = window; window.ace = window; window.onerror = function(message, file, line, col, err) { postMessage({type: "error", data: { message: message, data: err.data, file: file, line: line, col: col, stack: err.stack }}); }; window.normalizeModule = function(parentId, moduleName) { // normalize plugin requires if (moduleName.indexOf("!") !== -1) { var chunks = moduleName.split("!"); return window.normalizeModule(parentId, chunks[0]) + "!" + window.normalizeModule(parentId, chunks[1]); } // normalize relative requires if (moduleName.charAt(0) == ".") { var base = parentId.split("/").slice(0, -1).join("/"); moduleName = (base ? base + "/" : "") + moduleName; while (moduleName.indexOf(".") !== -1 && previous != moduleName) { var previous = moduleName; moduleName = moduleName.replace(/^\.\//, "").replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, ""); } } return moduleName; }; window.require = function require(parentId, id) { if (!id) { id = parentId; parentId = null; } if (!id.charAt) throw new Error("worker.js require() accepts only (parentId, id) as arguments"); id = window.normalizeModule(parentId, id); var module = window.require.modules[id]; if (module) { if (!module.initialized) { module.initialized = true; module.exports = module.factory().exports; } return module.exports; } if (!window.require.tlns) return console.log("unable to load " + id); var path = resolveModuleId(id, window.require.tlns); if (path.slice(-3) != ".js") path += ".js"; window.require.id = id; window.require.modules[id] = {}; // prevent infinite loop on broken modules importScripts(path); return window.require(parentId, id); }; function resolveModuleId(id, paths) { var testPath = id, tail = ""; while (testPath) { var alias = paths[testPath]; if (typeof alias == "string") { return alias + tail; } else if (alias) { return alias.location.replace(/\/*$/, "/") + (tail || alias.main || alias.name); } else if (alias === false) { return ""; } var i = testPath.lastIndexOf("/"); if (i === -1) break; tail = testPath.substr(i) + tail; testPath = testPath.slice(0, i); } return id; } window.require.modules = {}; window.require.tlns = {}; window.define = function(id, deps, factory) { if (arguments.length == 2) { factory = deps; if (typeof id != "string") { deps = id; id = window.require.id; } } else if (arguments.length == 1) { factory = id; deps = []; id = window.require.id; } if (typeof factory != "function") { window.require.modules[id] = { exports: factory, initialized: true }; return; } if (!deps.length) // If there is no dependencies, we inject "require", "exports" and // "module" as dependencies, to provide CommonJS compatibility. deps = ["require", "exports", "module"]; var req = function(childId) { return window.require(id, childId); }; window.require.modules[id] = { exports: {}, factory: function() { var module = this; var returnExports = factory.apply(this, deps.map(function(dep) { switch (dep) { // Because "require", "exports" and "module" aren't actual // dependencies, we must handle them seperately. case "require": return req; case "exports": return module.exports; case "module": return module; // But for all other dependencies, we can just go ahead and // require them. default: return req(dep); } })); if (returnExports) module.exports = returnExports; return module; } }; }; window.define.amd = {}; require.tlns = {}; window.initBaseUrls = function initBaseUrls(topLevelNamespaces) { for (var i in topLevelNamespaces) require.tlns[i] = topLevelNamespaces[i]; }; window.initSender = function initSender() { var EventEmitter = window.require("ace/lib/event_emitter").EventEmitter; var oop = window.require("ace/lib/oop"); var Sender = function() {}; (function() { oop.implement(this, EventEmitter); this.callback = function(data, callbackId) { postMessage({ type: "call", id: callbackId, data: data }); }; this.emit = function(name, data) { postMessage({ type: "event", name: name, data: data }); }; }).call(Sender.prototype); return new Sender(); }; var main = window.main = null; var sender = window.sender = null; window.onmessage = function(e) { var msg = e.data; if (msg.event && sender) { sender._signal(msg.event, msg.data); } else if (msg.command) { if (main[msg.command]) main[msg.command].apply(main, msg.args); else if (window[msg.command]) window[msg.command].apply(window, msg.args); else throw new Error("Unknown command:" + msg.command); } else if (msg.init) { window.initBaseUrls(msg.tlns); require("ace/lib/es5-shim"); sender = window.sender = window.initSender(); var clazz = require(msg.module)[msg.classname]; main = window.main = new clazz(sender); } }; })(this); define("ace/lib/oop",["require","exports","module"], function(require, exports, module) { "use strict"; exports.inherits = function(ctor, superCtor) { ctor.super_ = superCtor; ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: false, writable: true, configurable: true } }); }; exports.mixin = function(obj, mixin) { for (var key in mixin) { obj[key] = mixin[key]; } return obj; }; exports.implement = function(proto, mixin) { exports.mixin(proto, mixin); }; }); define("ace/lib/lang",["require","exports","module"], function(require, exports, module) { "use strict"; exports.last = function(a) { return a[a.length - 1]; }; exports.stringReverse = function(string) { return string.split("").reverse().join(""); }; exports.stringRepeat = function (string, count) { var result = ''; while (count > 0) { if (count & 1) result += string; if (count >>= 1) string += string; } return result; }; var trimBeginRegexp = /^\s\s*/; var trimEndRegexp = /\s\s*$/; exports.stringTrimLeft = function (string) { return string.replace(trimBeginRegexp, ''); }; exports.stringTrimRight = function (string) { return string.replace(trimEndRegexp, ''); }; exports.copyObject = function(obj) { var copy = {}; for (var key in obj) { copy[key] = obj[key]; } return copy; }; exports.copyArray = function(array){ var copy = []; for (var i=0, l=array.length; i<l; i++) { if (array[i] && typeof array[i] == "object") copy[i] = this.copyObject(array[i]); else copy[i] = array[i]; } return copy; }; exports.deepCopy = function deepCopy(obj) { if (typeof obj !== "object" || !obj) return obj; var copy; if (Array.isArray(obj)) { copy = []; for (var key = 0; key < obj.length; key++) { copy[key] = deepCopy(obj[key]); } return copy; } if (Object.prototype.toString.call(obj) !== "[object Object]") return obj; copy = {}; for (var key in obj) copy[key] = deepCopy(obj[key]); return copy; }; exports.arrayToMap = function(arr) { var map = {}; for (var i=0; i<arr.length; i++) { map[arr[i]] = 1; } return map; }; exports.createMap = function(props) { var map = Object.create(null); for (var i in props) { map[i] = props[i]; } return map; }; exports.arrayRemove = function(array, value) { for (var i = 0; i <= array.length; i++) { if (value === array[i]) { array.splice(i, 1); } } }; exports.escapeRegExp = function(str) { return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1'); }; exports.escapeHTML = function(str) { return str.replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;"); }; exports.getMatchOffsets = function(string, regExp) { var matches = []; string.replace(regExp, function(str) { matches.push({ offset: arguments[arguments.length-2], length: str.length }); }); return matches; }; exports.deferredCall = function(fcn) { var timer = null; var callback = function() { timer = null; fcn(); }; var deferred = function(timeout) { deferred.cancel(); timer = setTimeout(callback, timeout || 0); return deferred; }; deferred.schedule = deferred; deferred.call = function() { this.cancel(); fcn(); return deferred; }; deferred.cancel = function() { clearTimeout(timer); timer = null; return deferred; }; deferred.isPending = function() { return timer; }; return deferred; }; exports.delayedCall = function(fcn, defaultTimeout) { var timer = null; var callback = function() { timer = null; fcn(); }; var _self = function(timeout) { if (timer == null) timer = setTimeout(callback, timeout || defaultTimeout); }; _self.delay = function(timeout) { timer && clearTimeout(timer); timer = setTimeout(callback, timeout || defaultTimeout); }; _self.schedule = _self; _self.call = function() { this.cancel(); fcn(); }; _self.cancel = function() { timer && clearTimeout(timer); timer = null; }; _self.isPending = function() { return timer; }; return _self; }; }); define("ace/range",["require","exports","module"], function(require, exports, module) { "use strict"; var comparePoints = function(p1, p2) { return p1.row - p2.row || p1.column - p2.column; }; var Range = function(startRow, startColumn, endRow, endColumn) { this.start = { row: startRow, column: startColumn }; this.end = { row: endRow, column: endColumn }; }; (function() { this.isEqual = function(range) { return this.start.row === range.start.row && this.end.row === range.end.row && this.start.column === range.start.column && this.end.column === range.end.column; }; this.toString = function() { return ("Range: [" + this.start.row + "/" + this.start.column + "] -> [" + this.end.row + "/" + this.end.column + "]"); }; this.contains = function(row, column) { return this.compare(row, column) == 0; }; this.compareRange = function(range) { var cmp, end = range.end, start = range.start; cmp = this.compare(end.row, end.column); if (cmp == 1) { cmp = this.compare(start.row, start.column); if (cmp == 1) { return 2; } else if (cmp == 0) { return 1; } else { return 0; } } else if (cmp == -1) { return -2; } else { cmp = this.compare(start.row, start.column); if (cmp == -1) { return -1; } else if (cmp == 1) { return 42; } else { return 0; } } }; this.comparePoint = function(p) { return this.compare(p.row, p.column); }; this.containsRange = function(range) { return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0; }; this.intersects = function(range) { var cmp = this.compareRange(range); return (cmp == -1 || cmp == 0 || cmp == 1); }; this.isEnd = function(row, column) { return this.end.row == row && this.end.column == column; }; this.isStart = function(row, column) { return this.start.row == row && this.start.column == column; }; this.setStart = function(row, column) { if (typeof row == "object") { this.start.column = row.column; this.start.row = row.row; } else { this.start.row = row; this.start.column = column; } }; this.setEnd = function(row, column) { if (typeof row == "object") { this.end.column = row.column; this.end.row = row.row; } else { this.end.row = row; this.end.column = column; } }; this.inside = function(row, column) { if (this.compare(row, column) == 0) { if (this.isEnd(row, column) || this.isStart(row, column)) { return false; } else { return true; } } return false; }; this.insideStart = function(row, column) { if (this.compare(row, column) == 0) { if (this.isEnd(row, column)) { return false; } else { return true; } } return false; }; this.insideEnd = function(row, column) { if (this.compare(row, column) == 0) { if (this.isStart(row, column)) { return false; } else { return true; } } return false; }; this.compare = function(row, column) { if (!this.isMultiLine()) { if (row === this.start.row) { return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0); } } if (row < this.start.row) return -1; if (row > this.end.row) return 1; if (this.start.row === row) return column >= this.start.column ? 0 : -1; if (this.end.row === row) return column <= this.end.column ? 0 : 1; return 0; }; this.compareStart = function(row, column) { if (this.start.row == row && this.start.column == column) { return -1; } else { return this.compare(row, column); } }; this.compareEnd = function(row, column) { if (this.end.row == row && this.end.column == column) { return 1; } else { return this.compare(row, column); } }; this.compareInside = function(row, column) { if (this.end.row == row && this.end.column == column) { return 1; } else if (this.start.row == row && this.start.column == column) { return -1; } else { return this.compare(row, column); } }; this.clipRows = function(firstRow, lastRow) { if (this.end.row > lastRow) var end = {row: lastRow + 1, column: 0}; else if (this.end.row < firstRow) var end = {row: firstRow, column: 0}; if (this.start.row > lastRow) var start = {row: lastRow + 1, column: 0}; else if (this.start.row < firstRow) var start = {row: firstRow, column: 0}; return Range.fromPoints(start || this.start, end || this.end); }; this.extend = function(row, column) { var cmp = this.compare(row, column); if (cmp == 0) return this; else if (cmp == -1) var start = {row: row, column: column}; else var end = {row: row, column: column}; return Range.fromPoints(start || this.start, end || this.end); }; this.isEmpty = function() { return (this.start.row === this.end.row && this.start.column === this.end.column); }; this.isMultiLine = function() { return (this.start.row !== this.end.row); }; this.clone = function() { return Range.fromPoints(this.start, this.end); }; this.collapseRows = function() { if (this.end.column == 0) return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0); else return new Range(this.start.row, 0, this.end.row, 0); }; this.toScreenRange = function(session) { var screenPosStart = session.documentToScreenPosition(this.start); var screenPosEnd = session.documentToScreenPosition(this.end); return new Range( screenPosStart.row, screenPosStart.column, screenPosEnd.row, screenPosEnd.column ); }; this.moveBy = function(row, column) { this.start.row += row; this.start.column += column; this.end.row += row; this.end.column += column; }; }).call(Range.prototype); Range.fromPoints = function(start, end) { return new Range(start.row, start.column, end.row, end.column); }; Range.comparePoints = comparePoints; Range.comparePoints = function(p1, p2) { return p1.row - p2.row || p1.column - p2.column; }; exports.Range = Range; }); define("ace/apply_delta",["require","exports","module"], function(require, exports, module) { "use strict"; function throwDeltaError(delta, errorText){ console.log("Invalid Delta:", delta); throw "Invalid Delta: " + errorText; } function positionInDocument(docLines, position) { return position.row >= 0 && position.row < docLines.length && position.column >= 0 && position.column <= docLines[position.row].length; } function validateDelta(docLines, delta) { if (delta.action != "insert" && delta.action != "remove") throwDeltaError(delta, "delta.action must be 'insert' or 'remove'"); if (!(delta.lines instanceof Array)) throwDeltaError(delta, "delta.lines must be an Array"); if (!delta.start || !delta.end) throwDeltaError(delta, "delta.start/end must be an present"); var start = delta.start; if (!positionInDocument(docLines, delta.start)) throwDeltaError(delta, "delta.start must be contained in document"); var end = delta.end; if (delta.action == "remove" && !positionInDocument(docLines, end)) throwDeltaError(delta, "delta.end must contained in document for 'remove' actions"); var numRangeRows = end.row - start.row; var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0)); if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars) throwDeltaError(delta, "delta.range must match delta lines"); } exports.applyDelta = function(docLines, delta, doNotValidate) { var row = delta.start.row; var startColumn = delta.start.column; var line = docLines[row] || ""; switch (delta.action) { case "insert": var lines = delta.lines; if (lines.length === 1) { docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn); } else { var args = [row, 1].concat(delta.lines); docLines.splice.apply(docLines, args); docLines[row] = line.substring(0, startColumn) + docLines[row]; docLines[row + delta.lines.length - 1] += line.substring(startColumn); } break; case "remove": var endColumn = delta.end.column; var endRow = delta.end.row; if (row === endRow) { docLines[row] = line.substring(0, startColumn) + line.substring(endColumn); } else { docLines.splice( row, endRow - row + 1, line.substring(0, startColumn) + docLines[endRow].substring(endColumn) ); } break; } }; }); define("ace/lib/event_emitter",["require","exports","module"], function(require, exports, module) { "use strict"; var EventEmitter = {}; var stopPropagation = function() { this.propagationStopped = true; }; var preventDefault = function() { this.defaultPrevented = true; }; EventEmitter._emit = EventEmitter._dispatchEvent = function(eventName, e) { this._eventRegistry || (this._eventRegistry = {}); this._defaultHandlers || (this._defaultHandlers = {}); var listeners = this._eventRegistry[eventName] || []; var defaultHandler = this._defaultHandlers[eventName]; if (!listeners.length && !defaultHandler) return; if (typeof e != "object" || !e) e = {}; if (!e.type) e.type = eventName; if (!e.stopPropagation) e.stopPropagation = stopPropagation; if (!e.preventDefault) e.preventDefault = preventDefault; listeners = listeners.slice(); for (var i=0; i<listeners.length; i++) { listeners[i](e, this); if (e.propagationStopped) break; } if (defaultHandler && !e.defaultPrevented) return defaultHandler(e, this); }; EventEmitter._signal = function(eventName, e) { var listeners = (this._eventRegistry || {})[eventName]; if (!listeners) return; listeners = listeners.slice(); for (var i=0; i<listeners.length; i++) listeners[i](e, this); }; EventEmitter.once = function(eventName, callback) { var _self = this; callback && this.addEventListener(eventName, function newCallback() { _self.removeEventListener(eventName, newCallback); callback.apply(null, arguments); }); }; EventEmitter.setDefaultHandler = function(eventName, callback) { var handlers = this._defaultHandlers; if (!handlers) handlers = this._defaultHandlers = {_disabled_: {}}; if (handlers[eventName]) { var old = handlers[eventName]; var disabled = handlers._disabled_[eventName]; if (!disabled) handlers._disabled_[eventName] = disabled = []; disabled.push(old); var i = disabled.indexOf(callback); if (i != -1) disabled.splice(i, 1); } handlers[eventName] = callback; }; EventEmitter.removeDefaultHandler = function(eventName, callback) { var handlers = this._defaultHandlers; if (!handlers) return; var disabled = handlers._disabled_[eventName]; if (handlers[eventName] == callback) { var old = handlers[eventName]; if (disabled) this.setDefaultHandler(eventName, disabled.pop()); } else if (disabled) { var i = disabled.indexOf(callback); if (i != -1) disabled.splice(i, 1); } }; EventEmitter.on = EventEmitter.addEventListener = function(eventName, callback, capturing) { this._eventRegistry = this._eventRegistry || {}; var listeners = this._eventRegistry[eventName]; if (!listeners) listeners = this._eventRegistry[eventName] = []; if (listeners.indexOf(callback) == -1) listeners[capturing ? "unshift" : "push"](callback); return callback; }; EventEmitter.off = EventEmitter.removeListener = EventEmitter.removeEventListener = function(eventName, callback) { this._eventRegistry = this._eventRegistry || {}; var listeners = this._eventRegistry[eventName]; if (!listeners) return; var index = listeners.indexOf(callback); if (index !== -1) listeners.splice(index, 1); }; EventEmitter.removeAllListeners = function(eventName) { if (this._eventRegistry) this._eventRegistry[eventName] = []; }; exports.EventEmitter = EventEmitter; }); define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"], function(require, exports, module) { "use strict"; var oop = require("./lib/oop"); var EventEmitter = require("./lib/event_emitter").EventEmitter; var Anchor = exports.Anchor = function(doc, row, column) { this.$onChange = this.onChange.bind(this); this.attach(doc); if (typeof column == "undefined") this.setPosition(row.row, row.column); else this.setPosition(row, column); }; (function() { oop.implement(this, EventEmitter); this.getPosition = function() { return this.$clipPositionToDocument(this.row, this.column); }; this.getDocument = function() { return this.document; }; this.$insertRight = false; this.onChange = function(delta) { if (delta.start.row == delta.end.row && delta.start.row != this.row) return; if (delta.start.row > this.row) return; var point = $getTransformedPoint(delta, {row: this.row, column: this.column}, this.$insertRight); this.setPosition(point.row, point.column, true); }; function $pointsInOrder(point1, point2, equalPointsInOrder) { var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column; return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter); } function $getTransformedPoint(delta, point, moveIfEqual) { var deltaIsInsert = delta.action == "insert"; var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row); var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column); var deltaStart = delta.start; var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range. if ($pointsInOrder(point, deltaStart, moveIfEqual)) { return { row: point.row, column: point.column }; } if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) { return { row: point.row + deltaRowShift, column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0) }; } return { row: deltaStart.row, column: deltaStart.column }; } this.setPosition = function(row, column, noClip) { var pos; if (noClip) { pos = { row: row, column: column }; } else { pos = this.$clipPositionToDocument(row, column); } if (this.row == pos.row && this.column == pos.column) return; var old = { row: this.row, column: this.column }; this.row = pos.row; this.column = pos.column; this._signal("change", { old: old, value: pos }); }; this.detach = function() { this.document.removeEventListener("change", this.$onChange); }; this.attach = function(doc) { this.document = doc || this.document; this.document.on("change", this.$onChange); }; this.$clipPositionToDocument = function(row, column) { var pos = {}; if (row >= this.document.getLength()) { pos.row = Math.max(0, this.document.getLength() - 1); pos.column = this.document.getLine(pos.row).length; } else if (row < 0) { pos.row = 0; pos.column = 0; } else { pos.row = row; pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column)); } if (column < 0) pos.column = 0; return pos; }; }).call(Anchor.prototype); }); define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"], function(require, exports, module) { "use strict"; var oop = require("./lib/oop"); var applyDelta = require("./apply_delta").applyDelta; var EventEmitter = require("./lib/event_emitter").EventEmitter; var Range = require("./range").Range; var Anchor = require("./anchor").Anchor; var Document = function(textOrLines) { this.$lines = [""]; if (textOrLines.length === 0) { this.$lines = [""]; } else if (Array.isArray(textOrLines)) { this.insertMergedLines({row: 0, column: 0}, textOrLines); } else { this.insert({row: 0, column:0}, textOrLines); } }; (function() { oop.implement(this, EventEmitter); this.setValue = function(text) { var len = this.getLength() - 1; this.remove(new Range(0, 0, len, this.getLine(len).length)); this.insert({row: 0, column: 0}, text); }; this.getValue = function() { return this.getAllLines().join(this.getNewLineCharacter()); }; this.createAnchor = function(row, column) { return new Anchor(this, row, column); }; if ("aaa".split(/a/).length === 0) { this.$split = function(text) { return text.replace(/\r\n|\r/g, "\n").split("\n"); }; } else { this.$split = function(text) { return text.split(/\r\n|\r|\n/); }; } this.$detectNewLine = function(text) { var match = text.match(/^.*?(\r\n|\r|\n)/m); this.$autoNewLine = match ? match[1] : "\n"; this._signal("changeNewLineMode"); }; this.getNewLineCharacter = function() { switch (this.$newLineMode) { case "windows": return "\r\n"; case "unix": return "\n"; default: return this.$autoNewLine || "\n"; } }; this.$autoNewLine = ""; this.$newLineMode = "auto"; this.setNewLineMode = function(newLineMode) { if (this.$newLineMode === newLineMode) return; this.$newLineMode = newLineMode; this._signal("changeNewLineMode"); }; this.getNewLineMode = function() { return this.$newLineMode; }; this.isNewLine = function(text) { return (text == "\r\n" || text == "\r" || text == "\n"); }; this.getLine = function(row) { return this.$lines[row] || ""; }; this.getLines = function(firstRow, lastRow) { return this.$lines.slice(firstRow, lastRow + 1); }; this.getAllLines = function() { return this.getLines(0, this.getLength()); }; this.getLength = function() { return this.$lines.length; }; this.getTextRange = function(range) { return this.getLinesForRange(range).join(this.getNewLineCharacter()); }; this.getLinesForRange = function(range) { var lines; if (range.start.row === range.end.row) { lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)]; } else { lines = this.getLines(range.start.row, range.end.row); lines[0] = (lines[0] || "").substring(range.start.column); var l = lines.length - 1; if (range.end.row - range.start.row == l) lines[l] = lines[l].substring(0, range.end.column); } return lines; }; this.insertLines = function(row, lines) { console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."); return this.insertFullLines(row, lines); }; this.removeLines = function(firstRow, lastRow) { console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."); return this.removeFullLines(firstRow, lastRow); }; this.insertNewLine = function(position) { console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."); return this.insertMergedLines(position, ["", ""]); }; this.insert = function(position, text) { if (this.getLength() <= 1) this.$detectNewLine(text); return this.insertMergedLines(position, this.$split(text)); }; this.insertInLine = function(position, text) { var start = this.clippedPos(position.row, position.column); var end = this.pos(position.row, position.column + text.length); this.applyDelta({ start: start, end: end, action: "insert", lines: [text] }, true); return this.clonePos(end); }; this.clippedPos = function(row, column) { var length = this.getLength(); if (row === undefined) { row = length; } else if (row < 0) { row = 0; } else if (row >= length) { row = length - 1; column = undefined; } var line = this.getLine(row); if (column == undefined) column = line.length; column = Math.min(Math.max(column, 0), line.length); return {row: row, column: column}; }; this.clonePos = function(pos) { return {row: pos.row, column: pos.column}; }; this.pos = function(row, column) { return {row: row, column: column}; }; this.$clipPosition = function(position) { var length = this.getLength(); if (position.row >= length) { position.row = Math.max(0, length - 1); position.column = this.getLine(length - 1).length; } else { position.row = Math.max(0, position.row); position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length); } return position; }; this.insertFullLines = function(row, lines) { row = Math.min(Math.max(row, 0), this.getLength()); var column = 0; if (row < this.getLength()) { lines = lines.concat([""]); column = 0; } else { lines = [""].concat(lines); row--; column = this.$lines[row].length; } this.insertMergedLines({row: row, column: column}, lines); }; this.insertMergedLines = function(position, lines) { var start = this.clippedPos(position.row, position.column); var end = { row: start.row + lines.length - 1, column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length }; this.applyDelta({ start: start, end: end, action: "insert", lines: lines }); return this.clonePos(end); }; this.remove = function(range) { var start = this.clippedPos(range.start.row, range.start.column); var end = this.clippedPos(range.end.row, range.end.column); this.applyDelta({ start: start, end: end, action: "remove", lines: this.getLinesForRange({start: start, end: end}) }); return this.clonePos(start); }; this.removeInLine = function(row, startColumn, endColumn) { var start = this.clippedPos(row, startColumn); var end = this.clippedPos(row, endColumn); this.applyDelta({ start: start, end: end, action: "remove", lines: this.getLinesForRange({start: start, end: end}) }, true); return this.clonePos(start); }; this.removeFullLines = function(firstRow, lastRow) { firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1); lastRow = Math.min(Math.max(0, lastRow ), this.getLength() - 1); var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0; var deleteLastNewLine = lastRow < this.getLength() - 1; var startRow = ( deleteFirstNewLine ? firstRow - 1 : firstRow ); var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0 ); var endRow = ( deleteLastNewLine ? lastRow + 1 : lastRow ); var endCol = ( deleteLastNewLine ? 0 : this.getLine(endRow).length ); var range = new Range(startRow, startCol, endRow, endCol); var deletedLines = this.$lines.slice(firstRow, lastRow + 1); this.applyDelta({ start: range.start, end: range.end, action: "remove", lines: this.getLinesForRange(range) }); return deletedLines; }; this.removeNewLine = function(row) { if (row < this.getLength() - 1 && row >= 0) { this.applyDelta({ start: this.pos(row, this.getLine(row).length), end: this.pos(row + 1, 0), action: "remove", lines: ["", ""] }); } }; this.replace = function(range, text) { if (!(range instanceof Range)) range = Range.fromPoints(range.start, range.end); if (text.length === 0 && range.isEmpty()) return range.start; if (text == this.getTextRange(range)) return range.end; this.remove(range); var end; if (text) { end = this.insert(range.start, text); } else { end = range.start; } return end; }; this.applyDeltas = function(deltas) { for (var i=0; i<deltas.length; i++) { this.applyDelta(deltas[i]); } }; this.revertDeltas = function(deltas) { for (var i=deltas.length-1; i>=0; i--) { this.revertDelta(deltas[i]); } }; this.applyDelta = function(delta, doNotValidate) { var isInsert = delta.action == "insert"; if (isInsert ? delta.lines.length <= 1 && !delta.lines[0] : !Range.comparePoints(delta.start, delta.end)) { return; } if (isInsert && delta.lines.length > 20000) this.$splitAndapplyLargeDelta(delta, 20000); applyDelta(this.$lines, delta, doNotValidate); this._signal("change", delta); }; this.$splitAndapplyLargeDelta = function(delta, MAX) { var lines = delta.lines; var l = lines.length; var row = delta.start.row; var column = delta.start.column; var from = 0, to = 0; do { from = to; to += MAX - 1; var chunk = lines.slice(from, to); if (to > l) { delta.lines = chunk; delta.start.row = row + from; delta.start.column = column; break; } chunk.push(""); this.applyDelta({ start: this.pos(row + from, column), end: this.pos(row + to, column = 0), action: delta.action, lines: chunk }, true); } while(true); }; this.revertDelta = function(delta) { this.applyDelta({ start: this.clonePos(delta.start), end: this.clonePos(delta.end), action: (delta.action == "insert" ? "remove" : "insert"), lines: delta.lines.slice() }); }; this.indexToPosition = function(index, startRow) { var lines = this.$lines || this.getAllLines(); var newlineLength = this.getNewLineCharacter().length; for (var i = startRow || 0, l = lines.length; i < l; i++) { index -= lines[i].length + newlineLength; if (index < 0) return {row: i, column: index + lines[i].length + newlineLength}; } return {row: l-1, column: lines[l-1].length}; }; this.positionToIndex = function(pos, startRow) { var lines = this.$lines || this.getAllLines(); var newlineLength = this.getNewLineCharacter().length; var index = 0; var row = Math.min(pos.row, lines.length); for (var i = startRow || 0; i < row; ++i) index += lines[i].length + newlineLength; return index + pos.column; }; }).call(Document.prototype); exports.Document = Document; }); define("ace/worker/mirror",["require","exports","module","ace/range","ace/document","ace/lib/lang"], function(require, exports, module) { "use strict"; var Range = require("../range").Range; var Document = require("../document").Document; var lang = require("../lib/lang"); var Mirror = exports.Mirror = function(sender) { this.sender = sender; var doc = this.doc = new Document(""); var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this)); var _self = this; sender.on("change", function(e) { var data = e.data; if (data[0].start) { doc.applyDeltas(data); } else { for (var i = 0; i < data.length; i += 2) { if (Array.isArray(data[i+1])) { var d = {action: "insert", start: data[i], lines: data[i+1]}; } else { var d = {action: "remove", start: data[i], end: data[i+1]}; } doc.applyDelta(d, true); } } if (_self.$timeout) return deferredUpdate.schedule(_self.$timeout); _self.onUpdate(); }); }; (function() { this.$timeout = 500; this.setTimeout = function(timeout) { this.$timeout = timeout; }; this.setValue = function(value) { this.doc.setValue(value); this.deferredUpdate.schedule(this.$timeout); }; this.getValue = function(callbackId) { this.sender.callback(this.doc.getValue(), callbackId); }; this.onUpdate = function() { }; this.isPending = function() { return this.deferredUpdate.isPending(); }; }).call(Mirror.prototype); }); define("ace/mode/xml/sax",["require","exports","module"], function(require, exports, module) { var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]///\u10000-\uEFFFF var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\u00B7\u0300-\u036F\\ux203F-\u2040]"); var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$'); var S_TAG = 0;//tag name offerring var S_ATTR = 1;//attr name offerring var S_ATTR_S=2;//attr name end and space offer var S_EQ = 3;//=space? var S_V = 4;//attr value(no quot value only) var S_E = 5;//attr value end and no space(quot end) var S_S = 6;//(attr value end || tag end ) && (space offer) var S_C = 7;//closed el<el /> function XMLReader(){ } XMLReader.prototype = { parse:function(source,defaultNSMap,entityMap){ var domBuilder = this.domBuilder; domBuilder.startDocument(); _copy(defaultNSMap ,defaultNSMap = {}) parse(source,defaultNSMap,entityMap, domBuilder,this.errorHandler); domBuilder.endDocument(); } } function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){ function fixedFromCharCode(code) { if (code > 0xffff) { code -= 0x10000; var surrogate1 = 0xd800 + (code >> 10) , surrogate2 = 0xdc00 + (code & 0x3ff); return String.fromCharCode(surrogate1, surrogate2); } else { return String.fromCharCode(code); } } function entityReplacer(a){ var k = a.slice(1,-1); if(k in entityMap){ return entityMap[k]; }else if(k.charAt(0) === '#'){ return fixedFromCharCode(parseInt(k.substr(1).replace('x','0x'))) }else{ errorHandler.error('entity not found:'+a); return a; } } function appendText(end){//has some bugs var xt = source.substring(start,end).replace(/&#?\w+;/g,entityReplacer); locator&&position(start); domBuilder.characters(xt,0,end-start); start = end } function position(start,m){ while(start>=endPos && (m = linePattern.exec(source))){ startPos = m.index; endPos = startPos + m[0].length; locator.lineNumber++; } locator.columnNumber = start-startPos+1; } var startPos = 0; var endPos = 0; var linePattern = /.+(?:\r\n?|\n)|.*$/g var locator = domBuilder.locator; var parseStack = [{currentNSMap:defaultNSMapCopy}] var closeMap = {}; var start = 0; while(true){ var i = source.indexOf('<',start); if(i<0){ if(!source.substr(start).match(/^\s*$/)){ var doc = domBuilder.document; var text = doc.createTextNode(source.substr(start)); doc.appendChild(text); domBuilder.currentElement = text; } return; } if(i>start){ appendText(i); } switch(source.charAt(i+1)){ case '/': var end = source.indexOf('>',i+3); var tagName = source.substring(i+2,end); var config; if (parseStack.length > 1) { config = parseStack.pop(); } else { errorHandler.fatalError("end tag name not found for: "+tagName); break; } var localNSMap = config.localNSMap; if(config.tagName != tagName){ errorHandler.fatalError("end tag name: " + tagName + " does not match the current start tagName: "+config.tagName ); } domBuilder.endElement(config.uri,config.localName,tagName); if(localNSMap){ for(var prefix in localNSMap){ domBuilder.endPrefixMapping(prefix) ; } } end++; break; case '?':// <?...?> locator&&position(i); end = parseInstruction(source,i,domBuilder); break; case '!':// <!doctype,<![CDATA,<!-- locator&&position(i); end = parseDCC(source,i,domBuilder,errorHandler); break; default: try{ locator&&position(i); var el = new ElementAttributes(); var end = parseElementStartPart(source,i,el,entityReplacer,errorHandler); var len = el.length; if(len && locator){ var backup = copyLocator(locator,{}); for(var i = 0;i<len;i++){ var a = el[i]; position(a.offset); a.offset = copyLocator(locator,{}); } copyLocator(backup,locator); } if(!el.closed && fixSelfClosed(source,end,el.tagName,closeMap)){ el.closed = true; if(!entityMap.nbsp){ errorHandler.warning('unclosed xml attribute'); } } appendElement(el,domBuilder,parseStack); if(el.uri === 'http://www.w3.org/1999/xhtml' && !el.closed){ end = parseHtmlSpecialContent(source,end,el.tagName,entityReplacer,domBuilder) }else{ end++; } }catch(e){ errorHandler.error('element parse error: '+e); end = -1; } } if(end<0){ appendText(i+1); }else{ start = end; } } } function copyLocator(f,t){ t.lineNumber = f.lineNumber; t.columnNumber = f.columnNumber; return t; } function parseElementStartPart(source,start,el,entityReplacer,errorHandler){ var attrName; var value; var p = ++start; var s = S_TAG;//status while(true){ var c = source.charAt(p); switch(c){ case '=': if(s === S_ATTR){//attrName attrName = source.slice(start,p); s = S_EQ; }else if(s === S_ATTR_S){ s = S_EQ; }else{ throw new Error('attribute equal must after attrName'); } break; case '\'': case '"': if(s === S_EQ){//equal start = p+1; p = source.indexOf(c,start) if(p>0){ value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer); el.add(attrName,value,start-1); s = S_E; }else{ throw new Error('attribute value no end \''+c+'\' match'); } }else if(s == S_V){ value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer); el.add(attrName,value,start); errorHandler.warning('attribute "'+attrName+'" missed start quot('+c+')!!'); start = p+1; s = S_E }else{ throw new Error('attribute value must after "="'); } break; case '/': switch(s){ case S_TAG: el.setTagName(source.slice(start,p)); case S_E: case S_S: case S_C: s = S_C; el.closed = true; case S_V: case S_ATTR: case S_ATTR_S: break; default: throw new Error("attribute invalid close char('/')") } break; case ''://end document errorHandler.error('unexpected end of input'); case '>': switch(s){ case S_TAG: el.setTagName(source.slice(start,p)); case S_E: case S_S: case S_C: break;//normal case S_V://Compatible state case S_ATTR: value = source.slice(start,p); if(value.slice(-1) === '/'){ el.closed = true; value = value.slice(0,-1) } case S_ATTR_S: if(s === S_ATTR_S){ value = attrName; } if(s == S_V){ errorHandler.warning('attribute "'+value+'" missed quot(")!!'); el.add(attrName,value.replace(/&#?\w+;/g,entityReplacer),start) }else{ errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!') el.add(value,value,start) } break; case S_EQ: throw new Error('attribute value missed!!'); } return p; case '\u0080': c = ' '; default: if(c<= ' '){//space switch(s){ case S_TAG: el.setTagName(source.slice(start,p));//tagName s = S_S; break; case S_ATTR: attrName = source.slice(start,p) s = S_ATTR_S; break; case S_V: var value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer); errorHandler.warning('attribute "'+value+'" missed quot(")!!'); el.add(attrName,value,start) case S_E: s = S_S; break; } }else{//not space switch(s){ case S_ATTR_S: errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead!!') el.add(attrName,attrName,start); start = p; s = S_ATTR; break; case S_E: errorHandler.warning('attribute space is required"'+attrName+'"!!') case S_S: s = S_ATTR; start = p; break; case S_EQ: s = S_V; start = p; break; case S_C: throw new Error("elements closed character '/' and '>' must be connected to"); } } } p++; } } function appendElement(el,domBuilder,parseStack){ var tagName = el.tagName; var localNSMap = null; var currentNSMap = parseStack[parseStack.length-1].currentNSMap; var i = el.length; while(i--){ var a = el[i]; var qName = a.qName; var value = a.value; var nsp = qName.indexOf(':'); if(nsp>0){ var prefix = a.prefix = qName.slice(0,nsp); var localName = qName.slice(nsp+1); var nsPrefix = prefix === 'xmlns' && localName }else{ localName = qName; prefix = null nsPrefix = qName === 'xmlns' && '' } a.localName = localName ; if(nsPrefix !== false){//hack!! if(localNSMap == null){ localNSMap = {} _copy(currentNSMap,currentNSMap={}) } currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value; a.uri = 'http://www.w3.org/2000/xmlns/' domBuilder.startPrefixMapping(nsPrefix, value) } } var i = el.length; while(i--){ a = el[i]; var prefix = a.prefix; if(prefix){//no prefix attribute has no namespace if(prefix === 'xml'){ a.uri = 'http://www.w3.org/XML/1998/namespace'; }if(prefix !== 'xmlns'){ a.uri = currentNSMap[prefix] } } } var nsp = tagName.indexOf(':'); if(nsp>0){ prefix = el.prefix = tagName.slice(0,nsp); localName = el.localName = tagName.slice(nsp+1); }else{ prefix = null;//important!! localName = el.localName = tagName; } var ns = el.uri = currentNSMap[prefix || '']; domBuilder.startElement(ns,localName,tagName,el); if(el.closed){ domBuilder.endElement(ns,localName,tagName); if(localNSMap){ for(prefix in localNSMap){ domBuilder.endPrefixMapping(prefix) } } }else{ el.currentNSMap = currentNSMap; el.localNSMap = localNSMap; parseStack.push(el); } } function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){ if(/^(?:script|textarea)$/i.test(tagName)){ var elEndStart = source.indexOf('</'+tagName+'>',elStartEnd); var text = source.substring(elStartEnd+1,elEndStart); if(/[&<]/.test(text)){ if(/^script$/i.test(tagName)){ domBuilder.characters(text,0,text.length); return elEndStart; }//}else{//text area text = text.replace(/&#?\w+;/g,entityReplacer); domBuilder.characters(text,0,text.length); return elEndStart; } } return elStartEnd+1; } function fixSelfClosed(source,elStartEnd,tagName,closeMap){ var pos = closeMap[tagName]; if(pos == null){ pos = closeMap[tagName] = source.lastIndexOf('</'+tagName+'>') } return pos<elStartEnd; } function _copy(source,target){ for(var n in source){target[n] = source[n]} } function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!' var next= source.charAt(start+2) switch(next){ case '-': if(source.charAt(start + 3) === '-'){ var end = source.indexOf('-->',start+4); if(end>start){ domBuilder.comment(source,start+4,end-start-4); return end+3; }else{ errorHandler.error("Unclosed comment"); return -1; } }else{ return -1; } default: if(source.substr(start+3,6) == 'CDATA['){ var end = source.indexOf(']]>',start+9); domBuilder.startCDATA(); domBuilder.characters(source,start+9,end-start-9); domBuilder.endCDATA() return end+3; } var matchs = split(source,start); var len = matchs.length; if(len>1 && /!doctype/i.test(matchs[0][0])){ var name = matchs[1][0]; var pubid = len>3 && /^public$/i.test(matchs[2][0]) && matchs[3][0] var sysid = len>4 && matchs[4][0]; var lastMatch = matchs[len-1] domBuilder.startDTD(name,pubid && pubid.replace(/^(['"])(.*?)\1$/,'$2'), sysid && sysid.replace(/^(['"])(.*?)\1$/,'$2')); domBuilder.endDTD(); return lastMatch.index+lastMatch[0].length } } return -1; } function parseInstruction(source,start,domBuilder){ var end = source.indexOf('?>',start); if(end){ var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/); if(match){ var len = match[0].length; domBuilder.processingInstruction(match[1], match[2]) ; return end+2; }else{//error return -1; } } return -1; } function ElementAttributes(source){ } ElementAttributes.prototype = { setTagName:function(tagName){ if(!tagNamePattern.test(tagName)){ throw new Error('invalid tagName:'+tagName) } this.tagName = tagName }, add:function(qName,value,offset){ if(!tagNamePattern.test(qName)){ throw new Error('invalid attribute:'+qName) } this[this.length++] = {qName:qName,value:value,offset:offset} }, length:0, getLocalName:function(i){return this[i].localName}, getOffset:function(i){return this[i].offset}, getQName:function(i){return this[i].qName}, getURI:function(i){return this[i].uri}, getValue:function(i){return this[i].value} } function _set_proto_(thiz,parent){ thiz.__proto__ = parent; return thiz; } if(!(_set_proto_({},_set_proto_.prototype) instanceof _set_proto_)){ _set_proto_ = function(thiz,parent){ function p(){}; p.prototype = parent; p = new p(); for(parent in thiz){ p[parent] = thiz[parent]; } return p; } } function split(source,start){ var match; var buf = []; var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g; reg.lastIndex = start; reg.exec(source);//skip < while(match = reg.exec(source)){ buf.push(match); if(match[1])return buf; } } return XMLReader; }); define("ace/mode/xml/dom",["require","exports","module"], function(require, exports, module) { function copy(src,dest){ for(var p in src){ dest[p] = src[p]; } } function _extends(Class,Super){ var pt = Class.prototype; if(Object.create){ var ppt = Object.create(Super.prototype) pt.__proto__ = ppt; } if(!(pt instanceof Super)){ function t(){}; t.prototype = Super.prototype; t = new t(); copy(pt,t); Class.prototype = pt = t; } if(pt.constructor != Class){ if(typeof Class != 'function'){ console.error("unknow Class:"+Class) } pt.constructor = Class } } var htmlns = 'http://www.w3.org/1999/xhtml' ; var NodeType = {} var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1; var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2; var TEXT_NODE = NodeType.TEXT_NODE = 3; var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4; var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5; var ENTITY_NODE = NodeType.ENTITY_NODE = 6; var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7; var COMMENT_NODE = NodeType.COMMENT_NODE = 8; var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9; var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10; var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11; var NOTATION_NODE = NodeType.NOTATION_NODE = 12; var ExceptionCode = {} var ExceptionMessage = {}; var INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = ((ExceptionMessage[1]="Index size error"),1); var DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = ((ExceptionMessage[2]="DOMString size error"),2); var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = ((ExceptionMessage[3]="Hierarchy request error"),3); var WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = ((ExceptionMessage[4]="Wrong document"),4); var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5); var NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = ((ExceptionMessage[6]="No data allowed"),6); var NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = ((ExceptionMessage[7]="No modification allowed"),7); var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = ((ExceptionMessage[8]="Not found"),8); var NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = ((ExceptionMessage[9]="Not supported"),9); var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = ((ExceptionMessage[10]="Attribute in use"),10); var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11); var SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = ((ExceptionMessage[12]="Syntax error"),12); var INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = ((ExceptionMessage[13]="Invalid modification"),13); var NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = ((ExceptionMessage[14]="Invalid namespace"),14); var INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = ((ExceptionMessage[15]="Invalid access"),15); function DOMException(code, message) { if(message instanceof Error){ var error = message; }else{ error = this; Error.call(this, ExceptionMessage[code]); this.message = ExceptionMessage[code]; if(Error.captureStackTrace) Error.captureStackTrace(this, DOMException); } error.code = code; if(message) this.message = this.message + ": " + message; return error; }; DOMException.prototype = Error.prototype; copy(ExceptionCode,DOMException) function NodeList() { }; NodeList.prototype = { length:0, item: function(index) { return this[index] || null; } }; function LiveNodeList(node,refresh){ this._node = node; this._refresh = refresh _updateLiveList(this); } function _updateLiveList(list){ var inc = list._node._inc || list._node.ownerDocument._inc; if(list._inc != inc){ var ls = list._refresh(list._node); __set__(list,'length',ls.length); copy(ls,list); list._inc = inc; } } LiveNodeList.prototype.item = function(i){ _updateLiveList(this); return this[i]; } _extends(LiveNodeList,NodeList); function NamedNodeMap() { }; function _findNodeIndex(list,node){ var i = list.length; while(i--){ if(list[i] === node){return i} } } function _addNamedNode(el,list,newAttr,oldAttr){ if(oldAttr){ list[_findNodeIndex(list,oldAttr)] = newAttr; }else{ list[list.length++] = newAttr; } if(el){ newAttr.ownerElement = el; var doc = el.ownerDocument; if(doc){ oldAttr && _onRemoveAttribute(doc,el,oldAttr); _onAddAttribute(doc,el,newAttr); } } } function _removeNamedNode(el,list,attr){ var i = _findNodeIndex(list,attr); if(i>=0){ var lastIndex = list.length-1 while(i<lastIndex){ list[i] = list[++i] } list.length = lastIndex; if(el){ var doc = el.ownerDocument; if(doc){ _onRemoveAttribute(doc,el,attr); attr.ownerElement = null; } } }else{ throw new DOMException(NOT_FOUND_ERR,new Error()) } } NamedNodeMap.prototype = { length:0, item:NodeList.prototype.item, getNamedItem: function(key) { var i = this.length; while(i--){ var attr = this[i]; if(attr.nodeName == key){ return attr; } } }, setNamedItem: function(attr) { var el = attr.ownerElement; if(el && el!=this._ownerElement){ throw new DOMException(INUSE_ATTRIBUTE_ERR); } var oldAttr = this.getNamedItem(attr.nodeName); _addNamedNode(this._ownerElement,this,attr,oldAttr); return oldAttr; }, setNamedItemNS: function(attr) {// raises: WRONG_DOCUMENT_ERR,NO_MODIFICATION_ALLOWED_ERR,INUSE_ATTRIBUTE_ERR var el = attr.ownerElement, oldAttr; if(el && el!=this._ownerElement){ throw new DOMException(INUSE_ATTRIBUTE_ERR); } oldAttr = this.getNamedItemNS(attr.namespaceURI,attr.localName); _addNamedNode(this._ownerElement,this,attr,oldAttr); return oldAttr; }, removeNamedItem: function(key) { var attr = this.getNamedItem(key); _removeNamedNode(this._ownerElement,this,attr); return attr; },// raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR removeNamedItemNS:function(namespaceURI,localName){ var attr = this.getNamedItemNS(namespaceURI,localName); _removeNamedNode(this._ownerElement,this,attr); return attr; }, getNamedItemNS: function(namespaceURI, localName) { var i = this.length; while(i--){ var node = this[i]; if(node.localName == localName && node.namespaceURI == namespaceURI){ return node; } } return null; } }; function DOMImplementation(/* Object */ features) { this._features = {}; if (features) { for (var feature in features) { this._features = features[feature]; } } }; DOMImplementation.prototype = { hasFeature: function(/* string */ feature, /* string */ version) { var versions = this._features[feature.toLowerCase()]; if (versions && (!version || version in versions)) { return true; } else { return false; } }, createDocument:function(namespaceURI, qualifiedName, doctype){// raises:INVALID_CHARACTER_ERR,NAMESPACE_ERR,WRONG_DOCUMENT_ERR var doc = new Document(); doc.implementation = this; doc.childNodes = new NodeList(); doc.doctype = doctype; if(doctype){ doc.appendChild(doctype); } if(qualifiedName){ var root = doc.createElementNS(namespaceURI,qualifiedName); doc.appendChild(root); } return doc; }, createDocumentType:function(qualifiedName, publicId, systemId){// raises:INVALID_CHARACTER_ERR,NAMESPACE_ERR var node = new DocumentType(); node.name = qualifiedName; node.nodeName = qualifiedName; node.publicId = publicId; node.systemId = systemId; return node; } }; function Node() { }; Node.prototype = { firstChild : null, lastChild : null, previousSibling : null, nextSibling : null, attributes : null, parentNode : null, childNodes : null, ownerDocument : null, nodeValue : null, namespaceURI : null, prefix : null, localName : null, insertBefore:function(newChild, refChild){//raises return _insertBefore(this,newChild,refChild); }, replaceChild:function(newChild, oldChild){//raises this.insertBefore(newChild,oldChild); if(oldChild){ this.removeChild(oldChild); } }, removeChild:function(oldChild){ return _removeChild(this,oldChild); }, appendChild:function(newChild){ return this.insertBefore(newChild,null); }, hasChildNodes:function(){ return this.firstChild != null; }, cloneNode:function(deep){ return cloneNode(this.ownerDocument||this,this,deep); }, normalize:function(){ var child = this.firstChild; while(child){ var next = child.nextSibling; if(next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE){ this.removeChild(next); child.appendData(next.data); }else{ child.normalize(); child = next; } } }, isSupported:function(feature, version){ return this.ownerDocument.implementation.hasFeature(feature,version); }, hasAttributes:function(){ return this.attributes.length>0; }, lookupPrefix:function(namespaceURI){ var el = this; while(el){ var map = el._nsMap; if(map){ for(var n in map){ if(map[n] == namespaceURI){ return n; } } } el = el.nodeType == 2?el.ownerDocument : el.parentNode; } return null; }, lookupNamespaceURI:function(prefix){ var el = this; while(el){ var map = el._nsMap; if(map){ if(prefix in map){ return map[prefix] ; } } el = el.nodeType == 2?el.ownerDocument : el.parentNode; } return null; }, isDefaultNamespace:function(namespaceURI){ var prefix = this.lookupPrefix(namespaceURI); return prefix == null; } }; function _xmlEncoder(c){ return c == '<' && '&lt;' || c == '>' && '&gt;' || c == '&' && '&amp;' || c == '"' && '&quot;' || '&#'+c.charCodeAt()+';' } copy(NodeType,Node); copy(NodeType,Node.prototype); function _visitNode(node,callback){ if(callback(node)){ return true; } if(node = node.firstChild){ do{ if(_visitNode(node,callback)){return true} }while(node=node.nextSibling) } } function Document(){ } function _onAddAttribute(doc,el,newAttr){ doc && doc._inc++; var ns = newAttr.namespaceURI ; if(ns == 'http://www.w3.org/2000/xmlns/'){ el._nsMap[newAttr.prefix?newAttr.localName:''] = newAttr.value } } function _onRemoveAttribute(doc,el,newAttr,remove){ doc && doc._inc++; var ns = newAttr.namespaceURI ; if(ns == 'http://www.w3.org/2000/xmlns/'){ delete el._nsMap[newAttr.prefix?newAttr.localName:''] } } function _onUpdateChild(doc,el,newChild){ if(doc && doc._inc){ doc._inc++; var cs = el.childNodes; if(newChild){ cs[cs.length++] = newChild; }else{ var child = el.firstChild; var i = 0; while(child){ cs[i++] = child; child =child.nextSibling; } cs.length = i; } } } function _removeChild(parentNode,child){ var previous = child.previousSibling; var next = child.nextSibling; if(previous){ previous.nextSibling = next; }else{ parentNode.firstChild = next } if(next){ next.previousSibling = previous; }else{ parentNode.lastChild = previous; } _onUpdateChild(parentNode.ownerDocument,parentNode); return child; } function _insertBefore(parentNode,newChild,nextChild){ var cp = newChild.parentNode; if(cp){ cp.removeChild(newChild);//remove and update } if(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){ var newFirst = newChild.firstChild; if (newFirst == null) { return newChild; } var newLast = newChild.lastChild; }else{ newFirst = newLast = newChild; } var pre = nextChild ? nextChild.previousSibling : parentNode.lastChild; newFirst.previousSibling = pre; newLast.nextSibling = nextChild; if(pre){ pre.nextSibling = newFirst; }else{ parentNode.firstChild = newFirst; } if(nextChild == null){ parentNode.lastChild = newLast; }else{ nextChild.previousSibling = newLast; } do{ newFirst.parentNode = parentNode; }while(newFirst !== newLast && (newFirst= newFirst.nextSibling)) _onUpdateChild(parentNode.ownerDocument||parentNode,parentNode); if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) { newChild.firstChild = newChild.lastChild = null; } return newChild; } function _appendSingleChild(parentNode,newChild){ var cp = newChild.parentNode; if(cp){ var pre = parentNode.lastChild; cp.removeChild(newChild);//remove and update var pre = parentNode.lastChild; } var pre = parentNode.lastChild; newChild.parentNode = parentNode; newChild.previousSibling = pre; newChild.nextSibling = null; if(pre){ pre.nextSibling = newChild; }else{ parentNode.firstChild = newChild; } parentNode.lastChild = newChild; _onUpdateChild(parentNode.ownerDocument,parentNode,newChild); return newChild; } Document.prototype = { nodeName : '#document', nodeType : DOCUMENT_NODE, doctype : null, documentElement : null, _inc : 1, insertBefore : function(newChild, refChild){//raises if(newChild.nodeType == DOCUMENT_FRAGMENT_NODE){ var child = newChild.firstChild; while(child){ var next = child.nextSibling; this.insertBefore(child,refChild); child = next; } return newChild; } if(this.documentElement == null && newChild.nodeType == 1){ this.documentElement = newChild; } return _insertBefore(this,newChild,refChild),(newChild.ownerDocument = this),newChild; }, removeChild : function(oldChild){ if(this.documentElement == oldChild){ this.documentElement = null; } return _removeChild(this,oldChild); }, importNode : function(importedNode,deep){ return importNode(this,importedNode,deep); }, getElementById : function(id){ var rtv = null; _visitNode(this.documentElement,function(node){ if(node.nodeType == 1){ if(node.getAttribute('id') == id){ rtv = node; return true; } } }) return rtv; }, createElement : function(tagName){ var node = new Element(); node.ownerDocument = this; node.nodeName = tagName; node.tagName = tagName; node.childNodes = new NodeList(); var attrs = node.attributes = new NamedNodeMap(); attrs._ownerElement = node; return node; }, createDocumentFragment : function(){ var node = new DocumentFragment(); node.ownerDocument = this; node.childNodes = new NodeList(); return node; }, createTextNode : function(data){ var node = new Text(); node.ownerDocument = this; node.appendData(data) return node; }, createComment : function(data){ var node = new Comment(); node.ownerDocument = this; node.appendData(data) return node; }, createCDATASection : function(data){ var node = new CDATASection(); node.ownerDocument = this; node.appendData(data) return node; }, createProcessingInstruction : function(target,data){ var node = new ProcessingInstruction(); node.ownerDocument = this; node.tagName = node.target = target; node.nodeValue= node.data = data; return node; }, createAttribute : function(name){ var node = new Attr(); node.ownerDocument = this; node.name = name; node.nodeName = name; node.localName = name; node.specified = true; return node; }, createEntityReference : function(name){ var node = new EntityReference(); node.ownerDocument = this; node.nodeName = name; return node; }, createElementNS : function(namespaceURI,qualifiedName){ var node = new Element(); var pl = qualifiedName.split(':'); var attrs = node.attributes = new NamedNodeMap(); node.childNodes = new NodeList(); node.ownerDocument = this; node.nodeName = qualifiedName; node.tagName = qualifiedName; node.namespaceURI = namespaceURI; if(pl.length == 2){ node.prefix = pl[0]; node.localName = pl[1]; }else{ node.localName = qualifiedName; } attrs._ownerElement = node; return node; }, createAttributeNS : function(namespaceURI,qualifiedName){ var node = new Attr(); var pl = qualifiedName.split(':'); node.ownerDocument = this; node.nodeName = qualifiedName; node.name = qualifiedName; node.namespaceURI = namespaceURI; node.specified = true; if(pl.length == 2){ node.prefix = pl[0]; node.localName = pl[1]; }else{ node.localName = qualifiedName; } return node; } }; _extends(Document,Node); function Element() { this._nsMap = {}; }; Element.prototype = { nodeType : ELEMENT_NODE, hasAttribute : function(name){ return this.getAttributeNode(name)!=null; }, getAttribute : function(name){ var attr = this.getAttributeNode(name); return attr && attr.value || ''; }, getAttributeNode : function(name){ return this.attributes.getNamedItem(name); }, setAttribute : function(name, value){ var attr = this.ownerDocument.createAttribute(name); attr.value = attr.nodeValue = "" + value; this.setAttributeNode(attr) }, removeAttribute : function(name){ var attr = this.getAttributeNode(name) attr && this.removeAttributeNode(attr); }, appendChild:function(newChild){ if(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){ return this.insertBefore(newChild,null); }else{ return _appendSingleChild(this,newChild); } }, setAttributeNode : function(newAttr){ return this.attributes.setNamedItem(newAttr); }, setAttributeNodeNS : function(newAttr){ return this.attributes.setNamedItemNS(newAttr); }, removeAttributeNode : function(oldAttr){ return this.attributes.removeNamedItem(oldAttr.nodeName); }, removeAttributeNS : function(namespaceURI, localName){ var old = this.getAttributeNodeNS(namespaceURI, localName); old && this.removeAttributeNode(old); }, hasAttributeNS : function(namespaceURI, localName){ return this.getAttributeNodeNS(namespaceURI, localName)!=null; }, getAttributeNS : function(namespaceURI, localName){ var attr = this.getAttributeNodeNS(namespaceURI, localName); return attr && attr.value || ''; }, setAttributeNS : function(namespaceURI, qualifiedName, value){ var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName); attr.value = attr.nodeValue = "" + value; this.setAttributeNode(attr) }, getAttributeNodeNS : function(namespaceURI, localName){ return this.attributes.getNamedItemNS(namespaceURI, localName); }, getElementsByTagName : function(tagName){ return new LiveNodeList(this,function(base){ var ls = []; _visitNode(base,function(node){ if(node !== base && node.nodeType == ELEMENT_NODE && (tagName === '*' || node.tagName == tagName)){ ls.push(node); } }); return ls; }); }, getElementsByTagNameNS : function(namespaceURI, localName){ return new LiveNodeList(this,function(base){ var ls = []; _visitNode(base,function(node){ if(node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === '*' || node.namespaceURI === namespaceURI) && (localName === '*' || node.localName == localName)){ ls.push(node); } }); return ls; }); } }; Document.prototype.getElementsByTagName = Element.prototype.getElementsByTagName; Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS; _extends(Element,Node); function Attr() { }; Attr.prototype.nodeType = ATTRIBUTE_NODE; _extends(Attr,Node); function CharacterData() { }; CharacterData.prototype = { data : '', substringData : function(offset, count) { return this.data.substring(offset, offset+count); }, appendData: function(text) { text = this.data+text; this.nodeValue = this.data = text; this.length = text.length; }, insertData: function(offset,text) { this.replaceData(offset,0,text); }, appendChild:function(newChild){ throw new Error(ExceptionMessage[3]) return Node.prototype.appendChild.apply(this,arguments) }, deleteData: function(offset, count) { this.replaceData(offset,count,""); }, replaceData: function(offset, count, text) { var start = this.data.substring(0,offset); var end = this.data.substring(offset+count); text = start + text + end; this.nodeValue = this.data = text; this.length = text.length; } } _extends(CharacterData,Node); function Text() { }; Text.prototype = { nodeName : "#text", nodeType : TEXT_NODE, splitText : function(offset) { var text = this.data; var newText = text.substring(offset); text = text.substring(0, offset); this.data = this.nodeValue = text; this.length = text.length; var newNode = this.ownerDocument.createTextNode(newText); if(this.parentNode){ this.parentNode.insertBefore(newNode, this.nextSibling); } return newNode; } } _extends(Text,CharacterData); function Comment() { }; Comment.prototype = { nodeName : "#comment", nodeType : COMMENT_NODE } _extends(Comment,CharacterData); function CDATASection() { }; CDATASection.prototype = { nodeName : "#cdata-section", nodeType : CDATA_SECTION_NODE } _extends(CDATASection,CharacterData); function DocumentType() { }; DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE; _extends(DocumentType,Node); function Notation() { }; Notation.prototype.nodeType = NOTATION_NODE; _extends(Notation,Node); function Entity() { }; Entity.prototype.nodeType = ENTITY_NODE; _extends(Entity,Node); function EntityReference() { }; EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE; _extends(EntityReference,Node); function DocumentFragment() { }; DocumentFragment.prototype.nodeName = "#document-fragment"; DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE; _extends(DocumentFragment,Node); function ProcessingInstruction() { } ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE; _extends(ProcessingInstruction,Node); function XMLSerializer(){} XMLSerializer.prototype.serializeToString = function(node){ var buf = []; serializeToString(node,buf); return buf.join(''); } Node.prototype.toString =function(){ return XMLSerializer.prototype.serializeToString(this); } function serializeToString(node,buf){ switch(node.nodeType){ case ELEMENT_NODE: var attrs = node.attributes; var len = attrs.length; var child = node.firstChild; var nodeName = node.tagName; var isHTML = htmlns === node.namespaceURI buf.push('<',nodeName); for(var i=0;i<len;i++){ serializeToString(attrs.item(i),buf); } if(child || isHTML && !/^(?:meta|link|img|br|hr|input|button)$/i.test(nodeName)){ buf.push('>'); if(isHTML && /^script$/i.test(nodeName)){ if(child){ buf.push(child.data); } }else{ while(child){ serializeToString(child,buf); child = child.nextSibling; } } buf.push('</',nodeName,'>'); }else{ buf.push('/>'); } return; case DOCUMENT_NODE: case DOCUMENT_FRAGMENT_NODE: var child = node.firstChild; while(child){ serializeToString(child,buf); child = child.nextSibling; } return; case ATTRIBUTE_NODE: return buf.push(' ',node.name,'="',node.value.replace(/[<&"]/g,_xmlEncoder),'"'); case TEXT_NODE: return buf.push(node.data.replace(/[<&]/g,_xmlEncoder)); case CDATA_SECTION_NODE: return buf.push( '<![CDATA[',node.data,']]>'); case COMMENT_NODE: return buf.push( "<!--",node.data,"-->"); case DOCUMENT_TYPE_NODE: var pubid = node.publicId; var sysid = node.systemId; buf.push('<!DOCTYPE ',node.name); if(pubid){ buf.push(' PUBLIC "',pubid); if (sysid && sysid!='.') { buf.push( '" "',sysid); } buf.push('">'); }else if(sysid && sysid!='.'){ buf.push(' SYSTEM "',sysid,'">'); }else{ var sub = node.internalSubset; if(sub){ buf.push(" [",sub,"]"); } buf.push(">"); } return; case PROCESSING_INSTRUCTION_NODE: return buf.push( "<?",node.target," ",node.data,"?>"); case ENTITY_REFERENCE_NODE: return buf.push( '&',node.nodeName,';'); default: buf.push('??',node.nodeName); } } function importNode(doc,node,deep){ var node2; switch (node.nodeType) { case ELEMENT_NODE: node2 = node.cloneNode(false); node2.ownerDocument = doc; case DOCUMENT_FRAGMENT_NODE: break; case ATTRIBUTE_NODE: deep = true; break; } if(!node2){ node2 = node.cloneNode(false);//false } node2.ownerDocument = doc; node2.parentNode = null; if(deep){ var child = node.firstChild; while(child){ node2.appendChild(importNode(doc,child,deep)); child = child.nextSibling; } } return node2; } function cloneNode(doc,node,deep){ var node2 = new node.constructor(); for(var n in node){ var v = node[n]; if(typeof v != 'object' ){ if(v != node2[n]){ node2[n] = v; } } } if(node.childNodes){ node2.childNodes = new NodeList(); } node2.ownerDocument = doc; switch (node2.nodeType) { case ELEMENT_NODE: var attrs = node.attributes; var attrs2 = node2.attributes = new NamedNodeMap(); var len = attrs.length attrs2._ownerElement = node2; for(var i=0;i<len;i++){ node2.setAttributeNode(cloneNode(doc,attrs.item(i),true)); } break;; case ATTRIBUTE_NODE: deep = true; } if(deep){ var child = node.firstChild; while(child){ node2.appendChild(cloneNode(doc,child,deep)); child = child.nextSibling; } } return node2; } function __set__(object,key,value){ object[key] = value } try{ if(Object.defineProperty){ Object.defineProperty(LiveNodeList.prototype,'length',{ get:function(){ _updateLiveList(this); return this.$$length; } }); Object.defineProperty(Node.prototype,'textContent',{ get:function(){ return getTextContent(this); }, set:function(data){ switch(this.nodeType){ case 1: case 11: while(this.firstChild){ this.removeChild(this.firstChild); } if(data || String(data)){ this.appendChild(this.ownerDocument.createTextNode(data)); } break; default: this.data = data; this.value = value; this.nodeValue = data; } } }) function getTextContent(node){ switch(node.nodeType){ case 1: case 11: var buf = []; node = node.firstChild; while(node){ if(node.nodeType!==7 && node.nodeType !==8){ buf.push(getTextContent(node)); } node = node.nextSibling; } return buf.join(''); default: return node.nodeValue; } } __set__ = function(object,key,value){ object['$$'+key] = value } } }catch(e){//ie8 } return DOMImplementation; }); define("ace/mode/xml/dom-parser",["require","exports","module","ace/mode/xml/sax","ace/mode/xml/dom"], function(require, exports, module) { 'use strict'; var XMLReader = require('./sax'), DOMImplementation = require('./dom'); function DOMParser(options){ this.options = options ||{locator:{}}; } DOMParser.prototype.parseFromString = function(source,mimeType){ var options = this.options; var sax = new XMLReader(); var domBuilder = options.domBuilder || new DOMHandler();//contentHandler and LexicalHandler var errorHandler = options.errorHandler; var locator = options.locator; var defaultNSMap = options.xmlns||{}; var entityMap = {'lt':'<','gt':'>','amp':'&','quot':'"','apos':"'"} if(locator){ domBuilder.setDocumentLocator(locator) } sax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator); sax.domBuilder = options.domBuilder || domBuilder; if(/\/x?html?$/.test(mimeType)){ entityMap.nbsp = '\xa0'; entityMap.copy = '\xa9'; defaultNSMap['']= 'http://www.w3.org/1999/xhtml'; } if(source){ sax.parse(source,defaultNSMap,entityMap); }else{ sax.errorHandler.error("invalid document source"); } return domBuilder.document; } function buildErrorHandler(errorImpl,domBuilder,locator){ if(!errorImpl){ if(domBuilder instanceof DOMHandler){ return domBuilder; } errorImpl = domBuilder ; } var errorHandler = {} var isCallback = errorImpl instanceof Function; locator = locator||{} function build(key){ var fn = errorImpl[key]; if(!fn){ if(isCallback){ fn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl; }else{ var i=arguments.length; while(--i){ if(fn = errorImpl[arguments[i]]){ break; } } } } errorHandler[key] = fn && function(msg){ fn(msg+_locator(locator), msg, locator); }||function(){}; } build('warning','warn'); build('error','warn','warning'); build('fatalError','warn','warning','error'); return errorHandler; } function DOMHandler() { this.cdata = false; } function position(locator,node){ node.lineNumber = locator.lineNumber; node.columnNumber = locator.columnNumber; } DOMHandler.prototype = { startDocument : function() { this.document = new DOMImplementation().createDocument(null, null, null); if (this.locator) { this.document.documentURI = this.locator.systemId; } }, startElement:function(namespaceURI, localName, qName, attrs) { var doc = this.document; var el = doc.createElementNS(namespaceURI, qName||localName); var len = attrs.length; appendElement(this, el); this.currentElement = el; this.locator && position(this.locator,el) for (var i = 0 ; i < len; i++) { var namespaceURI = attrs.getURI(i); var value = attrs.getValue(i); var qName = attrs.getQName(i); var attr = doc.createAttributeNS(namespaceURI, qName); if( attr.getOffset){ position(attr.getOffset(1),attr) } attr.value = attr.nodeValue = value; el.setAttributeNode(attr) } }, endElement:function(namespaceURI, localName, qName) { var current = this.currentElement var tagName = current.tagName; this.currentElement = current.parentNode; }, startPrefixMapping:function(prefix, uri) { }, endPrefixMapping:function(prefix) { }, processingInstruction:function(target, data) { var ins = this.document.createProcessingInstruction(target, data); this.locator && position(this.locator,ins) appendElement(this, ins); }, ignorableWhitespace:function(ch, start, length) { }, characters:function(chars, start, length) { chars = _toString.apply(this,arguments) if(this.currentElement && chars){ if (this.cdata) { var charNode = this.document.createCDATASection(chars); this.currentElement.appendChild(charNode); } else { var charNode = this.document.createTextNode(chars); this.currentElement.appendChild(charNode); } this.locator && position(this.locator,charNode) } }, skippedEntity:function(name) { }, endDocument:function() { this.document.normalize(); }, setDocumentLocator:function (locator) { if(this.locator = locator){// && !('lineNumber' in locator)){ locator.lineNumber = 0; } }, comment:function(chars, start, length) { chars = _toString.apply(this,arguments) var comm = this.document.createComment(chars); this.locator && position(this.locator,comm) appendElement(this, comm); }, startCDATA:function() { this.cdata = true; }, endCDATA:function() { this.cdata = false; }, startDTD:function(name, publicId, systemId) { var impl = this.document.implementation; if (impl && impl.createDocumentType) { var dt = impl.createDocumentType(name, publicId, systemId); this.locator && position(this.locator,dt) appendElement(this, dt); } }, warning:function(error) { console.warn(error,_locator(this.locator)); }, error:function(error) { console.error(error,_locator(this.locator)); }, fatalError:function(error) { console.error(error,_locator(this.locator)); throw error; } } function _locator(l){ if(l){ return '\n@'+(l.systemId ||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']' } } function _toString(chars,start,length){ if(typeof chars == 'string'){ return chars.substr(start,length) }else{//java sax connect width xmldom on rhino(what about: "? && !(chars instanceof String)") if(chars.length >= start+length || start){ return new java.lang.String(chars,start,length)+''; } return chars; } } "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(key){ DOMHandler.prototype[key] = function(){return null} }) function appendElement (hander,node) { if (!hander.currentElement) { hander.document.appendChild(node); } else { hander.currentElement.appendChild(node); } }//appendChild and setAttributeNS are preformance key return { DOMParser: DOMParser }; }); define("ace/mode/xml_worker",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/worker/mirror","ace/mode/xml/dom-parser"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var Mirror = require("../worker/mirror").Mirror; var DOMParser = require("./xml/dom-parser").DOMParser; var Worker = exports.Worker = function(sender) { Mirror.call(this, sender); this.setTimeout(400); this.context = null; }; oop.inherits(Worker, Mirror); (function() { this.setOptions = function(options) { this.context = options.context; }; this.onUpdate = function() { var value = this.doc.getValue(); if (!value) return; var parser = new DOMParser(); var errors = []; parser.options.errorHandler = { fatalError: function(fullMsg, errorMsg, locator) { errors.push({ row: locator.lineNumber, column: locator.columnNumber, text: errorMsg, type: "error" }); }, error: function(fullMsg, errorMsg, locator) { errors.push({ row: locator.lineNumber, column: locator.columnNumber, text: errorMsg, type: "error" }); }, warning: function(fullMsg, errorMsg, locator) { errors.push({ row: locator.lineNumber, column: locator.columnNumber, text: errorMsg, type: "warning" }); } }; parser.parseFromString(value); this.sender.emit("error", errors); }; }).call(Worker.prototype); }); define("ace/lib/es5-shim",["require","exports","module"], function(require, exports, module) { function Empty() {} if (!Function.prototype.bind) { Function.prototype.bind = function bind(that) { // .length is 1 var target = this; if (typeof target != "function") { throw new TypeError("Function.prototype.bind called on incompatible " + target); } var args = slice.call(arguments, 1); // for normal call var bound = function () { if (this instanceof bound) { var result = target.apply( this, args.concat(slice.call(arguments)) ); if (Object(result) === result) { return result; } return this; } else { return target.apply( that, args.concat(slice.call(arguments)) ); } }; if(target.prototype) { Empty.prototype = target.prototype; bound.prototype = new Empty(); Empty.prototype = null; } return bound; }; } var call = Function.prototype.call; var prototypeOfArray = Array.prototype; var prototypeOfObject = Object.prototype; var slice = prototypeOfArray.slice; var _toString = call.bind(prototypeOfObject.toString); var owns = call.bind(prototypeOfObject.hasOwnProperty); var defineGetter; var defineSetter; var lookupGetter; var lookupSetter; var supportsAccessors; if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) { defineGetter = call.bind(prototypeOfObject.__defineGetter__); defineSetter = call.bind(prototypeOfObject.__defineSetter__); lookupGetter = call.bind(prototypeOfObject.__lookupGetter__); lookupSetter = call.bind(prototypeOfObject.__lookupSetter__); } if ([1,2].splice(0).length != 2) { if(function() { // test IE < 9 to splice bug - see issue #138 function makeArray(l) { var a = new Array(l+2); a[0] = a[1] = 0; return a; } var array = [], lengthBefore; array.splice.apply(array, makeArray(20)); array.splice.apply(array, makeArray(26)); lengthBefore = array.length; //46 array.splice(5, 0, "XXX"); // add one element lengthBefore + 1 == array.length if (lengthBefore + 1 == array.length) { return true;// has right splice implementation without bugs } }()) {//IE 6/7 var array_splice = Array.prototype.splice; Array.prototype.splice = function(start, deleteCount) { if (!arguments.length) { return []; } else { return array_splice.apply(this, [ start === void 0 ? 0 : start, deleteCount === void 0 ? (this.length - start) : deleteCount ].concat(slice.call(arguments, 2))) } }; } else {//IE8 Array.prototype.splice = function(pos, removeCount){ var length = this.length; if (pos > 0) { if (pos > length) pos = length; } else if (pos == void 0) { pos = 0; } else if (pos < 0) { pos = Math.max(length + pos, 0); } if (!(pos+removeCount < length)) removeCount = length - pos; var removed = this.slice(pos, pos+removeCount); var insert = slice.call(arguments, 2); var add = insert.length; if (pos === length) { if (add) { this.push.apply(this, insert); } } else { var remove = Math.min(removeCount, length - pos); var tailOldPos = pos + remove; var tailNewPos = tailOldPos + add - remove; var tailCount = length - tailOldPos; var lengthAfterRemove = length - remove; if (tailNewPos < tailOldPos) { // case A for (var i = 0; i < tailCount; ++i) { this[tailNewPos+i] = this[tailOldPos+i]; } } else if (tailNewPos > tailOldPos) { // case B for (i = tailCount; i--; ) { this[tailNewPos+i] = this[tailOldPos+i]; } } // else, add == remove (nothing to do) if (add && pos === lengthAfterRemove) { this.length = lengthAfterRemove; // truncate array this.push.apply(this, insert); } else { this.length = lengthAfterRemove + add; // reserves space for (i = 0; i < add; ++i) { this[pos+i] = insert[i]; } } } return removed; }; } } if (!Array.isArray) { Array.isArray = function isArray(obj) { return _toString(obj) == "[object Array]"; }; } var boxedString = Object("a"), splitString = boxedString[0] != "a" || !(0 in boxedString); if (!Array.prototype.forEach) { Array.prototype.forEach = function forEach(fun /*, thisp*/) { var object = toObject(this), self = splitString && _toString(this) == "[object String]" ? this.split("") : object, thisp = arguments[1], i = -1, length = self.length >>> 0; if (_toString(fun) != "[object Function]") { throw new TypeError(); // TODO message } while (++i < length) { if (i in self) { fun.call(thisp, self[i], i, object); } } }; } if (!Array.prototype.map) { Array.prototype.map = function map(fun /*, thisp*/) { var object = toObject(this), self = splitString && _toString(this) == "[object String]" ? this.split("") : object, length = self.length >>> 0, result = Array(length), thisp = arguments[1]; if (_toString(fun) != "[object Function]") { throw new TypeError(fun + " is not a function"); } for (var i = 0; i < length; i++) { if (i in self) result[i] = fun.call(thisp, self[i], i, object); } return result; }; } if (!Array.prototype.filter) { Array.prototype.filter = function filter(fun /*, thisp */) { var object = toObject(this), self = splitString && _toString(this) == "[object String]" ? this.split("") : object, length = self.length >>> 0, result = [], value, thisp = arguments[1]; if (_toString(fun) != "[object Function]") { throw new TypeError(fun + " is not a function"); } for (var i = 0; i < length; i++) { if (i in self) { value = self[i]; if (fun.call(thisp, value, i, object)) { result.push(value); } } } return result; }; } if (!Array.prototype.every) { Array.prototype.every = function every(fun /*, thisp */) { var object = toObject(this), self = splitString && _toString(this) == "[object String]" ? this.split("") : object, length = self.length >>> 0, thisp = arguments[1]; if (_toString(fun) != "[object Function]") { throw new TypeError(fun + " is not a function"); } for (var i = 0; i < length; i++) { if (i in self && !fun.call(thisp, self[i], i, object)) { return false; } } return true; }; } if (!Array.prototype.some) { Array.prototype.some = function some(fun /*, thisp */) { var object = toObject(this), self = splitString && _toString(this) == "[object String]" ? this.split("") : object, length = self.length >>> 0, thisp = arguments[1]; if (_toString(fun) != "[object Function]") { throw new TypeError(fun + " is not a function"); } for (var i = 0; i < length; i++) { if (i in self && fun.call(thisp, self[i], i, object)) { return true; } } return false; }; } if (!Array.prototype.reduce) { Array.prototype.reduce = function reduce(fun /*, initial*/) { var object = toObject(this), self = splitString && _toString(this) == "[object String]" ? this.split("") : object, length = self.length >>> 0; if (_toString(fun) != "[object Function]") { throw new TypeError(fun + " is not a function"); } if (!length && arguments.length == 1) { throw new TypeError("reduce of empty array with no initial value"); } var i = 0; var result; if (arguments.length >= 2) { result = arguments[1]; } else { do { if (i in self) { result = self[i++]; break; } if (++i >= length) { throw new TypeError("reduce of empty array with no initial value"); } } while (true); } for (; i < length; i++) { if (i in self) { result = fun.call(void 0, result, self[i], i, object); } } return result; }; } if (!Array.prototype.reduceRight) { Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) { var object = toObject(this), self = splitString && _toString(this) == "[object String]" ? this.split("") : object, length = self.length >>> 0; if (_toString(fun) != "[object Function]") { throw new TypeError(fun + " is not a function"); } if (!length && arguments.length == 1) { throw new TypeError("reduceRight of empty array with no initial value"); } var result, i = length - 1; if (arguments.length >= 2) { result = arguments[1]; } else { do { if (i in self) { result = self[i--]; break; } if (--i < 0) { throw new TypeError("reduceRight of empty array with no initial value"); } } while (true); } do { if (i in this) { result = fun.call(void 0, result, self[i], i, object); } } while (i--); return result; }; } if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) { Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) { var self = splitString && _toString(this) == "[object String]" ? this.split("") : toObject(this), length = self.length >>> 0; if (!length) { return -1; } var i = 0; if (arguments.length > 1) { i = toInteger(arguments[1]); } i = i >= 0 ? i : Math.max(0, length + i); for (; i < length; i++) { if (i in self && self[i] === sought) { return i; } } return -1; }; } if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) { Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) { var self = splitString && _toString(this) == "[object String]" ? this.split("") : toObject(this), length = self.length >>> 0; if (!length) { return -1; } var i = length - 1; if (arguments.length > 1) { i = Math.min(i, toInteger(arguments[1])); } i = i >= 0 ? i : length - Math.abs(i); for (; i >= 0; i--) { if (i in self && sought === self[i]) { return i; } } return -1; }; } if (!Object.getPrototypeOf) { Object.getPrototypeOf = function getPrototypeOf(object) { return object.__proto__ || ( object.constructor ? object.constructor.prototype : prototypeOfObject ); }; } if (!Object.getOwnPropertyDescriptor) { var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " + "non-object: "; Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) { if ((typeof object != "object" && typeof object != "function") || object === null) throw new TypeError(ERR_NON_OBJECT + object); if (!owns(object, property)) return; var descriptor, getter, setter; descriptor = { enumerable: true, configurable: true }; if (supportsAccessors) { var prototype = object.__proto__; object.__proto__ = prototypeOfObject; var getter = lookupGetter(object, property); var setter = lookupSetter(object, property); object.__proto__ = prototype; if (getter || setter) { if (getter) descriptor.get = getter; if (setter) descriptor.set = setter; return descriptor; } } descriptor.value = object[property]; return descriptor; }; } if (!Object.getOwnPropertyNames) { Object.getOwnPropertyNames = function getOwnPropertyNames(object) { return Object.keys(object); }; } if (!Object.create) { var createEmpty; if (Object.prototype.__proto__ === null) { createEmpty = function () { return { "__proto__": null }; }; } else { createEmpty = function () { var empty = {}; for (var i in empty) empty[i] = null; empty.constructor = empty.hasOwnProperty = empty.propertyIsEnumerable = empty.isPrototypeOf = empty.toLocaleString = empty.toString = empty.valueOf = empty.__proto__ = null; return empty; } } Object.create = function create(prototype, properties) { var object; if (prototype === null) { object = createEmpty(); } else { if (typeof prototype != "object") throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'"); var Type = function () {}; Type.prototype = prototype; object = new Type(); object.__proto__ = prototype; } if (properties !== void 0) Object.defineProperties(object, properties); return object; }; } function doesDefinePropertyWork(object) { try { Object.defineProperty(object, "sentinel", {}); return "sentinel" in object; } catch (exception) { } } if (Object.defineProperty) { var definePropertyWorksOnObject = doesDefinePropertyWork({}); var definePropertyWorksOnDom = typeof document == "undefined" || doesDefinePropertyWork(document.createElement("div")); if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) { var definePropertyFallback = Object.defineProperty; } } if (!Object.defineProperty || definePropertyFallback) { var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: "; var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: " var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " + "on this javascript engine"; Object.defineProperty = function defineProperty(object, property, descriptor) { if ((typeof object != "object" && typeof object != "function") || object === null) throw new TypeError(ERR_NON_OBJECT_TARGET + object); if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null) throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor); if (definePropertyFallback) { try { return definePropertyFallback.call(Object, object, property, descriptor); } catch (exception) { } } if (owns(descriptor, "value")) { if (supportsAccessors && (lookupGetter(object, property) || lookupSetter(object, property))) { var prototype = object.__proto__; object.__proto__ = prototypeOfObject; delete object[property]; object[property] = descriptor.value; object.__proto__ = prototype; } else { object[property] = descriptor.value; } } else { if (!supportsAccessors) throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); if (owns(descriptor, "get")) defineGetter(object, property, descriptor.get); if (owns(descriptor, "set")) defineSetter(object, property, descriptor.set); } return object; }; } if (!Object.defineProperties) { Object.defineProperties = function defineProperties(object, properties) { for (var property in properties) { if (owns(properties, property)) Object.defineProperty(object, property, properties[property]); } return object; }; } if (!Object.seal) { Object.seal = function seal(object) { return object; }; } if (!Object.freeze) { Object.freeze = function freeze(object) { return object; }; } try { Object.freeze(function () {}); } catch (exception) { Object.freeze = (function freeze(freezeObject) { return function freeze(object) { if (typeof object == "function") { return object; } else { return freezeObject(object); } }; })(Object.freeze); } if (!Object.preventExtensions) { Object.preventExtensions = function preventExtensions(object) { return object; }; } if (!Object.isSealed) { Object.isSealed = function isSealed(object) { return false; }; } if (!Object.isFrozen) { Object.isFrozen = function isFrozen(object) { return false; }; } if (!Object.isExtensible) { Object.isExtensible = function isExtensible(object) { if (Object(object) === object) { throw new TypeError(); // TODO message } var name = ''; while (owns(object, name)) { name += '?'; } object[name] = true; var returnValue = owns(object, name); delete object[name]; return returnValue; }; } if (!Object.keys) { var hasDontEnumBug = true, dontEnums = [ "toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "constructor" ], dontEnumsLength = dontEnums.length; for (var key in {"toString": null}) { hasDontEnumBug = false; } Object.keys = function keys(object) { if ( (typeof object != "object" && typeof object != "function") || object === null ) { throw new TypeError("Object.keys called on a non-object"); } var keys = []; for (var name in object) { if (owns(object, name)) { keys.push(name); } } if (hasDontEnumBug) { for (var i = 0, ii = dontEnumsLength; i < ii; i++) { var dontEnum = dontEnums[i]; if (owns(object, dontEnum)) { keys.push(dontEnum); } } } return keys; }; } if (!Date.now) { Date.now = function now() { return new Date().getTime(); }; } var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" + "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" + "\u2029\uFEFF"; if (!String.prototype.trim || ws.trim()) { ws = "[" + ws + "]"; var trimBeginRegexp = new RegExp("^" + ws + ws + "*"), trimEndRegexp = new RegExp(ws + ws + "*$"); String.prototype.trim = function trim() { return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, ""); }; } function toInteger(n) { n = +n; if (n !== n) { // isNaN n = 0; } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) { n = (n > 0 || -1) * Math.floor(Math.abs(n)); } return n; } function isPrimitive(input) { var type = typeof input; return ( input === null || type === "undefined" || type === "boolean" || type === "number" || type === "string" ); } function toPrimitive(input) { var val, valueOf, toString; if (isPrimitive(input)) { return input; } valueOf = input.valueOf; if (typeof valueOf === "function") { val = valueOf.call(input); if (isPrimitive(val)) { return val; } } toString = input.toString; if (typeof toString === "function") { val = toString.call(input); if (isPrimitive(val)) { return val; } } throw new TypeError(); } var toObject = function (o) { if (o == null) { // this matches both null and undefined throw new TypeError("can't convert "+o+" to object"); } return Object(o); }; });
(function ($) { $.fn.characterCounter = function(){ return this.each(function(){ itHasLengthAttribute = $(this).attr('length') != undefined; if(itHasLengthAttribute){ $(this).on('input', updateCounter); $(this).on('focus', updateCounter); $(this).on('blur', removeCounterElement); addCounterElement($(this)); } }); }; function updateCounter(){ var maxLength = +$(this).attr('length'), actualLength = +$(this).val().length, isValidLength = actualLength <= maxLength; $(this).parent().find('span[class="character-counter"]') .html( actualLength + '/' + maxLength); addInputStyle(isValidLength, $(this)); } function addCounterElement($input){ $counterElement = $('<span/>') .addClass('character-counter') .css('float','right') .css('font-size','12px') .css('height', 1); $input.parent().append($counterElement); } function removeCounterElement(){ $(this).parent().find('span[class="character-counter"]').html(''); } function addInputStyle(isValidLength, $input){ inputHasInvalidClass = $input.hasClass('invalid'); if (isValidLength && inputHasInvalidClass) { $input.removeClass('invalid'); } else if(!isValidLength && !inputHasInvalidClass){ $input.removeClass('valid'); $input.addClass('invalid'); } } $(document).ready(function(){ $('input, textarea').characterCounter(); }); }( jQuery ));
var core = require('../../core'); // @see https://github.com/substack/brfs/issues/25 var fs = require('fs'); /** * The BlurYTintFilter applies a vertical Gaussian blur to an object. * * @class * @extends PIXI.AbstractFilter * @memberof PIXI.filters */ function BlurYTintFilter() { core.AbstractFilter.call(this, // vertex shader fs.readFileSync(__dirname + '/blurYTint.vert', 'utf8'), // fragment shader fs.readFileSync(__dirname + '/blurYTint.frag', 'utf8'), // set the uniforms { blur: { type: '1f', value: 1 / 512 }, color: { type: 'c', value: [0,0,0]}, alpha: { type: '1f', value: 0.7 }, offset: { type: '2f', value:[5, 5]}, strength: { type: '1f', value:1} } ); this.passes = 1; this.strength = 4; } BlurYTintFilter.prototype = Object.create(core.AbstractFilter.prototype); BlurYTintFilter.prototype.constructor = BlurYTintFilter; module.exports = BlurYTintFilter; BlurYTintFilter.prototype.applyFilter = function (renderer, input, output, clear) { var shader = this.getShader(renderer); this.uniforms.strength.value = this.strength / 4 / this.passes * (input.frame.height / input.size.height); if(this.passes === 1) { renderer.filterManager.applyFilter(shader, input, output, clear); } else { var renderTarget = renderer.filterManager.getRenderTarget(true); var flip = input; var flop = renderTarget; for(var i = 0; i < this.passes-1; i++) { renderer.filterManager.applyFilter(shader, flip, flop, clear); var temp = flop; flop = flip; flip = temp; } renderer.filterManager.applyFilter(shader, flip, output, clear); renderer.filterManager.returnRenderTarget(renderTarget); } }; Object.defineProperties(BlurYTintFilter.prototype, { /** * Sets the strength of both the blur. * * @member {number} * @memberof BlurYFilter# * @default 2 */ blur: { get: function () { return this.strength; }, set: function (value) { this.padding = value * 0.5; this.strength = value; } } });