diff --git a/core/function.php b/core/function.php index 65d09ef..2205c75 100644 --- a/core/function.php +++ b/core/function.php @@ -3,7 +3,7 @@ /* 获取主题当前版本号 */ function _getVersion() { - return "5.2.2"; + return "5.2.3"; }; /* 判断是否是手机 */ diff --git a/public/include.php b/public/include.php index 5736dd8..87e25e3 100644 --- a/public/include.php +++ b/public/include.php @@ -66,7 +66,7 @@ - + diff --git a/typecho/editor/joe.owo.js b/typecho/editor/joe.owo.js index 51fefd0..15d1ea7 100644 --- a/typecho/editor/joe.owo.js +++ b/typecho/editor/joe.owo.js @@ -1,6 +1,42 @@ -class JoeOwO { - constructor(options) { - const defaultOption = { +function _instanceof(left, right) { + if (right != null && typeof Symbol !== 'undefined' && right[Symbol.hasInstance]) { + return !!right[Symbol.hasInstance](left); + } else { + return left instanceof right; + } +} + +function _classCallCheck(instance, Constructor) { + if (!_instanceof(instance, Constructor)) { + throw new TypeError('Cannot call a class as a 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); + } +} + +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; +} + +var JoeOwO = /*#__PURE__*/ (function () { + 'use strict'; + + function JoeOwO(options) { + var _this = this; + + _classCallCheck(this, JoeOwO); + + var defaultOption = { contain: '.joe_owo__contain', target: '.joe_owo__target', seat: 'OωO', @@ -11,72 +47,84 @@ class JoeOwO { url: this.options.api, type: 'get', dataType: 'json', - success: res => this.initHtml(res) + success: function success(res) { + return _this.initHtml(res); + } }); } /* 初始化 */ - initHtml(res) { - let barStr = ''; - let scrollStr = ''; - for (let key in res) { - barStr += `
${key}
`; - scrollStr += ` - - `; + + _createClass(JoeOwO, [ + { + key: 'initHtml', + value: function initHtml(res) { + var barStr = ''; + var scrollStr = ''; + + for (var key in res) { + barStr += '
').concat(key, '
'); + scrollStr += '\n \n ' + ); + } + + $(this.options.contain).html('\n
'.concat(this.options.seat, '
\n
\n ').concat(scrollStr, '\n
').concat(barStr, '
\n
\n ')); + this.initEvent(); + } + }, + { + key: 'initEvent', + value: function initEvent() { + /* 容器 */ + var contain = this.options.contain; + var height = $(contain).height(); + /* 点击页面关闭 */ + + $(document).on('click', function () { + $(contain + ' .box').removeClass('show'); + }); + /* 点击占位符,显示表情弹窗 */ + + var seat = contain + ' .seat'; + $(seat).on('click', function (e) { + e.stopPropagation(); + $(this).siblings('.box').css('top', height).toggleClass('show'); + }); + /* 点击tab栏,切换表情类型 */ + + var barItem = contain + ' .box .bar .item'; + $(barItem).on('click', function (e) { + e.stopPropagation(); + $(this).addClass('active').siblings().removeClass('active'); + var scrollIndx = contain + ' .box .scroll[data-index="' + $(this).attr('data-index') + '"]'; + $(scrollIndx).show().siblings('.scroll').hide(); + }); + /* 点击表情,向文本框插入内容 */ + + var items = contain + ' .scroll .item'; + var textarea = $(this.options.target)[0]; + $(items).on('click', function () { + var text = $(this).attr('data-text'); + var cursorPos = textarea.selectionEnd; + var areaValue = textarea.value; + textarea.value = areaValue.slice(0, cursorPos) + text + areaValue.slice(cursorPos); + textarea.focus(); + }); + /* 默认激活第一个 */ + + $(barItem).first().click(); + } } - $(this.options.contain).html(` -
${this.options.seat}
-
- ${scrollStr} -
${barStr}
-
- `); + ]); - this.initEvent(); - } - initEvent() { - /* 容器 */ - const contain = this.options.contain; - const height = $(contain).height(); + return JoeOwO; +})(); - /* 点击页面关闭 */ - $(document).on('click', function () { - $(contain + ' .box').removeClass('show'); - }); - - /* 点击占位符,显示表情弹窗 */ - const seat = contain + ' .seat'; - $(seat).on('click', function (e) { - e.stopPropagation(); - $(this).siblings('.box').css('top', height).toggleClass('show'); - }); - - /* 点击tab栏,切换表情类型 */ - const barItem = contain + ' .box .bar .item'; - $(barItem).on('click', function (e) { - e.stopPropagation(); - $(this).addClass('active').siblings().removeClass('active'); - const scrollIndx = contain + ' .box .scroll[data-index="' + $(this).attr('data-index') + '"]'; - $(scrollIndx).show().siblings('.scroll').hide(); - }); - - /* 点击表情,向文本框插入内容 */ - const items = contain + ' .scroll .item'; - const textarea = $(this.options.target)[0]; - $(items).on('click', function () { - const text = $(this).attr('data-text'); - const cursorPos = textarea.selectionEnd; - const areaValue = textarea.value; - textarea.value = areaValue.slice(0, cursorPos) + text + areaValue.slice(cursorPos); - textarea.focus(); - }); - - /* 默认激活第一个 */ - $(barItem).first().click(); - } -} if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { module.exports = JoeOwO; } else {