Commit b58eff0f authored by Van's avatar Van

💄 #47

parent 24219959
{ {
"name": "Solo", "name": "solo",
"version": "3.8.0", "version": "3.8.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
...@@ -8658,9 +8658,12 @@ ...@@ -8658,9 +8658,12 @@
} }
}, },
"vcmt": { "vcmt": {
"version": "1.0.6", "version": "1.0.9",
"resolved": "https://registry.npmjs.org/vcmt/-/vcmt-1.0.6.tgz", "resolved": "https://registry.npmjs.org/vcmt/-/vcmt-1.0.9.tgz",
"integrity": "sha512-OKcnwcPHNJUenziaZzZ09jHB1R7F1E24rGFEDDpI95bVFjUtOTZ4M04GblOWZ4kysyZCVTOwpLRkE6mNB74UDA==" "integrity": "sha512-ikSsf2H9CeVga+3Y45j8oBeSqiV2ibyFiCrXMpsvkUDtj/baLU/KUhHfpvzGwaSjYnxKJVotwa4hxcDYBm1OXg==",
"requires": {
"jquery": "^3.4.1"
}
}, },
"vditor": { "vditor": {
"version": "2.1.1", "version": "2.1.1",
......
{ {
"name": "Solo", "name": "solo",
"version": "3.8.0", "version": "3.8.0",
"description": " 一款小而美的博客系统,专为程序员设计。", "description": " 一款小而美的博客系统,专为程序员设计。",
"homepage": "https://github.com/88250/solo", "homepage": "https://github.com/88250/solo",
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
"jquery": "^3.4.1", "jquery": "^3.4.1",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"uvstat": "^1.0.6", "uvstat": "^1.0.6",
"vcmt": "^1.0.6", "vcmt": "^1.0.9",
"vditor": "^2.1.1" "vditor": "^2.1.1"
} }
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.0.0, Mar 17, 2019 * @version 1.2.0.0, Jan 18, 2020
*/ */
admin.comment = { admin.comment = {
...@@ -95,7 +95,6 @@ admin.comment = { ...@@ -95,7 +95,6 @@ admin.comment = {
$('#' + fromId + 'Comments').html(commentsHTML) $('#' + fromId + 'Comments').html(commentsHTML)
Util.parseMarkdown() Util.parseMarkdown()
Util.parseLanguage()
$('#loadMsg').text('') $('#loadMsg').text('')
}, },
}) })
......
...@@ -111,7 +111,6 @@ admin.commentList = { ...@@ -111,7 +111,6 @@ admin.commentList = {
result.pagination) result.pagination)
Util.parseMarkdown() Util.parseMarkdown()
Util.parseLanguage()
$('#loadMsg').text('') $('#loadMsg').text('')
}, },
}) })
......
...@@ -19,9 +19,8 @@ ...@@ -19,9 +19,8 @@
* @fileoverview editor * @fileoverview editor
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.3.0.1, Aug 6, 2019 * @version 1.4.0.0, Jan 18, 2020
*/ */
import Vditor from 'vditor'
admin.editors = {} admin.editors = {}
/* /*
...@@ -57,7 +56,7 @@ $.extend(SoloEditor.prototype, { ...@@ -57,7 +56,7 @@ $.extend(SoloEditor.prototype, {
if (element.style.display === 'none') { if (element.style.display === 'none') {
return return
} }
Util.parseLanguage() Util.parseMarkdown()
}, },
}, },
upload: { upload: {
......
...@@ -16,18 +16,22 @@ ...@@ -16,18 +16,22 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import $ from 'jquery' import $ from 'jquery'
window.$ = $
import NProgress from 'nprogress' import NProgress from 'nprogress'
import Uvstat from 'uvstat' import Uvstat from 'uvstat'
import pjax from './pjax' import pjax from './pjax'
import Vditor from 'vditor'
import Vcomment from 'vcmt'
window.$ = $
window.Vditor = Vditor
window.Vcomment = Vcomment
/** /**
* @fileoverview util and every page should be used. * @fileoverview util and every page should be used.
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 2.0.1.0, Jan 12, 2020 * @version 2.1.0.0, Jan 18, 2020
*/ */
/** /**
...@@ -114,7 +118,6 @@ window.Util = { ...@@ -114,7 +118,6 @@ window.Util = {
}, },
callback: function () { callback: function () {
Util.parseMarkdown() Util.parseMarkdown()
Util.parseLanguage()
Util.uvstat.addStat() Util.uvstat.addStat()
Util.uvstat.renderStat() Util.uvstat.renderStat()
Util.uvstat.renderCmtStat() Util.uvstat.renderCmtStat()
...@@ -142,21 +145,6 @@ window.Util = { ...@@ -142,21 +145,6 @@ window.Util = {
window.open(this.src) window.open(this.src)
}) })
}, },
/**
* 异步添加 css
* @param url css 文件访问地址
* @param id css 文件标示
*/
addStyle: function (url, id) {
if (!document.getElementById(id)) {
var styleElement = document.createElement('link')
styleElement.id = id
styleElement.setAttribute('rel', 'stylesheet')
styleElement.setAttribute('type', 'text/css')
styleElement.setAttribute('href', url)
document.getElementsByTagName('head')[0].appendChild(styleElement)
}
},
/** /**
* 异步添加 js * 异步添加 js
* @param url js 文件访问地址 * @param url js 文件访问地址
...@@ -176,40 +164,15 @@ window.Util = { ...@@ -176,40 +164,15 @@ window.Util = {
document.getElementsByTagName('head')[0].appendChild(scriptElement) document.getElementsByTagName('head')[0].appendChild(scriptElement)
} }
}, },
/*
* @description 解析语法高亮
*/
parseLanguage: function () {
Vditor.highlightRender({
style: Label.hljsStyle,
enable: !Label.luteAvailable,
}, document)
},
/** /**
* 按需加载数学公式、流程图、代码复制、五线谱、多媒体、图表 * 按需加载数学公式、流程图、代码复制、五线谱、多媒体、图表
* @returns {undefined} * @returns {undefined}
*/ */
parseMarkdown: function () { parseMarkdown: function () {
Vcomment.parseMarkdown({
if (typeof Vditor === 'undefined') { lang: Label.langLabel,
Util.addScript( hljsEnable: !Label.luteAvailable,
'https://cdn.jsdelivr.net/npm/vditor@2.1.1/dist/method.min.js', hljsStyle: Label.hljsStyle,
'vditorPreviewScript')
}
Vditor.codeRender(document.body, Label.langLabel)
if (Label.luteAvailable) {
Vditor.mathRenderByLute(document.body)
} else {
Vditor.mathRender(document.body)
}
Vditor.abcRender()
Vditor.chartRender()
Vditor.mediaRender(document.body)
Vditor.mermaidRender(document.body)
document.querySelectorAll('.vditor-reset').forEach((e) => {
Vditor.speechRender(e, Label.langLabel)
}) })
}, },
/** /**
...@@ -221,14 +184,16 @@ window.Util = { ...@@ -221,14 +184,16 @@ window.Util = {
var left = ($(window).width() - 781) / 2, var left = ($(window).width() - 781) / 2,
top1 = ($(window).height() - 680) / 2 top1 = ($(window).height() - 680) / 2
var killIEHTML = '<div class="killIEIframe" style=\'display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6;filter: alpha(opacity=60); top: 0px;z-index:110\'></div>' var killIEHTML = '<div class="killIEIframe" style=\'display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6;filter: alpha(opacity=60); top: 0px;z-index:110\'></div>'
+ '<iframe class="killIEIframe" style=\'left:' + left + 'px;z-index:120;top: ' + top1 + + '<iframe class="killIEIframe" style=\'left:' + left +
'px;z-index:120;top: ' + top1 +
'px; position: fixed; border: 0px none; width: 781px; height: 680px;\' src=\'' + 'px; position: fixed; border: 0px none; width: 781px; height: 680px;\' src=\'' +
Label.servePath + '/kill-browser\'></iframe>' Label.servePath + '/kill-browser\'></iframe>'
$('body').append(killIEHTML) $('body').append(killIEHTML)
} catch (e) { } catch (e) {
var left = 10, top1 = 0 var left = 10, top1 = 0
var killIEHTML = '<div class="killIEIframe" style=\'display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6;filter: alpha(opacity=60); top: 0px;z-index:110\'></div>' var killIEHTML = '<div class="killIEIframe" style=\'display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6;filter: alpha(opacity=60); top: 0px;z-index:110\'></div>'
+ '<iframe class="killIEIframe" style=\'left:' + left + 'px;z-index:120;top: ' + top1 + + '<iframe class="killIEIframe" style=\'left:' + left +
'px;z-index:120;top: ' + top1 +
'px; position: fixed; border: 0px none; width: 781px; height: 680px;\' src=\'' + 'px; position: fixed; border: 0px none; width: 781px; height: 680px;\' src=\'' +
Label.servePath + '/kill-browser\'></iframe>' Label.servePath + '/kill-browser\'></iframe>'
document.body.innerHTML = document.body.innerHTML + killIEHTML document.body.innerHTML = document.body.innerHTML + killIEHTML
...@@ -285,7 +250,6 @@ window.Util = { ...@@ -285,7 +250,6 @@ window.Util = {
init: function () { init: function () {
Util.killIE() Util.killIE()
Util.parseMarkdown() Util.parseMarkdown()
Util.parseLanguage()
Util.initSW() Util.initSW()
Util.previewImg() Util.previewImg()
Util.initDebugInfo() Util.initDebugInfo()
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -14,7 +14,13 @@ ...@@ -14,7 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
import $ from 'jquery'; /**
* @fileoverview 工具类
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 0.1.0.0, Jan 18, 2020
*/
(function (a) { (function (a) {
var b = function () {} var b = function () {}
...@@ -39,7 +45,7 @@ import $ from 'jquery'; ...@@ -39,7 +45,7 @@ import $ from 'jquery';
}, },
}) })
a.bowknot = new b a.bowknot = new b
})(jQuery); })($);
(function ($) { (function ($) {
$.fn.extend({paginate: {version: '0.0.0.8', author: 'v@b3log.org'}}) $.fn.extend({paginate: {version: '0.0.0.8', author: 'v@b3log.org'}})
...@@ -270,7 +276,7 @@ import $ from 'jquery'; ...@@ -270,7 +276,7 @@ import $ from 'jquery';
} }
$.paginate = new Paginate() $.paginate = new Paginate()
window['DP_jQuery_' + dpuuid] = $ window['DP_jQuery_' + dpuuid] = $
})(jQuery); })($);
(function ($) { (function ($) {
$.fn.extend({table: {version: '0.0.1.0', author: 'v@b3log.org'}}) $.fn.extend({table: {version: '0.0.1.0', author: 'v@b3log.org'}})
var n = new Date().getTime() var n = new Date().getTime()
...@@ -681,7 +687,7 @@ import $ from 'jquery'; ...@@ -681,7 +687,7 @@ import $ from 'jquery';
} }
$.table = new p() $.table = new p()
window['DP_jQuery_' + n] = $ window['DP_jQuery_' + n] = $
})(jQuery); })($);
(function ($) { (function ($) {
$.fn.extend({dialog: {version: '0.0.1.7', author: 'v@b3log.org'}}) $.fn.extend({dialog: {version: '0.0.1.7', author: 'v@b3log.org'}})
var dpuuid = new Date().getTime() var dpuuid = new Date().getTime()
...@@ -935,7 +941,7 @@ import $ from 'jquery'; ...@@ -935,7 +941,7 @@ import $ from 'jquery';
} }
$.dialog = new Dialog() $.dialog = new Dialog()
window['DP_jQuery_' + dpuuid] = $ window['DP_jQuery_' + dpuuid] = $
})(jQuery) })($)
!function (e) { !function (e) {
var t = (new Date).getTime(), n = 'completed', a = function () { var t = (new Date).getTime(), n = 'completed', a = function () {
this._defaults = { this._defaults = {
...@@ -1119,7 +1125,7 @@ import $ from 'jquery'; ...@@ -1119,7 +1125,7 @@ import $ from 'jquery';
e.completed, [this].concat(n)) : e.completed._attach(this, t) e.completed, [this].concat(n)) : e.completed._attach(this, t)
}) })
}, e.completed = new a, window['DP_jQuery_' + t] = e }, e.completed = new a, window['DP_jQuery_' + t] = e
}(jQuery); }($);
(function ($) { (function ($) {
$.fn.extend({tabs: {version: '0.0.1.9', author: 'v@b3log.org'}}) $.fn.extend({tabs: {version: '0.0.1.9', author: 'v@b3log.org'}})
var g = new Date().getTime() var g = new Date().getTime()
...@@ -1207,4 +1213,4 @@ import $ from 'jquery'; ...@@ -1207,4 +1213,4 @@ import $ from 'jquery';
} }
$.tabs = new k() $.tabs = new k()
window['DP_jQuery_' + g] = $ window['DP_jQuery_' + g] = $
})(jQuery) })($)
...@@ -16,14 +16,12 @@ ...@@ -16,14 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import $ from 'jquery'
import Vcomment from 'vcmt'
/** /**
* @fileoverview Page util, load heighlight and process comment. * @fileoverview Page util, load heighlight and process comment.
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 2.5.0.0, Jan 15, 2020 * @version 2.6.0.0, Jan 18, 2020
*/ */
window.Page = function (tips) { window.Page = function (tips) {
this.currentCommentId = '' this.currentCommentId = ''
...@@ -136,9 +134,6 @@ $.extend(Page.prototype, { ...@@ -136,9 +134,6 @@ $.extend(Page.prototype, {
if (!$('#soloEditorComment').hasClass('vditor')) { if (!$('#soloEditorComment').hasClass('vditor')) {
var that = this var that = this
Util.addScript(
'https://cdn.jsdelivr.net/npm/vditor@2.1.1/dist/index.min.js',
'vditorScript')
var toolbar = [ var toolbar = [
'emoji', 'emoji',
'headings', 'headings',
...@@ -208,7 +203,7 @@ $.extend(Page.prototype, { ...@@ -208,7 +203,7 @@ $.extend(Page.prototype, {
if (element.style.display === 'none') { if (element.style.display === 'none') {
return return
} }
Util.parseLanguage() Util.parseMarkdown()
}, },
}, },
counter: 500, counter: 500,
...@@ -399,15 +394,6 @@ $.extend(Page.prototype, { ...@@ -399,15 +394,6 @@ $.extend(Page.prototype, {
$('#soloEditorError').text(that.tips.commentContentCannotEmptyLabel) $('#soloEditorError').text(that.tips.commentContentCannotEmptyLabel)
} }
}, },
/*
* @description 添加回复评论表单
* @param {String} id 被回复的评论 id
*/
addReplyForm: function (id, name) {
var that = this
that.currentCommentId = id
this.toggleEditor(id, name)
},
/* /*
* @description 隐藏回复评论的浮出层 * @description 隐藏回复评论的浮出层
* @parma {String} id 被回复的评论 id * @parma {String} id 被回复的评论 id
...@@ -449,7 +435,6 @@ $.extend(Page.prototype, { ...@@ -449,7 +435,6 @@ $.extend(Page.prototype, {
$('#comments').html(commentHTML) $('#comments').html(commentHTML)
} }
Util.parseMarkdown() Util.parseMarkdown()
Util.parseLanguage()
window.location.hash = '#comments' window.location.hash = '#comments'
}, },
}) })
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -74,7 +74,6 @@ var getArticle = function (it, id) { ...@@ -74,7 +74,6 @@ var getArticle = function (it, id) {
$content.html(result) $content.html(result)
$abstract.hide().css('background', 'none') $abstract.hide().css('background', 'none')
$content.fadeIn('slow') $content.fadeIn('slow')
Util.parseLanguage()
Util.parseMarkdown() Util.parseMarkdown()
}, },
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment