diff --git a/src/server/public/abejs/scripts/admin-compiled.js b/src/server/public/abejs/scripts/admin-compiled.js deleted file mode 100644 index b1976ac0..00000000 --- a/src/server/public/abejs/scripts/admin-compiled.js +++ /dev/null @@ -1,5150 +0,0 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 0){ - pys.push([nohans]); - nohans = ""; // reset non-chinese words. - } - - if(words.length === 1){ - pys.push(single_pinyin(words, options)); - }else{ - pys = pys.concat(phrases_pinyin(words, options)); - } - - }else{ - nohans += words; - } - } - - // 清理最后的非中文字符串。 - if(nohans.length > 0){ - pys.push([nohans]); - nohans = ""; // reset non-chinese words. - } - return pys; -} - - -// 格式化为声母(Initials)、韵母(Finals)。 -// @param {String} -// @return {String} -function initials(pinyin) { - for (var i = 0, l = INITIALS.length; i < l; i++){ - if (pinyin.indexOf(INITIALS[i]) === 0) { - return INITIALS[i]; - } - } - return ""; -} - -pinyin.STYLE_NORMAL = PINYIN_STYLE.NORMAL; -pinyin.STYLE_TONE = PINYIN_STYLE.TONE; -pinyin.STYLE_TONE2 = PINYIN_STYLE.TONE2; -pinyin.STYLE_INITIALS = PINYIN_STYLE.INITIALS; -pinyin.STYLE_FIRST_LETTER = PINYIN_STYLE.FIRST_LETTER; - -module.exports = pinyin; - -}).call(this,require('_process')) -},{"./dict-zi-web":6,"./phonetic-symbol.js":7,"_process":9}],9:[function(require,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.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; }; - -},{}],10:[function(require,module,exports){ -'use strict'; - -var replace = String.prototype.replace; -var percentTwenties = /%20/g; - -module.exports = { - 'default': 'RFC3986', - formatters: { - RFC1738: function (value) { - return replace.call(value, percentTwenties, '+'); - }, - RFC3986: function (value) { - return value; - } - }, - RFC1738: 'RFC1738', - RFC3986: 'RFC3986' -}; - -},{}],11:[function(require,module,exports){ -'use strict'; - -var stringify = require('./stringify'); -var parse = require('./parse'); -var formats = require('./formats'); - -module.exports = { - formats: formats, - parse: parse, - stringify: stringify -}; - -},{"./formats":10,"./parse":12,"./stringify":13}],12:[function(require,module,exports){ -'use strict'; - -var utils = require('./utils'); - -var has = Object.prototype.hasOwnProperty; - -var defaults = { - allowDots: false, - allowPrototypes: false, - arrayLimit: 20, - decoder: utils.decode, - delimiter: '&', - depth: 5, - parameterLimit: 1000, - plainObjects: false, - strictNullHandling: false -}; - -var parseValues = function parseValues(str, options) { - var obj = {}; - var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit); - - for (var i = 0; i < parts.length; ++i) { - var part = parts[i]; - var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1; - - var key, val; - if (pos === -1) { - key = options.decoder(part); - val = options.strictNullHandling ? null : ''; - } else { - key = options.decoder(part.slice(0, pos)); - val = options.decoder(part.slice(pos + 1)); - } - if (has.call(obj, key)) { - obj[key] = [].concat(obj[key]).concat(val); - } else { - obj[key] = val; - } - } - - return obj; -}; - -var parseObject = function parseObject(chain, val, options) { - if (!chain.length) { - return val; - } - - var root = chain.shift(); - - var obj; - if (root === '[]') { - obj = []; - obj = obj.concat(parseObject(chain, val, options)); - } else { - obj = options.plainObjects ? Object.create(null) : {}; - var cleanRoot = root[0] === '[' && root[root.length - 1] === ']' ? root.slice(1, root.length - 1) : root; - var index = parseInt(cleanRoot, 10); - if ( - !isNaN(index) && - root !== cleanRoot && - String(index) === cleanRoot && - index >= 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 && has.call(Object.prototype, 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 < options.depth) { - i += 1; - if (!options.plainObjects && has.call(Object.prototype, segment[1].replace(/\[|\]/g, ''))) { - if (!options.allowPrototypes) { - continue; - } - } - keys.push(segment[1]); - } - - // If there's a remainder, just add whatever is left - - if (segment) { - keys.push('[' + key.slice(segment.index) + ']'); - } - - return parseObject(keys, val, options); -}; - -module.exports = function (str, opts) { - var options = opts || {}; - - if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') { - throw new TypeError('Decoder has to be a function.'); - } - - options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter; - options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth; - options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit; - options.parseArrays = options.parseArrays !== false; - options.decoder = typeof options.decoder === 'function' ? options.decoder : defaults.decoder; - options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : defaults.allowDots; - options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : defaults.plainObjects; - options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes; - options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit; - options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling; - - if (str === '' || str === null || typeof str === 'undefined') { - return options.plainObjects ? Object.create(null) : {}; - } - - var tempObj = typeof str === 'string' ? parseValues(str, options) : str; - var obj = options.plainObjects ? Object.create(null) : {}; - - // Iterate over the keys and setup the new object - - var keys = Object.keys(tempObj); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - var newObj = parseKeys(key, tempObj[key], options); - obj = utils.merge(obj, newObj, options); - } - - return utils.compact(obj); -}; - -},{"./utils":14}],13:[function(require,module,exports){ -'use strict'; - -var utils = require('./utils'); -var formats = require('./formats'); - -var arrayPrefixGenerators = { - brackets: function brackets(prefix) { - return prefix + '[]'; - }, - indices: function indices(prefix, key) { - return prefix + '[' + key + ']'; - }, - repeat: function repeat(prefix) { - return prefix; - } -}; - -var toISO = Date.prototype.toISOString; - -var defaults = { - delimiter: '&', - encode: true, - encoder: utils.encode, - serializeDate: function serializeDate(date) { - return toISO.call(date); - }, - skipNulls: false, - strictNullHandling: false -}; - -var stringify = function stringify(object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, formatter) { - var obj = object; - if (typeof filter === 'function') { - obj = filter(prefix, obj); - } else if (obj instanceof Date) { - obj = serializeDate(obj); - } else if (obj === null) { - if (strictNullHandling) { - return encoder ? encoder(prefix) : prefix; - } - - obj = ''; - } - - if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) { - if (encoder) { - return [formatter(encoder(prefix)) + '=' + formatter(encoder(obj))]; - } - return [formatter(prefix) + '=' + formatter(String(obj))]; - } - - var values = []; - - if (typeof obj === 'undefined') { - return values; - } - - var objKeys; - if (Array.isArray(filter)) { - objKeys = filter; - } else { - var keys = Object.keys(obj); - objKeys = sort ? keys.sort(sort) : keys; - } - - for (var i = 0; i < objKeys.length; ++i) { - var key = objKeys[i]; - - if (skipNulls && obj[key] === null) { - continue; - } - - if (Array.isArray(obj)) { - values = values.concat(stringify( - obj[key], - generateArrayPrefix(prefix, key), - generateArrayPrefix, - strictNullHandling, - skipNulls, - encoder, - filter, - sort, - allowDots, - serializeDate, - formatter - )); - } else { - values = values.concat(stringify( - obj[key], - prefix + (allowDots ? '.' + key : '[' + key + ']'), - generateArrayPrefix, - strictNullHandling, - skipNulls, - encoder, - filter, - sort, - allowDots, - serializeDate, - formatter - )); - } - } - - return values; -}; - -module.exports = function (object, opts) { - var obj = object; - var options = opts || {}; - var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter; - var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling; - var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls; - var encode = typeof options.encode === 'boolean' ? options.encode : defaults.encode; - var encoder = encode ? (typeof options.encoder === 'function' ? options.encoder : defaults.encoder) : null; - var sort = typeof options.sort === 'function' ? options.sort : null; - var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots; - var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate; - if (typeof options.format === 'undefined') { - options.format = formats.default; - } else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) { - throw new TypeError('Unknown format option provided.'); - } - var formatter = formats.formatters[options.format]; - var objKeys; - var filter; - - if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') { - throw new TypeError('Encoder has to be a function.'); - } - - if (typeof options.filter === 'function') { - filter = options.filter; - obj = filter('', obj); - } else if (Array.isArray(options.filter)) { - filter = options.filter; - objKeys = filter; - } - - var keys = []; - - if (typeof obj !== 'object' || obj === null) { - return ''; - } - - var arrayFormat; - if (options.arrayFormat in arrayPrefixGenerators) { - arrayFormat = options.arrayFormat; - } else if ('indices' in options) { - arrayFormat = options.indices ? 'indices' : 'repeat'; - } else { - arrayFormat = 'indices'; - } - - var generateArrayPrefix = arrayPrefixGenerators[arrayFormat]; - - if (!objKeys) { - objKeys = Object.keys(obj); - } - - if (sort) { - objKeys.sort(sort); - } - - for (var i = 0; i < objKeys.length; ++i) { - var key = objKeys[i]; - - if (skipNulls && obj[key] === null) { - continue; - } - - keys = keys.concat(stringify( - obj[key], - key, - generateArrayPrefix, - strictNullHandling, - skipNulls, - encoder, - filter, - sort, - allowDots, - serializeDate, - formatter - )); - } - - return keys.join(delimiter); -}; - -},{"./formats":10,"./utils":14}],14:[function(require,module,exports){ -'use strict'; - -var has = Object.prototype.hasOwnProperty; - -var hexTable = (function () { - var array = []; - for (var i = 0; i < 256; ++i) { - array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); - } - - return array; -}()); - -exports.arrayToObject = function (source, options) { - var obj = options && options.plainObjects ? Object.create(null) : {}; - for (var i = 0; i < source.length; ++i) { - if (typeof source[i] !== 'undefined') { - obj[i] = source[i]; - } - } - - return obj; -}; - -exports.merge = function (target, source, options) { - if (!source) { - return target; - } - - if (typeof source !== 'object') { - if (Array.isArray(target)) { - target.push(source); - } else if (typeof target === 'object') { - target[source] = true; - } else { - return [target, source]; - } - - return target; - } - - if (typeof target !== 'object') { - return [target].concat(source); - } - - var mergeTarget = target; - if (Array.isArray(target) && !Array.isArray(source)) { - mergeTarget = exports.arrayToObject(target, options); - } - - if (Array.isArray(target) && Array.isArray(source)) { - source.forEach(function (item, i) { - if (has.call(target, i)) { - if (target[i] && typeof target[i] === 'object') { - target[i] = exports.merge(target[i], item, options); - } else { - target.push(item); - } - } else { - target[i] = item; - } - }); - return target; - } - - return Object.keys(source).reduce(function (acc, key) { - var value = source[key]; - - if (Object.prototype.hasOwnProperty.call(acc, key)) { - acc[key] = exports.merge(acc[key], value, options); - } else { - acc[key] = value; - } - return acc; - }, mergeTarget); -}; - -exports.decode = function (str) { - try { - return decodeURIComponent(str.replace(/\+/g, ' ')); - } catch (e) { - return str; - } -}; - -exports.encode = function (str) { - // This code was originally written by Brian White (mscdex) for the io.js core querystring library. - // It has been adapted here for stricter adherence to RFC 3986 - if (str.length === 0) { - return str; - } - - var string = typeof str === 'string' ? str : String(str); - - var out = ''; - for (var i = 0; i < string.length; ++i) { - var c = string.charCodeAt(i); - - if ( - c === 0x2D || // - - c === 0x2E || // . - c === 0x5F || // _ - c === 0x7E || // ~ - (c >= 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 !== '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 < obj.length; ++i) { - if (obj[i] && typeof obj[i] === 'object') { - compacted.push(exports.compact(obj[i], refs)); - } else if (typeof obj[i] !== 'undefined') { - compacted.push(obj[i]); - } - } - - return compacted; - } - - var keys = Object.keys(obj); - keys.forEach(function (key) { - obj[key] = exports.compact(obj[key], refs); - }); - - return obj; -}; - -exports.isRegExp = function (obj) { - return Object.prototype.toString.call(obj) === '[object RegExp]'; -}; - -exports.isBuffer = function (obj) { - if (obj === null || typeof obj === 'undefined') { - return false; - } - - return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); -}; - -},{}],15:[function(require,module,exports){ -module.exports = require('./lib/speakingurl'); - -},{"./lib/speakingurl":16}],16:[function(require,module,exports){ -(function (root, undefined) { - 'use strict'; - - /** - * getSlug - * @param {string} input input string - * @param {object|string} opts config object or separator string/char - * @api public - * @return {string} sluggified string - */ - var getSlug = function getSlug(input, opts) { - - var separator = '-'; - var uricChars = [';', '?', ':', '@', '&', '=', '+', '$', ',', '/']; - var uricNoSlashChars = [';', '?', ':', '@', '&', '=', '+', '$', ',']; - var markChars = ['.', '!', '~', '*', '\'', '(', ')']; - var result = ''; - var diatricString = ''; - var convertSymbols = true; - var customReplacements = {}; - var maintainCase; - var titleCase; - var truncate; - var uricFlag; - var uricNoSlashFlag; - var markFlag; - var symbol; - var langChar; - var lucky; - var i; - var ch; - var l; - var lastCharWasSymbol; - var lastCharWasDiatric; - var allowedChars; - - /** - * charMap - * @type {Object} - */ - var charMap = { - - // latin - 'À': 'A', - 'Á': 'A', - 'Â': 'A', - 'Ã': 'A', - 'Ä': 'Ae', - 'Å': 'A', - 'Æ': 'AE', - 'Ç': 'C', - 'È': 'E', - 'É': 'E', - 'Ê': 'E', - 'Ë': 'E', - 'Ì': 'I', - 'Í': 'I', - 'Î': 'I', - 'Ï': 'I', - 'Ð': 'D', - 'Ñ': 'N', - 'Ò': 'O', - 'Ó': 'O', - 'Ô': 'O', - 'Õ': 'O', - 'Ö': 'Oe', - 'Ő': 'O', - 'Ø': 'O', - 'Ù': 'U', - 'Ú': 'U', - 'Û': 'U', - 'Ü': 'Ue', - 'Ű': 'U', - 'Ý': 'Y', - 'Þ': 'TH', - 'ß': 'ss', - 'à': 'a', - 'á': 'a', - 'â': 'a', - 'ã': 'a', - 'ä': 'ae', - 'å': 'a', - 'æ': 'ae', - 'ç': 'c', - 'è': 'e', - 'é': 'e', - 'ê': 'e', - 'ë': 'e', - 'ì': 'i', - 'í': 'i', - 'î': 'i', - 'ï': 'i', - 'ð': 'd', - 'ñ': 'n', - 'ò': 'o', - 'ó': 'o', - 'ô': 'o', - 'õ': 'o', - 'ö': 'oe', - 'ő': 'o', - 'ø': 'o', - 'ù': 'u', - 'ú': 'u', - 'û': 'u', - 'ü': 'ue', - 'ű': 'u', - 'ý': 'y', - 'þ': 'th', - 'ÿ': 'y', - 'ẞ': 'SS', - - // language specific - - // Arabic - 'ا': 'a', - 'أ': 'a', - 'إ': 'i', - 'آ': 'aa', - 'ؤ': 'u', - 'ئ': 'e', - 'ء': 'a', - 'ب': 'b', - 'ت': 't', - 'ث': 'th', - 'ج': 'j', - 'ح': 'h', - 'خ': 'kh', - 'د': 'd', - 'ذ': 'th', - 'ر': 'r', - 'ز': 'z', - 'س': 's', - 'ش': 'sh', - 'ص': 's', - 'ض': 'dh', - 'ط': 't', - 'ظ': 'z', - 'ع': 'a', - 'غ': 'gh', - 'ف': 'f', - 'ق': 'q', - 'ك': 'k', - 'ل': 'l', - 'م': 'm', - 'ن': 'n', - 'ه': 'h', - 'و': 'w', - 'ي': 'y', - 'ى': 'a', - 'ة': 'h', - 'ﻻ': 'la', - 'ﻷ': 'laa', - 'ﻹ': 'lai', - 'ﻵ': 'laa', - - // Persian additional characters than Arabic - 'گ': 'g', - 'چ': 'ch', - 'پ': 'p', - 'ژ': 'zh', - 'ک': 'k', - 'ی': 'y', - - // Arabic diactrics - 'َ': 'a', - 'ً': 'an', - 'ِ': 'e', - 'ٍ': 'en', - 'ُ': 'u', - 'ٌ': 'on', - 'ْ': '', - - // Arabic numbers - '٠': '0', - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - - // Persian numbers - '۰': '0', - '۱': '1', - '۲': '2', - '۳': '3', - '۴': '4', - '۵': '5', - '۶': '6', - '۷': '7', - '۸': '8', - '۹': '9', - - // Burmese consonants - 'က': 'k', - 'ခ': 'kh', - 'ဂ': 'g', - 'ဃ': 'ga', - 'င': 'ng', - 'စ': 's', - 'ဆ': 'sa', - 'ဇ': 'z', - 'စျ': 'za', - 'ည': 'ny', - 'ဋ': 't', - 'ဌ': 'ta', - 'ဍ': 'd', - 'ဎ': 'da', - 'ဏ': 'na', - 'တ': 't', - 'ထ': 'ta', - 'ဒ': 'd', - 'ဓ': 'da', - 'န': 'n', - 'ပ': 'p', - 'ဖ': 'pa', - 'ဗ': 'b', - 'ဘ': 'ba', - 'မ': 'm', - 'ယ': 'y', - 'ရ': 'ya', - 'လ': 'l', - 'ဝ': 'w', - 'သ': 'th', - 'ဟ': 'h', - 'ဠ': 'la', - 'အ': 'a', - // consonant character combos - 'ြ': 'y', - 'ျ': 'ya', - 'ွ': 'w', - 'ြွ': 'yw', - 'ျွ': 'ywa', - 'ှ': 'h', - // independent vowels - 'ဧ': 'e', - '၏': '-e', - 'ဣ': 'i', - 'ဤ': '-i', - 'ဉ': 'u', - 'ဦ': '-u', - 'ဩ': 'aw', - 'သြော': 'aw', - 'ဪ': 'aw', - // numbers - '၀': '0', - '၁': '1', - '၂': '2', - '၃': '3', - '၄': '4', - '၅': '5', - '၆': '6', - '၇': '7', - '၈': '8', - '၉': '9', - // virama and tone marks which are silent in transliteration - '္': '', - '့': '', - 'း': '', - - // Czech - 'č': 'c', - 'ď': 'd', - 'ě': 'e', - 'ň': 'n', - 'ř': 'r', - 'š': 's', - 'ť': 't', - 'ů': 'u', - 'ž': 'z', - 'Č': 'C', - 'Ď': 'D', - 'Ě': 'E', - 'Ň': 'N', - 'Ř': 'R', - 'Š': 'S', - 'Ť': 'T', - 'Ů': 'U', - 'Ž': 'Z', - - // Dhivehi - 'ހ': 'h', - 'ށ': 'sh', - 'ނ': 'n', - 'ރ': 'r', - 'ބ': 'b', - 'ޅ': 'lh', - 'ކ': 'k', - 'އ': 'a', - 'ވ': 'v', - 'މ': 'm', - 'ފ': 'f', - 'ދ': 'dh', - 'ތ': 'th', - 'ލ': 'l', - 'ގ': 'g', - 'ޏ': 'gn', - 'ސ': 's', - 'ޑ': 'd', - 'ޒ': 'z', - 'ޓ': 't', - 'ޔ': 'y', - 'ޕ': 'p', - 'ޖ': 'j', - 'ޗ': 'ch', - 'ޘ': 'tt', - 'ޙ': 'hh', - 'ޚ': 'kh', - 'ޛ': 'th', - 'ޜ': 'z', - 'ޝ': 'sh', - 'ޞ': 's', - 'ޟ': 'd', - 'ޠ': 't', - 'ޡ': 'z', - 'ޢ': 'a', - 'ޣ': 'gh', - 'ޤ': 'q', - 'ޥ': 'w', - 'ަ': 'a', - 'ާ': 'aa', - 'ި': 'i', - 'ީ': 'ee', - 'ު': 'u', - 'ޫ': 'oo', - 'ެ': 'e', - 'ޭ': 'ey', - 'ޮ': 'o', - 'ޯ': 'oa', - 'ް': '', - - // Greek - 'α': 'a', - 'β': 'v', - 'γ': 'g', - 'δ': 'd', - 'ε': 'e', - 'ζ': 'z', - 'η': 'i', - 'θ': 'th', - 'ι': 'i', - 'κ': 'k', - 'λ': 'l', - 'μ': 'm', - 'ν': 'n', - 'ξ': 'ks', - 'ο': 'o', - 'π': 'p', - 'ρ': 'r', - 'σ': 's', - 'τ': 't', - 'υ': 'y', - 'φ': 'f', - 'χ': 'x', - 'ψ': 'ps', - 'ω': 'o', - 'ά': 'a', - 'έ': 'e', - 'ί': 'i', - 'ό': 'o', - 'ύ': 'y', - 'ή': 'i', - 'ώ': 'o', - 'ς': 's', - 'ϊ': 'i', - 'ΰ': 'y', - 'ϋ': 'y', - 'ΐ': 'i', - 'Α': 'A', - 'Β': 'B', - 'Γ': 'G', - 'Δ': 'D', - 'Ε': 'E', - 'Ζ': 'Z', - 'Η': 'I', - 'Θ': 'TH', - 'Ι': 'I', - 'Κ': 'K', - 'Λ': 'L', - 'Μ': 'M', - 'Ν': 'N', - 'Ξ': 'KS', - 'Ο': 'O', - 'Π': 'P', - 'Ρ': 'R', - 'Σ': 'S', - 'Τ': 'T', - 'Υ': 'Y', - 'Φ': 'F', - 'Χ': 'X', - 'Ψ': 'PS', - 'Ω': 'W', - 'Ά': 'A', - 'Έ': 'E', - 'Ί': 'I', - 'Ό': 'O', - 'Ύ': 'Y', - 'Ή': 'I', - 'Ώ': 'O', - 'Ϊ': 'I', - 'Ϋ': 'Y', - - // Latvian - 'ā': 'a', - // 'č': 'c', // duplicate - 'ē': 'e', - 'ģ': 'g', - 'ī': 'i', - 'ķ': 'k', - 'ļ': 'l', - 'ņ': 'n', - // 'š': 's', // duplicate - 'ū': 'u', - // 'ž': 'z', // duplicate - 'Ā': 'A', - // 'Č': 'C', // duplicate - 'Ē': 'E', - 'Ģ': 'G', - 'Ī': 'I', - 'Ķ': 'k', - 'Ļ': 'L', - 'Ņ': 'N', - // 'Š': 'S', // duplicate - 'Ū': 'U', - // 'Ž': 'Z', // duplicate - - // Macedonian - 'Ќ': 'Kj', - 'ќ': 'kj', - 'Љ': 'Lj', - 'љ': 'lj', - 'Њ': 'Nj', - 'њ': 'nj', - 'Тс': 'Ts', - 'тс': 'ts', - - // Polish - 'ą': 'a', - 'ć': 'c', - 'ę': 'e', - 'ł': 'l', - 'ń': 'n', - // 'ó': 'o', // duplicate - 'ś': 's', - 'ź': 'z', - 'ż': 'z', - 'Ą': 'A', - 'Ć': 'C', - 'Ę': 'E', - 'Ł': 'L', - 'Ń': 'N', - 'Ś': 'S', - 'Ź': 'Z', - 'Ż': 'Z', - - // Ukranian - 'Є': 'Ye', - 'І': 'I', - 'Ї': 'Yi', - 'Ґ': 'G', - 'є': 'ye', - 'і': 'i', - 'ї': 'yi', - 'ґ': 'g', - - // Romanian - 'ă': 'a', - 'Ă': 'A', - 'ș': 's', - 'Ș': 'S', - // 'ş': 's', // duplicate - // 'Ş': 'S', // duplicate - 'ț': 't', - 'Ț': 'T', - 'ţ': 't', - 'Ţ': 'T', - - // Russian https://en.wikipedia.org/wiki/Romanization_of_Russian - // ICAO - - 'а': 'a', - 'б': 'b', - 'в': 'v', - 'г': 'g', - 'д': 'd', - 'е': 'e', - 'ё': 'yo', - 'ж': 'zh', - 'з': 'z', - 'и': 'i', - 'й': 'i', - 'к': 'k', - 'л': 'l', - 'м': 'm', - 'н': 'n', - 'о': 'o', - 'п': 'p', - 'р': 'r', - 'с': 's', - 'т': 't', - 'у': 'u', - 'ф': 'f', - 'х': 'kh', - 'ц': 'c', - 'ч': 'ch', - 'ш': 'sh', - 'щ': 'sh', - 'ъ': '', - 'ы': 'y', - 'ь': '', - 'э': 'e', - 'ю': 'yu', - 'я': 'ya', - 'А': 'A', - 'Б': 'B', - 'В': 'V', - 'Г': 'G', - 'Д': 'D', - 'Е': 'E', - 'Ё': 'Yo', - 'Ж': 'Zh', - 'З': 'Z', - 'И': 'I', - 'Й': 'I', - 'К': 'K', - 'Л': 'L', - 'М': 'M', - 'Н': 'N', - 'О': 'O', - 'П': 'P', - 'Р': 'R', - 'С': 'S', - 'Т': 'T', - 'У': 'U', - 'Ф': 'F', - 'Х': 'Kh', - 'Ц': 'C', - 'Ч': 'Ch', - 'Ш': 'Sh', - 'Щ': 'Sh', - 'Ъ': '', - 'Ы': 'Y', - 'Ь': '', - 'Э': 'E', - 'Ю': 'Yu', - 'Я': 'Ya', - - // Serbian - 'ђ': 'dj', - 'ј': 'j', - // 'љ': 'lj', // duplicate - // 'њ': 'nj', // duplicate - 'ћ': 'c', - 'џ': 'dz', - 'Ђ': 'Dj', - 'Ј': 'j', - // 'Љ': 'Lj', // duplicate - // 'Њ': 'Nj', // duplicate - 'Ћ': 'C', - 'Џ': 'Dz', - - // Slovak - 'ľ': 'l', - 'ĺ': 'l', - 'ŕ': 'r', - 'Ľ': 'L', - 'Ĺ': 'L', - 'Ŕ': 'R', - - // Turkish - 'ş': 's', - 'Ş': 'S', - 'ı': 'i', - 'İ': 'I', - // 'ç': 'c', // duplicate - // 'Ç': 'C', // duplicate - // 'ü': 'u', // duplicate, see langCharMap - // 'Ü': 'U', // duplicate, see langCharMap - // 'ö': 'o', // duplicate, see langCharMap - // 'Ö': 'O', // duplicate, see langCharMap - 'ğ': 'g', - 'Ğ': 'G', - - // Vietnamese - 'ả': 'a', - 'Ả': 'A', - 'ẳ': 'a', - 'Ẳ': 'A', - 'ẩ': 'a', - 'Ẩ': 'A', - 'đ': 'd', - 'Đ': 'D', - 'ẹ': 'e', - 'Ẹ': 'E', - 'ẽ': 'e', - 'Ẽ': 'E', - 'ẻ': 'e', - 'Ẻ': 'E', - 'ế': 'e', - 'Ế': 'E', - 'ề': 'e', - 'Ề': 'E', - 'ệ': 'e', - 'Ệ': 'E', - 'ễ': 'e', - 'Ễ': 'E', - 'ể': 'e', - 'Ể': 'E', - 'ọ': 'o', - 'Ọ': 'o', - 'ố': 'o', - 'Ố': 'O', - 'ồ': 'o', - 'Ồ': 'O', - 'ổ': 'o', - 'Ổ': 'O', - 'ộ': 'o', - 'Ộ': 'O', - 'ỗ': 'o', - 'Ỗ': 'O', - 'ơ': 'o', - 'Ơ': 'O', - 'ớ': 'o', - 'Ớ': 'O', - 'ờ': 'o', - 'Ờ': 'O', - 'ợ': 'o', - 'Ợ': 'O', - 'ỡ': 'o', - 'Ỡ': 'O', - 'Ở': 'o', - 'ở': 'o', - 'ị': 'i', - 'Ị': 'I', - 'ĩ': 'i', - 'Ĩ': 'I', - 'ỉ': 'i', - 'Ỉ': 'i', - 'ủ': 'u', - 'Ủ': 'U', - 'ụ': 'u', - 'Ụ': 'U', - 'ũ': 'u', - 'Ũ': 'U', - 'ư': 'u', - 'Ư': 'U', - 'ứ': 'u', - 'Ứ': 'U', - 'ừ': 'u', - 'Ừ': 'U', - 'ự': 'u', - 'Ự': 'U', - 'ữ': 'u', - 'Ữ': 'U', - 'ử': 'u', - 'Ử': 'ư', - 'ỷ': 'y', - 'Ỷ': 'y', - 'ỳ': 'y', - 'Ỳ': 'Y', - 'ỵ': 'y', - 'Ỵ': 'Y', - 'ỹ': 'y', - 'Ỹ': 'Y', - 'ạ': 'a', - 'Ạ': 'A', - 'ấ': 'a', - 'Ấ': 'A', - 'ầ': 'a', - 'Ầ': 'A', - 'ậ': 'a', - 'Ậ': 'A', - 'ẫ': 'a', - 'Ẫ': 'A', - // 'ă': 'a', // duplicate - // 'Ă': 'A', // duplicate - 'ắ': 'a', - 'Ắ': 'A', - 'ằ': 'a', - 'Ằ': 'A', - 'ặ': 'a', - 'Ặ': 'A', - 'ẵ': 'a', - 'Ẵ': 'A', - - // symbols - '“': '"', - '”': '"', - '‘': '\'', - '’': '\'', - '∂': 'd', - 'ƒ': 'f', - '™': '(TM)', - '©': '(C)', - 'œ': 'oe', - 'Œ': 'OE', - '®': '(R)', - '†': '+', - '℠': '(SM)', - '…': '...', - '˚': 'o', - 'º': 'o', - 'ª': 'a', - '•': '*', - '၊': ',', - '။': '.', - - // currency - '$': 'USD', - '€': 'EUR', - '₢': 'BRN', - '₣': 'FRF', - '£': 'GBP', - '₤': 'ITL', - '₦': 'NGN', - '₧': 'ESP', - '₩': 'KRW', - '₪': 'ILS', - '₫': 'VND', - '₭': 'LAK', - '₮': 'MNT', - '₯': 'GRD', - '₱': 'ARS', - '₲': 'PYG', - '₳': 'ARA', - '₴': 'UAH', - '₵': 'GHS', - '¢': 'cent', - '¥': 'CNY', - '元': 'CNY', - '円': 'YEN', - '﷼': 'IRR', - '₠': 'EWE', - '฿': 'THB', - '₨': 'INR', - '₹': 'INR', - '₰': 'PF' - - }; - - /** - * special look ahead character array - * These characters form with consonants to become 'single'/consonant combo - * @type [Array] - */ - var lookAheadCharArray = [ - // burmese - '်', - - // Dhivehi - 'ް' - ]; - - /** - * diatricMap for languages where transliteration changes entirely as more diatrics are added - * @type {Object} - */ - var diatricMap = { - // Burmese - // dependent vowels - 'ာ': 'a', - 'ါ': 'a', - 'ေ': 'e', - 'ဲ': 'e', - 'ိ': 'i', - 'ီ': 'i', - 'ို': 'o', - 'ု': 'u', - 'ူ': 'u', - 'ေါင်': 'aung', - 'ော': 'aw', - 'ော်': 'aw', - 'ေါ': 'aw', - 'ေါ်': 'aw', - '်': '်', // this is special case but the character will be converted to latin in the code - 'က်': 'et', - 'ိုက်': 'aik', - 'ောက်': 'auk', - 'င်': 'in', - 'ိုင်': 'aing', - 'ောင်': 'aung', - 'စ်': 'it', - 'ည်': 'i', - 'တ်': 'at', - 'ိတ်': 'eik', - 'ုတ်': 'ok', - 'ွတ်': 'ut', - 'ေတ်': 'it', - 'ဒ်': 'd', - 'ိုဒ်': 'ok', - 'ုဒ်': 'ait', - 'န်': 'an', - 'ာန်': 'an', - 'ိန်': 'ein', - 'ုန်': 'on', - 'ွန်': 'un', - 'ပ်': 'at', - 'ိပ်': 'eik', - 'ုပ်': 'ok', - 'ွပ်': 'ut', - 'န်ုပ်': 'nub', - 'မ်': 'an', - 'ိမ်': 'ein', - 'ုမ်': 'on', - 'ွမ်': 'un', - 'ယ်': 'e', - 'ိုလ်': 'ol', - 'ဉ်': 'in', - 'ံ': 'an', - 'ိံ': 'ein', - 'ုံ': 'on', - - // Dhivehi - 'ައް': 'ah', - 'ަށް': 'ah', - }; - - /** - * langCharMap language specific characters translations - * @type {Object} - */ - var langCharMap = { - - 'en': {}, // default language - - 'az': { // Azerbaijani - 'ç': 'c', - 'ə': 'e', - 'ğ': 'g', - 'ı': 'i', - 'ö': 'o', - 'ş': 's', - 'ü': 'u', - 'Ç': 'C', - 'Ə': 'E', - 'Ğ': 'G', - 'İ': 'I', - 'Ö': 'O', - 'Ş': 'S', - 'Ü': 'U' - }, - - 'cs': { // Czech - 'č': 'c', - 'ď': 'd', - 'ě': 'e', - 'ň': 'n', - 'ř': 'r', - 'š': 's', - 'ť': 't', - 'ů': 'u', - 'ž': 'z', - 'Č': 'C', - 'Ď': 'D', - 'Ě': 'E', - 'Ň': 'N', - 'Ř': 'R', - 'Š': 'S', - 'Ť': 'T', - 'Ů': 'U', - 'Ž': 'Z' - }, - - 'fi': { // Finnish - // 'å': 'a', duplicate see charMap/latin - // 'Å': 'A', duplicate see charMap/latin - 'ä': 'a', // ok - 'Ä': 'A', // ok - 'ö': 'o', // ok - 'Ö': 'O' // ok - }, - - 'hu': { // Hungarian - 'ä': 'a', // ok - 'Ä': 'A', // ok - // 'á': 'a', duplicate see charMap/latin - // 'Á': 'A', duplicate see charMap/latin - 'ö': 'o', // ok - 'Ö': 'O', // ok - // 'ő': 'o', duplicate see charMap/latin - // 'Ő': 'O', duplicate see charMap/latin - 'ü': 'u', - 'Ü': 'U', - 'ű': 'u', - 'Ű': 'U' - }, - - 'lt': { // Lithuanian - 'ą': 'a', - 'č': 'c', - 'ę': 'e', - 'ė': 'e', - 'į': 'i', - 'š': 's', - 'ų': 'u', - 'ū': 'u', - 'ž': 'z', - 'Ą': 'A', - 'Č': 'C', - 'Ę': 'E', - 'Ė': 'E', - 'Į': 'I', - 'Š': 'S', - 'Ų': 'U', - 'Ū': 'U' - }, - - 'lv': { // Latvian - 'ā': 'a', - 'č': 'c', - 'ē': 'e', - 'ģ': 'g', - 'ī': 'i', - 'ķ': 'k', - 'ļ': 'l', - 'ņ': 'n', - 'š': 's', - 'ū': 'u', - 'ž': 'z', - 'Ā': 'A', - 'Č': 'C', - 'Ē': 'E', - 'Ģ': 'G', - 'Ī': 'i', - 'Ķ': 'k', - 'Ļ': 'L', - 'Ņ': 'N', - 'Š': 'S', - 'Ū': 'u', - 'Ž': 'Z' - }, - - 'pl': { // Polish - 'ą': 'a', - 'ć': 'c', - 'ę': 'e', - 'ł': 'l', - 'ń': 'n', - 'ó': 'o', - 'ś': 's', - 'ź': 'z', - 'ż': 'z', - 'Ą': 'A', - 'Ć': 'C', - 'Ę': 'e', - 'Ł': 'L', - 'Ń': 'N', - 'Ó': 'O', - 'Ś': 'S', - 'Ź': 'Z', - 'Ż': 'Z' - }, - - 'sk': { // Slovak - 'ä': 'a', - 'Ä': 'A' - }, - - 'sr': { // Serbian - 'љ': 'lj', - 'њ': 'nj', - 'Љ': 'Lj', - 'Њ': 'Nj', - 'đ': 'dj', - 'Đ': 'Dj' - }, - - 'tr': { // Turkish - 'Ü': 'U', - 'Ö': 'O', - 'ü': 'u', - 'ö': 'o' - } - }; - - /** - * symbolMap language specific symbol translations - * translations must be transliterated already - * @type {Object} - */ - var symbolMap = { - - 'ar': { - '∆': 'delta', - '∞': 'la-nihaya', - '♥': 'hob', - '&': 'wa', - '|': 'aw', - '<': 'aqal-men', - '>': 'akbar-men', - '∑': 'majmou', - '¤': 'omla' - }, - - 'az': {}, - - 'ca': { - '∆': 'delta', - '∞': 'infinit', - '♥': 'amor', - '&': 'i', - '|': 'o', - '<': 'menys que', - '>': 'mes que', - '∑': 'suma dels', - '¤': 'moneda' - }, - - 'cz': { - '∆': 'delta', - '∞': 'nekonecno', - '♥': 'laska', - '&': 'a', - '|': 'nebo', - '<': 'mene jako', - '>': 'vice jako', - '∑': 'soucet', - '¤': 'mena' - }, - - 'de': { - '∆': 'delta', - '∞': 'unendlich', - '♥': 'Liebe', - '&': 'und', - '|': 'oder', - '<': 'kleiner als', - '>': 'groesser als', - '∑': 'Summe von', - '¤': 'Waehrung' - }, - - 'dv': { - '∆': 'delta', - '∞': 'kolunulaa', - '♥': 'loabi', - '&': 'aai', - '|': 'noonee', - '<': 'ah vure kuda', - '>': 'ah vure bodu', - '∑': 'jumula', - '¤': 'faisaa' - }, - - 'en': { - '∆': 'delta', - '∞': 'infinity', - '♥': 'love', - '&': 'and', - '|': 'or', - '<': 'less than', - '>': 'greater than', - '∑': 'sum', - '¤': 'currency' - }, - - 'es': { - '∆': 'delta', - '∞': 'infinito', - '♥': 'amor', - '&': 'y', - '|': 'u', - '<': 'menos que', - '>': 'mas que', - '∑': 'suma de los', - '¤': 'moneda' - }, - - 'fa': { - '∆': 'delta', - '∞': 'bi-nahayat', - '♥': 'eshgh', - '&': 'va', - '|': 'ya', - '<': 'kamtar-az', - '>': 'bishtar-az', - '∑': 'majmooe', - '¤': 'vahed' - }, - - 'fr': { - '∆': 'delta', - '∞': 'infiniment', - '♥': 'Amour', - '&': 'et', - '|': 'ou', - '<': 'moins que', - '>': 'superieure a', - '∑': 'somme des', - '¤': 'monnaie' - }, - - 'gr': {}, - - 'hu': { - '∆': 'delta', - '∞': 'vegtelen', - '♥': 'szerelem', - '&': 'es', - '|': 'vagy', - '<': 'kisebb mint', - '>': 'nagyobb mint', - '∑': 'szumma', - '¤': 'penznem' - }, - - 'it': { - '∆': 'delta', - '∞': 'infinito', - '♥': 'amore', - '&': 'e', - '|': 'o', - '<': 'minore di', - '>': 'maggiore di', - '∑': 'somma', - '¤': 'moneta' - }, - - 'lt': {}, - - 'lv': { - '∆': 'delta', - '∞': 'bezgaliba', - '♥': 'milestiba', - '&': 'un', - '|': 'vai', - '<': 'mazak neka', - '>': 'lielaks neka', - '∑': 'summa', - '¤': 'valuta' - }, - - 'my': { - '∆': 'kwahkhyaet', - '∞': 'asaonasme', - '♥': 'akhyait', - '&': 'nhin', - '|': 'tho', - '<': 'ngethaw', - '>': 'kyithaw', - '∑': 'paungld', - '¤': 'ngwekye' - }, - - 'mk': {}, - - 'nl': { - '∆': 'delta', - '∞': 'oneindig', - '♥': 'liefde', - '&': 'en', - '|': 'of', - '<': 'kleiner dan', - '>': 'groter dan', - '∑': 'som', - '¤': 'valuta' - }, - - 'pl': { - '∆': 'delta', - '∞': 'nieskonczonosc', - '♥': 'milosc', - '&': 'i', - '|': 'lub', - '<': 'mniejsze niz', - '>': 'wieksze niz', - '∑': 'suma', - '¤': 'waluta' - }, - - 'pt': { - '∆': 'delta', - '∞': 'infinito', - '♥': 'amor', - '&': 'e', - '|': 'ou', - '<': 'menor que', - '>': 'maior que', - '∑': 'soma', - '¤': 'moeda' - }, - - 'ro': { - '∆': 'delta', - '∞': 'infinit', - '♥': 'dragoste', - '&': 'si', - '|': 'sau', - '<': 'mai mic ca', - '>': 'mai mare ca', - '∑': 'suma', - '¤': 'valuta' - }, - - 'ru': { - '∆': 'delta', - '∞': 'beskonechno', - '♥': 'lubov', - '&': 'i', - '|': 'ili', - '<': 'menshe', - '>': 'bolshe', - '∑': 'summa', - '¤': 'valjuta' - }, - - 'sk': { - '∆': 'delta', - '∞': 'nekonecno', - '♥': 'laska', - '&': 'a', - '|': 'alebo', - '<': 'menej ako', - '>': 'viac ako', - '∑': 'sucet', - '¤': 'mena' - }, - - 'sr': {}, - - 'tr': { - '∆': 'delta', - '∞': 'sonsuzluk', - '♥': 'ask', - '&': 've', - '|': 'veya', - '<': 'kucuktur', - '>': 'buyuktur', - '∑': 'toplam', - '¤': 'para birimi' - }, - - 'uk': { - '∆': 'delta', - '∞': 'bezkinechnist', - '♥': 'lubov', - '&': 'i', - '|': 'abo', - '<': 'menshe', - '>': 'bilshe', - '∑': 'suma', - '¤': 'valjuta' - }, - - 'vn': { - '∆': 'delta', - '∞': 'vo cuc', - '♥': 'yeu', - '&': 'va', - '|': 'hoac', - '<': 'nho hon', - '>': 'lon hon', - '∑': 'tong', - '¤': 'tien te' - } - }; - - if (typeof input !== 'string') { - return ''; - } - - if (typeof opts === 'string') { - separator = opts; - } - - symbol = symbolMap.en; - langChar = langCharMap.en; - - if (typeof opts === 'object') { - - maintainCase = opts.maintainCase || false; - customReplacements = (opts.custom && typeof opts.custom === 'object') ? opts.custom : customReplacements; - truncate = (+opts.truncate > 1 && opts.truncate) || false; - uricFlag = opts.uric || false; - uricNoSlashFlag = opts.uricNoSlash || false; - markFlag = opts.mark || false; - convertSymbols = (opts.symbols === false || opts.lang === false) ? false : true; - separator = opts.separator || separator; - - if (uricFlag) { - allowedChars += uricChars.join(''); - } - - if (uricNoSlashFlag) { - allowedChars += uricNoSlashChars.join(''); - } - - if (markFlag) { - allowedChars += markChars.join(''); - } - - symbol = (opts.lang && symbolMap[opts.lang] && convertSymbols) ? - symbolMap[opts.lang] : (convertSymbols ? symbolMap.en : {}); - - langChar = (opts.lang && langCharMap[opts.lang]) ? - langCharMap[opts.lang] : - opts.lang === false || opts.lang === true ? {} : langCharMap.en; - - // if titleCase config is an Array, rewrite to object format - if (opts.titleCase && typeof opts.titleCase.length === "number" && Array.prototype.toString.call(opts.titleCase)) { - - opts.titleCase.forEach(function (v) { - customReplacements[v + ""] = v + ""; - }); - - titleCase = true; - } else { - titleCase = !!opts.titleCase; - } - - // if custom config is an Array, rewrite to object format - if (opts.custom && typeof opts.custom.length === "number" && Array.prototype.toString.call(opts.custom)) { - - opts.custom.forEach(function (v) { - customReplacements[v + ""] = v + ""; - }); - } - - // custom replacements - Object.keys(customReplacements).forEach(function (v) { - - var r; - - if (v.length > 1) { - r = new RegExp('\\b' + escapeChars(v) + '\\b', 'gi'); - } else { - r = new RegExp(escapeChars(v), 'gi'); - } - - input = input.replace(r, customReplacements[v]); - }); - - // add all custom replacement to allowed charlist - for (ch in customReplacements) { - allowedChars += ch; - } - - } - - allowedChars += separator; - - // escape all necessary chars - allowedChars = escapeChars(allowedChars); - - // trim whitespaces - input = input.replace(/(^\s+|\s+$)/g, ''); - - lastCharWasSymbol = false; - lastCharWasDiatric = false; - - for (i = 0, l = input.length; i < l; i++) { - - ch = input[i]; - - if (isReplacedCustomChar(ch, customReplacements)) { - // don't convert a already converted char - lastCharWasSymbol = false; - } else if (langChar[ch]) { - // process language specific diactrics chars conversion - ch = lastCharWasSymbol && langChar[ch].match(/[A-Za-z0-9]/) ? ' ' + langChar[ch] : langChar[ch]; - - lastCharWasSymbol = false; - } else if (ch in charMap) { - // the transliteration changes entirely when some special characters are added - if (i + 1 < l && lookAheadCharArray.indexOf(input[i + 1]) >= 0) { - diatricString += ch; - ch = ''; - } else if (lastCharWasDiatric === true) { - ch = diatricMap[diatricString] + charMap[ch]; - diatricString = ''; - } else { - // process diactrics chars - ch = lastCharWasSymbol && charMap[ch].match(/[A-Za-z0-9]/) ? ' ' + charMap[ch] : charMap[ch]; - } - - lastCharWasSymbol = false; - lastCharWasDiatric = false; - } else - if (ch in diatricMap) { - diatricString += ch; - ch = ''; - // end of string, put the whole meaningful word - if (i === l - 1) { - ch = diatricMap[diatricString]; - } - lastCharWasDiatric = true; - } else if ( - // process symbol chars - symbol[ch] && !(uricFlag && uricChars.join('') - .indexOf(ch) !== -1) && !(uricNoSlashFlag && uricNoSlashChars.join('') - //.indexOf(ch) !== -1) && !(markFlag && markChars.join('') - .indexOf(ch) !== -1)) { - - ch = lastCharWasSymbol || result.substr(-1).match(/[A-Za-z0-9]/) ? separator + symbol[ch] : symbol[ch]; - ch += input[i + 1] !== void 0 && input[i + 1].match(/[A-Za-z0-9]/) ? separator : ''; - - lastCharWasSymbol = true; - } else { - if (lastCharWasDiatric === true) { - ch = diatricMap[diatricString] + ch; - diatricString = ''; - lastCharWasDiatric = false; - } else if (lastCharWasSymbol && (/[A-Za-z0-9]/.test(ch) || result.substr(-1).match(/A-Za-z0-9]/))) { - // process latin chars - ch = ' ' + ch; - } - lastCharWasSymbol = false; - } - - // add allowed chars - result += ch.replace(new RegExp('[^\\w\\s' + allowedChars + '_-]', 'g'), separator); - } - - if (titleCase) { - result = result.replace(/(\w)(\S*)/g, function (_, i, r) { - var j = i.toUpperCase() + (r !== null ? r : ""); - return (Object.keys(customReplacements).indexOf(j.toLowerCase()) < 0) ? j : j.toLowerCase(); - }); - } - - // eliminate duplicate separators - // add separator - // trim separators from start and end - result = result.replace(/\s+/g, separator) - .replace(new RegExp('\\' + separator + '+', 'g'), separator) - .replace(new RegExp('(^\\' + separator + '+|\\' + separator + '+$)', 'g'), ''); - - if (truncate && result.length > truncate) { - - lucky = result.charAt(truncate) === separator; - result = result.slice(0, truncate); - - if (!lucky) { - result = result.slice(0, result.lastIndexOf(separator)); - } - } - - if (!maintainCase && !titleCase) { - result = result.toLowerCase(); - } - - return result; - }; - - /** - * createSlug curried(opts)(input) - * @param {object|string} opts config object or input string - * @return {Function} function getSlugWithConfig() - **/ - var createSlug = function createSlug(opts) { - - /** - * getSlugWithConfig - * @param {string} input string - * @return {string} slug string - */ - return function getSlugWithConfig(input) { - return getSlug(input, opts); - }; - }; - - /** - * escape Chars - * @param {string} input string - */ - var escapeChars = function escapeChars(input) { - - return input.replace(/[-\\^$*+?.()|[\]{}\/]/g, '\\$&'); - }; - - /** - * check if the char is an already converted char from custom list - * @param {char} ch character to check - * @param {object} customReplacements custom translation map - */ - var isReplacedCustomChar = function (ch, customReplacements) { - - for (var c in customReplacements) { - if (customReplacements[c] === ch) { - return true; - } - } - }; - - if (typeof module !== 'undefined' && module.exports) { - - // export functions for use in Node - module.exports = getSlug; - module.exports.createSlug = createSlug; - - } else if (typeof define !== 'undefined' && define.amd) { - - // export function for use in AMD - define([], function () { - return getSlug; - }); - - } else { - - // don't overwrite global if exists - try { - if (root.getSlug || root.createSlug) { - throw 'speakingurl: globals exists /(getSlug|createSlug)/'; - } else { - root.getSlug = getSlug; - root.createSlug = createSlug; - } - } catch (e) {} - - } -})(this); -},{}],17:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /*global document */ - -var _FormCreate = require('./modules/FormCreate'); - -var _FormCreate2 = _interopRequireDefault(_FormCreate); - -var _FormList = require('./modules/FormList'); - -var _FormList2 = _interopRequireDefault(_FormList); - -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"); } } - -var Admin = function () { - function Admin() { - _classCallCheck(this, Admin); - - this._page = document.querySelector('body').getAttribute('data-page'); - // this._formCreate = document.querySelector('.form-create') - var forms = document.querySelectorAll('[data-form-abe-create]'); - Array.prototype.forEach.call(forms, function (form) { - new _FormCreate2.default(form); - }); - - this._bindEvents(); - } - - /** - * _bindEvents for admin pages - * @return {null} - */ - - - _createClass(Admin, [{ - key: '_bindEvents', - value: function _bindEvents() { - if (typeof this._formCreate !== 'undefined' && this._formCreate !== null) {} else if (this._page === 'list') { - new _FormList2.default(); - } - } - }]); - - return Admin; -}(); - -new Admin(); - -},{"./modules/FormCreate":19,"./modules/FormList":20}],18:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var FolderSelect = function () { - function FolderSelect(form) { - _classCallCheck(this, FolderSelect); - - this._form = form; - // constante variable - this._selectTemplate = this._form.querySelector('#selectTemplate'); - this._selectsWebsite = this._form.querySelector('#level-1'); - this._selectsCreate = [].slice.call(this._form.querySelectorAll('select[id*="level-"]')); - - // constante methode - this._handleChangeSelectsCreate = this._changeSelectsCreate.bind(this); - - this._bindEvents(); - } - - _createClass(FolderSelect, [{ - key: '_bindEvents', - value: function _bindEvents() { - var _this = this; - - this._selectsCreate.forEach(function (select) { - select.addEventListener('change', _this._handleChangeSelectsCreate); - }); - } - - /** - * bind event for select page create - * @param {[type]} e [description] - * @return {[type]} [description] - */ - - }, { - key: '_changeSelectsCreate', - value: function _changeSelectsCreate(e) { - var selectedOption = e.currentTarget.querySelector('option:checked'); - - var dataShow = selectedOption.getAttribute('data-show'), - levelShow = selectedOption.getAttribute('data-level-show'), - levelHide = selectedOption.getAttribute('data-level-hide'); - - if (typeof levelShow !== 'undefined' && levelShow !== null && levelShow !== '') { - this._showSubLevels(levelShow, dataShow); - } - if (typeof levelHide !== 'undefined' && levelHide !== null && levelHide !== '') { - this._hideSubLevels(levelHide); - } - } - }, { - key: '_hideSubLevels', - value: function _hideSubLevels(i) { - var levels = [].slice.call(this._form.querySelectorAll('.level-' + i)); - while (levels.length > 0) { - levels.forEach(function (level) { - var options = [].slice.call(level.querySelectorAll('option')); - Array.prototype.forEach.call(options, function (option) { - option.selected = null; - option.removeAttribute('selected'); - }); - level.classList.add('hidden'); - }); - levels = [].slice.call(this._form.querySelectorAll('.level-' + i++)); - } - } - }, { - key: '_showSubLevels', - value: function _showSubLevels(i, dataShow) { - var _this2 = this; - - var levels = [].slice.call(this._form.querySelectorAll('.level-' + i)); - levels.forEach(function (level) { - level.classList.add('hidden'); - - var childs = [].slice.call(_this2._form.querySelectorAll('[data-shown=' + dataShow + ']')); - if (childs) { - childs.forEach(function (child) { - var options = [].slice.call(child.querySelectorAll('option')); - Array.prototype.forEach.call(options, function (option) { - option.selected = null; - option.removeAttribute('selected'); - }); - - child.classList.remove('hidden'); - }); - } - }); - } - }]); - - return FolderSelect; -}(); - -exports.default = FolderSelect; - -},{}],19:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /*global document, window, alert, slugs, CONFIG */ - -var _limax = require('limax'); - -var _limax2 = _interopRequireDefault(_limax); - -var _nanoajax = require('nanoajax'); - -var _nanoajax2 = _interopRequireDefault(_nanoajax); - -var _qs = require('qs'); - -var _qs2 = _interopRequireDefault(_qs); - -var _FolderSelect = require('./FolderSelect'); - -var _FolderSelect2 = _interopRequireDefault(_FolderSelect); - -var _jsonObject = require('../utils/jsonObject'); - -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"); } } - -var FormCreate = function () { - function FormCreate(parentForm) { - _classCallCheck(this, FormCreate); - - this._form = parentForm; - if (typeof this._form !== 'undefined' && this._form !== null) { - this._isSaving = false; - - // constantes variables - this._ajax = _nanoajax2.default.ajax; - - // constantes variables DOM elements - this._previewPostPath = this._form.querySelector('[data-post-path-preview]'); - - this._formInputs = [].slice.call(this._form.querySelectorAll('input, select')); - this._precontribTemplate = [].slice.call(this._form.querySelectorAll('[data-precontrib-templates]')); - - this._selectTemplate = this._form.querySelector('[data-id="abe_meta.template"]'); - this._showHideSelect(this._selectTemplate); - this._handleBtnSelectTemplate = this._btnSelectTemplate.bind(this); - - // // manager update btn - this._btnCreate = this._form.querySelector('[date-abe-create]'); - this._btnUpdate = this._form.querySelector('[date-abe-update]'); - this._btnDuplicate = this._form.querySelector('[date-abe-duplicate]'); - this._handleBtnDuplicateManagerClick = this._btnDuplicateManagerClick.bind(this); - this._handleBtnUpdateManagerClick = this._btnUpdateManagerClick.bind(this); - this._handleBtnCreateManagerClick = this._btnCreateManagerClick.bind(this); - this._handleBlurEvent = this._blurEvent.bind(this); - - // // init modules - new _FolderSelect2.default(this._form); - - this._bindEvents(); - - this._setSlug(false); - } - } - - _createClass(FormCreate, [{ - key: '_bindEvents', - value: function _bindEvents() { - if (typeof this._btnUpdate !== 'undefined' && this._btnUpdate !== null) { - this._btnUpdate.addEventListener('click', this._handleBtnUpdateManagerClick); // click update metadata - } - if (typeof this._btnCreate !== 'undefined' && this._btnCreate !== null) { - this._btnCreate.addEventListener('click', this._handleBtnCreateManagerClick); // click update metadata - } - if (typeof this._btnDuplicate !== 'undefined' && this._btnDuplicate !== null) { - this._btnDuplicate.addEventListener('click', this._handleBtnDuplicateManagerClick); // click duplicate content - } - if (typeof this._form !== 'undefined' && this._form !== null) { - this._form.addEventListener('submit', this._handleSubmit); - } - if (typeof this._selectTemplate !== 'undefined' && this._selectTemplate !== null) { - this._selectTemplate.addEventListener('change', this._handleBtnSelectTemplate); - } - - Array.prototype.forEach.call(this._formInputs, function (input) { - input.addEventListener('blur', this._handleBlurEvent); - }.bind(this)); - } - }, { - key: '_blurEvent', - value: function _blurEvent() { - this._setSlug(false); - } - }, { - key: '_showHideSelect', - value: function _showHideSelect(target) { - this._selectedTemplate = target.value; - Array.prototype.forEach.call(this._precontribTemplate, function (input) { - var linkedTpl = input.getAttribute('data-precontrib-templates').split(','); - var found = false; - Array.prototype.forEach.call(linkedTpl, function (tpl) { - if (tpl === this._selectedTemplate) { - found = true; - } - }.bind(this)); - - if (found) { - input.style.display = 'block'; - } else { - input.style.display = 'none'; - } - }.bind(this)); - } - }, { - key: '_btnSelectTemplate', - value: function _btnSelectTemplate(e) { - this._showHideSelect(e.currentTarget); - } - }, { - key: '_setSlug', - value: function _setSlug(showErrors) { - var values = {}; - var postPath = ''; - var isValid = true; - if (this._selectedTemplate != null && this._selectedTemplate != '') { - - Array.prototype.forEach.call(this._formInputs, function (input) { - if (input.getAttribute('data-slug-type') == 'path') { - if (input.parentNode.classList.contains('hidden')) { - return; - } - } - - var parentNode = input.parentNode; - if (parentNode.getAttribute('data-precontrib-templates') == null) { - parentNode = input.parentNode.parentNode; - } - parentNode.classList.remove('has-error'); - var linkedTpl = parentNode.getAttribute('data-precontrib-templates'); - input.parentNode.classList.remove('error'); - if (linkedTpl == null || linkedTpl == this._selectedTemplate) { - var id = input.getAttribute('data-id'); - if (id !== null) { - var autocomplete = input.getAttribute('data-autocomplete') == 'true' ? true : false; - var required = input.getAttribute('data-required') == 'true' ? true : false; - var value = input.value; - - if (autocomplete) { - var results = input.parentNode.querySelectorAll('.autocomplete-result'); - values[id] = []; - Array.prototype.forEach.call(results, function (result) { - var resultValue = result.getAttribute('value'); - if (resultValue.indexOf('{') > -1) { - try { - var jsonValue = JSON.parse(resultValue); - (0, _jsonObject.setObjByString)(values, id, jsonValue); - // values[id].push(jsonValue) - } catch (e) { - // values[id].push(value) - } - } - }.bind(this)); - if (required && values[id].length == 0) { - isValid = false; - if (showErrors) parentNode.classList.add('has-error'); - } - } else { - if (value.indexOf('{') > -1) { - try { - var jsonValue = JSON.parse(value); - // values[id] = [jsonValue] - (0, _jsonObject.setObjByString)(values, id, [jsonValue]); - - if (required && values[id].length == 0) { - isValid = false; - if (showErrors) parentNode.classList.add('has-error'); - } - } catch (e) { - // values[id].push(value) - } - } else { - // values[id] = value - (0, _jsonObject.setObjByString)(values, id, value); - if (required && values[id] == '') { - isValid = false; - if (showErrors) parentNode.classList.add('has-error'); - } - } - } - } - } - }.bind(this)); - - var slug = slugs[this._selectedTemplate]; - var slugMatches = slug.match(/{{.*?}}/g); - if (slugMatches !== null) { - Array.prototype.forEach.call(slugMatches, function (slugMatch) { - var cleanSlugMath = slugMatch.replace('{{', '').replace('}}', ''); - try { - var valueSlug = eval('values.' + cleanSlugMath) + ''; - valueSlug = (0, _limax2.default)(valueSlug, { separateNumbers: false }); - slug = slug.replace(slugMatch, valueSlug); - } catch (e) { - slug = slug.replace(slugMatch, ''); - isValid = false; - // console.error('error on create', e.stack) - } - }.bind(this)); - } - - var slugPaths = this._form.querySelectorAll('[data-slug-type=path]'); - Array.prototype.forEach.call(slugPaths, function (slugPath) { - var isStructureFolder = slugPath.parentNode.getAttribute('data-shown') != null; - if (slugPath.value != null && slugPath.value != '' && isStructureFolder && !slugPath.parentNode.classList.contains('hidden')) { - postPath += slugPath.value + '/'; - } - }); - postPath += slug.replace(/^\//, ''); - } else { - isValid = false; - } - - var breadcrumbs = postPath.split('/'); - var breadcrumbsHtml = ''; - Array.prototype.forEach.call(breadcrumbs, function (breadcrumb) { - var breadcrumbNames = breadcrumb.split('-'); - breadcrumbsHtml += '
  • '; - Array.prototype.forEach.call(breadcrumbNames, function (breadcrumbName) { - if (breadcrumbName == '' && showErrors) { - breadcrumbsHtml += '...-'; - } else { - breadcrumbsHtml += '' + breadcrumbName + '-'; - } - }.bind(this)); - breadcrumbsHtml = breadcrumbsHtml.replace(/-$/, ''); - breadcrumbsHtml += '
  • '; - }); - breadcrumbsHtml += '.' + CONFIG.EXTENSION + ''; - this._previewPostPath.innerHTML = 'URL : ' + breadcrumbsHtml; - - return { - isValid: isValid, - postPath: postPath, - values: values - }; - } - }, { - key: '_submit', - value: function _submit(type) { - var _this = this; - - var res = this._setSlug(true); - var toSave = _qs2.default.stringify(res.values); - - if (res.isValid && !this._isSaving) { - this._isSaving = true; - this._ajax({ - url: document.location.origin + '/abe/' + type + '/' + res.postPath, - body: toSave, - headers: {}, - method: 'post' - }, function (code, responseText) { - _this._isSaving = false; - var jsonRes = JSON.parse(responseText); - if (jsonRes.success == 1 && jsonRes.json != null && jsonRes.json.abe_meta != null) { - window.location.href = window.location.origin + '/abe/editor' + jsonRes.json.abe_meta.link; - } else { - console.log(responseText); - alert('error'); - } - }); - } - } - }, { - key: '_btnDuplicateManagerClick', - value: function _btnDuplicateManagerClick(e) { - e.preventDefault(); - this._submit('duplicate'); - } - }, { - key: '_btnUpdateManagerClick', - value: function _btnUpdateManagerClick(e) { - e.preventDefault(); - this._submit('update'); - } - }, { - key: '_btnCreateManagerClick', - value: function _btnCreateManagerClick(e) { - e.preventDefault(); - this._submit('create'); - } - }]); - - return FormCreate; -}(); - -exports.default = FormCreate; - -},{"../utils/jsonObject":21,"./FolderSelect":18,"limax":3,"nanoajax":4,"qs":11}],20:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -/*global document, $, top */ - -var FormList = function () { - function FormList() { - var _this = this; - - _classCallCheck(this, FormList); - - // bind button event click - this._btnValidates = [].slice.call(document.querySelectorAll('[data-validate-content]')); - this._handleBtnValidatesClick = this._btnValidatesClick.bind(this); - - this._btnValidates.forEach(function (input) { - input.addEventListener('click', _this._handleBtnValidatesClick); - }); - - // bind button event click - this._btnSetRevisions = [].slice.call(document.querySelectorAll('[data-revisions]')); - - this._btnSetRevisions.forEach(function (input) { - input.addEventListener('click', _this._handleBtnValidatesClick); - }); - } - - _createClass(FormList, [{ - key: '_btnValidatesClick', - value: function _btnValidatesClick(e) { - var tplPath = e.currentTarget.getAttribute('data-template-path'); - var filePath = e.currentTarget.getAttribute('data-file-path'); - var type = e.currentTarget.getAttribute('data-type'); - - var data = { - tplPath: tplPath, - filePath: filePath, - saveAction: type - }; - - $.ajax({ - url: document.location.origin + '/save', - data: data - }).done(function () { - top.location.href = top.location.href; - }); - } - }]); - - return FormList; -}(); - -exports.default = FormList; - -},{}],21:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.setObjByString = setObjByString; -function setObjByString(obj, str, val) { - var keys, key; - //make sure str is a string with length - if (!str || !str.length || Object.prototype.toString.call(str) !== "[object String]") { - return false; - } - if (obj !== Object(obj)) { - //if it's not an object, make it one - obj = {}; - } - keys = str.split("."); - while (keys.length > 1) { - key = keys.shift(); - if (obj !== Object(obj)) { - //if it's not an object, make it one - obj = {}; - } - if (!(key in obj)) { - //if obj doesn't contain the key, add it and set it to an empty object - obj[key] = {}; - } - obj = obj[key]; - } - return obj[keys[0]] = val; -} - -},{}]},{},[17]);