Commit 35287002 authored by Van's avatar Van

💄 #47

parent fe840024
src/main/resources/markdowns/*
!src/main/resources/markdowns/README.md
src/main/resources/dist/
solo_h2_test/
target/
node_modules/
......
......@@ -8637,9 +8637,9 @@
"dev": true
},
"uvstat": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/uvstat/-/uvstat-1.0.0.tgz",
"integrity": "sha512-cLbn3UBgaPI/+Q6ke2JQZF8tyItCQt6WNG09h6/9CoRUDJU8J9c1W+h/0VLW4DXIzxoPbx0HkOJ9nTMBd9UTUg=="
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/uvstat/-/uvstat-1.0.6.tgz",
"integrity": "sha512-Rl7ENBVv7ZtZ2kdDL5Vv4BVsbCP0qxcyOWhRBEpEfY5LHv5nB3iPMbBbSngLRsGPX2eAEboBwseScvIdu0i6eA=="
},
"v8-compile-cache": {
"version": "2.0.3",
......@@ -8657,6 +8657,11 @@
"spdx-expression-parse": "^3.0.0"
}
},
"vcmt": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/vcmt/-/vcmt-1.0.6.tgz",
"integrity": "sha512-OKcnwcPHNJUenziaZzZ09jHB1R7F1E24rGFEDDpI95bVFjUtOTZ4M04GblOWZ4kysyZCVTOwpLRkE6mNB74UDA=="
},
"vditor": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/vditor/-/vditor-2.1.1.tgz",
......
......@@ -47,7 +47,8 @@
"dependencies": {
"jquery": "^3.4.1",
"nprogress": "^0.2.0",
"uvstat": "^1.0.0",
"uvstat": "^1.0.6",
"vcmt": "^1.0.6",
"vditor": "^2.1.1"
}
}
......@@ -173,9 +173,10 @@
</div>
</div>
<#include "admin-label.ftl">
<script src="${staticServePath}/js/admin/admin.min.js${staticResourceVersion}"></script>
<script src="${staticServePath}/js/admin/admin.min.js?${staticResourceVersion}"></script>
${plugins}
<script>
admin.init()
admin.inited()
</script>
</body>
......
......@@ -99,5 +99,4 @@
Label.categoryTooLongLabel = "${categoryTooLongLabel}"
Label.descriptionLabel = "${descriptionLabel}"
Label.previewLabel = '${previewLabel}'
admin.init()
</script>
......@@ -28,7 +28,8 @@ import '../lib/jquery/jquery.bowknot.min'
*/
window.$ = $
export const htmlDecode = function (code) {
Util.init()
window.htmlDecode = function (code) {
var div = document.createElement('div')
div.innerHTML = decodeURIComponent(code)
return div.innerText
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -21,7 +21,7 @@
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.3.0.1, Aug 6, 2019
*/
import Vditor from 'vditor'
admin.editors = {}
/*
......@@ -31,7 +31,7 @@ admin.editors = {}
* @param conf.id 编辑器渲染元素 id
* @param conf.height 编辑器种类
*/
var SoloEditor = function (conf) {
window.SoloEditor = function (conf) {
this.conf = conf
this.init()
}
......
......@@ -18,6 +18,7 @@
import $ from 'jquery'
import NProgress from 'nprogress'
import pjax from './pjax'
import Uvstat from 'uvstat'
/**
* @fileoverview util and every page should be used.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -488,12 +488,7 @@ import jQuery from 'jquery'
})
$(this).addClass(styleClass.lineHoverClass)
if ($(this).find('tr').length === 2) {
if ($.browser.msie) {
if ($.browser.version > 7) {
$(this).
find('tr')[1].style.display = 'block'
}
} else {$(this).find('tr')[1].style.display = 'table-row'}
$(this).find('tr')[1].style.display = 'table-row'
}
}
})
......
This source diff could not be displayed because it is too large. You can view the blob instead.
var Util = {
import $ from 'jquery'
const pjaxUtil = {
support: {
pjax: window.history && window.history.pushState &&
window.history.replaceState && !navigator.userAgent.match(
......@@ -35,7 +36,7 @@ var Util = {
},
// 清除所有的cache
removeAllCache: function () {
if (!Util.support.storage)
if (!pjaxUtil.support.storage)
return
for (var name in localStorage) {
if ((name.split('_') || [''])[0] === 'pjax') {
......@@ -46,23 +47,23 @@ var Util = {
// 获取cache
getCache: function (src, time, flag) {
var item, vkey, tkey, tval
time = Util.toInt(time)
if (src in Util.stack) {
item = Util.stack[src]
const ctime = Util.getTime()
time = pjaxUtil.toInt(time)
if (src in pjaxUtil.stack) {
item = pjaxUtil.stack[src]
const ctime = pjaxUtil.getTime()
if ((item.time + time * 1000) > ctime) {
return item
} else {
delete Util.stack[src]
delete pjaxUtil.stack[src]
}
} else if (flag && Util.support.storage) { // 从localStorage里查询
var l = Util.getLocalKey(src)
} else if (flag && pjaxUtil.support.storage) { // 从localStorage里查询
var l = pjaxUtil.getLocalKey(src)
vkey = l.data
tkey = l.time
item = localStorage.getItem(vkey)
if (item) {
tval = Util.toInt(localStorage.getItem(tkey))
if ((tval + time * 1000) > Util.getTime()) {
tval = pjaxUtil.toInt(localStorage.getItem(tkey))
if ((tval + time * 1000) > pjaxUtil.getTime()) {
return {
data: item,
title: localStorage.getItem(l.title),
......@@ -78,14 +79,14 @@ var Util = {
},
// 设置cache
setCache: function (src, data, title, flag) {
var time = Util.getTime(), key
Util.stack[src] = {
var time = pjaxUtil.getTime(), key
pjaxUtil.stack[src] = {
data: data,
title: title,
time: time,
}
if (flag && Util.support.storage) {
key = Util.getLocalKey(src)
if (flag && pjaxUtil.support.storage) {
key = pjaxUtil.getLocalKey(src)
localStorage.setItem(key.data, data)
localStorage.setItem(key.time, time)
localStorage.setItem(key.title, title)
......@@ -93,10 +94,10 @@ var Util = {
},
// 清除cache
removeCache: function (src) {
src = Util.getRealUrl(src || location.href)
delete Util.stack[src]
if (Util.support.storage) {
var key = Util.getLocalKey(src)
src = pjaxUtil.getRealUrl(src || location.href)
delete pjaxUtil.stack[src]
if (pjaxUtil.support.storage) {
var key = pjaxUtil.getLocalKey(src)
localStorage.removeItem(key.data)
localStorage.removeItem(key.time)
localStorage.removeItem(key.title)
......@@ -129,8 +130,8 @@ var pjax = function (options) {
return true
}
// 只是hash不同
if (Util.getRealUrl(href) == Util.getRealUrl(location.href)) {
var hash = Util.getUrlHash(href)
if (pjaxUtil.getRealUrl(href) == pjaxUtil.getRealUrl(location.href)) {
var hash = pjaxUtil.getUrlHash(href)
if (hash) {
location.hash = hash
options.callback && options.callback.call(this, {
......@@ -295,7 +296,7 @@ pjax.success = function (data, isCached) {
}, isCached)
// 设置cache
if (pjax.options.cache && !isCached) {
Util.setCache(pjax.options.url, data, title, pjax.options.storage)
pjaxUtil.setCache(pjax.options.url, data, title, pjax.options.storage)
}
}
......@@ -308,9 +309,9 @@ pjax.request = function (options) {
options = $.extend(true, pjax.defaultOptions, options)
var cache, container = $(options.container)
options.oldUrl = options.url
options.url = Util.getRealUrl(options.url)
options.url = pjaxUtil.getRealUrl(options.url)
if ($(options.element).length) {
cache = Util.toInt($(options.element).attr('data-pjax-cache'))
cache = pjaxUtil.toInt($(options.element).attr('data-pjax-cache'))
if (cache) {
options.cache = cache
}
......@@ -318,10 +319,10 @@ pjax.request = function (options) {
if (options.cache === true) {
options.cache = 24 * 3600
}
options.cache = Util.toInt(options.cache)
options.cache = pjaxUtil.toInt(options.cache)
// 如果将缓存时间设为0,则将之前的缓存也清除
if (options.cache === 0) {
Util.removeAllCache()
pjaxUtil.removeAllCache()
}
// 展现函数
if (!options.showFn) {
......@@ -332,7 +333,7 @@ pjax.request = function (options) {
pjax.options = options
pjax.options.success = pjax.success
if (options.cache &&
(cache = Util.getCache(options.url, options.cache, options.storage))) {
(cache = pjaxUtil.getCache(options.url, options.cache, options.storage))) {
options.beforeSend()
options.title = cache.title
pjax.success(cache.data, true)
......@@ -373,7 +374,7 @@ $(window).bind('popstate', function (event) {
})
// not support
if (!Util.support.pjax) {
if (!pjaxUtil.support.pjax) {
pjax = function () {
return true
}
......
......@@ -1462,13 +1462,14 @@ a[class*=" icon-"]:hover {
/* start first tab */
#tabs {
height: 100%;
min-height: 468px;
width: 240px;
margin-top: 50px;
position: fixed;
top: 0;
background-color: #32323a;
overflow: auto; }
#tabs::-webkit-scrollbar {
display: none; }
#tabs ul {
list-style: none; }
......@@ -1829,7 +1830,7 @@ button#submitArticle:hover {
.dialog-panel {
display: none;
position: absolute;
position: fixed;
z-index: 100; }
.dialog-title {
......
......@@ -304,13 +304,15 @@ a[class*=" icon-"]:hover {
/* start first tab */
#tabs {
height: 100%;
min-height: 468px;
width: 240px;
margin-top: 50px;
position: fixed;
top: 0;
background-color: #32323a;
overflow: auto;
&::-webkit-scrollbar {
display: none;
}
}
#tabs ul {
......@@ -744,7 +746,7 @@ button#submitArticle:hover {
.dialog-panel {
display: none;
position: absolute;
position: fixed;
z-index: 100;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -8,7 +8,7 @@
* @fileoverview webpack ipfs.
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 3.2.0.0, Jan 8, 2020
* @version 0.1.0.0, Jan 18, 2020
*/
const path = require('path')
......@@ -67,11 +67,11 @@ module.exports = {
'./src/main/resources/js/admin/plugin.js',
'./src/main/resources/js/admin/main.js',
'./src/main/resources/js/admin/about.js'],
// 'js/common': './src/main/resources/js/common.js',
// 'js/page': './src/main/resources/js/page.js',
'css/admin': './src/main/resources/scss/admin.scss',
// 'css/base': './src/main/resources/scss/base.scss',
// 'css/start': './src/main/resources/scss/start.scss',
'js/common': './src/main/resources/js/common.js',
'js/page': './src/main/resources/js/page.js',
'dist/admin': './src/main/resources/scss/admin.scss',
'dist/base': './src/main/resources/scss/base.scss',
'dist/start': './src/main/resources/scss/start.scss',
}),
module: {
rules: [
......
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