diff --git a/dist/cli/helpers/abe-create.js b/dist/cli/helpers/abe-create.js index 303639d..0f1e515 100644 --- a/dist/cli/helpers/abe-create.js +++ b/dist/cli/helpers/abe-create.js @@ -8,6 +8,7 @@ var _cli = require('../../cli'); var create = function create(template, path, name, req) { var forceJson = arguments.length <= 4 || arguments[4] === undefined ? {} : arguments[4]; + var duplicate = arguments.length <= 5 || arguments[5] === undefined ? false : arguments[5]; var p = new Promise(function (resolve, reject) { _cli.Hooks.instance.trigger('beforeCreate', template, path, name, req, forceJson); @@ -24,6 +25,9 @@ var create = function create(template, path, name, req) { var json = forceJson ? forceJson : {}; var tpl = templatePath; var text = (0, _cli.getTemplate)(tpl); + if (duplicate) { + json = (0, _cli.removeDuplicateAttr)(text, json); + } text = _cli.Util.removeDataList(text); var resHook = _cli.Hooks.instance.trigger('beforeFirstSave', filePath, req.query, json, text); filePath = resHook.filePath; diff --git a/dist/cli/helpers/abe-duplicate.js b/dist/cli/helpers/abe-duplicate.js index 9302f3e..557784c 100644 --- a/dist/cli/helpers/abe-duplicate.js +++ b/dist/cli/helpers/abe-duplicate.js @@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", { var _cli = require('../../cli'); var duplicate = function duplicate(oldFilePath, template, path, name, req) { - var deleteFiles = arguments.length <= 5 || arguments[5] === undefined ? false : arguments[5]; + var isUpdate = arguments.length <= 5 || arguments[5] === undefined ? false : arguments[5]; var p = new Promise(function (resolve, reject) { - _cli.Hooks.instance.trigger('beforeDuplicate', oldFilePath, template, path, name, req, deleteFiles); + _cli.Hooks.instance.trigger('beforeDuplicate', oldFilePath, template, path, name, req, isUpdate); if (typeof oldFilePath !== 'undefined' && oldFilePath !== null) { var url = _cli.fileUtils.concatPath(_cli.config.root, _cli.config.draft.url, oldFilePath); @@ -27,7 +27,7 @@ var duplicate = function duplicate(oldFilePath, template, path, name, req) { if (latest.length) { url = latest[0].path; } - } else if (deleteFiles) { + } else if (isUpdate) { files = _cli.FileParser.getFiles(folderFilePath, true, 2); revisions = _cli.fileAttr.getFilesRevision(files, url); } @@ -38,17 +38,17 @@ var duplicate = function duplicate(oldFilePath, template, path, name, req) { delete json.abe_meta; } - if (deleteFiles) { - _cli.Hooks.instance.trigger('beforeUpdate', json, oldFilePath, template, path, name, req, deleteFiles); + if (isUpdate) { + _cli.Hooks.instance.trigger('beforeUpdate', json, oldFilePath, template, path, name, req, isUpdate); Array.prototype.forEach.call(revisions, function (revision) { if (typeof revision.path !== 'undefined' && revision.path !== null) { _cli.FileParser.deleteFile(revision.path); } }); } - _cli.Hooks.instance.trigger('afterDuplicate', json, oldFilePath, template, path, name, req, deleteFiles); + _cli.Hooks.instance.trigger('afterDuplicate', json, oldFilePath, template, path, name, req, isUpdate); - var pCreate = (0, _cli.abeCreate)(template, path, name, req, json); + var pCreate = (0, _cli.abeCreate)(template, path, name, req, json, isUpdate ? false : true); pCreate.then(function (resSave) { resolve(resSave); }, function () { diff --git a/dist/cli/helpers/abe-remove-duplicate-attr.js b/dist/cli/helpers/abe-remove-duplicate-attr.js new file mode 100644 index 0000000..7c4fae2 --- /dev/null +++ b/dist/cli/helpers/abe-remove-duplicate-attr.js @@ -0,0 +1,54 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: 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; }; + +exports.default = removeDuplicateAttr; + +var _cli = require('../../cli'); + +function recurseDeleteKey(currentLevel, arrayKeyAttr) { + var currentArray = arrayKeyAttr.slice(0); + + if (arrayKeyAttr.length === 1) { + delete currentLevel[arrayKeyAttr[0]]; + } + + Array.prototype.forEach.call(currentArray, function (key) { + if (typeof currentLevel[key] !== 'undefined' && currentLevel[key] !== null) { + currentLevel = currentLevel[key]; + currentArray.shift(); + recurseDeleteKey(currentLevel, currentArray); + if ((typeof currentLevel === 'undefined' ? 'undefined' : _typeof(currentLevel)) === 'object' && Object.prototype.toString.call(currentLevel) === '[object Array]') { + Array.prototype.forEach.call(currentLevel, function (item) { + recurseDeleteKey(item, currentArray); + }); + } else { + recurseDeleteKey(currentLevel, currentArray); + } + } + }); +} + +function removeDuplicateAttr(text, json) { + var regAbe = /{{abe[\S\s].*?duplicate=['|"]([\S\s].*?['|"| ]}})/g; + var matches = text.match(regAbe); + var requiredValue = 0; + var complete = 0; + if (typeof matches !== 'undefined' && matches !== null) { + + Array.prototype.forEach.call(matches, function (match) { + var keyAttr = (0, _cli.getAttr)(match, 'key'); + + if (typeof match !== 'undefined' && match !== null) { + var arrayKeyAttr = keyAttr.split('.'); + recurseDeleteKey(json, arrayKeyAttr); + } + }); + } + + return json; +} \ No newline at end of file diff --git a/dist/cli/helpers/remove-abe-deep-val.js b/dist/cli/helpers/remove-abe-deep-val.js new file mode 100644 index 0000000..79a5c3e --- /dev/null +++ b/dist/cli/helpers/remove-abe-deep-val.js @@ -0,0 +1,41 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: 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 deep_value = function deep_value(obj, path) { + + if (path.indexOf('.') === -1) { + return typeof obj[path] !== 'undefined' && obj[path] !== null ? obj[path] : null; + } + + var pathSplit = path.split('.'); + var res = JSON.parse(JSON.stringify(obj)); + + while (pathSplit.length > 0) { + + if (typeof res[pathSplit[0]] !== 'undefined' && res[pathSplit[0]] !== null) { + if (_typeof(res[pathSplit[0]]) === 'object' && Object.prototype.toString.call(res[pathSplit[0]]) === '[object Array]') { + var resArray = []; + + Array.prototype.forEach.call(res[pathSplit[0]], function (item) { + resArray.push(deep_value(item, pathSplit.join('.').replace(pathSplit[0] + '.', ''))); + }); + res = resArray; + pathSplit.shift(); + } else { + res = res[pathSplit[0]]; + } + } else { + return null; + } + pathSplit.shift(); + } + + return res; +}; + +exports.default = deep_value; \ No newline at end of file diff --git a/dist/cli/index.js b/dist/cli/index.js index 778c071..d83bf0e 100755 --- a/dist/cli/index.js +++ b/dist/cli/index.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.compileAbe = exports.dateUnslug = exports.dateSlug = exports.saveJson = exports.checkRequired = exports.Locales = exports.Plugins = exports.Hooks = exports.save = exports.Page = exports.log = exports.getTemplate = exports.cli = exports.config = exports.escapeTextToRegex = exports.getEnclosingTags = exports.getAttr = exports.ifCond = exports.ifIn = exports.printConfig = exports.cleanTab = exports.folders = exports.attrAbe = exports.abeEngine = exports.listPage = exports.moduloIf = exports.className = exports.printJson = exports.notEmpty = exports.printBlock = exports.translate = exports.abeProcess = exports.Sql = exports.Create = exports.testObj = exports.math = exports.abeImport = exports.printInput = exports.fileUtils = exports.folderUtils = exports.FileParser = exports.cleanSlug = exports.slugify = exports.abeDuplicate = exports.deep_value = exports.abeCreate = exports.Util = exports.Handlebars = exports.fse = exports.moment = exports.fileAttr = undefined; +exports.compileAbe = exports.dateUnslug = exports.dateSlug = exports.saveJson = exports.checkRequired = exports.Locales = exports.Plugins = exports.Hooks = exports.save = exports.Page = exports.removeDuplicateAttr = exports.log = exports.getTemplate = exports.cli = exports.config = exports.escapeTextToRegex = exports.getEnclosingTags = exports.getAttr = exports.ifCond = exports.ifIn = exports.printConfig = exports.cleanTab = exports.folders = exports.attrAbe = exports.abeEngine = exports.listPage = exports.moduloIf = exports.className = exports.printJson = exports.notEmpty = exports.printBlock = exports.translate = exports.abeProcess = exports.Sql = exports.Create = exports.testObj = exports.math = exports.abeImport = exports.printInput = exports.fileUtils = exports.folderUtils = exports.FileParser = exports.cleanSlug = exports.slugify = exports.abeDuplicate = exports.deep_value = exports.abeCreate = exports.Util = exports.Handlebars = exports.fse = exports.moment = exports.fileAttr = undefined; var _fileAttr = require('./helpers/file-attr'); @@ -69,6 +69,10 @@ var _abeLogs = require('./helpers/abe-logs'); var _abeLogs2 = _interopRequireDefault(_abeLogs); +var _abeRemoveDuplicateAttr = require('./helpers/abe-remove-duplicate-attr'); + +var _abeRemoveDuplicateAttr2 = _interopRequireDefault(_abeRemoveDuplicateAttr); + var _abeCreate = require('./helpers/abe-create'); var _abeCreate2 = _interopRequireDefault(_abeCreate); @@ -150,6 +154,7 @@ exports.config = _abeConfig2.default; exports.cli = _cliUtils2.default; exports.getTemplate = _abeTemplate.getTemplate; exports.log = _abeLogs2.default; +exports.removeDuplicateAttr = _abeRemoveDuplicateAttr2.default; exports.Page = _Page2.default; exports.save = _Save.save; exports.Hooks = _abeHooks2.default; diff --git a/dist/server/public/scripts/admin-compiled.js b/dist/server/public/scripts/admin-compiled.js index da5d9e2..fd2f158 100644 --- a/dist/server/public/scripts/admin-compiled.js +++ b/dist/server/public/scripts/admin-compiled.js @@ -64,7 +64,7 @@ defineCache[id]=[id,deps,factory];}else {runFactory(id,deps,factory);}} //define //cache. Useful for AMD modules that all have IDs in the file, //but need to finally export a value to node based on one of those //IDs. -define.require=function(id){if(loaderCache[id]){return loaderCache[id];}if(defineCache[id]){runFactory.apply(null,defineCache[id]);return loaderCache[id];}};define.amd={};return define;}module.exports=amdefine;}).call(this,require('_process'),"/node_modules/amdefine/amdefine.js");},{"_process":35,"path":34}],2:[function(require,module,exports){},{}],3:[function(require,module,exports){'use strict';exports.__esModule=true; // istanbul ignore next +define.require=function(id){if(loaderCache[id]){return loaderCache[id];}if(defineCache[id]){runFactory.apply(null,defineCache[id]);return loaderCache[id];}};define.amd={};return define;}module.exports=amdefine;}).call(this,require('_process'),"/node_modules/amdefine/amdefine.js");},{"_process":46,"path":45}],2:[function(require,module,exports){},{}],3:[function(require,module,exports){'use strict';exports.__esModule=true; // istanbul ignore next function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{'default':obj};}var _handlebarsRuntime=require('./handlebars.runtime');var _handlebarsRuntime2=_interopRequireDefault(_handlebarsRuntime); // Compiler imports var _handlebarsCompilerAst=require('./handlebars/compiler/ast');var _handlebarsCompilerAst2=_interopRequireDefault(_handlebarsCompilerAst);var _handlebarsCompilerBase=require('./handlebars/compiler/base');var _handlebarsCompilerCompiler=require('./handlebars/compiler/compiler');var _handlebarsCompilerJavascriptCompiler=require('./handlebars/compiler/javascript-compiler');var _handlebarsCompilerJavascriptCompiler2=_interopRequireDefault(_handlebarsCompilerJavascriptCompiler);var _handlebarsCompilerVisitor=require('./handlebars/compiler/visitor');var _handlebarsCompilerVisitor2=_interopRequireDefault(_handlebarsCompilerVisitor);var _handlebarsNoConflict=require('./handlebars/no-conflict');var _handlebarsNoConflict2=_interopRequireDefault(_handlebarsNoConflict);var _create=_handlebarsRuntime2['default'].create;function create(){var hb=_create();hb.compile=function(input,options){return _handlebarsCompilerCompiler.compile(input,options,hb);};hb.precompile=function(input,options){return _handlebarsCompilerCompiler.precompile(input,options,hb);};hb.AST=_handlebarsCompilerAst2['default'];hb.Compiler=_handlebarsCompilerCompiler.Compiler;hb.JavaScriptCompiler=_handlebarsCompilerJavascriptCompiler2['default'];hb.Parser=_handlebarsCompilerBase.parser;hb.parse=_handlebarsCompilerBase.parse;return hb;}var inst=create();inst.create=create;_handlebarsNoConflict2['default'](inst);inst.Visitor=_handlebarsCompilerVisitor2['default'];inst['default']=inst;exports['default']=inst;module.exports=exports['default'];},{"./handlebars.runtime":4,"./handlebars/compiler/ast":6,"./handlebars/compiler/base":7,"./handlebars/compiler/compiler":9,"./handlebars/compiler/javascript-compiler":11,"./handlebars/compiler/visitor":14,"./handlebars/no-conflict":28}],4:[function(require,module,exports){'use strict';exports.__esModule=true; // istanbul ignore next function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{'default':obj};} // istanbul ignore next @@ -89,7 +89,7 @@ yy.locInfo=function(locInfo){return new yy.SourceLocation(options&&options.srcNa // they are running on the browser and thus have no need for the source-map library. var SourceMap=require('source-map');SourceNode=SourceMap.SourceNode;}}catch(err){} /* NOP */ /* istanbul ignore if: tested but not covered in istanbul due to dist build */if(!SourceNode){SourceNode=function SourceNode(line,column,srcFile,chunks){this.src='';if(chunks){this.add(chunks);}}; /* istanbul ignore next */SourceNode.prototype={add:function add(chunks){if(_utils.isArray(chunks)){chunks=chunks.join('');}this.src+=chunks;},prepend:function prepend(chunks){if(_utils.isArray(chunks)){chunks=chunks.join('');}this.src=chunks+this.src;},toStringWithSourceMap:function toStringWithSourceMap(){return {code:this.toString()};},toString:function toString(){return this.src;}};}function castChunk(chunk,codeGen,loc){if(_utils.isArray(chunk)){var ret=[];for(var i=0,len=chunk.length;i 0 -var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==='.'){parts.splice(i,1);}else if(last==='..'){parts.splice(i,1);up++;}else if(up){parts.splice(i,1);up--;}} // if the path is allowed to go above the root, restore leading ..s -if(allowAboveRoot){for(;up--;up){parts.unshift('..');}}return parts;} // Split a filename into [root, dir, basename, ext], unix version -// 'root' is just a slash, or nothing. -var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function splitPath(filename){return splitPathRe.exec(filename).slice(1);}; // path.resolve([from ...], to) -// posix version -exports.resolve=function(){var resolvedPath='',resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd(); // Skip empty and invalid entries -if(typeof path!=='string'){throw new TypeError('Arguments to path.resolve must be strings');}else if(!path){continue;}resolvedPath=path+'/'+resolvedPath;resolvedAbsolute=path.charAt(0)==='/';} // At this point the path should be resolved to a full absolute path, but -// handle relative paths to be safe (might happen when process.cwd() fails) -// Normalize the path -resolvedPath=normalizeArray(filter(resolvedPath.split('/'),function(p){return !!p;}),!resolvedAbsolute).join('/');return (resolvedAbsolute?'/':'')+resolvedPath||'.';}; // path.normalize(path) -// posix version -exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==='/'; // Normalize the path -path=normalizeArray(filter(path.split('/'),function(p){return !!p;}),!isAbsolute).join('/');if(!path&&!isAbsolute){path='.';}if(path&&trailingSlash){path+='/';}return (isAbsolute?'/':'')+path;}; // posix version -exports.isAbsolute=function(path){return path.charAt(0)==='/';}; // posix version -exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=='string'){throw new TypeError('Arguments to path.join must be strings');}return p;}).join('/'));}; // path.relative(from, to) -// posix version -exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=='')break;}if(start>end)return [];return arr.slice(start,end-start+1);}var fromParts=trim(from.split('/'));var toParts=trim(to.split('/'));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i1){for(var i=1;i=0&&options.parseArrays&&index<=options.arrayLimit){obj=[];obj[index]=internals.parseObject(chain,val,options);}else {obj[cleanRoot]=internals.parseObject(chain,val,options);}}return obj;};internals.parseKeys=function(givenKey,val,options){if(!givenKey){return;} // Transform dot notation to bracket notation -var key=options.allowDots?givenKey.replace(/\.([^\.\[]+)/g,'[$1]'):givenKey; // The regex chunks -var parent=/^([^\[\]]*)/;var child=/(\[[^\[\]]*\])/g; // Get the parent -var segment=parent.exec(key); // Stash the parent if it exists -var keys=[];if(segment[1]){ // If we aren't using plain objects, optionally prefix keys -// that would overwrite object prototype properties -if(!options.plainObjects&&Object.prototype.hasOwnProperty(segment[1])){if(!options.allowPrototypes){return;}}keys.push(segment[1]);} // Loop through children appending to the array until we hit depth -var i=0;while((segment=child.exec(key))!==null&&i=0x30&&c<=0x39|| // 0-9 -c>=0x41&&c<=0x5A|| // a-z -c>=0x61&&c<=0x7A // A-Z -){out+=string.charAt(i);continue;}if(c<0x80){out=out+hexTable[c];continue;}if(c<0x800){out=out+(hexTable[0xC0|c>>6]+hexTable[0x80|c&0x3F]);continue;}if(c<0xD800||c>=0xE000){out=out+(hexTable[0xE0|c>>12]+hexTable[0x80|c>>6&0x3F]+hexTable[0x80|c&0x3F]);continue;}i+=1;c=0x10000+((c&0x3FF)<<10|string.charCodeAt(i)&0x3FF);out+=hexTable[0xF0|c>>18]+hexTable[0x80|c>>12&0x3F]+hexTable[0x80|c>>6&0x3F]+hexTable[0x80|c&0x3F];}return out;};exports.compact=function(obj,references){if((typeof obj==="undefined"?"undefined":_typeof(obj))!=='object'||obj===null){return obj;}var refs=references||[];var lookup=refs.indexOf(obj);if(lookup!==-1){return refs[lookup];}refs.push(obj);if(Array.isArray(obj)){var compacted=[];for(var i=0;i=0x61&&c<=0x7A // A-Z * Returns the array representation of this set (which has the proper indices * indicated by indexOf). Note that this is a copy of the internal array used * for storing the members so that no one can mess with internal state. - */ArraySet.prototype.toArray=function ArraySet_toArray(){return this._array.slice();};exports.ArraySet=ArraySet;});},{"./util":50,"amdefine":1}],42:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* + */ArraySet.prototype.toArray=function ArraySet_toArray(){return this._array.slice();};exports.ArraySet=ArraySet;});},{"./util":43,"amdefine":1}],35:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause @@ -609,7 +500,7 @@ var VLQ_CONTINUATION_BIT=VLQ_BASE; /** digit|=VLQ_CONTINUATION_BIT;}encoded+=base64.encode(digit);}while(vlq>0);return encoded;}; /** * Decodes the next base 64 VLQ value from the given string and returns the * value and the rest of the string via the out parameter. - */exports.decode=function base64VLQ_decode(aStr,aIndex,aOutParam){var strLen=aStr.length;var result=0;var shift=0;var continuation,digit;do {if(aIndex>=strLen){throw new Error("Expected more digits in base 64 VLQ value.");}digit=base64.decode(aStr.charCodeAt(aIndex++));if(digit===-1){throw new Error("Invalid base64 digit: "+aStr.charAt(aIndex-1));}continuation=!!(digit&VLQ_CONTINUATION_BIT);digit&=VLQ_BASE_MASK;result=result+(digit<=strLen){throw new Error("Expected more digits in base 64 VLQ value.");}digit=base64.decode(aStr.charCodeAt(aIndex++));if(digit===-1){throw new Error("Invalid base64 digit: "+aStr.charAt(aIndex-1));}continuation=!!(digit&VLQ_CONTINUATION_BIT);digit&=VLQ_BASE_MASK;result=result+(digit<=0){if(aCompare(aHaystack[index],aHaystack[index-1],true)!==0){break;}--index;}return index;};});},{"amdefine":1}],45:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* +while(index-1>=0){if(aCompare(aHaystack[index],aHaystack[index-1],true)!==0){break;}--index;}return index;};});},{"amdefine":1}],38:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2014 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause @@ -715,7 +606,7 @@ this._last={generatedLine:-1,generatedColumn:0};} /** * performance. The return value must NOT be mutated, and should be treated as * an immutable borrow. If you want to take ownership, you must make your own * copy. - */MappingList.prototype.toArray=function MappingList_toArray(){if(!this._sorted){this._array.sort(util.compareByGeneratedPositionsInflated);this._sorted=true;}return this._array;};exports.MappingList=MappingList;});},{"./util":50,"amdefine":1}],46:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* + */MappingList.prototype.toArray=function MappingList_toArray(){if(!this._sorted){this._array.sort(util.compareByGeneratedPositionsInflated);this._sorted=true;}return this._array;};exports.MappingList=MappingList;});},{"./util":43,"amdefine":1}],39:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause @@ -782,7 +673,7 @@ doQuickSort(ary,comparator,p,q-1);doQuickSort(ary,comparator,q+1,r);}} /** * An array to sort. * @param {function} comparator * Function to use to compare two items. - */exports.quickSort=function(ary,comparator){doQuickSort(ary,comparator,0,ary.length-1);};});},{"amdefine":1}],47:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* + */exports.quickSort=function(ary,comparator){doQuickSort(ary,comparator,0,ary.length-1);};});},{"amdefine":1}],40:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause @@ -1102,7 +993,7 @@ if(section.consumer.sources.indexOf(util.getArg(aArgs,'source'))===-1){continue; // generated positions relative to the start of the section, so we // need to offset them to be relative to the start of the concatenated // generated file. -var adjustedMapping={source:source,generatedLine:mapping.generatedLine+(section.generatedOffset.generatedLine-1),generatedColumn:mapping.column+(section.generatedOffset.generatedLine===mapping.generatedLine)?section.generatedOffset.generatedColumn-1:0,originalLine:mapping.originalLine,originalColumn:mapping.originalColumn,name:name};this.__generatedMappings.push(adjustedMapping);if(typeof adjustedMapping.originalLine==='number'){this.__originalMappings.push(adjustedMapping);}};};quickSort(this.__generatedMappings,util.compareByGeneratedPositionsDeflated);quickSort(this.__originalMappings,util.compareByOriginalPositions);};exports.IndexedSourceMapConsumer=IndexedSourceMapConsumer;});},{"./array-set":41,"./base64-vlq":42,"./binary-search":44,"./quick-sort":46,"./util":50,"amdefine":1}],48:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* +var adjustedMapping={source:source,generatedLine:mapping.generatedLine+(section.generatedOffset.generatedLine-1),generatedColumn:mapping.column+(section.generatedOffset.generatedLine===mapping.generatedLine)?section.generatedOffset.generatedColumn-1:0,originalLine:mapping.originalLine,originalColumn:mapping.originalColumn,name:name};this.__generatedMappings.push(adjustedMapping);if(typeof adjustedMapping.originalLine==='number'){this.__originalMappings.push(adjustedMapping);}};};quickSort(this.__generatedMappings,util.compareByGeneratedPositionsDeflated);quickSort(this.__originalMappings,util.compareByOriginalPositions);};exports.IndexedSourceMapConsumer=IndexedSourceMapConsumer;});},{"./array-set":34,"./base64-vlq":35,"./binary-search":37,"./quick-sort":39,"./util":43,"amdefine":1}],41:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause @@ -1175,7 +1066,7 @@ result+=base64VLQ.encode(mapping.originalLine-1-previousOriginalLine);previousOr * Externalize the source map. */SourceMapGenerator.prototype.toJSON=function SourceMapGenerator_toJSON(){var map={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};if(this._file!=null){map.file=this._file;}if(this._sourceRoot!=null){map.sourceRoot=this._sourceRoot;}if(this._sourcesContents){map.sourcesContent=this._generateSourcesContent(map.sources,map.sourceRoot);}return map;}; /** * Render the source map being generated to a string. - */SourceMapGenerator.prototype.toString=function SourceMapGenerator_toString(){return JSON.stringify(this.toJSON());};exports.SourceMapGenerator=SourceMapGenerator;});},{"./array-set":41,"./base64-vlq":42,"./mapping-list":45,"./util":50,"amdefine":1}],49:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* + */SourceMapGenerator.prototype.toString=function SourceMapGenerator_toString(){return JSON.stringify(this.toJSON());};exports.SourceMapGenerator=SourceMapGenerator;});},{"./array-set":34,"./base64-vlq":35,"./mapping-list":38,"./util":43,"amdefine":1}],42:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause @@ -1274,7 +1165,7 @@ aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapCo * Returns the string representation of this source node along with a source * map. */SourceNode.prototype.toStringWithSourceMap=function SourceNode_toStringWithSourceMap(aArgs){var generated={code:"",line:1,column:0};var map=new SourceMapGenerator(aArgs);var sourceMappingActive=false;var lastOriginalSource=null;var lastOriginalLine=null;var lastOriginalColumn=null;var lastOriginalName=null;this.walk(function(chunk,original){generated.code+=chunk;if(original.source!==null&&original.line!==null&&original.column!==null){if(lastOriginalSource!==original.source||lastOriginalLine!==original.line||lastOriginalColumn!==original.column||lastOriginalName!==original.name){map.addMapping({source:original.source,original:{line:original.line,column:original.column},generated:{line:generated.line,column:generated.column},name:original.name});}lastOriginalSource=original.source;lastOriginalLine=original.line;lastOriginalColumn=original.column;lastOriginalName=original.name;sourceMappingActive=true;}else if(sourceMappingActive){map.addMapping({generated:{line:generated.line,column:generated.column}});lastOriginalSource=null;sourceMappingActive=false;}for(var idx=0,length=chunk.length;idxaStr2){return 1;}return -1;} /** * Comparator between two mappings with inflated source and name strings where * the generated positions are compared. - */function compareByGeneratedPositionsInflated(mappingA,mappingB){var cmp=mappingA.generatedLine-mappingB.generatedLine;if(cmp!==0){return cmp;}cmp=mappingA.generatedColumn-mappingB.generatedColumn;if(cmp!==0){return cmp;}cmp=strcmp(mappingA.source,mappingB.source);if(cmp!==0){return cmp;}cmp=mappingA.originalLine-mappingB.originalLine;if(cmp!==0){return cmp;}cmp=mappingA.originalColumn-mappingB.originalColumn;if(cmp!==0){return cmp;}return strcmp(mappingA.name,mappingB.name);};exports.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated;});},{"amdefine":1}],51:[function(require,module,exports){'use strict';var _createClass=function(){function defineProperties(target,props){for(var i=0;i 0 +var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==='.'){parts.splice(i,1);}else if(last==='..'){parts.splice(i,1);up++;}else if(up){parts.splice(i,1);up--;}} // if the path is allowed to go above the root, restore leading ..s +if(allowAboveRoot){for(;up--;up){parts.unshift('..');}}return parts;} // Split a filename into [root, dir, basename, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function splitPath(filename){return splitPathRe.exec(filename).slice(1);}; // path.resolve([from ...], to) +// posix version +exports.resolve=function(){var resolvedPath='',resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd(); // Skip empty and invalid entries +if(typeof path!=='string'){throw new TypeError('Arguments to path.resolve must be strings');}else if(!path){continue;}resolvedPath=path+'/'+resolvedPath;resolvedAbsolute=path.charAt(0)==='/';} // At this point the path should be resolved to a full absolute path, but +// handle relative paths to be safe (might happen when process.cwd() fails) +// Normalize the path +resolvedPath=normalizeArray(filter(resolvedPath.split('/'),function(p){return !!p;}),!resolvedAbsolute).join('/');return (resolvedAbsolute?'/':'')+resolvedPath||'.';}; // path.normalize(path) +// posix version +exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==='/'; // Normalize the path +path=normalizeArray(filter(path.split('/'),function(p){return !!p;}),!isAbsolute).join('/');if(!path&&!isAbsolute){path='.';}if(path&&trailingSlash){path+='/';}return (isAbsolute?'/':'')+path;}; // posix version +exports.isAbsolute=function(path){return path.charAt(0)==='/';}; // posix version +exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=='string'){throw new TypeError('Arguments to path.join must be strings');}return p;}).join('/'));}; // path.relative(from, to) +// posix version +exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=='')break;}if(start>end)return [];return arr.slice(start,end-start+1);}var fromParts=trim(from.split('/'));var toParts=trim(to.split('/'));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i1){for(var i=1;i=0&&options.parseArrays&&index<=options.arrayLimit){obj=[];obj[index]=parseObject(chain,val,options);}else {obj[cleanRoot]=parseObject(chain,val,options);}}return obj;};var parseKeys=function parseKeys(givenKey,val,options){if(!givenKey){return;} // Transform dot notation to bracket notation +var key=options.allowDots?givenKey.replace(/\.([^\.\[]+)/g,'[$1]'):givenKey; // The regex chunks +var parent=/^([^\[\]]*)/;var child=/(\[[^\[\]]*\])/g; // Get the parent +var segment=parent.exec(key); // Stash the parent if it exists +var keys=[];if(segment[1]){ // If we aren't using plain objects, optionally prefix keys +// that would overwrite object prototype properties +if(!options.plainObjects&&Object.prototype.hasOwnProperty(segment[1])){if(!options.allowPrototypes){return;}}keys.push(segment[1]);} // Loop through children appending to the array until we hit depth +var i=0;while((segment=child.exec(key))!==null&&i=0x30&&c<=0x39|| // 0-9 +c>=0x41&&c<=0x5A|| // a-z +c>=0x61&&c<=0x7A // A-Z +){out+=string.charAt(i);continue;}if(c<0x80){out=out+hexTable[c];continue;}if(c<0x800){out=out+(hexTable[0xC0|c>>6]+hexTable[0x80|c&0x3F]);continue;}if(c<0xD800||c>=0xE000){out=out+(hexTable[0xE0|c>>12]+hexTable[0x80|c>>6&0x3F]+hexTable[0x80|c&0x3F]);continue;}i+=1;c=0x10000+((c&0x3FF)<<10|string.charCodeAt(i)&0x3FF);out+=hexTable[0xF0|c>>18]+hexTable[0x80|c>>12&0x3F]+hexTable[0x80|c>>6&0x3F]+hexTable[0x80|c&0x3F];}return out;};exports.compact=function(obj,references){if((typeof obj==="undefined"?"undefined":_typeof(obj))!=='object'||obj===null){return obj;}var refs=references||[];var lookup=refs.indexOf(obj);if(lookup!==-1){return refs[lookup];}refs.push(obj);if(Array.isArray(obj)){var compacted=[];for(var i=0;i0&&select.offsetHeight>0){var value=select.querySelector('option:checked').getAttribute('clean-value');if(typeof value!=='undefined'&&value!==null&&value!==''){path+=value+'/';}else if(typeof select.value!=='undefined'&&select.value!==null&&select.value!==''){path+=select.value+'/';}}});path=path.slice(0,-1);path=path.split('/');path=path.join('/');path='/'+path.replace(/^\//,'');return path;}},{key:'_submit',value:function _submit(type,btn){if(btn.classList.contains('disable'))return;btn.classList.add('disable');var inputs=[].slice.call(document.querySelectorAll('.form-create input'));inputs=inputs.concat([].slice.call(document.querySelectorAll('.form-create select')));var values={};Array.prototype.forEach.call(inputs,function(input){values[input.getAttribute('name')]=input.value;});var toSave=_qs2.default.stringify(values);this._ajax({url:document.location.origin+'/abe/'+type+'/?'+toSave,body:toSave,headers:{},method:'get'},function(code,responseText,request){var jsonRes=JSON.parse(responseText);if(jsonRes.success==1&&typeof jsonRes.json.abe_meta!=='undefined'&&jsonRes.json.abe_meta!==null){window.location.href=window.location.origin+'/abe/'+jsonRes.json.abe_meta.template+'?filePath='+jsonRes.json.abe_meta.link;}else {alert('error');btn.classList.remove('disable');}});}},{key:'_btnDuplicateManagerClick',value:function _btnDuplicateManagerClick(e){e.preventDefault();this._submit('duplicate',e.srcElement);}},{key:'_btnUpdateManagerClick',value:function _btnUpdateManagerClick(e){e.preventDefault();this._submit('update',e.srcElement);}},{key:'_btnCreateManagerClick',value:function _btnCreateManagerClick(e){e.preventDefault();this._submit('create',e.srcElement);}}]);return FormCreate;}();exports.default=FormCreate;},{"./FolderSelect":52,"./TemplateSelect":55,"nanoajax":33,"qs":36}],54:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&select.offsetHeight>0){var value=select.querySelector('option:checked').getAttribute('clean-value');if(typeof value!=='undefined'&&value!==null&&value!==''){path+=value+'/';}else if(typeof select.value!=='undefined'&&select.value!==null&&select.value!==''){path+=select.value+'/';}}});path=path.slice(0,-1);path=path.split('/');path=path.join('/');path='/'+path.replace(/^\//,'');return path;}},{key:'_submit',value:function _submit(type,btn){if(btn.classList.contains('disable'))return;btn.classList.add('disable');var inputs=[].slice.call(document.querySelectorAll('.form-create input'));inputs=inputs.concat([].slice.call(document.querySelectorAll('.form-create select')));var values={};Array.prototype.forEach.call(inputs,function(input){values[input.getAttribute('name')]=input.value;});var toSave=_qs2.default.stringify(values);this._ajax({url:document.location.origin+'/abe/'+type+'/?'+toSave,body:toSave,headers:{},method:'get'},function(code,responseText,request){var jsonRes=JSON.parse(responseText);if(jsonRes.success==1&&typeof jsonRes.json.abe_meta!=='undefined'&&jsonRes.json.abe_meta!==null){window.location.href=window.location.origin+'/abe/'+jsonRes.json.abe_meta.template+'?filePath='+jsonRes.json.abe_meta.link;}else {alert('error');btn.classList.remove('disable');}});}},{key:'_btnDuplicateManagerClick',value:function _btnDuplicateManagerClick(e){e.preventDefault();this._submit('duplicate',e.srcElement);}},{key:'_btnUpdateManagerClick',value:function _btnUpdateManagerClick(e){e.preventDefault();this._submit('update',e.srcElement);}},{key:'_btnCreateManagerClick',value:function _btnCreateManagerClick(e){e.preventDefault();this._submit('create',e.srcElement);}}]);return FormCreate;}();exports.default=FormCreate;},{"./FolderSelect":52,"./TemplateSelect":55,"nanoajax":44,"qs":47}],54:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i 0 -var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==='.'){parts.splice(i,1);}else if(last==='..'){parts.splice(i,1);up++;}else if(up){parts.splice(i,1);up--;}} // if the path is allowed to go above the root, restore leading ..s -if(allowAboveRoot){for(;up--;up){parts.unshift('..');}}return parts;} // Split a filename into [root, dir, basename, ext], unix version -// 'root' is just a slash, or nothing. -var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function splitPath(filename){return splitPathRe.exec(filename).slice(1);}; // path.resolve([from ...], to) -// posix version -exports.resolve=function(){var resolvedPath='',resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd(); // Skip empty and invalid entries -if(typeof path!=='string'){throw new TypeError('Arguments to path.resolve must be strings');}else if(!path){continue;}resolvedPath=path+'/'+resolvedPath;resolvedAbsolute=path.charAt(0)==='/';} // At this point the path should be resolved to a full absolute path, but -// handle relative paths to be safe (might happen when process.cwd() fails) -// Normalize the path -resolvedPath=normalizeArray(filter(resolvedPath.split('/'),function(p){return !!p;}),!resolvedAbsolute).join('/');return (resolvedAbsolute?'/':'')+resolvedPath||'.';}; // path.normalize(path) -// posix version -exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==='/'; // Normalize the path -path=normalizeArray(filter(path.split('/'),function(p){return !!p;}),!isAbsolute).join('/');if(!path&&!isAbsolute){path='.';}if(path&&trailingSlash){path+='/';}return (isAbsolute?'/':'')+path;}; // posix version -exports.isAbsolute=function(path){return path.charAt(0)==='/';}; // posix version -exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=='string'){throw new TypeError('Arguments to path.join must be strings');}return p;}).join('/'));}; // path.relative(from, to) -// posix version -exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=='')break;}if(start>end)return [];return arr.slice(start,end-start+1);}var fromParts=trim(from.split('/'));var toParts=trim(to.split('/'));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i1){for(var i=1;i=0&&options.parseArrays&&index<=options.arrayLimit){obj=[];obj[index]=internals.parseObject(chain,val,options);}else {obj[cleanRoot]=internals.parseObject(chain,val,options);}}return obj;};internals.parseKeys=function(givenKey,val,options){if(!givenKey){return;} // Transform dot notation to bracket notation -var key=options.allowDots?givenKey.replace(/\.([^\.\[]+)/g,'[$1]'):givenKey; // The regex chunks -var parent=/^([^\[\]]*)/;var child=/(\[[^\[\]]*\])/g; // Get the parent -var segment=parent.exec(key); // Stash the parent if it exists -var keys=[];if(segment[1]){ // If we aren't using plain objects, optionally prefix keys -// that would overwrite object prototype properties -if(!options.plainObjects&&Object.prototype.hasOwnProperty(segment[1])){if(!options.allowPrototypes){return;}}keys.push(segment[1]);} // Loop through children appending to the array until we hit depth -var i=0;while((segment=child.exec(key))!==null&&i=0x30&&c<=0x39|| // 0-9 -c>=0x41&&c<=0x5A|| // a-z -c>=0x61&&c<=0x7A // A-Z -){out+=string.charAt(i);continue;}if(c<0x80){out=out+hexTable[c];continue;}if(c<0x800){out=out+(hexTable[0xC0|c>>6]+hexTable[0x80|c&0x3F]);continue;}if(c<0xD800||c>=0xE000){out=out+(hexTable[0xE0|c>>12]+hexTable[0x80|c>>6&0x3F]+hexTable[0x80|c&0x3F]);continue;}i+=1;c=0x10000+((c&0x3FF)<<10|string.charCodeAt(i)&0x3FF);out+=hexTable[0xF0|c>>18]+hexTable[0x80|c>>12&0x3F]+hexTable[0x80|c>>6&0x3F]+hexTable[0x80|c&0x3F];}return out;};exports.compact=function(obj,references){if((typeof obj==="undefined"?"undefined":_typeof2(obj))!=='object'||obj===null){return obj;}var refs=references||[];var lookup=refs.indexOf(obj);if(lookup!==-1){return refs[lookup];}refs.push(obj);if(Array.isArray(obj)){var compacted=[];for(var i=0;i=0x61&&c<=0x7A // A-Z * Returns the array representation of this set (which has the proper indices * indicated by indexOf). Note that this is a copy of the internal array used * for storing the members so that no one can mess with internal state. - */ArraySet.prototype.toArray=function ArraySet_toArray(){return this._array.slice();};exports.ArraySet=ArraySet;});},{"./util":53,"amdefine":1}],45:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* + */ArraySet.prototype.toArray=function ArraySet_toArray(){return this._array.slice();};exports.ArraySet=ArraySet;});},{"./util":45,"amdefine":1}],37:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause @@ -958,7 +849,7 @@ var VLQ_CONTINUATION_BIT=VLQ_BASE; /** digit|=VLQ_CONTINUATION_BIT;}encoded+=base64.encode(digit);}while(vlq>0);return encoded;}; /** * Decodes the next base 64 VLQ value from the given string and returns the * value and the rest of the string via the out parameter. - */exports.decode=function base64VLQ_decode(aStr,aIndex,aOutParam){var strLen=aStr.length;var result=0;var shift=0;var continuation,digit;do {if(aIndex>=strLen){throw new Error("Expected more digits in base 64 VLQ value.");}digit=base64.decode(aStr.charCodeAt(aIndex++));if(digit===-1){throw new Error("Invalid base64 digit: "+aStr.charAt(aIndex-1));}continuation=!!(digit&VLQ_CONTINUATION_BIT);digit&=VLQ_BASE_MASK;result=result+(digit<=strLen){throw new Error("Expected more digits in base 64 VLQ value.");}digit=base64.decode(aStr.charCodeAt(aIndex++));if(digit===-1){throw new Error("Invalid base64 digit: "+aStr.charAt(aIndex-1));}continuation=!!(digit&VLQ_CONTINUATION_BIT);digit&=VLQ_BASE_MASK;result=result+(digit<=0){if(aCompare(aHaystack[index],aHaystack[index-1],true)!==0){break;}--index;}return index;};});},{"amdefine":1}],48:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* +while(index-1>=0){if(aCompare(aHaystack[index],aHaystack[index-1],true)!==0){break;}--index;}return index;};});},{"amdefine":1}],40:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2014 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause @@ -1064,7 +955,7 @@ this._last={generatedLine:-1,generatedColumn:0};} /** * performance. The return value must NOT be mutated, and should be treated as * an immutable borrow. If you want to take ownership, you must make your own * copy. - */MappingList.prototype.toArray=function MappingList_toArray(){if(!this._sorted){this._array.sort(util.compareByGeneratedPositionsInflated);this._sorted=true;}return this._array;};exports.MappingList=MappingList;});},{"./util":53,"amdefine":1}],49:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* + */MappingList.prototype.toArray=function MappingList_toArray(){if(!this._sorted){this._array.sort(util.compareByGeneratedPositionsInflated);this._sorted=true;}return this._array;};exports.MappingList=MappingList;});},{"./util":45,"amdefine":1}],41:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause @@ -1131,7 +1022,7 @@ doQuickSort(ary,comparator,p,q-1);doQuickSort(ary,comparator,q+1,r);}} /** * An array to sort. * @param {function} comparator * Function to use to compare two items. - */exports.quickSort=function(ary,comparator){doQuickSort(ary,comparator,0,ary.length-1);};});},{"amdefine":1}],50:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* + */exports.quickSort=function(ary,comparator){doQuickSort(ary,comparator,0,ary.length-1);};});},{"amdefine":1}],42:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause @@ -1451,7 +1342,7 @@ if(section.consumer.sources.indexOf(util.getArg(aArgs,'source'))===-1){continue; // generated positions relative to the start of the section, so we // need to offset them to be relative to the start of the concatenated // generated file. -var adjustedMapping={source:source,generatedLine:mapping.generatedLine+(section.generatedOffset.generatedLine-1),generatedColumn:mapping.column+(section.generatedOffset.generatedLine===mapping.generatedLine)?section.generatedOffset.generatedColumn-1:0,originalLine:mapping.originalLine,originalColumn:mapping.originalColumn,name:name};this.__generatedMappings.push(adjustedMapping);if(typeof adjustedMapping.originalLine==='number'){this.__originalMappings.push(adjustedMapping);}};};quickSort(this.__generatedMappings,util.compareByGeneratedPositionsDeflated);quickSort(this.__originalMappings,util.compareByOriginalPositions);};exports.IndexedSourceMapConsumer=IndexedSourceMapConsumer;});},{"./array-set":44,"./base64-vlq":45,"./binary-search":47,"./quick-sort":49,"./util":53,"amdefine":1}],51:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* +var adjustedMapping={source:source,generatedLine:mapping.generatedLine+(section.generatedOffset.generatedLine-1),generatedColumn:mapping.column+(section.generatedOffset.generatedLine===mapping.generatedLine)?section.generatedOffset.generatedColumn-1:0,originalLine:mapping.originalLine,originalColumn:mapping.originalColumn,name:name};this.__generatedMappings.push(adjustedMapping);if(typeof adjustedMapping.originalLine==='number'){this.__originalMappings.push(adjustedMapping);}};};quickSort(this.__generatedMappings,util.compareByGeneratedPositionsDeflated);quickSort(this.__originalMappings,util.compareByOriginalPositions);};exports.IndexedSourceMapConsumer=IndexedSourceMapConsumer;});},{"./array-set":36,"./base64-vlq":37,"./binary-search":39,"./quick-sort":41,"./util":45,"amdefine":1}],43:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause @@ -1524,7 +1415,7 @@ result+=base64VLQ.encode(mapping.originalLine-1-previousOriginalLine);previousOr * Externalize the source map. */SourceMapGenerator.prototype.toJSON=function SourceMapGenerator_toJSON(){var map={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};if(this._file!=null){map.file=this._file;}if(this._sourceRoot!=null){map.sourceRoot=this._sourceRoot;}if(this._sourcesContents){map.sourcesContent=this._generateSourcesContent(map.sources,map.sourceRoot);}return map;}; /** * Render the source map being generated to a string. - */SourceMapGenerator.prototype.toString=function SourceMapGenerator_toString(){return JSON.stringify(this.toJSON());};exports.SourceMapGenerator=SourceMapGenerator;});},{"./array-set":44,"./base64-vlq":45,"./mapping-list":48,"./util":53,"amdefine":1}],52:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* + */SourceMapGenerator.prototype.toString=function SourceMapGenerator_toString(){return JSON.stringify(this.toJSON());};exports.SourceMapGenerator=SourceMapGenerator;});},{"./array-set":36,"./base64-vlq":37,"./mapping-list":40,"./util":45,"amdefine":1}],44:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause @@ -1623,7 +1514,7 @@ aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapCo * Returns the string representation of this source node along with a source * map. */SourceNode.prototype.toStringWithSourceMap=function SourceNode_toStringWithSourceMap(aArgs){var generated={code:"",line:1,column:0};var map=new SourceMapGenerator(aArgs);var sourceMappingActive=false;var lastOriginalSource=null;var lastOriginalLine=null;var lastOriginalColumn=null;var lastOriginalName=null;this.walk(function(chunk,original){generated.code+=chunk;if(original.source!==null&&original.line!==null&&original.column!==null){if(lastOriginalSource!==original.source||lastOriginalLine!==original.line||lastOriginalColumn!==original.column||lastOriginalName!==original.name){map.addMapping({source:original.source,original:{line:original.line,column:original.column},generated:{line:generated.line,column:generated.column},name:original.name});}lastOriginalSource=original.source;lastOriginalLine=original.line;lastOriginalColumn=original.column;lastOriginalName=original.name;sourceMappingActive=true;}else if(sourceMappingActive){map.addMapping({generated:{line:generated.line,column:generated.column}});lastOriginalSource=null;sourceMappingActive=false;}for(var idx=0,length=chunk.length;idxaStr2){return 1;}return -1;} /** * Comparator between two mappings with inflated source and name strings where * the generated positions are compared. - */function compareByGeneratedPositionsInflated(mappingA,mappingB){var cmp=mappingA.generatedLine-mappingB.generatedLine;if(cmp!==0){return cmp;}cmp=mappingA.generatedColumn-mappingB.generatedColumn;if(cmp!==0){return cmp;}cmp=strcmp(mappingA.source,mappingB.source);if(cmp!==0){return cmp;}cmp=mappingA.originalLine-mappingB.originalLine;if(cmp!==0){return cmp;}cmp=mappingA.originalColumn-mappingB.originalColumn;if(cmp!==0){return cmp;}return strcmp(mappingA.name,mappingB.name);};exports.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated;});},{"amdefine":1}],54:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=math;function math(lvalue,operator,rvalue,options){lvalue=parseFloat(lvalue);rvalue=parseFloat(rvalue);return {"+":lvalue+rvalue,"-":lvalue-rvalue,"*":lvalue*rvalue,"/":lvalue/rvalue,"%":lvalue%rvalue}[operator];}},{}],55:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=translate;function translate(lang,str){var trad=Locales;if(typeof trad[lang]!=='undefined'&&trad[lang]!==null&&typeof trad[lang][str]!=='undefined'&&trad[lang][str]!==null){return trad[lang][str];}return str;}},{}],56:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i 0 +var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==='.'){parts.splice(i,1);}else if(last==='..'){parts.splice(i,1);up++;}else if(up){parts.splice(i,1);up--;}} // if the path is allowed to go above the root, restore leading ..s +if(allowAboveRoot){for(;up--;up){parts.unshift('..');}}return parts;} // Split a filename into [root, dir, basename, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function splitPath(filename){return splitPathRe.exec(filename).slice(1);}; // path.resolve([from ...], to) +// posix version +exports.resolve=function(){var resolvedPath='',resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd(); // Skip empty and invalid entries +if(typeof path!=='string'){throw new TypeError('Arguments to path.resolve must be strings');}else if(!path){continue;}resolvedPath=path+'/'+resolvedPath;resolvedAbsolute=path.charAt(0)==='/';} // At this point the path should be resolved to a full absolute path, but +// handle relative paths to be safe (might happen when process.cwd() fails) +// Normalize the path +resolvedPath=normalizeArray(filter(resolvedPath.split('/'),function(p){return !!p;}),!resolvedAbsolute).join('/');return (resolvedAbsolute?'/':'')+resolvedPath||'.';}; // path.normalize(path) +// posix version +exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==='/'; // Normalize the path +path=normalizeArray(filter(path.split('/'),function(p){return !!p;}),!isAbsolute).join('/');if(!path&&!isAbsolute){path='.';}if(path&&trailingSlash){path+='/';}return (isAbsolute?'/':'')+path;}; // posix version +exports.isAbsolute=function(path){return path.charAt(0)==='/';}; // posix version +exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=='string'){throw new TypeError('Arguments to path.join must be strings');}return p;}).join('/'));}; // path.relative(from, to) +// posix version +exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=='')break;}if(start>end)return [];return arr.slice(start,end-start+1);}var fromParts=trim(from.split('/'));var toParts=trim(to.split('/'));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i1){for(var i=1;i=0&&options.parseArrays&&index<=options.arrayLimit){obj=[];obj[index]=parseObject(chain,val,options);}else {obj[cleanRoot]=parseObject(chain,val,options);}}return obj;};var parseKeys=function parseKeys(givenKey,val,options){if(!givenKey){return;} // Transform dot notation to bracket notation +var key=options.allowDots?givenKey.replace(/\.([^\.\[]+)/g,'[$1]'):givenKey; // The regex chunks +var parent=/^([^\[\]]*)/;var child=/(\[[^\[\]]*\])/g; // Get the parent +var segment=parent.exec(key); // Stash the parent if it exists +var keys=[];if(segment[1]){ // If we aren't using plain objects, optionally prefix keys +// that would overwrite object prototype properties +if(!options.plainObjects&&Object.prototype.hasOwnProperty(segment[1])){if(!options.allowPrototypes){return;}}keys.push(segment[1]);} // Loop through children appending to the array until we hit depth +var i=0;while((segment=child.exec(key))!==null&&i=0x30&&c<=0x39|| // 0-9 +c>=0x41&&c<=0x5A|| // a-z +c>=0x61&&c<=0x7A // A-Z +){out+=string.charAt(i);continue;}if(c<0x80){out=out+hexTable[c];continue;}if(c<0x800){out=out+(hexTable[0xC0|c>>6]+hexTable[0x80|c&0x3F]);continue;}if(c<0xD800||c>=0xE000){out=out+(hexTable[0xE0|c>>12]+hexTable[0x80|c>>6&0x3F]+hexTable[0x80|c&0x3F]);continue;}i+=1;c=0x10000+((c&0x3FF)<<10|string.charCodeAt(i)&0x3FF);out+=hexTable[0xF0|c>>18]+hexTable[0x80|c>>12&0x3F]+hexTable[0x80|c>>6&0x3F]+hexTable[0x80|c&0x3F];}return out;};exports.compact=function(obj,references){if((typeof obj==="undefined"?"undefined":_typeof2(obj))!=='object'||obj===null){return obj;}var refs=references||[];var lookup=refs.indexOf(obj);if(lookup!==-1){return refs[lookup];}refs.push(obj);if(Array.isArray(obj)){var compacted=[];for(var i=0;i0){var results=[].slice.call(this._currentInput.parentNode.querySelectorAll('.autocomplete-result-wrapper .autocomplete-result'));var json=this._json.data;json[id]=[];Array.prototype.forEach.call(results,function(result){var value=result.getAttribute('value');if(value!==''){if(value.indexOf('{')>-1||value.indexOf('[')>-1){json[id].push(JSON.parse(value));}else {json[id].push(value);}}});this._json.data=json;try{Array.prototype.forEach.call(nodeComments,function(nodeComment){var blockHtml=unescape(nodeComment.textContent.replace(/\[\[([\S\s]*?)\]\]/,'')).replace(/\[0\]-/g,'[0]-'); // var blockHtml = unescape(blockContent.innerHTML).replace(/\[0\]-/g, '[0]-') var template=_handlebars2.default.compile(blockHtml,{noEscape:true});var compiled=template(_this2._json.data);nodeComment.parentNode.innerHTML=compiled+('');});}catch(e){console.log(e);}}else if(typeof id!=='undefined'&&id!==null){if(this._currentInput.getAttribute('visible')===true){var nodes=_EditorUtils2.default.getNode(attr);Array.prototype.forEach.call(nodes,function(node){_EditorUtils2.default.formToHtml(node,_this2._currentInput);});}}this.onReload._fire();}},{key:'_documentClick',value:function _documentClick(e){if(this._visible&&!this._canSelect){if(typeof this._divWrapper.parentNode!=='undefined'&&this._divWrapper.parentNode!==null){this._hide();}}}},{key:'_select',value:function _select(target){var val=JSON.parse(target.getAttribute('data-value'));var maxLength=this._currentInput.getAttribute('data-maxlength');if(typeof maxLength!=='undefined'&&maxLength!==null&&maxLength!==''){maxLength=parseInt(maxLength);var countLength=[].slice.call(this._currentInput.parentNode.querySelectorAll('.autocomplete-result-wrapper .autocomplete-result')).length;if(countLength+1>maxLength){return;}}var display=target.getAttribute('data-display');var div=document.createElement('div');div.classList.add('autocomplete-result');div.setAttribute('data-parent-id',this._currentInput.getAttribute('data-id'));div.setAttribute('value',target.getAttribute('data-value'));div.innerHTML=''+this._deep_value_array(val,display);var resWrapper=this._divWrapper.parentNode.querySelector('.autocomplete-result-wrapper');var remove=document.createElement('span');remove.classList.add('glyphicon','glyphicon-remove');remove.setAttribute('data-autocomplete-remove','true');remove.addEventListener('click',this._handleRemove);div.appendChild(remove);resWrapper.appendChild(div);this._saveData();}},{key:'_selectValue',value:function _selectValue(e){this._select(e.currentTarget);}},{key:'_showAutocomplete',value:function _showAutocomplete(sources,target,val){var _this3=this;var display=target.getAttribute('data-display');var first=true;this._divWrapper.innerHTML='';if(typeof sources!=='undefined'&&sources!==null){if((typeof sources==='undefined'?'undefined':_typeof(sources))==='object'&&Object.prototype.toString.call(sources)==='[object Object]'){sources=[sources];}Array.prototype.forEach.call(sources,function(source){var sourceVal=_this3._deep_value_array(source,display);if(typeof sourceVal!=='undefined'&&sourceVal!==null){sourceVal=sourceVal.toLowerCase();if(sourceVal.indexOf(val)>-1){var div=document.createElement('div');div.addEventListener('mousedown',_this3._handleSelectValue);div.setAttribute('data-value',JSON.stringify(source));div.setAttribute('data-display',display);if(first){div.classList.add('selected');}first=false;div.innerHTML=sourceVal.replace(val,''+val+'');_this3._divWrapper.appendChild(div);}}});}this._show(target);}},{key:'_hide',value:function _hide(){if(this._visible){this._visible=false;this._shouldBeVisible=false;this._divWrapper.parentNode.removeChild(this._divWrapper);}}},{key:'_show',value:function _show(target){if(!this._visible){this._visible=true;this._divWrapper.style.marginTop=target.offsetHeight+'px';this._divWrapper.style.width=target.offsetWidth+'px';target.parentNode.insertBefore(this._divWrapper,target);}}},{key:'_startAutocomplete',value:function _startAutocomplete(target){var _this4=this;var val=target.value.toLowerCase();if(val.length>2){if(this._previousValue===val){this._show(target);return;}else {this._previousValue=val;}var dataVal=target.getAttribute('data-value');if(dataVal.indexOf('http')===0){this._ajax({url:''+dataVal+val,body:'',cors:true,method:'get'},function(code,responseText,request){_this4._showAutocomplete(JSON.parse(responseText),target,val);});}else {var sources=JSON.parse(target.getAttribute('data-value'));this._showAutocomplete(sources,target,val);}}else {this._hide();}}},{key:'_keyUp',value:function _keyUp(e){if(e.keyCode!==13){this._startAutocomplete(e.currentTarget);}}},{key:'_keyDown',value:function _keyDown(e){if(this._canSelect){var parent=this._currentInput.parentNode.querySelector('.autocomplete-wrapper');if(typeof parent!=='undefined'&&parent!==null){var current=this._currentInput.parentNode.querySelector('.autocomplete-wrapper .selected');var newSelected=null;var selected=document.querySelector('.autocomplete-wrapper .selected');switch(e.keyCode){case 9: // tab this._hide();break;case 13: // enter e.preventDefault();if(typeof selected!=='undefined'&&selected!==null){this._select(selected);this._hide();}break;case 27: // escape e.preventDefault();this._hide();break;case 40: // down e.preventDefault();if(typeof selected!=='undefined'&&selected!==null){newSelected=selected.nextSibling;this._show(e.currentTarget);}break;case 38: // prev -e.preventDefault();if(typeof selected!=='undefined'&&selected!==null){newSelected=selected.previousSibling;}break;default:break;}if(typeof newSelected!=='undefined'&&newSelected!==null){var scrollTopMin=parent.scrollTop;var scrollTopMax=parent.scrollTop+parent.offsetHeight-newSelected.offsetHeight;var offsetTop=newSelected.offsetTop;if(scrollTopMaxoffsetTop){parent.scrollTop=newSelected.offsetTop;}current.classList.remove('selected');newSelected.classList.add('selected');}}}}},{key:'_focus',value:function _focus(e){this._canSelect=true;this._currentInput=e.currentTarget;this._startAutocomplete(e.currentTarget);}},{key:'_blur',value:function _blur(e){this._canSelect=false;this._currentInput=null;this._hide();}},{key:'_remove',value:function _remove(e){var target=e.currentTarget.parentNode;this._currentInput=document.querySelector('#'+target.getAttribute('data-parent-id'));target.parentNode.removeChild(target);this._saveData();this._currentInput=null;}},{key:'_deep_value_array',value:function _deep_value_array(obj,path){var _this5=this;if(path.indexOf('.')===-1){return typeof obj[path]!=='undefined'&&obj[path]!==null?obj[path]:null;}var pathSplit=path.split('.');var res=JSON.parse(JSON.stringify(obj));while(pathSplit.length>0){if(typeof res[pathSplit[0]]!=='undefined'&&res[pathSplit[0]]!==null){if(_typeof(res[pathSplit[0]])==='object'&&Object.prototype.toString.call(res[pathSplit[0]])==='[object Array]'){var resArray=[];Array.prototype.forEach.call(res[pathSplit[0]],function(item){resArray.push(_this5._deep_value_array(item,pathSplit.join('.').replace(pathSplit[0]+'.','')));});res=resArray;pathSplit.shift();}else {res=res[pathSplit[0]];}}else {return null;}pathSplit.shift();}return res;}},{key:'_deep_value',value:function _deep_value(obj,path){if(path.indexOf('.')===-1){return typeof obj[path]!=='undefined'&&obj[path]!==null?obj[path]:null;}var pathSplit=path.split('.');var res=JSON.parse(JSON.stringify(obj));for(var i=0;ioffsetTop){parent.scrollTop=newSelected.offsetTop;}current.classList.remove('selected');newSelected.classList.add('selected');}}}}},{key:'_focus',value:function _focus(e){this._canSelect=true;this._currentInput=e.currentTarget;this._startAutocomplete(e.currentTarget);}},{key:'_blur',value:function _blur(e){this._canSelect=false;this._currentInput=null;this._hide();}},{key:'_remove',value:function _remove(e){var target=e.currentTarget.parentNode;this._currentInput=document.querySelector('#'+target.getAttribute('data-parent-id'));target.parentNode.removeChild(target);this._saveData();this._currentInput=null;}},{key:'_deep_value_array',value:function _deep_value_array(obj,path){var _this5=this;if(path.indexOf('.')===-1){return typeof obj[path]!=='undefined'&&obj[path]!==null?obj[path]:null;}var pathSplit=path.split('.');var res=JSON.parse(JSON.stringify(obj));while(pathSplit.length>0){if(typeof res[pathSplit[0]]!=='undefined'&&res[pathSplit[0]]!==null){if(_typeof(res[pathSplit[0]])==='object'&&Object.prototype.toString.call(res[pathSplit[0]])==='[object Array]'){var resArray=[];Array.prototype.forEach.call(res[pathSplit[0]],function(item){resArray.push(_this5._deep_value_array(item,pathSplit.join('.').replace(pathSplit[0]+'.','')));});res=resArray;pathSplit.shift();}else {res=res[pathSplit[0]];}}else {return null;}pathSplit.shift();}return res;}},{key:'_deep_value',value:function _deep_value(obj,path){if(path.indexOf('.')===-1){return typeof obj[path]!=='undefined'&&obj[path]!==null?obj[path]:null;}var pathSplit=path.split('.');var res=JSON.parse(JSON.stringify(obj));for(var i=0;i0){Array.prototype.forEach.call(richs,function(rich){rich.remove();});var newRichs=[].slice.call(newBlock.querySelectorAll('.rich'));Array.prototype.forEach.call(newRichs,function(newRich){new _richTexarea2.default(newRich,_this2.color,_this2.link);});}return newNumber;}}]);return EditorBlock;}();exports.default=EditorBlock;},{"../utils/color-picker":67,"../utils/dom":68,"../utils/iframe":69,"../utils/link-picker":70,"../utils/rich-texarea":72,"./EditorInputs":60,"./EditorJson":61,"./EditorUtils":65,"on":36}],59:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0){Array.prototype.forEach.call(richs,function(rich){rich.remove();});var newRichs=[].slice.call(newBlock.querySelectorAll('.rich'));Array.prototype.forEach.call(newRichs,function(newRich){new _richTexarea2.default(newRich,_this2.color,_this2.link);});}return newNumber;}}]);return EditorBlock;}();exports.default=EditorBlock;},{"../utils/color-picker":67,"../utils/dom":68,"../utils/iframe":69,"../utils/link-picker":70,"../utils/rich-texarea":72,"./EditorInputs":60,"./EditorJson":61,"./EditorUtils":65,"on":47}],59:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;imaxLength){var lastValues=JSON.parse(target.getAttribute('last-values'));Array.prototype.forEach.call(optionsChecked,function(optionChecked){var unselect=true;Array.prototype.forEach.call(lastValues,function(lastValue){if(optionChecked.value.indexOf('{')>-1||optionChecked.value.indexOf('[')>-1){if(JSON.stringify(JSON.parse(optionChecked.value))==JSON.stringify(lastValue)){unselect=false;}}else {if(optionChecked.value==lastValue){unselect=false;}}});if(unselect){optionChecked.removeAttribute('selected');optionChecked.selected=false;optionChecked.disabled=true;}});}else {var lastValues='[';Array.prototype.forEach.call(optionsChecked,function(optionChecked){if(optionChecked.value!==''){if(optionChecked.value.indexOf('{')>-1||optionChecked.value.indexOf('[')>-1){lastValues+=JSON.stringify(JSON.parse(optionChecked.value));}else {lastValues+='"'+optionChecked.value+'"';}}lastValues+=',';});lastValues=lastValues.substring(0,lastValues.length-1);lastValues+=']';target.setAttribute('last-values',lastValues);}} // var blockContent = IframeNode('#page-template', '.select-' + attr.id)[0] var nodeComments=(0,_iframe.IframeCommentNode)('#page-template',attr.id);if(typeof nodeComments!=='undefined'&&nodeComments!==null&&nodeComments.length>0){var checked=e.target.querySelectorAll('option:checked');var json=this._json.data;json[attr.id]=[];Array.prototype.forEach.call(checked,function(check){if(check.value!==''){if(check.value.indexOf('{')>-1||check.value.indexOf('[')>-1){json[attr.id].push(JSON.parse(check.value));}else {json[attr.id].push(check.value);}}});this._json.data=json;try{Array.prototype.forEach.call(nodeComments,function(nodeComment){var blockHtml=unescape(nodeComment.textContent.replace(/\[\[([\S\s]*?)\]\]/,'')).replace(/\[0\]-/g,'[0]-'); // var blockHtml = unescape(blockContent.innerHTML).replace(/\[0\]-/g, '[0]-') -var template=_handlebars2.default.compile(blockHtml,{noEscape:true});var compiled=template(_this5._json.data);nodeComment.parentNode.innerHTML=compiled+('');});}catch(e){console.log(e);}}else if(typeof attr.id!=='undefined'&&attr.id!==null){var nodes=_EditorUtils2.default.getNode(attr);Array.prototype.forEach.call(nodes,function(node){_EditorUtils2.default.formToHtml(node,target);});}Array.prototype.forEach.call(options,function(option){option.disabled=false;});}}]);return EditorInputs;}();exports.default=EditorInputs;},{"../modules/EditorJson":61,"../modules/EditorSave":64,"../modules/EditorUtils":65,"../utils/color-picker":67,"../utils/iframe":69,"../utils/link-picker":70,"../utils/rich-texarea":72,"handlebars":34,"on":36,"qs":39}],61:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i');});}catch(e){console.log(e);}}else if(typeof attr.id!=='undefined'&&attr.id!==null){var nodes=_EditorUtils2.default.getNode(attr);Array.prototype.forEach.call(nodes,function(node){_EditorUtils2.default.formToHtml(node,target);});}Array.prototype.forEach.call(options,function(option){option.disabled=false;});}}]);return EditorInputs;}();exports.default=EditorInputs;},{"../modules/EditorJson":61,"../modules/EditorSave":64,"../modules/EditorUtils":65,"../utils/color-picker":67,"../utils/iframe":69,"../utils/link-picker":70,"../utils/rich-texarea":72,"handlebars":34,"on":47,"qs":50}],61:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i=0;i--){script.setAttribute(node.attributes[i].name,node.attributes[i].value);}return script;}},{key:'reload',value:function reload(){var iframe=document.querySelector('#page-template');var iframeBody=(0,_iframe.IframeDocument)('#page-template').body;var scrollTop=iframeBody.scrollTop;var json=JSON.parse(JSON.stringify(this._json.data));delete json.abe_source;var data=_qs2.default.stringify({json:json});this._ajax({url:iframe.getAttribute('data-iframe-src'),body:data,method:'post'},function(code,responseText,request){if(typeof responseText!=='undefined'&&responseText!==null){var str=responseText;var doc=iframe.contentWindow.document;str=str.replace(/<\/head>/,'');doc.open();doc.write(str);doc.close();setTimeout(function(){var iframeDoc=(0,_iframe.IframeDocument)('#page-template');if(typeof iframeDoc!=='undefined'&&iframeDoc!==null&&typeof iframeDoc.body!=='undefined'&&iframeDoc.body!==null){iframeDoc.body.scrollTop=scrollTop;}},1000);}return;});}}],[{key:'instance',get:function get(){if(!this[singleton]){this[singleton]=new Reload(singletonEnforcer);window.formJson=this[singleton];}return this[singleton];}}]);return Reload;}();exports.default=Reload;},{"../modules/EditorJson":61,"../utils/iframe":69,"es6-promise":3,"nanoajax":35,"qs":39}],64:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _typeof=typeof Symbol==="function"&&_typeof2(Symbol.iterator)==="symbol"?function(obj){return typeof obj==="undefined"?"undefined":_typeof2(obj);}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj==="undefined"?"undefined":_typeof2(obj);};var _createClass=function(){function defineProperties(target,props){for(var i=0;i=0;i--){script.setAttribute(node.attributes[i].name,node.attributes[i].value);}return script;}},{key:'reload',value:function reload(){var iframe=document.querySelector('#page-template');var iframeBody=(0,_iframe.IframeDocument)('#page-template').body;var scrollTop=iframeBody.scrollTop;var json=JSON.parse(JSON.stringify(this._json.data));delete json.abe_source;var data=_qs2.default.stringify({json:json});this._ajax({url:iframe.getAttribute('data-iframe-src'),body:data,method:'post'},function(code,responseText,request){if(typeof responseText!=='undefined'&&responseText!==null){var str=responseText;var doc=iframe.contentWindow.document;str=str.replace(/<\/head>/,'');doc.open();doc.write(str);doc.close();setTimeout(function(){var iframeDoc=(0,_iframe.IframeDocument)('#page-template');if(typeof iframeDoc!=='undefined'&&iframeDoc!==null&&typeof iframeDoc.body!=='undefined'&&iframeDoc.body!==null){iframeDoc.body.scrollTop=scrollTop;}},1000);}return;});}}],[{key:'instance',get:function get(){if(!this[singleton]){this[singleton]=new Reload(singletonEnforcer);window.formJson=this[singleton];}return this[singleton];}}]);return Reload;}();exports.default=Reload;},{"../modules/EditorJson":61,"../utils/iframe":69,"es6-promise":3,"nanoajax":46,"qs":50}],64:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _typeof=typeof Symbol==="function"&&_typeof2(Symbol.iterator)==="symbol"?function(obj){return typeof obj==="undefined"?"undefined":_typeof2(obj);}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj==="undefined"?"undefined":_typeof2(obj);};var _createClass=function(){function defineProperties(target,props){for(var i=0;i-1){var obj=dataId.split('[')[0];var index=dataId.match(/[^\[]+?(?=\])/)[0];var key=dataId.replace(/[^\.]+?-/,'');if(typeof _this2._json.data[obj]==='undefined'||_this2._json.data[obj]===null)_this2._json.data[obj]=[];if(typeof _this2._json.data[obj][index]==='undefined'||_this2._json.data[obj][index]===null)_this2._json.data[obj][index]={};_this2._json.data[obj][index][key]=input.value;}else {var value;if(input.nodeName==='SELECT'){var checked=input.querySelectorAll('option:checked');value=[];Array.prototype.forEach.call(checked,function(check){if(check.value!==''){if(check.value.indexOf('{')>-1||check.value.indexOf('[')>-1){value.push(JSON.parse(check.value));}else {value.push(check.value);}}});}else if(input.getAttribute('data-autocomplete')==='true'){var results=input.parentNode.querySelectorAll('.autocomplete-result-wrapper .autocomplete-result');value=[];Array.prototype.forEach.call(results,function(result){var val=result.getAttribute('value');if(val!==''){if(val.indexOf('{')>-1||val.indexOf('[')>-1){value.push(JSON.parse(val));}else {value.push(val);}}});}else {value=input.value.replace(/\"/g,'\"')+"";}_this2._json.data[dataId]=value;}}});}},{key:'savePage',value:function savePage(type){var tplName=arguments.length<=1||arguments[1]===undefined?null:arguments[1];var filePath=arguments.length<=2||arguments[2]===undefined?null:arguments[2];var target=document.querySelector('[data-action="'+type+'"]');this.serializeForm();target.classList.add('loading');target.setAttribute('disabled','disabled');this._json.save(this._saveType).then(function(result){target.classList.add('done'); // this._populateFromJson(this._json.data) @@ -1799,7 +1799,7 @@ if(typeof nodes[0]!=='undefined'&&nodes[0]!==null){var bounds=nodes[0].getBoundi * @return {null} */},{key:'formToHtml',value:function formToHtml(node,input){var val=input.value;var id=input.id;var placeholder=input.getAttribute('placeholder');if(typeof placeholder==='undefined'||placeholder==='undefined'||placeholder===null){placeholder="";}if(val.replace(/^\s+|\s+$/g,'').length<1){val=placeholder;}switch(input.nodeName.toLowerCase()){case 'input':var dataAbeAttr=node.getAttribute('data-abe-attr-'+id.replace(/\[([0-9]*)\]/g,'$1'));if(typeof dataAbeAttr!=='undefined'&&dataAbeAttr!==null){node.setAttribute(dataAbeAttr,val);}else {node.innerHTML=val;}break;case 'textarea':node.innerHTML=input.classList.contains('form-rich')?input.parentNode.querySelector('[contenteditable]').innerHTML:val;break;case 'select':var key=node.getAttribute('data-abe-'+id);var dataAbeAttr=node.getAttribute('data-abe-attr-'+id.replace(/\[([0-9]*)\]/g,'$1'));var dataAbeAttrEscaped=unescape(node.getAttribute('data-abe-attr-escaped'));var option=input.querySelector('option:checked');if(typeof option!=='undefined'&&option!==null){val=option.value;if(typeof dataAbeAttr!=='undefined'&&dataAbeAttr!==null){try{var template=_handlebars2.default.compile(dataAbeAttrEscaped,{noEscape:true});var json={};json[key]=val;var compiled=template(json);node.setAttribute(dataAbeAttr,compiled);}catch(e){console.log(e);}}else {node.innerHTML=val;}}break;}}}]);return EditorUtils;}();exports.default=EditorUtils;},{"../../../../cli/handlebars/utils/math":54,"../../../../cli/handlebars/utils/translate-front":55,"../utils/iframe":69,"handlebars":34}],66:[function(require,module,exports){'use strict';var _createClass=function(){function defineProperties(target,props){for(var i=0;i';});colorHTML+='';});colorHTML+='\n ';this.wrapper.innerHTML=colorHTML;this.bindEvt();}_createClass(ColorPicker,[{key:'bindEvt',value:function bindEvt(){var _this=this;this.onColor=(0,_on2.default)(this);this.wrapper.addEventListener('click',function(e){var target=e.target;if(target.classList.contains('wysiwyg-toolbar-color')){_this.onColor._fire(target.getAttribute('title'));_this.popup.close();}});}},{key:'show',value:function show(el){var elBounds=el.getBoundingClientRect();this.popup.open(elBounds.left,elBounds.top+elBounds.height+5);}}]);return ColorPicker;}();exports.default=ColorPicker;},{"./popup":71,"on":36}],68:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.nextSibling=nextSibling;exports.getClosest=getClosest;function nextSibling(parent,ele){var next;var found=false;Array.prototype.forEach.call(parent.childNodes,function(node){if(node.nodeName.indexOf('text')===-1){if(found){next=node;found=false;}if(node===ele){found=true;}}});return next;} /** +});}}]);return Engine;}();var engine=new Engine();window.abe={json:engine.json,inputs:engine._inputs,files:engine._files,blocks:engine._blocks,autocomplete:engine._autocomplete,editorReload:_EditorReload2.default};document.addEventListener("DOMContentLoaded",function(event){if(document.querySelector('#page-template'))engine.loadIframe();});},{"./devtool/Devtool":56,"./modules/EditorAutocomplete":57,"./modules/EditorBlock":58,"./modules/EditorFiles":59,"./modules/EditorInputs":60,"./modules/EditorJson":61,"./modules/EditorManager":62,"./modules/EditorReload":63,"./modules/EditorSave":64,"./modules/EditorUtils":65,"qs":50}],67:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i';});colorHTML+='';});colorHTML+='\n ';this.wrapper.innerHTML=colorHTML;this.bindEvt();}_createClass(ColorPicker,[{key:'bindEvt',value:function bindEvt(){var _this=this;this.onColor=(0,_on2.default)(this);this.wrapper.addEventListener('click',function(e){var target=e.target;if(target.classList.contains('wysiwyg-toolbar-color')){_this.onColor._fire(target.getAttribute('title'));_this.popup.close();}});}},{key:'show',value:function show(el){var elBounds=el.getBoundingClientRect();this.popup.open(elBounds.left,elBounds.top+elBounds.height+5);}}]);return ColorPicker;}();exports.default=ColorPicker;},{"./popup":71,"on":47}],68:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.nextSibling=nextSibling;exports.getClosest=getClosest;function nextSibling(parent,ele){var next;var found=false;Array.prototype.forEach.call(parent.childNodes,function(node){if(node.nodeName.indexOf('text')===-1){if(found){next=node;found=false;}if(node===ele){found=true;}}});return next;} /** * Get closest DOM element up the tree that contains a class, ID, or data attribute * @param {Node} elem The base element * @param {String} selector The class, id, data attribute, or tag to look for @@ -1809,7 +1809,7 @@ for(;elem&&elem!==document;elem=elem.parentNode){ // If selector is a class if(firstChar==='.'){if(elem.classList.contains(selector.substr(1))){return elem;}} // If selector is an ID if(firstChar==='#'){if(elem.id===selector.substr(1)){return elem;}} // If selector is a data attribute if(firstChar==='['){if(elem.hasAttribute(selector.substr(1,selector.length-2))){return elem;}} // If selector is a tag -if(elem.tagName.toLowerCase()===selector){return elem;}}return false;};},{}],69:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.IframeDocument=IframeDocument;exports.IframeNode=IframeNode;exports.IframeCommentNode=IframeCommentNode;function IframeDocument(frameId){var iframe=document.querySelector(frameId);var iframeDocument=iframe.contentDocument||iframe.contentWindow.document;return iframeDocument;}function IframeNode(frameId,selector){return IframeDocument(frameId).querySelectorAll(selector.replace(/\[([0-9]*)\]/g,'$1'));}function IframeGetComment(frameId,prop,val,meth,nd,useSelf){var prop="nodeType";var val=8;var meth=null;var r=[],any=IframeGetComment[val]===true;nd=nd||IframeDocument(frameId).documentElement;if(nd.constructor===Array){nd={childNodes:nd};}for(var cn=nd.childNodes,i=0,mx=cn.length;i-1){found.push(node);}});return found;}},{}],70:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i'+window.getSelection().toString()+'');var off=this.link.onLink(function(obj){if(obj.link!==null){var html=_this2.textEditor.getHTML().replace('[LINK]',obj.link);if(obj.target)html=html.replace(/\[TARGET\]/,'_blank');else html=html.replace(/target=\"\[TARGET\]\"/,'');if(obj.noFollow)html=html.replace(/\[REL\]/,'nofollow');else html=html.replace(/rel=\"\[REL\]\"/,'');_this2.textEditor.setHTML(html);}else _this2.textEditor.setHTML(html);_this2.setHTML();off();});this.link.show(this.el);break;}}else if(this.action==='code'){this._replaceSelectionWithHtml('
'+window.getSelection().toString()+'
');this.textEditor.setHTML(this.textEditor.getHTML());this.setHTML();}else {this.textEditor[this.action](this.param);this.setHTML();}}}]);return RichTexarea;}();exports.default=RichTexarea;},{}],73:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i-1){found.push(node);}});return found;}},{}],70:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i'+window.getSelection().toString()+'');var off=this.link.onLink(function(obj){if(obj.link!==null){var html=_this2.textEditor.getHTML().replace('[LINK]',obj.link);if(obj.target)html=html.replace(/\[TARGET\]/,'_blank');else html=html.replace(/target=\"\[TARGET\]\"/,'');if(obj.noFollow)html=html.replace(/\[REL\]/,'nofollow');else html=html.replace(/rel=\"\[REL\]\"/,'');_this2.textEditor.setHTML(html);}else _this2.textEditor.setHTML(html);_this2.setHTML();off();});this.link.show(this.el);break;}}else if(this.action==='code'){this._replaceSelectionWithHtml('
'+window.getSelection().toString()+'
');this.textEditor.setHTML(this.textEditor.getHTML());this.setHTML();}else {this.textEditor[this.action](this.param);this.setHTML();}}}]);return RichTexarea;}();exports.default=RichTexarea;},{}],73:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i