协议IP配置增加导入功能
This commit is contained in:
@@ -29,6 +29,8 @@
|
||||
|
||||
<link href="${pageContext.request.contextPath}/static/global/css/page.css" rel="stylesheet" type="text/css" />
|
||||
<link href="${pageContext.request.contextPath}/static/global/css/jquery.tagsinput.css" rel="stylesheet" type="text/css" />
|
||||
<!-- 文件导入 -->
|
||||
<link href="${pageContext.request.contextPath}/static/global/plugins/bootstrap-fileupload/css/bootstrap-fileupload.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<!--[if lt IE 9]>
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/respond.min.js"></script>
|
||||
@@ -87,4 +89,8 @@
|
||||
</c:choose>
|
||||
<script src="${pageContext.request.contextPath}/static/global/scripts/common.js" type="text/javascript"></script>
|
||||
<script src="${pageContext.request.contextPath}/static/global/scripts/jquery.tagsinput.js" type="text/javascript"></script>
|
||||
<script src="${pageContext.request.contextPath}/static/global/scripts/app.js" type="text/javascript"></script>
|
||||
<script src="${pageContext.request.contextPath}/static/global/scripts/app.js" type="text/javascript"></script>
|
||||
|
||||
<!-- 文件导入 -->
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/bootstrap-fileupload/js/bootstrap-fileupload.js" type="text/javascript"></script>
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/bootstrap-fileupload/js/jquery.cookie.min.js" type="text/javascript"></script>
|
||||
@@ -3,6 +3,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title><spring:message code="agreement_ip_configuration" /></title>
|
||||
<script src="${pageContext.request.contextPath}/static/global/scripts/app.js" type="text/javascript"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
//筛选功能初始化
|
||||
@@ -22,6 +23,18 @@
|
||||
$("input.i-checks").prop("checked",false);
|
||||
}
|
||||
});
|
||||
$("#btnImport").click(function(){
|
||||
$.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true},
|
||||
bottomText:"导入文件不能超过5M,仅允许导入“xls”或“xlsx”格式文件!"});
|
||||
});
|
||||
|
||||
|
||||
$("button[data-dismiss='modal']").click(function (){
|
||||
|
||||
alert("close");
|
||||
|
||||
window.location ="${ctx}/specific/specificServiceHostCfg/list";
|
||||
})
|
||||
});
|
||||
function resetx(){
|
||||
$(':input','#searchForm')
|
||||
@@ -75,19 +88,148 @@
|
||||
$("#searchForm").submit();
|
||||
return false;
|
||||
}
|
||||
|
||||
//导入文件提示框
|
||||
function toImport(){
|
||||
$("#import_modal").modal({
|
||||
backdrop:"static",
|
||||
keyboard:false,
|
||||
show:true
|
||||
});
|
||||
}
|
||||
//导入配置
|
||||
function ajaxImp(){
|
||||
|
||||
/*var fileName = $(".fileupload-preview", $("#importForm1")).text();
|
||||
var $error = $('.alert-error', $("#importForm1"));
|
||||
if(App.isEmpty(fileName)){
|
||||
|
||||
$("span",$error).html("请选择xls或者xlsx格式文件进行导入...");
|
||||
$error.removeClass("hide");
|
||||
$error.addClass("show");
|
||||
return false;
|
||||
|
||||
}else if(fileName.lastIndexOf("\.")==-1||fileName.substring(fileName.lastIndexOf("\.")+1).toLowerCase()!='xls' &&fileName.substring(fileName.lastIndexOf("\.")+1).toLowerCase()!='xlsx'){
|
||||
$("span",$error).html("导入的文件后缀,必须为xls或者xlsx...");
|
||||
$error.removeClass("hide");
|
||||
$error.addClass("show");
|
||||
return false;
|
||||
}
|
||||
$("#import_modal").modal('hide');//导入文件隐藏
|
||||
$("#importForm1").submit();
|
||||
*/
|
||||
|
||||
$("#importForm1").submit();
|
||||
|
||||
/* $("#importForm1").ajaxSubmit({
|
||||
//clearForm:true,
|
||||
resetForm:true,
|
||||
dataType:'json',
|
||||
type:'post',
|
||||
beforeSubmit:function(formData,jqForm,options){
|
||||
var fileName = $(".fileupload-preview", jqForm).text();
|
||||
var $error = $('.alert-error', jqForm);
|
||||
$error.hide();
|
||||
if(App.isEmpty(fileName)){
|
||||
$("span",$error).html("请选择xls或者xlsx格式文件进行导入...");
|
||||
|
||||
$error.removeClass("hide");
|
||||
$error.addClass("show");
|
||||
return false;
|
||||
}else if(fileName.lastIndexOf("\.")==-1||fileName.substring(fileName.lastIndexOf("\.")+1).toLowerCase()!='xls' &&fileName.substring(fileName.lastIndexOf("\.")+1).toLowerCase()!='xlsx'){
|
||||
$("span",$error).html("导入的文件后缀,必须为xls或者xlsx...");
|
||||
$error.removeClass("hide");
|
||||
$error.addClass("show");
|
||||
return false;
|
||||
}
|
||||
$("#import_modal").modal('hide');//导入文件隐藏
|
||||
|
||||
return true;
|
||||
},
|
||||
success:function(data,statusText){
|
||||
if(statusText='success'){
|
||||
if(data!=null&&data.length>0){
|
||||
alert(data[0].errorMessage);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}); */
|
||||
|
||||
}
|
||||
function downLoadXLS(){
|
||||
window.location ="${ctx}/specific/specificServiceHostCfg/import/template";
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="modal fade" id="import_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<form id="importForm1" action="${ctx}/specific/specificServiceHostCfg/import/" method="post"
|
||||
enctype="multipart/form-data" class="form-horizontal"
|
||||
onsubmit="loading('<spring:message code='loading'/>');">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel"><spring:message code="import"/></h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-error hide">
|
||||
<button class="close" data-dismiss="alert"></button>
|
||||
<span></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label" style="margin-top:5px;"><spring:message code="chooseFile"/>:</label>
|
||||
<div class="controls">
|
||||
|
||||
<div class="fileupload fileupload-new" data-provides="fileupload">
|
||||
|
||||
<div class="input-append">
|
||||
|
||||
<div class="uneditable-input">
|
||||
<i class="fa fa-fa fa-file"></i>
|
||||
<span class="fileupload-preview"></span>
|
||||
</div>
|
||||
<span class="btn btn-file ">
|
||||
<button type="button" class="btn fileupload-new"><spring:message code="add"/></button>
|
||||
<button type="button" class="btn fileupload-exists"><spring:message code="edit"/></button>
|
||||
<input type="file" class="default" id="uploadFile" name="file"/>
|
||||
<input type="hidden" name="flag" value="${flag }"/>
|
||||
</span>
|
||||
<button type="button" class="btn red fileupload-exists" data-dismiss="fileupload" style="margin-left:-1px;"><spring:message code="remove"/></a>
|
||||
<button type="button" onclick="downLoadXLS()" class="btn black" style="margin-left:-1px"><spring:message code="download"/></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn red" onclick="ajaxImp()"><spring:message code="ok"/></button>
|
||||
<button type="button" class="btn" data-dismiss="modal"><spring:message code="close"/></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="page-content">
|
||||
<div class="theme-panel hidden-xs hidden-sm">
|
||||
<%-- <button type="button" class="btn btn-default" onclick="javascript:window.location='${ctx}/specific/specificServiceHostCfg/list'"><spring:message code="refresh"></spring:message></button> --%>
|
||||
<shiro:hasPermission name="specific:serviceIp:add">
|
||||
<button type="button" class="btn btn-primary"
|
||||
onClick="javascript:window.location='${ctx}/specific/specificServiceHostCfg/form'">
|
||||
<i class="fa fa-plus"></i>
|
||||
<spring:message code="add"/></button>
|
||||
<button type="button" class="btn btn-primary green" data-toggle="modal" data-target="#exampleModal" onClick="toImport();">
|
||||
<i class="fa fa-upload"></i>
|
||||
<spring:message code="import"/></button>
|
||||
</button>
|
||||
</shiro:hasPermission>
|
||||
</div>
|
||||
|
||||
@@ -263,7 +405,7 @@
|
||||
<th><spring:message code="server_port_mask" /></th>
|
||||
<th><spring:message code="direction" /></th>
|
||||
<th><spring:message code="protocol" /></th>
|
||||
<th><spring:message code="is_audit" /></th>
|
||||
<%-- <th><spring:message code="is_audit" /></th> --%>
|
||||
<th><spring:message code="creator" /></th>
|
||||
<th class="sort-column create_time"><spring:message code="config_time" /></th>
|
||||
<th><spring:message code="editor" /></th>
|
||||
@@ -287,10 +429,10 @@
|
||||
<td>${specificServiceHostCfg.dstPortMask }</td>
|
||||
<td><spring:message code='${fns:getDictLabel("SPEC_DIRECTION",specificServiceHostCfg.direction,"0")}' /></td>
|
||||
<td><spring:message code='${fns:getDictLabel("SPEC_PROTOCOL",specificServiceHostCfg.protocol,"0")}' /></td>
|
||||
<td><spring:message code='${fns:getDictLabel("SPEC_AUDIT",specificServiceHostCfg.isAudit,"0")}' /></td>
|
||||
<!--<td><spring:message code='${fns:getDictLabel("SPEC_AUDIT",specificServiceHostCfg.isAudit,"0")}' /></td> -->
|
||||
<td>${fns:getUserById(specificServiceHostCfg.creator.id).name}</td>
|
||||
<td><fmt:formatDate value="${specificServiceHostCfg.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
|
||||
<td>${fns:getUserById(specificServiceHostCfg.editor.id).name}</td>
|
||||
<td>${fns:getUserById(specificServiceHostCfg.editor.id==null?0:specificServiceHostCfg.editor.id).name}</td>
|
||||
<td><fmt:formatDate value="${specificServiceHostCfg.editTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
|
||||
<td>${fns:getUserById(specificServiceHostCfg.auditor.id==null?0:specificServiceHostCfg.auditor.id).name}</td>
|
||||
<td><fmt:formatDate value="${specificServiceHostCfg.auditTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
|
||||
|
||||
129
src/main/webapp/static/global/plugins/bootstrap-fileupload/css/bootstrap-fileupload.css
vendored
Normal file
129
src/main/webapp/static/global/plugins/bootstrap-fileupload/css/bootstrap-fileupload.css
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
.btn-file {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
vertical-align: middle;
|
||||
padding-left:0px !important;
|
||||
padding-right:0px !important;
|
||||
margin-left:-5px;
|
||||
margin-right:-3px
|
||||
}
|
||||
|
||||
.btn-file > input {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin: 0;
|
||||
font-size: 23px;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
transform: translate(-300px, 0) scale(4);
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
.fileupload {
|
||||
margin-bottom: 9px;
|
||||
}
|
||||
|
||||
.fileupload .uneditable-input {
|
||||
display: inline-block;
|
||||
margin-bottom: 0;
|
||||
vertical-align: middle;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.fileupload .thumbnail {
|
||||
display: inline-block;
|
||||
margin-bottom: 5px;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.fileupload .thumbnail > img {
|
||||
display: inline-block;
|
||||
max-height: 100%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.fileupload .btn {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.fileupload-exists .fileupload-new,
|
||||
.fileupload-new .fileupload-exists {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.fileupload-inline .fileupload-controls {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.fileupload-new .input-append .btn-file {
|
||||
-webkit-border-radius: 0 3px 3px 0;
|
||||
-moz-border-radius: 0 3px 3px 0;
|
||||
border-radius: 0 3px 3px 0;
|
||||
}
|
||||
|
||||
.thumbnail-borderless .thumbnail {
|
||||
padding: 0;
|
||||
border: none;
|
||||
-webkit-border-radius: 0;
|
||||
-moz-border-radius: 0;
|
||||
border-radius: 0;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.fileupload-new.thumbnail-borderless .thumbnail {
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.control-group.warning .fileupload .uneditable-input {
|
||||
color: #a47e3c;
|
||||
border-color: #a47e3c;
|
||||
}
|
||||
|
||||
.control-group.warning .fileupload .fileupload-preview {
|
||||
color: #a47e3c;
|
||||
}
|
||||
|
||||
.control-group.warning .fileupload .thumbnail {
|
||||
border-color: #a47e3c;
|
||||
}
|
||||
|
||||
.control-group.error .fileupload .uneditable-input {
|
||||
color: #b94a48;
|
||||
border-color: #b94a48;
|
||||
}
|
||||
|
||||
.control-group.error .fileupload .fileupload-preview {
|
||||
color: #b94a48;
|
||||
}
|
||||
|
||||
.control-group.error .fileupload .thumbnail {
|
||||
border-color: #b94a48;
|
||||
}
|
||||
|
||||
.control-group.success .fileupload .uneditable-input {
|
||||
color: #468847;
|
||||
border-color: #468847;
|
||||
}
|
||||
|
||||
.control-group.success .fileupload .fileupload-preview {
|
||||
color: #468847;
|
||||
}
|
||||
|
||||
.control-group.success .fileupload .thumbnail {
|
||||
border-color: #468847;
|
||||
}
|
||||
.btn.black {
|
||||
background-color: #555555;
|
||||
color: white;
|
||||
text-shadow: none;
|
||||
}
|
||||
.btn.black:hover, .btn.black:focus, .btn.black:active, .btn.black.active, .btn.black.disabled, .btn.black[disabled] {
|
||||
background-color: #222222 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
171
src/main/webapp/static/global/plugins/bootstrap-fileupload/js/bootstrap-fileupload.js
vendored
Normal file
171
src/main/webapp/static/global/plugins/bootstrap-fileupload/js/bootstrap-fileupload.js
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
/* ===========================================================
|
||||
* bootstrap-fileupload.js j2
|
||||
* http://jasny.github.com/bootstrap/javascript.html#fileupload
|
||||
* ===========================================================
|
||||
* Copyright 2012 Jasny BV, Netherlands.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ========================================================== */
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"; // jshint ;_
|
||||
|
||||
/* FILEUPLOAD PUBLIC CLASS DEFINITION
|
||||
* ================================= */
|
||||
|
||||
var Fileupload = function (element, options) {
|
||||
this.$element = $(element)
|
||||
this.type = this.$element.data('uploadtype') || (this.$element.find('.thumbnail').length > 0 ? "image" : "file")
|
||||
|
||||
this.$input = this.$element.find(':file')
|
||||
if (this.$input.length === 0) return
|
||||
|
||||
this.name = this.$input.attr('name') || options.name
|
||||
|
||||
this.$hidden = this.$element.find('input[type=hidden][name="'+this.name+'"]')
|
||||
if (this.$hidden.length === 0) {
|
||||
this.$hidden = $('<input type="hidden" />')
|
||||
this.$element.prepend(this.$hidden)
|
||||
}
|
||||
|
||||
this.$preview = this.$element.find('.fileupload-preview')
|
||||
var height = this.$preview.css('height')
|
||||
if (this.$preview.css('display') != 'inline' && height != '0px' && height != 'none') this.$preview.css('line-height', height)
|
||||
|
||||
this.original = {
|
||||
'exists': this.$element.hasClass('fileupload-exists'),
|
||||
'preview': this.$preview.html(),
|
||||
'hiddenVal': this.$hidden.val()
|
||||
}
|
||||
|
||||
this.$remove = this.$element.find('[data-dismiss="fileupload"]')
|
||||
|
||||
this.$element.find('[data-trigger="fileupload"]').on('click.fileupload', $.proxy(this.trigger, this))
|
||||
|
||||
this.listen()
|
||||
}
|
||||
|
||||
Fileupload.prototype = {
|
||||
|
||||
listen: function() {
|
||||
this.$input.on('change.fileupload', $.proxy(this.change, this))
|
||||
$(this.$input[0].form).on('reset.fileupload', $.proxy(this.reset, this))
|
||||
if (this.$remove) this.$remove.on('click.fileupload', $.proxy(this.clear, this))
|
||||
},
|
||||
|
||||
change: function(e, invoked) {
|
||||
var file = e.target.files !== undefined ? e.target.files[0] : (e.target.value ? { name: e.target.value.replace(/^.+\\/, '') } : null)
|
||||
if (invoked === 'clear') return
|
||||
|
||||
if (!file) {
|
||||
this.clear()
|
||||
return
|
||||
}
|
||||
|
||||
this.$hidden.val('')
|
||||
this.$hidden.attr('name', '')
|
||||
this.$input.attr('name', this.name)
|
||||
|
||||
if (this.type === "image" && this.$preview.length > 0 && (typeof file.type !== "undefined" ? file.type.match('image.*') : file.name.match('\\.(gif|png|jpe?g)$')) && typeof FileReader !== "undefined") {
|
||||
var reader = new FileReader()
|
||||
var preview = this.$preview
|
||||
var element = this.$element
|
||||
|
||||
reader.onload = function(e) {
|
||||
preview.html('<img src="' + e.target.result + '" ' + (preview.css('max-height') != 'none' ? 'style="max-height: ' + preview.css('max-height') + ';"' : '') + ' />')
|
||||
element.addClass('fileupload-exists').removeClass('fileupload-new')
|
||||
}
|
||||
|
||||
reader.readAsDataURL(file)
|
||||
} else {
|
||||
this.$preview.text(file.name)
|
||||
this.$element.addClass('fileupload-exists').removeClass('fileupload-new')
|
||||
}
|
||||
},
|
||||
|
||||
clear: function(e) {
|
||||
this.$hidden.val('')
|
||||
this.$hidden.attr('name', this.name)
|
||||
this.$input.attr('name', '')
|
||||
|
||||
//ie8+ doesn't support changing the value of input with type=file so clone instead
|
||||
if($.browser.msie){
|
||||
var inputClone = this.$input.clone(true);
|
||||
this.$input.after(inputClone);
|
||||
this.$input.remove();
|
||||
this.$input = inputClone;
|
||||
}else{
|
||||
this.$input.val('')
|
||||
}
|
||||
|
||||
this.$preview.html('')
|
||||
this.$element.addClass('fileupload-new').removeClass('fileupload-exists')
|
||||
|
||||
if (e) {
|
||||
this.$input.trigger('change', [ 'clear' ])
|
||||
e.preventDefault()
|
||||
}
|
||||
},
|
||||
|
||||
reset: function(e) {
|
||||
this.clear()
|
||||
|
||||
this.$hidden.val(this.original.hiddenVal)
|
||||
this.$preview.html(this.original.preview)
|
||||
|
||||
if (this.original.exists) this.$element.addClass('fileupload-exists').removeClass('fileupload-new')
|
||||
else this.$element.addClass('fileupload-new').removeClass('fileupload-exists')
|
||||
},
|
||||
|
||||
trigger: function(e) {
|
||||
this.$input.trigger('click')
|
||||
e.preventDefault()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* FILEUPLOAD PLUGIN DEFINITION
|
||||
* =========================== */
|
||||
|
||||
$.fn.fileupload = function (options) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('fileupload')
|
||||
if (!data) $this.data('fileupload', (data = new Fileupload(this, options)))
|
||||
if (typeof options == 'string') data[options]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.fileupload.Constructor = Fileupload
|
||||
|
||||
|
||||
/* FILEUPLOAD DATA-API
|
||||
* ================== */
|
||||
|
||||
$(function () {
|
||||
$('body').on('click.fileupload.data-api', '[data-provides="fileupload"]', function (e) {
|
||||
var $this = $(this)
|
||||
if ($this.data('fileupload')) return
|
||||
$this.fileupload($this.data())
|
||||
|
||||
var $target = $(e.target).is('[data-dismiss=fileupload],[data-trigger=fileupload]') ?
|
||||
$(e.target) : $(e.target).parents('[data-dismiss=fileupload],[data-trigger=fileupload]').first()
|
||||
if ($target.length > 0) {
|
||||
$target.trigger('click.fileupload')
|
||||
e.preventDefault()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
8
src/main/webapp/static/global/plugins/bootstrap-fileupload/js/jquery.cookie.min.js
vendored
Normal file
8
src/main/webapp/static/global/plugins/bootstrap-fileupload/js/jquery.cookie.min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*!
|
||||
* jQuery Cookie Plugin v1.3.1
|
||||
* https://github.com/carhartl/jquery-cookie
|
||||
*
|
||||
* Copyright 2013 Klaus Hartl
|
||||
* Released under the MIT license
|
||||
*/
|
||||
(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{a(jQuery)}}(function(e){var a=/\+/g;function d(g){return g}function b(g){return decodeURIComponent(g.replace(a," "))}function f(g){if(g.indexOf('"')===0){g=g.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")}try{return c.json?JSON.parse(g):g}catch(h){}}var c=e.cookie=function(p,o,u){if(o!==undefined){u=e.extend({},c.defaults,u);if(typeof u.expires==="number"){var q=u.expires,s=u.expires=new Date();s.setDate(s.getDate()+q)}o=c.json?JSON.stringify(o):String(o);return(document.cookie=[c.raw?p:encodeURIComponent(p),"=",c.raw?o:encodeURIComponent(o),u.expires?"; expires="+u.expires.toUTCString():"",u.path?"; path="+u.path:"",u.domain?"; domain="+u.domain:"",u.secure?"; secure":""].join(""))}var g=c.raw?d:b;var r=document.cookie.split("; ");var v=p?undefined:{};for(var n=0,k=r.length;n<k;n++){var m=r[n].split("=");var h=g(m.shift());var j=g(m.join("="));if(p&&p===h){v=f(j);break}if(!p){v[h]=f(j)}}return v};c.defaults={};e.removeCookie=function(h,g){if(e.cookie(h)!==undefined){e.cookie(h,"",e.extend({},g,{expires:-1}));return true}return false}}));
|
||||
Reference in New Issue
Block a user