浏览代码

删除无用资源 & 代码高亮修改

master
nelson 3 年前
父节点
当前提交
86e46858bb
  1. 3
      static/css/common.css
  2. 46
      static/js/jslide/demo-only.js
  3. 107
      static/js/jslide/jquery.jside.menu.js
  4. 2
      static/js/layer.js
  5. 119
      static/js/upload.js
  6. 4
      static/js/wangEditor.min.js
  7. 5
      views/blog.html
  8. 55
      views/editblog.html
  9. 1
      views/iframe/user.html
  10. 5
      views/newblog.html
  11. 4
      views/ublogs.html
  12. 4
      views/uinfo.html

3
static/css/common.css

@ -153,7 +153,8 @@ a{
text-align: center
}
.blog-root .blog-detaile{
color: #2f2f2f;
color: #444;
font-size: 16px;
}
.blog-root .blog-detaile pre{
/*color: #d2e8b9;*/

46
static/js/jslide/demo-only.js

@ -1,46 +0,0 @@
/* Author: Asif Mughal
* URL: https://www.codehim.com
* License: MIT License
* Copyright (c) 2018 - Asif Mughal
*/
/* File: demo-only.js */
$(function () {
/* Demo only */
var jSide = $(".menu-container, .menu-head, .menubar");
$(".menu-position").on('change', function () {
$(jSide).not(".menubar").addClass($(this).val());
$(".j-pos").html('jSidePosition: "position-right",');
if ($(this).val() == 'position-left') {
$(jSide).removeClass("position-right");
$(".j-pos").html('jSidePosition: "position-left",');
$(".menu-trigger").removeClass("right").addClass("left");
} else {
$(jSide).removeClass("position-left");
$(".menu-trigger").removeClass("left").addClass("right");
}
});
$(".bg-color").on('change', function () {
var color = $(this).val();
$(jSide).css({'background': color,});
$(".bg-color-input").val(color);
});
$(".bg-color-input").on('input', function () {
$(jSide).css({'background': $(this).val(),});
});
$("#set-top").change(function () {
$(".menubar").addClass("sticky");
$(".j-sticky").html("jSideSticky: true,");
});
$("#set-st").change(function () {
$(".menubar").removeClass("sticky");
$(".j-sticky").html("jSideSticky: false,");
});
$(".theme-tray span").click(function () {
var skin = $(this).attr("class");
$(".menubar").attr('class', skin).addClass("menubar sticky");
$(".menu-container").attr('class', skin).addClass("menu-container position-left");
$(".menu-head").attr('class', skin).addClass("menu-head position-left");
var newcode = 'jSideSkin:' + '\"' + skin + '\",';
$(".j-skin").html(newcode);
});
});

107
static/js/jslide/jquery.jside.menu.js

@ -1,107 +0,0 @@
/* Plugin: jSide Menu (Responsive Side Menu)
* Frameworks: jQuery 3.3.1 & Material Design Iconic Font 2.0
* Author: Asif Mughal
* GitHub: https://github.com/CodeHimBlog
* URL: https://www.codehim.com
* License: MIT License
* Copyright (c) 2018 - Asif Mughal
*/
/* File: jquery.jside.menu.js */
(function ($) {
$.fn.jSideMenu = function (options) {
var setting = $.extend({
jSidePosition: "position-left", //possible options position-left or position-right
jSideSticky: true, // menubar will be fixed on top, false to set static
jSideSkin: "default-skin", // to apply custom skin, just put its name in this string
}, options);
return this.each(function () {
var target, $headHeight,
$devHeight,
jSide,
arrow,
dimBackground;
target = $(this);
/* Accessing DOM */
jSide = $(".menu-container, .menu-head");
$devHeight = $(window).height();
$headHeight = $(".menu-head").height();
arrow = document.createElement("i");
dimBackground = $(".dim-overlay");
// Set the height of side menu according to the available height of device
$(target).css({
'height': $devHeight - $headHeight,
});
if (setting.jSideSticky == true) {
$(".menubar").addClass("sticky");
} else {
$(".menubar").removeClass("sticky");
}
$(".menubar").addClass(setting.jSideSkin);
$(jSide).addClass(setting.jSideSkin).addClass(setting.jSidePosition);
if ($(jSide).hasClass("position-left")) {
$(".menu-trigger").addClass("left").removeClass("right");
} else {
$(".menu-trigger").removeClass("left").addClass("right");
}
//Dropdown Arrow
$(arrow).addClass("zmdi zmdi-chevron-down arrow").appendTo(".dropdown-heading");
//Dropdowns
$(".dropdown-heading").click(function () {
var n = $(".has-sub").find("span:hover + ul li").length;
var h = $(".has-sub").find("span:hover + ul li").outerHeight();
var dropdown = h * n;
var todrop = $(".has-sub").find("span:hover + ul");
var nodrop = $(".has-sub ul");
$(todrop).animate({"height": dropdown}, 100);
$(this).find("i").toggleClass("arrowdown");
if ($(todrop).height() == dropdown) {
$(todrop).animate({"height": 0}, 100);
}
if ($(nodrop).height(dropdown)) {
$(nodrop).not(todrop).height(0);
$(".dropdown-heading").not(this).find("i").removeClass("arrowdown");
}
});
$(".menu-trigger").click(function () {
$(jSide).toggleClass("open");
$(dimBackground).show(500);
});
//close menu if user click outside of it
$(window).click(function (e) {
if ($(e.target).closest('.menu-trigger').length) {
return;
}
if ($(e.target).closest(jSide).length) {
return;
}
$(jSide).removeClass("open");
if (!$(jSide).hasClass("open")) {
$(dimBackground).hide(500);
}
});
});
};
})(jQuery);
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */

2
static/js/layer.js

文件差异因一行或多行过长而隐藏

119
static/js/upload.js

@ -1,119 +0,0 @@
function DragImgUpload(id,options) {
this.me = $(id);
var defaultOpt = {
boxWidth:'120px',
boxHeight:'auto'
}
this.preview = $('<div id="preview"><img src="/static/img/upload.png" class="img-responsive" style="width: 100%;height: auto;" alt="" title=""> </div>');
this.opts=$.extend(true, defaultOpt,{
}, options);
this.init();
this.callback = this.opts.callback;
}
//定义原型方法
DragImgUpload.prototype = {
init:function () {
this.me.append(this.preview);
this.me.append(this.fileupload);
this.cssInit();
this.eventClickInit();
},
cssInit:function () {
this.me.css({
'width':this.opts.boxWidth,
'height':this.opts.boxHeight,
'border':'1px solid #cccccc',
'padding':'10px',
'cursor':'pointer'
})
this.preview.css({
'height':'100%',
'overflow':'hidden'
})
},
onDragover:function (e) {
e.stopPropagation();
e.preventDefault();
e.dataTransfer.dropEffect = 'copy';
},
onDrop:function (e) {
var self = this;
e.stopPropagation();
e.preventDefault();
var fileList = e.dataTransfer.files; //获取文件对象
// do something upload
if(fileList.length == 0){
return false;
}
//检测文件是不是图片
if(fileList[0].type.indexOf('image') === -1){
alert("您拖的不是图片!");
return false;
}
//拖拉图片到浏览器,可以实现预览功能
var img = window.URL.createObjectURL(fileList[0]);
var filename = fileList[0].name; //图片名称
var filesize = Math.floor((fileList[0].size)/1024);
if(filesize>500){
alert("上传大小不能超过500K.");
return false;
}
self.me.find("img").attr("src",img);
self.me.find("img").attr("title",filename);
if(this.callback){
this.callback(fileList);
}
},
eventClickInit:function () {
var self = this;
this.me.unbind().click(function () {
self.createImageUploadDialog();
})
var dp = this.me[0];
dp.addEventListener('dragover', function(e) {
self.onDragover(e);
});
dp.addEventListener("drop", function(e) {
self.onDrop(e);
});
},
onChangeUploadFile:function () {
var fileInput = this.fileInput;
var files = fileInput.files;
var file = files[0];
var img = window.URL.createObjectURL(file);
var filename = file.name;
this.me.find("img").attr("src",img);
this.me.find("img").attr("title",filename);
if(this.callback){
this.callback(files);
}
},
createImageUploadDialog:function () {
var fileInput = this.fileInput;
if (!fileInput) {
//创建临时input元素
fileInput = document.createElement('input');
//设置input type为文件类型
fileInput.type = 'file';
//设置文件name
fileInput.name = 'ime-images';
//允许上传多个文件
fileInput.multiple = true;
fileInput.onchange = this.onChangeUploadFile.bind(this);
this.fileInput = fileInput;
}
//触发点击input点击事件,弹出选择文件对话框
fileInput.click();
}
}

4
static/js/wangEditor.min.js

文件差异因一行或多行过长而隐藏

5
views/blog.html

@ -2,9 +2,10 @@
<meta name="keywords" content="{{.Blog.Title}}-【码农随笔】">
<meta name="description" content="{{.Blog.BlogDesc}}">
<title>{{.Blog.Title}} - 码农随笔</title>
<link href="https://cdn.bootcss.com/highlight.js/9.15.6/styles/school-book.min.css" rel="stylesheet">
<!--<link href="https://cdn.bootcdn.net/ajax/libs/highlight.js/11.2.0/styles/androidstudio.min.css" rel="stylesheet">-->
<link href="https://cdn.bootcdn.net/ajax/libs/highlight.js/11.2.0/styles/atom-one-dark.min.css" rel="stylesheet">
<!--<link href="https://cdn.bootcss.com/highlight.js/9.15.6/styles/atelier-dune-light.min.css" rel="stylesheet">-->
<script src="https://cdn.bootcss.com/highlight.js/9.15.6/highlight.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/highlight.js/11.2.0/highlight.min.js"></script>
</head>
<body>
<div class="root-container">

55
views/editblog.html

@ -8,38 +8,36 @@
<body>
<div class="root-container" id="vue-app">
<div class="blog-title">
<i-input type="text" v-model="blog.Title" placeholder="请输入文章标题"/>
<el-input v-model="blog.Title" placeholder="请输入文章标题"></el-input>
</div>
<mavon-editor :externalLink="externalLink" :toolbars="toolbars" v-model="blog.BlogValue" @imgAdd="$imgAdd"
@save="saveHandler" @change="changeHandler" ref=md></mavon-editor>
<Modal
v-model="showModal"
title="发布文章"
:mask-closable="false">
<el-dialog title="发布文章" :visible.sync="showModal" width="500px">
<div class="modal_form">
<span class="span-lable">文章分类:</span>
<i-select v-model="blog.CategoryId" style="width:300px">
<i-option v-for="item in cats" :value="item.Id" :key="item.Id">${ item.Title }</i-option>
</i-select>
<el-select v-model="blog.CategoryId" placeholder="请选择文章分类" style="width: 310px">
<el-option v-for="item in cats" :key="item.Id" :label="item.Title" :value="item.Id"/>
</el-select>
</div>
<div class="modal_form">
<span class="span-lable">文章标签:</span>
<i-button type="primary" ghost size="small" v-for="item,index in lables" :key="index" style="margin-left: 5px">${item.Title}
<Icon type="ios-close-circle-outline" @click="delLabel(index)"/>
</i-button>
<el-tag v-for="item,index in lables" :key="index" closable @close="delLabel(index)" style="margin-right: 3px">
${item.Title}
</el-tag>
</div>
<div class="modal_form">
<span class="span-lable">添加标签:</span>
<div style="display: inline-block;width: 241px">
<i-input type="text" v-model="lableTitle" placeholder="请输入标签名称"/>
<el-input v-model="lableTitle" placeholder="请输入标签名称"/>
</div>
<i-button type="primary" ghost @click="addLable">添加</i-button>
<el-button type="primary" plain @click="addLable">添加</el-button>
</div>
<div slot="footer">
<i-button type="error" size="large" long :loading="loading" @click="okHandler">保存</i-button>
</div>
</Modal>
<span slot="footer" class="dialog-footer">
<el-button @click="showModal = false">取 消</el-button>
<el-button type="primary" :loading="loading" @click="okHandler">保存</el-button>
</span>
</el-dialog>
</div>
</body>
<script>
@ -128,9 +126,7 @@
methods: {
okHandler (){
if(!this.blog.CategoryId || this.blog.CategoryId==0){
this.$Notice.warning({
title: '文章分类必须选择',
})
this.$message.error('文章分类必须选择')
return
}
var _this = this
@ -151,21 +147,18 @@
function (data) {
_this.loading = false
if (data.Status == 0) {
layer.msg("保存成功", {icon: 6});
_this.$message.success('保存成功')
window.location.href = "/blog/{{.Blog.Id}}"
} else if (data.Status == 401) {
window.location.href = "/login"
} else if (data.Status == 500) {
layer.msg("保存失败", {icon: 6});
callback(false)
_this.$message.error('保存失败')
}
}, 'json')
},
addLable(){
if(!this.lableTitle){
this.$Notice.warning({
title: '请先输入标签名称',
})
this.$message.error('请先输入标签名称')
return
}
var tobj = {}
@ -206,20 +199,14 @@
changeHandler(value, render) {
this.blog.BlogValue = value
this.blog.BlogHtml = render
// var jsonStr = JSON.stringify(this.blog);
// window.localStorage.setItem("blog", jsonStr)
},
saveHandler(value, render) {
if (this.blog.Title.trim().length < 3) {
this.$Notice.warning({
title: '文章标题最少三个字',
})
this.$message.error('文章标题最少三个字')
return
}
if (this.blog.BlogValue.trim().length == 0) {
this.$Notice.warning({
title: '文章内容不能为空哦',
})
this.$message.error('文章内容不能为空哦')
return
}
this.showModal = true

1
views/iframe/user.html

@ -9,7 +9,6 @@
<link rel="stylesheet" href="//oss.aiprose.com/ali/sui/css/sui.min.css">
<script type="text/javascript" src="//oss.aiprose.com/ali/jquery/jquery.min.js"></script>
<script type="text/javascript" src="//oss.aiprose.com/ali/sui/js/sui.min.js"></script>
<script type="text/javascript" src="/static/js/layer.js"></script>
<title>首页 - 码农随笔</title>
<style>
.common {

5
views/newblog.html

@ -12,7 +12,7 @@
</div>
<mavon-editor :externalLink="externalLink" :toolbars="toolbars" v-model="blog.BlogValue" @imgAdd="$imgAdd"
@save="saveHandler" @change="changeHandler" ref=md></mavon-editor>
<el-dialog title="提示" :visible.sync="showModal" width="500px">
<el-dialog title="发布文章" :visible.sync="showModal" width="500px">
<div class="modal_form">
<span class="span-lable">文章分类:</span>
<el-select v-model="blog.CategoryId" placeholder="请选择文章分类" style="width: 310px">
@ -34,7 +34,7 @@
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="showModal = false">取 消</el-button>
<el-button type="primary" :loading="loading" @click="okHandler">确 定</el-button>
<el-button type="primary" :loading="loading" @click="okHandler">保存</el-button>
</span>
</el-dialog>
</div>
@ -175,7 +175,6 @@
$.get('/api/cats',
function (data) {
if (data.Status == 0) {
const tdata = data.Data.map(x=>{x.Id = x.Id+""; return x})
_this.cats = tdata
} else if (data.Status == 401) {
window.location.href = "/login"

4
views/ublogs.html

@ -65,12 +65,14 @@
if (data.Status == 0) {
$(obj).parent().parent().parent().remove()
layer.msg("删除成功", {icon: 6});
} else if (data.Status == 401) {
window.location.href = "/login"
} else if (data.Status == 403) {
layer.msg("暂无权限", {icon: 5});
this.$message.error("暂无权限")
} else {
layer.msg("服务器异常", {icon: 5});
this.$message.error("服务器异常")
}
}, 'json')
}, function () {

4
views/uinfo.html

@ -77,9 +77,9 @@
data: formData,
success:function(data,textstatus){
if (data.Status == 0){
layer.msg("上传成功", {icon: 6});
this.$message.success("上传成功")
}else{
layer.msg("上传失败", {icon: 5});
this.$message.error("上传失败")
}
}
});

正在加载...
取消
保存