仓库初始化

This commit is contained in:
2025-08-13 10:43:56 +08:00
commit e8f9b46680
5180 changed files with 859303 additions and 0 deletions

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,178 @@
html,
body {
height: 100%;
}
body {
padding-top: 50px;
/* Required padding for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigation changes. */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.img-addon {
margin-bottom: 10px;
width: 100%;
}
.img-hover:hover {
opacity: 0.8;
}
.display-1 {
font-size: 44px;
}
.display-4 {
font-size: 24px;
line-height: 32px;
}
/* Home Page Carousel */
header.carousel {
height: 50%;
}
header.carousel .item,
header.carousel .item.active,
header.carousel .carousel-inner {
height: 100%;
}
header.carousel .fill {
width: 100%;
height: 100%;
}
.error-404 {
font-size: 100px;
}
/* Pricing Page Styles */
.price {
display: block;
font-size: 50px;
line-height: 50px;
}
.price sup {
top: -20px;
left: 2px;
font-size: 20px;
}
.period {
display: block;
font-style: italic;
}
/* Footer Styles */
/* Responsive Styles */
@media (max-width: 991px) {
.customer-img,
.img-related {
margin-bottom: 30px;
}
}
@media (max-width: 767px) {
.img-addon {
margin-bottom: 15px;
}
header.carousel .carousel {
height: 70%;
}
}
.carousel-body {
position: absolute;
width: 100%;
top: 25%;
text-align: center;
color: #fff;
}
.addonlist a > p {
margin-bottom: 15px;
}
/* PC扫码支付 */
.scanpay {
margin-top: 20px;
}
.scanpay-title {
margin: 30px 0 15px 0;
padding-bottom: 15px;
border-bottom: 1px solid #eee;
position: relative;
}
.scanpay-qrcode {
margin-bottom: 20px;
position: relative;
}
.scanpay-qrcode img {
width: 100%;
border: 1px solid #eee;
}
.scanpay-qrcode .expired {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
opacity: .95;
background: #fff url(../images/expired.png) center center no-repeat;
}
.scanpay-qrcode .paid {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
opacity: .95;
background: #fff url(../images/paid.png) center center no-repeat;
}
.scanpay-screenshot {
padding: 0;
}
.scanpay-screenshot img {
width: 100%;
}
.scanpay-tips {
height: 60px;
padding: 8px 0 8px 125px;
background: #00c800 url(../images/scan.png) 50px 12px no-repeat;
background-size: 36px 36px;
}
.scanpay-tips p {
margin: 0;
font-size: 14px;
line-height: 22px;
color: #fff;
font-weight: 700;
}
.scanpay-time {
font-size: 14px;
margin-bottom: 15px;
position: absolute;
top: 15px;
right: 10px;
font-weight: normal;
display: none;
}
.scanpay-time span {
color: red;
}
.scanpay-order {
margin-bottom: 5px;
}
.scanpay-order em {
font-style: normal;
color: #666;
}
.scanpay-order em.scanpay-price {
color: #ff3333;
font-weight: bold;
}
.scanpay-alipay .scanpay-tips {
background-color: #4290e8;
}
@media (max-width: 767px) {
.scanpay {
margin-top: 20px;
}
}
@media (max-height: 855px) and (min-width: 767px) {
.scanpay {
width: calc(130vh);
min-width: 760px;
}
}
.qrcode canvas,
.qrcode img {
width: 100%;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 922 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,63 @@
$(function () {
if ($('.carousel').length > 0) {
$('.carousel').carousel({
interval: 5000
});
}
if ($(".qrcode").length > 0) {
$(".qrcode").qrcode({width: 250, height: 250, text: $(".qrcode").data("text")});
}
var si, xhr;
if (typeof queryParams != 'undefined') {
var queryResult = function () {
xhr && xhr.abort();
xhr = $.ajax({
url: "",
type: "post",
data: queryParams,
dataType: 'json',
success: function (ret) {
if (ret.code == 1) {
var data = ret.data;
if (typeof data.status != 'undefined') {
var status = data.status;
if (status == 'SUCCESS' || status == 'TRADE_SUCCESS') {
$(".scanpay-qrcode .paid").removeClass("hidden");
$(".scanpay-tips p").html("支付成功!<br><span>3</span>秒后将自动跳转...");
var sin = setInterval(function () {
$(".scanpay-tips p span").text(parseInt($(".scanpay-tips p span").text()) - 1);
}, 1000);
setTimeout(function () {
clearInterval(sin);
location.href = queryParams.returnurl;
}, 3000);
clearInterval(si);
} else if (status == 'REFUND' || status == 'TRADE_CLOSED') {
$(".scanpay-tips p").html("请求失败!<br>请返回重新发起支付");
clearInterval(si);
} else if (status == 'NOTPAY' || status == 'TRADE_NOT_EXIST') {
} else if (status == 'CLOSED' || status == 'TRADE_CLOSED') {
$(".scanpay-tips p").html("订单已关闭!<br>请返回重新发起支付");
clearInterval(si);
} else if (status == 'USERPAYING' || status == 'WAIT_BUYER_PAY') {
} else if (status == 'PAYERROR') {
clearInterval(si);
}
}
}
}
});
};
si = setInterval(function () {
queryResult();
}, 3000);
queryResult();
}
});

View File

@@ -0,0 +1,34 @@
/**
* jQuery-qrcode
* @url https://github.com/jeromeetienne/jquery-qrcode
* @licence MIT
*/
(function(r){r.fn.qrcode=function(h){var s;function u(a){this.mode=s;this.data=a}function o(a,c){this.typeNumber=a;this.errorCorrectLevel=c;this.modules=null;this.moduleCount=0;this.dataCache=null;this.dataList=[]}function q(a,c){if(void 0==a.length)throw Error(a.length+"/"+c);for(var d=0;d<a.length&&0==a[d];)d++;this.num=Array(a.length-d+c);for(var b=0;b<a.length-d;b++)this.num[b]=a[b+d]}function p(a,c){this.totalCount=a;this.dataCount=c}function t(){this.buffer=[];this.length=0}u.prototype={getLength:function(){return this.data.length},
write:function(a){for(var c=0;c<this.data.length;c++)a.put(this.data.charCodeAt(c),8)}};o.prototype={addData:function(a){this.dataList.push(new u(a));this.dataCache=null},isDark:function(a,c){if(0>a||this.moduleCount<=a||0>c||this.moduleCount<=c)throw Error(a+","+c);return this.modules[a][c]},getModuleCount:function(){return this.moduleCount},make:function(){if(1>this.typeNumber){for(var a=1,a=1;40>a;a++){for(var c=p.getRSBlocks(a,this.errorCorrectLevel),d=new t,b=0,e=0;e<c.length;e++)b+=c[e].dataCount;
for(e=0;e<this.dataList.length;e++)c=this.dataList[e],d.put(c.mode,4),d.put(c.getLength(),j.getLengthInBits(c.mode,a)),c.write(d);if(d.getLengthInBits()<=8*b)break}this.typeNumber=a}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,c){this.moduleCount=4*this.typeNumber+17;this.modules=Array(this.moduleCount);for(var d=0;d<this.moduleCount;d++){this.modules[d]=Array(this.moduleCount);for(var b=0;b<this.moduleCount;b++)this.modules[d][b]=null}this.setupPositionProbePattern(0,0);this.setupPositionProbePattern(this.moduleCount-
7,0);this.setupPositionProbePattern(0,this.moduleCount-7);this.setupPositionAdjustPattern();this.setupTimingPattern();this.setupTypeInfo(a,c);7<=this.typeNumber&&this.setupTypeNumber(a);null==this.dataCache&&(this.dataCache=o.createData(this.typeNumber,this.errorCorrectLevel,this.dataList));this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,c){for(var d=-1;7>=d;d++)if(!(-1>=a+d||this.moduleCount<=a+d))for(var b=-1;7>=b;b++)-1>=c+b||this.moduleCount<=c+b||(this.modules[a+d][c+b]=
0<=d&&6>=d&&(0==b||6==b)||0<=b&&6>=b&&(0==d||6==d)||2<=d&&4>=d&&2<=b&&4>=b?!0:!1)},getBestMaskPattern:function(){for(var a=0,c=0,d=0;8>d;d++){this.makeImpl(!0,d);var b=j.getLostPoint(this);if(0==d||a>b)a=b,c=d}return c},createMovieClip:function(a,c,d){a=a.createEmptyMovieClip(c,d);this.make();for(c=0;c<this.modules.length;c++)for(var d=1*c,b=0;b<this.modules[c].length;b++){var e=1*b;this.modules[c][b]&&(a.beginFill(0,100),a.moveTo(e,d),a.lineTo(e+1,d),a.lineTo(e+1,d+1),a.lineTo(e,d+1),a.endFill())}return a},
setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)null==this.modules[a][6]&&(this.modules[a][6]=0==a%2);for(a=8;a<this.moduleCount-8;a++)null==this.modules[6][a]&&(this.modules[6][a]=0==a%2)},setupPositionAdjustPattern:function(){for(var a=j.getPatternPosition(this.typeNumber),c=0;c<a.length;c++)for(var d=0;d<a.length;d++){var b=a[c],e=a[d];if(null==this.modules[b][e])for(var f=-2;2>=f;f++)for(var i=-2;2>=i;i++)this.modules[b+f][e+i]=-2==f||2==f||-2==i||2==i||0==f&&0==i?!0:!1}},setupTypeNumber:function(a){for(var c=
j.getBCHTypeNumber(this.typeNumber),d=0;18>d;d++){var b=!a&&1==(c>>d&1);this.modules[Math.floor(d/3)][d%3+this.moduleCount-8-3]=b}for(d=0;18>d;d++)b=!a&&1==(c>>d&1),this.modules[d%3+this.moduleCount-8-3][Math.floor(d/3)]=b},setupTypeInfo:function(a,c){for(var d=j.getBCHTypeInfo(this.errorCorrectLevel<<3|c),b=0;15>b;b++){var e=!a&&1==(d>>b&1);6>b?this.modules[b][8]=e:8>b?this.modules[b+1][8]=e:this.modules[this.moduleCount-15+b][8]=e}for(b=0;15>b;b++)e=!a&&1==(d>>b&1),8>b?this.modules[8][this.moduleCount-
b-1]=e:9>b?this.modules[8][15-b-1+1]=e:this.modules[8][15-b-1]=e;this.modules[this.moduleCount-8][8]=!a},mapData:function(a,c){for(var d=-1,b=this.moduleCount-1,e=7,f=0,i=this.moduleCount-1;0<i;i-=2)for(6==i&&i--;;){for(var g=0;2>g;g++)if(null==this.modules[b][i-g]){var n=!1;f<a.length&&(n=1==(a[f]>>>e&1));j.getMask(c,b,i-g)&&(n=!n);this.modules[b][i-g]=n;e--; -1==e&&(f++,e=7)}b+=d;if(0>b||this.moduleCount<=b){b-=d;d=-d;break}}}};o.PAD0=236;o.PAD1=17;o.createData=function(a,c,d){for(var c=p.getRSBlocks(a,
c),b=new t,e=0;e<d.length;e++){var f=d[e];b.put(f.mode,4);b.put(f.getLength(),j.getLengthInBits(f.mode,a));f.write(b)}for(e=a=0;e<c.length;e++)a+=c[e].dataCount;if(b.getLengthInBits()>8*a)throw Error("code length overflow. ("+b.getLengthInBits()+">"+8*a+")");for(b.getLengthInBits()+4<=8*a&&b.put(0,4);0!=b.getLengthInBits()%8;)b.putBit(!1);for(;!(b.getLengthInBits()>=8*a);){b.put(o.PAD0,8);if(b.getLengthInBits()>=8*a)break;b.put(o.PAD1,8)}return o.createBytes(b,c)};o.createBytes=function(a,c){for(var d=
0,b=0,e=0,f=Array(c.length),i=Array(c.length),g=0;g<c.length;g++){var n=c[g].dataCount,h=c[g].totalCount-n,b=Math.max(b,n),e=Math.max(e,h);f[g]=Array(n);for(var k=0;k<f[g].length;k++)f[g][k]=255&a.buffer[k+d];d+=n;k=j.getErrorCorrectPolynomial(h);n=(new q(f[g],k.getLength()-1)).mod(k);i[g]=Array(k.getLength()-1);for(k=0;k<i[g].length;k++)h=k+n.getLength()-i[g].length,i[g][k]=0<=h?n.get(h):0}for(k=g=0;k<c.length;k++)g+=c[k].totalCount;d=Array(g);for(k=n=0;k<b;k++)for(g=0;g<c.length;g++)k<f[g].length&&
(d[n++]=f[g][k]);for(k=0;k<e;k++)for(g=0;g<c.length;g++)k<i[g].length&&(d[n++]=i[g][k]);return d};s=4;for(var j={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,
78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){for(var c=a<<10;0<=j.getBCHDigit(c)-j.getBCHDigit(j.G15);)c^=j.G15<<j.getBCHDigit(c)-j.getBCHDigit(j.G15);return(a<<10|c)^j.G15_MASK},getBCHTypeNumber:function(a){for(var c=a<<12;0<=j.getBCHDigit(c)-
j.getBCHDigit(j.G18);)c^=j.G18<<j.getBCHDigit(c)-j.getBCHDigit(j.G18);return a<<12|c},getBCHDigit:function(a){for(var c=0;0!=a;)c++,a>>>=1;return c},getPatternPosition:function(a){return j.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,c,d){switch(a){case 0:return 0==(c+d)%2;case 1:return 0==c%2;case 2:return 0==d%3;case 3:return 0==(c+d)%3;case 4:return 0==(Math.floor(c/2)+Math.floor(d/3))%2;case 5:return 0==c*d%2+c*d%3;case 6:return 0==(c*d%2+c*d%3)%2;case 7:return 0==(c*d%3+(c+d)%2)%2;default:throw Error("bad maskPattern:"+
a);}},getErrorCorrectPolynomial:function(a){for(var c=new q([1],0),d=0;d<a;d++)c=c.multiply(new q([1,l.gexp(d)],0));return c},getLengthInBits:function(a,c){if(1<=c&&10>c)switch(a){case 1:return 10;case 2:return 9;case s:return 8;case 8:return 8;default:throw Error("mode:"+a);}else if(27>c)switch(a){case 1:return 12;case 2:return 11;case s:return 16;case 8:return 10;default:throw Error("mode:"+a);}else if(41>c)switch(a){case 1:return 14;case 2:return 13;case s:return 16;case 8:return 12;default:throw Error("mode:"+
a);}else throw Error("type:"+c);},getLostPoint:function(a){for(var c=a.getModuleCount(),d=0,b=0;b<c;b++)for(var e=0;e<c;e++){for(var f=0,i=a.isDark(b,e),g=-1;1>=g;g++)if(!(0>b+g||c<=b+g))for(var h=-1;1>=h;h++)0>e+h||c<=e+h||0==g&&0==h||i==a.isDark(b+g,e+h)&&f++;5<f&&(d+=3+f-5)}for(b=0;b<c-1;b++)for(e=0;e<c-1;e++)if(f=0,a.isDark(b,e)&&f++,a.isDark(b+1,e)&&f++,a.isDark(b,e+1)&&f++,a.isDark(b+1,e+1)&&f++,0==f||4==f)d+=3;for(b=0;b<c;b++)for(e=0;e<c-6;e++)a.isDark(b,e)&&!a.isDark(b,e+1)&&a.isDark(b,e+
2)&&a.isDark(b,e+3)&&a.isDark(b,e+4)&&!a.isDark(b,e+5)&&a.isDark(b,e+6)&&(d+=40);for(e=0;e<c;e++)for(b=0;b<c-6;b++)a.isDark(b,e)&&!a.isDark(b+1,e)&&a.isDark(b+2,e)&&a.isDark(b+3,e)&&a.isDark(b+4,e)&&!a.isDark(b+5,e)&&a.isDark(b+6,e)&&(d+=40);for(e=f=0;e<c;e++)for(b=0;b<c;b++)a.isDark(b,e)&&f++;a=Math.abs(100*f/c/c-50)/5;return d+10*a}},l={glog:function(a){if(1>a)throw Error("glog("+a+")");return l.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;256<=a;)a-=255;return l.EXP_TABLE[a]},EXP_TABLE:Array(256),
LOG_TABLE:Array(256)},m=0;8>m;m++)l.EXP_TABLE[m]=1<<m;for(m=8;256>m;m++)l.EXP_TABLE[m]=l.EXP_TABLE[m-4]^l.EXP_TABLE[m-5]^l.EXP_TABLE[m-6]^l.EXP_TABLE[m-8];for(m=0;255>m;m++)l.LOG_TABLE[l.EXP_TABLE[m]]=m;q.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var c=Array(this.getLength()+a.getLength()-1),d=0;d<this.getLength();d++)for(var b=0;b<a.getLength();b++)c[d+b]^=l.gexp(l.glog(this.get(d))+l.glog(a.get(b)));return new q(c,0)},mod:function(a){if(0>
this.getLength()-a.getLength())return this;for(var c=l.glog(this.get(0))-l.glog(a.get(0)),d=Array(this.getLength()),b=0;b<this.getLength();b++)d[b]=this.get(b);for(b=0;b<a.getLength();b++)d[b]^=l.gexp(l.glog(a.get(b))+c);return(new q(d,0)).mod(a)}};p.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],
[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,
116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,
43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,
3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,
55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,
45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];p.getRSBlocks=function(a,c){var d=p.getRsBlockTable(a,c);if(void 0==d)throw Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+c);for(var b=d.length/3,e=[],f=0;f<b;f++)for(var h=d[3*f+0],g=d[3*f+1],j=d[3*f+2],l=0;l<h;l++)e.push(new p(g,j));return e};p.getRsBlockTable=function(a,c){switch(c){case 1:return p.RS_BLOCK_TABLE[4*(a-1)+0];case 0:return p.RS_BLOCK_TABLE[4*(a-1)+1];case 3:return p.RS_BLOCK_TABLE[4*
(a-1)+2];case 2:return p.RS_BLOCK_TABLE[4*(a-1)+3]}};t.prototype={get:function(a){return 1==(this.buffer[Math.floor(a/8)]>>>7-a%8&1)},put:function(a,c){for(var d=0;d<c;d++)this.putBit(1==(a>>>c-d-1&1))},getLengthInBits:function(){return this.length},putBit:function(a){var c=Math.floor(this.length/8);this.buffer.length<=c&&this.buffer.push(0);a&&(this.buffer[c]|=128>>>this.length%8);this.length++}};"string"===typeof h&&(h={text:h});h=r.extend({},{render:"canvas",width:256,height:256,typeNumber:-1,
correctLevel:2,background:"#ffffff",foreground:"#000000"},h);return this.each(function(){var a;if("canvas"==h.render){a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();var c=document.createElement("canvas");c.width=h.width;c.height=h.height;for(var d=c.getContext("2d"),b=h.width/a.getModuleCount(),e=h.height/a.getModuleCount(),f=0;f<a.getModuleCount();f++)for(var i=0;i<a.getModuleCount();i++){d.fillStyle=a.isDark(f,i)?h.foreground:h.background;var g=Math.ceil((i+1)*b)-Math.floor(i*b),
j=Math.ceil((f+1)*b)-Math.floor(f*b);d.fillRect(Math.round(i*b),Math.round(f*e),g,j)}}else{a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();c=r("<table></table>").css("width",h.width+"px").css("height",h.height+"px").css("border","0px").css("border-collapse","collapse").css("background-color",h.background);d=h.width/a.getModuleCount();b=h.height/a.getModuleCount();for(e=0;e<a.getModuleCount();e++){f=r("<tr></tr>").css("height",b+"px").appendTo(c);for(i=0;i<a.getModuleCount();i++)r("<td></td>").css("width",
d+"px").css("background-color",a.isDark(e,i)?h.foreground:h.background).appendTo(f)}}a=c;jQuery(a).appendTo(this)})}})(jQuery);

View File

@@ -0,0 +1,224 @@
html,
body {
height: 100%;
}
body {
padding-top: 50px; /* Required padding for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigation changes. */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.img-addon {
margin-bottom: 10px;
width: 100%;
}
.img-hover:hover {
opacity: 0.8;
}
.display-1 {
font-size: 44px;
}
.display-4 {
font-size: 24px;
line-height: 32px;
}
/* Home Page Carousel */
header.carousel {
height: 50%;
}
header.carousel .item,
header.carousel .item.active,
header.carousel .carousel-inner {
height: 100%;
}
header.carousel .fill {
width: 100%;
height: 100%;
}
.error-404 {
font-size: 100px;
}
/* Pricing Page Styles */
.price {
display: block;
font-size: 50px;
line-height: 50px;
}
.price sup {
top: -20px;
left: 2px;
font-size: 20px;
}
.period {
display: block;
font-style: italic;
}
/* Footer Styles */
footer {
}
/* Responsive Styles */
@media (max-width: 991px) {
.customer-img,
.img-related {
margin-bottom: 30px;
}
}
@media (max-width: 767px) {
.img-addon {
margin-bottom: 15px;
}
header.carousel .carousel {
height: 70%;
}
}
.carousel-body {
position: absolute;
width: 100%;
top: 25%;
text-align: center;
color: #fff;
}
.addonlist a > p {
margin-bottom: 15px;
}
/* PC扫码支付 */
.scanpay {
margin-top: 20px;
}
.scanpay-title {
margin: 30px 0 15px 0;
padding-bottom: 15px;
border-bottom: 1px solid #eee;
position: relative;
}
.scanpay-qrcode {
margin-bottom: 20px;
position: relative;
img {
width: 100%;
border: 1px solid #eee;
}
.expired {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
opacity: .95;
background: #fff url(../images/expired.png) center center no-repeat;
}
.paid {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
opacity: .95;
background: #fff url(../images/paid.png) center center no-repeat;
}
}
.scanpay-screenshot {
padding: 0;
img {
width: 100%;
}
}
.scanpay-tips {
height: 60px;
padding: 8px 0 8px 125px;
background: #00c800 url(../images/scan.png) 50px 12px no-repeat;
background-size: 36px 36px;
p {
margin: 0;
font-size: 14px;
line-height: 22px;
color: #fff;
font-weight: 700
}
}
.scanpay-time {
font-size: 14px;
margin-bottom: 15px;
position: absolute;
top: 15px;
right: 10px;
font-weight: normal;
display: none;
span {
color: red;
}
}
.scanpay-order {
margin-bottom: 5px;
em {
font-style: normal;
color: #666;
&.scanpay-price {
color: #ff3333;
font-weight: bold;
}
}
}
.scanpay-alipay {
.scanpay-tips {
background-color: #4290e8;
}
}
@media (max-width: 767px) {
.scanpay {
margin-top: 20px;
}
}
@media (max-height: 855px) and (min-width: 767px) {
.scanpay {
width: calc(~ '130vh');
min-width: 760px;
}
}
.qrcode canvas, .qrcode img {
width: 100%;
}

View File

@@ -0,0 +1,222 @@
.md-editor {
display: block;
border: 1px solid #ddd
}
.md-editor .md-footer, .md-editor > .md-header {
display: block;
padding: 6px 4px;
background: #f5f5f5
}
.md-editor > .md-header {
margin: 0
}
.md-editor > .md-preview {
background: #fff;
border-top: 1px dashed #ddd;
border-bottom: 1px dashed #ddd;
min-height: 10px;
overflow: auto;
padding:8px;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
font-size: 14px;
}
.md-editor > textarea {
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
font-size: 14px;
outline: 0;
margin: 0;
display: block;
padding: 8px;
width: 100%;
border: 0;
border-top: 1px dashed #ddd;
border-bottom: 1px dashed #ddd;
border-radius: 0;
box-shadow: none;
}
.md-editor > textarea:focus {
box-shadow: none;
background: #fff
}
.md-editor.active {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6)
}
.md-editor .md-controls {
float: right;
padding: 3px
}
.md-editor .md-controls .md-control {
right: 5px;
color: #bebebe;
padding: 3px 3px 3px 10px
}
.md-editor .md-controls .md-control:hover {
color: #333
}
.md-editor.md-fullscreen-mode {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 99999;
padding: 60px 30px 15px;
background: #fff !important;
border: 0 !important
}
.md-editor.md-fullscreen-mode .md-footer {
display: none
}
.md-editor.md-fullscreen-mode .md-input, .md-editor.md-fullscreen-mode .md-preview {
margin: 0 auto !important;
height: 100% !important;
font-size: 20px !important;
padding: 20px !important;
color: #999;
line-height: 1.6em !important;
resize: none !important;
box-shadow: none !important;
background: #fff !important;
border: 0 !important
}
.md-editor.md-fullscreen-mode .md-preview {
color: #333;
overflow: auto
}
.md-editor.md-fullscreen-mode .md-input:focus, .md-editor.md-fullscreen-mode .md-input:hover {
color: #333;
background: #fff !important
}
.md-editor.md-fullscreen-mode .md-header {
background: 0 0;
text-align: center;
position: fixed;
width: 100%;
top: 20px
}
.md-editor.md-fullscreen-mode .btn-group {
float: none
}
.md-editor.md-fullscreen-mode .btn {
border: 0;
background: 0 0;
color: #b3b3b3
}
.md-editor.md-fullscreen-mode .btn.active, .md-editor.md-fullscreen-mode .btn:active, .md-editor.md-fullscreen-mode .btn:focus, .md-editor.md-fullscreen-mode .btn:hover {
box-shadow: none;
color: #333
}
.md-editor.md-fullscreen-mode .md-fullscreen-controls {
position: absolute;
top: 20px;
right: 20px;
text-align: right;
z-index: 1002;
display: block
}
.md-editor.md-fullscreen-mode .md-fullscreen-controls a {
color: #b3b3b3;
clear: right;
margin: 10px;
width: 30px;
height: 30px;
text-align: center
}
.md-editor.md-fullscreen-mode .md-fullscreen-controls a:hover {
color: #333;
text-decoration: none
}
.md-editor.md-fullscreen-mode .md-editor {
height: 100% !important;
position: relative
}
.md-editor .md-fullscreen-controls {
display: none
}
.md-nooverflow {
overflow: hidden;
position: fixed;
width: 100%
}
.md-relative {
position: relative;
}
.md-relative .uploadimage, .md-relative .uploadfile {
position: absolute;
right: 0;
top: 0;
width: 39px;
height: 31px;
opacity: 0;
z-index: 9;
overflow: hidden;
}
body.darktheme .md-editor {
border-color: #444;
}
body.darktheme .md-editor.active {
-webkit-box-shadow: none;
box-shadow: none;
}
body.darktheme .md-editor .md-footer, body.darktheme .md-editor > .md-header {
background-color: #3c3e3d;
border-color: #444;
color: #eee;
}
body.darktheme .md-editor > textarea {
background-color: #262626;
}
body.darktheme .md-editor > textarea:focus {
background-color: #262626;
}
body.darktheme .md-editor .btn-toolbar .btn {
background-color: #262626;
}
body.darktheme .md-editor .btn-toolbar .btn:hover {
color: #ccc;
}
body.darktheme .md-editor.md-fullscreen-mode {
background-color: #3c3e3c !important;
}
body.darktheme .md-editor.md-fullscreen-mode .md-input, body.darktheme .md-editor.md-fullscreen-mode .md-preview {
background-color: #262626 !important;
color: #ccc;
}

View File

@@ -0,0 +1,781 @@
(function (factory) {
if (typeof define === "function" && define.amd) {
define(["jquery"], factory)
} else if (typeof exports === "object") {
factory(require("jquery"))
} else {
factory(jQuery)
}
})(function ($) {
"use strict";
var Markdown = function (element, options) {
var opts = ["autofocus", "savable", "hideable", "width", "height", "resize", "iconlibrary", "language", "footer", "fullscreen", "hiddenButtons", "disabledButtons"];
$.each(opts, function (_, opt) {
if (typeof $(element).data(opt) !== "undefined") {
options = typeof options == "object" ? options : {};
options[opt] = $(element).data(opt)
}
});
this.$ns = "bootstrap-markdown";
this.$element = $(element);
this.$editable = {el: null, type: null, attrKeys: [], attrValues: [], content: null};
this.$options = $.extend(true, {}, $.fn.markdown.defaults, options, this.$element.data("options"));
this.$oldContent = null;
this.$isPreview = false;
this.$isFullscreen = false;
this.$editor = null;
this.$textarea = null;
this.$handler = [];
this.$callback = [];
this.$nextTab = [];
this.showEditor()
};
Markdown.prototype = {
constructor: Markdown, __alterButtons: function (name, alter) {
var handler = this.$handler, isAll = name == "all", that = this;
$.each(handler, function (k, v) {
var halt = true;
if (isAll) {
halt = false
} else {
halt = v.indexOf(name) < 0
}
if (halt === false) {
alter(that.$editor.find('button[data-handler="' + v + '"]'))
}
})
}, __buildButtons: function (buttonsArray, container) {
var i, ns = this.$ns, handler = this.$handler, callback = this.$callback;
for (i = 0; i < buttonsArray.length; i++) {
var y, btnGroups = buttonsArray[i];
for (y = 0; y < btnGroups.length; y++) {
var z, buttons = btnGroups[y].data, btnGroupContainer = $("<div/>", {class: "btn-group"});
for (z = 0; z < buttons.length; z++) {
var button = buttons[z], buttonContainer, buttonIconContainer, buttonHandler = ns + "-" + button.name, buttonIcon = this.__getIcon(button.icon), btnText = button.btnText ? button.btnText : "", btnClass = button.btnClass ? button.btnClass : "btn", tabIndex = button.tabIndex ? button.tabIndex : "-1", hotkey = typeof button.hotkey !== "undefined" ? button.hotkey : "", hotkeyCaption = typeof jQuery.hotkeys !== "undefined" && hotkey !== "" ? " (" + hotkey + ")" : "";
buttonContainer = $("<button></button>");
buttonContainer.text(" " + this.__localize(btnText)).addClass("btn-light").addClass(btnClass);
if (btnClass.match(/btn\-(primary|success|info|warning|danger|link)/)) {
buttonContainer.removeClass("btn-light")
}
buttonContainer.attr({type: "button", title: this.__localize(button.title) + hotkeyCaption, tabindex: tabIndex, "data-provider": ns, "data-handler": buttonHandler, "data-hotkey": hotkey});
if (button.toggle === true) {
buttonContainer.attr("data-toggle", "button")
}
buttonIconContainer = $("<span/>");
buttonIconContainer.addClass(buttonIcon);
buttonIconContainer.prependTo(buttonContainer);
btnGroupContainer.addClass("mr-2");
btnGroupContainer.append(buttonContainer);
handler.push(buttonHandler);
callback.push(button.callback)
}
container.append(btnGroupContainer)
}
}
return container
}, __setListener: function () {
var hasRows = typeof this.$textarea.attr("rows") !== "undefined", maxRows = this.$textarea.val().split("\n").length > 5 ? this.$textarea.val().split("\n").length : "5", rowsVal = hasRows ? this.$textarea.attr("rows") : maxRows;
this.$textarea.attr("rows", rowsVal);
if (this.$options.resize) {
this.$textarea.css("resize", this.$options.resize)
}
this.$textarea.on({focus: $.proxy(this.focus, this), keyup: $.proxy(this.keyup, this), change: $.proxy(this.change, this), select: $.proxy(this.select, this)});
if (this.eventSupported("keydown")) {
this.$textarea.on("keydown", $.proxy(this.keydown, this))
}
if (this.eventSupported("keypress")) {
this.$textarea.on("keypress", $.proxy(this.keypress, this))
}
this.$textarea.data("markdown", this)
}, __handle: function (e) {
var target = $(e.currentTarget), handler = this.$handler, callback = this.$callback, handlerName = target.attr("data-handler"), callbackIndex = handler.indexOf(handlerName), callbackHandler = callback[callbackIndex];
$(e.currentTarget).focus();
callbackHandler(this);
this.change(this);
if (handlerName.indexOf("cmdSave") < 0) {
this.$textarea.focus()
}
e.preventDefault()
}, __localize: function (string) {
var messages = $.fn.markdown.messages, language = this.$options.language;
if (typeof messages !== "undefined" && typeof messages[language] !== "undefined" && typeof messages[language][string] !== "undefined") {
return messages[language][string]
}
return string
}, __getIcon: function (src) {
return typeof src == "object" ? src[this.$options.iconlibrary] : src
}, setFullscreen: function (mode) {
var $editor = this.$editor, $textarea = this.$textarea;
if (mode === true) {
$editor.addClass("md-fullscreen-mode");
$("body").addClass("md-nooverflow");
this.$options.onFullscreen(this)
} else {
$editor.removeClass("md-fullscreen-mode");
$("body").removeClass("md-nooverflow");
if (this.$isPreview == true) this.hidePreview().showPreview()
}
this.$isFullscreen = mode;
$textarea.focus()
}, showEditor: function () {
var instance = this, textarea, ns = this.$ns, container = this.$element, originalHeigth = container.css("height"), originalWidth = container.css("width"), editable = this.$editable, handler = this.$handler, callback = this.$callback, options = this.$options, editor = $("<div/>", {
class: "md-editor", click: function () {
instance.focus()
}
});
if (this.$editor === null) {
var editorHeader = $("<div/>", {class: "md-header btn-toolbar"});
var allBtnGroups = [];
if (options.buttons.length > 0) allBtnGroups = allBtnGroups.concat(options.buttons[0]);
if (options.additionalButtons.length > 0) {
$.each(options.additionalButtons[0], function (idx, buttonGroup) {
var matchingGroups = $.grep(allBtnGroups, function (allButtonGroup, allIdx) {
return allButtonGroup.name === buttonGroup.name
});
if (matchingGroups.length > 0) {
matchingGroups[0].data = matchingGroups[0].data.concat(buttonGroup.data)
} else {
allBtnGroups.push(options.additionalButtons[0][idx])
}
})
}
if (options.reorderButtonGroups.length > 0) {
allBtnGroups = allBtnGroups.filter(function (btnGroup) {
return options.reorderButtonGroups.indexOf(btnGroup.name) > -1
}).sort(function (a, b) {
if (options.reorderButtonGroups.indexOf(a.name) < options.reorderButtonGroups.indexOf(b.name)) return -1;
if (options.reorderButtonGroups.indexOf(a.name) > options.reorderButtonGroups.indexOf(b.name)) return 1;
return 0
})
}
if (allBtnGroups.length > 0) {
editorHeader = this.__buildButtons([allBtnGroups], editorHeader)
}
if (options.fullscreen.enable) {
editorHeader.append('<div class="md-controls"><a class="md-control md-control-fullscreen" href="#"><span class="' + this.__getIcon(options.fullscreen.icons.fullscreenOn) + '"></span></a></div>').on("click", ".md-control-fullscreen", function (e) {
e.preventDefault();
instance.setFullscreen(true)
})
}
editor.append(editorHeader);
if (container.is("textarea")) {
container.before(editor);
textarea = container;
textarea.addClass("md-input");
editor.append(textarea)
} else {
var rawContent = typeof toMarkdown == "function" ? toMarkdown(container.html()) : container.html(), currentContent = $.trim(rawContent);
textarea = $("<textarea/>", {class: "md-input", val: currentContent});
editor.append(textarea);
editable.el = container;
editable.type = container.prop("tagName").toLowerCase();
editable.content = container.html();
$(container[0].attributes).each(function () {
editable.attrKeys.push(this.nodeName);
editable.attrValues.push(this.nodeValue)
});
container.replaceWith(editor)
}
var editorFooter = $("<div/>", {class: "md-footer"}), createFooter = false, footer = "";
if (options.savable) {
createFooter = true;
var saveHandler = "cmdSave";
handler.push(saveHandler);
callback.push(options.onSave);
editorFooter.append('<button class="btn btn-success" data-provider="' + ns + '" data-handler="' + saveHandler + '"><i class="icon icon-white icon-ok"></i> ' + this.__localize("Save") + "</button>")
}
footer = typeof options.footer === "function" ? options.footer(this) : options.footer;
if ($.trim(footer) !== "") {
createFooter = true;
editorFooter.append(footer)
}
if (createFooter) editor.append(editorFooter);
if (options.width && options.width !== "inherit") {
if (jQuery.isNumeric(options.width)) {
editor.css("display", "table");
textarea.css("width", options.width + "px")
} else {
editor.addClass(options.width)
}
}
if (options.height && options.height !== "inherit") {
if (jQuery.isNumeric(options.height)) {
var height = options.height;
if (editorHeader) height = Math.max(0, height - editorHeader.outerHeight());
if (editorFooter) height = Math.max(0, height - editorFooter.outerHeight());
textarea.css("height", height + "px")
} else {
editor.addClass(options.height)
}
}
this.$editor = editor;
this.$textarea = textarea;
this.$editable = editable;
this.$oldContent = this.getContent();
this.__setListener();
this.$editor.attr("id", (new Date).getTime());
this.$editor.on("click", '[data-provider="bootstrap-markdown"]', $.proxy(this.__handle, this));
if (this.$element.is(":disabled") || this.$element.is("[readonly]")) {
this.$editor.addClass("md-editor-disabled");
this.disableButtons("all")
}
if (this.eventSupported("keydown") && typeof jQuery.hotkeys === "object") {
editorHeader.find('[data-provider="bootstrap-markdown"]').each(function () {
var $button = $(this), hotkey = $button.attr("data-hotkey");
if (hotkey.toLowerCase() !== "") {
textarea.bind("keydown", hotkey, function () {
$button.trigger("click");
return false
})
}
})
}
if (options.initialstate === "preview") {
this.showPreview()
} else if (options.initialstate === "fullscreen" && options.fullscreen.enable) {
this.setFullscreen(true)
}
} else {
this.$editor.show()
}
if (options.autofocus) {
this.$textarea.focus();
this.$editor.addClass("active")
}
if (options.fullscreen.enable && options.fullscreen !== false) {
this.$editor.append('<div class="md-fullscreen-controls">' + '<a href="#" class="exit-fullscreen" title="Exit fullscreen"><span class="' + this.__getIcon(options.fullscreen.icons.fullscreenOff) + '">' + "</span></a>" + "</div>");
this.$editor.on("click", ".exit-fullscreen", function (e) {
e.preventDefault();
instance.setFullscreen(false)
})
}
this.hideButtons(options.hiddenButtons);
this.disableButtons(options.disabledButtons);
options.onShow(this);
return this
}, parseContent: function (val) {
var content;
var val = val || this.$textarea.val();
if (this.$options.parser) {
content = this.$options.parser(val)
} else if (typeof markdown == "object") {
content = markdown.toHTML(val)
} else if (typeof marked == "function") {
content = marked(val)
} else {
content = val
}
return content
}, showPreview: function () {
var options = this.$options, container = this.$textarea, afterContainer = container.next(), replacementContainer = $("<div/>", {class: "md-preview", "data-provider": "markdown-preview"}), content, callbackContent;
if (this.$isPreview == true) {
return this
}
this.$isPreview = true;
this.disableButtons("all").enableButtons("cmdPreview");
callbackContent = options.onPreview(this);
content = typeof callbackContent == "string" ? callbackContent : this.parseContent();
replacementContainer.html(content);
if (afterContainer && afterContainer.attr("class") == "md-footer") {
replacementContainer.insertBefore(afterContainer)
} else {
container.parent().append(replacementContainer)
}
replacementContainer.css({width: container.outerWidth() + "px", height: container.outerHeight() + "px"});
if (this.$options.resize) {
replacementContainer.css("resize", this.$options.resize)
}
container.hide();
replacementContainer.data("markdown", this);
if (this.$element.is(":disabled") || this.$element.is("[readonly]")) {
this.$editor.addClass("md-editor-disabled");
this.disableButtons("all")
}
return this
}, hidePreview: function () {
this.$isPreview = false;
var container = this.$editor.find('div[data-provider="markdown-preview"]');
container.remove();
this.enableButtons("all");
this.disableButtons(this.$options.disabledButtons);
this.$textarea.show();
this.__setListener();
return this
}, isDirty: function () {
return this.$oldContent != this.getContent()
}, getContent: function () {
return this.$textarea.val()
}, setContent: function (content) {
this.$textarea.val(content);
return this
}, findSelection: function (chunk) {
var content = this.getContent(), startChunkPosition;
if (startChunkPosition = content.indexOf(chunk), startChunkPosition >= 0 && chunk.length > 0) {
var oldSelection = this.getSelection(), selection;
this.setSelection(startChunkPosition, startChunkPosition + chunk.length);
selection = this.getSelection();
this.setSelection(oldSelection.start, oldSelection.end);
return selection
} else {
return null
}
}, getSelection: function () {
var e = this.$textarea[0];
return ("selectionStart" in e && function () {
var l = e.selectionEnd - e.selectionStart;
return {start: e.selectionStart, end: e.selectionEnd, length: l, text: e.value.substr(e.selectionStart, l)}
} || function () {
return null
})()
}, setSelection: function (start, end) {
var e = this.$textarea[0];
return ("selectionStart" in e && function () {
e.selectionStart = start;
e.selectionEnd = end;
return
} || function () {
return null
})()
}, replaceSelection: function (text) {
var e = this.$textarea[0];
return ("selectionStart" in e && function () {
e.value = e.value.substr(0, e.selectionStart) + text + e.value.substr(e.selectionEnd, e.value.length);
e.selectionStart = e.value.length;
return this
} || function () {
e.value += text;
return jQuery(e)
})()
}, getNextTab: function () {
if (this.$nextTab.length === 0) {
return null
} else {
var nextTab, tab = this.$nextTab.shift();
if (typeof tab == "function") {
nextTab = tab()
} else if (typeof tab == "object" && tab.length > 0) {
nextTab = tab
}
return nextTab
}
}, setNextTab: function (start, end) {
if (typeof start == "string") {
var that = this;
this.$nextTab.push(function () {
return that.findSelection(start)
})
} else if (typeof start == "number" && typeof end == "number") {
var oldSelection = this.getSelection();
this.setSelection(start, end);
this.$nextTab.push(this.getSelection());
this.setSelection(oldSelection.start, oldSelection.end)
}
return
}, __parseButtonNameParam: function (names) {
return typeof names == "string" ? names.split(" ") : names
}, enableButtons: function (name) {
var buttons = this.__parseButtonNameParam(name), that = this;
$.each(buttons, function (i, v) {
that.__alterButtons(buttons[i], function (el) {
el.removeAttr("disabled")
})
});
return this
}, disableButtons: function (name) {
var buttons = this.__parseButtonNameParam(name), that = this;
$.each(buttons, function (i, v) {
that.__alterButtons(buttons[i], function (el) {
el.attr("disabled", "disabled")
})
});
return this
}, hideButtons: function (name) {
var buttons = this.__parseButtonNameParam(name), that = this;
$.each(buttons, function (i, v) {
that.__alterButtons(buttons[i], function (el) {
el.prop("hidden", true)
})
});
return this
}, showButtons: function (name) {
var buttons = this.__parseButtonNameParam(name), that = this;
$.each(buttons, function (i, v) {
that.__alterButtons(buttons[i], function (el) {
el.removeProp("hidden")
})
});
return this
}, eventSupported: function (eventName) {
var isSupported = eventName in this.$element;
if (!isSupported) {
this.$element.setAttribute(eventName, "return;");
isSupported = typeof this.$element[eventName] === "function"
}
return isSupported
}, keyup: function (e) {
var blocked = false;
switch (e.keyCode) {
case 40:
case 38:
case 16:
case 17:
case 18:
break;
case 9:
if (typeof tabOverride !== 'undefined') {
break;
}
var nextTab;
if (nextTab = this.getNextTab(), nextTab !== null) {
var that = this;
setTimeout(function () {
that.setSelection(nextTab.start, nextTab.end)
}, 500);
blocked = true
} else {
var cursor = this.getSelection();
if (cursor.start == cursor.end && cursor.end == this.getContent().length) {
blocked = false
} else {
this.setSelection(this.getContent().length, this.getContent().length);
blocked = true
}
}
break;
case 13:
blocked = false;
break;
case 27:
if (this.$isFullscreen) this.setFullscreen(false);
blocked = false;
break;
default:
blocked = false
}
if (blocked) {
e.stopPropagation();
e.preventDefault()
}
this.$options.onChange(this)
}, change: function (e) {
this.$options.onChange(this);
return this
}, select: function (e) {
this.$options.onSelect(this);
return this
}, focus: function (e) {
var options = this.$options, isHideable = options.hideable, editor = this.$editor;
editor.addClass("active");
$(document).find(".md-editor").each(function () {
if ($(this).attr("id") !== editor.attr("id")) {
var attachedMarkdown;
if (attachedMarkdown = $(this).find("textarea").data("markdown"), attachedMarkdown === null) {
attachedMarkdown = $(this).find('div[data-provider="markdown-preview"]').data("markdown")
}
if (attachedMarkdown) {
attachedMarkdown.blur()
}
}
});
options.onFocus(this);
return this
}, blur: function (e) {
var options = this.$options, isHideable = options.hideable, editor = this.$editor, editable = this.$editable;
if (editor.hasClass("active") || this.$element.parent().length === 0) {
editor.removeClass("active");
if (isHideable) {
if (editable.el !== null) {
var oldElement = $("<" + editable.type + "/>"), content = this.getContent(), currentContent = this.parseContent(content);
$(editable.attrKeys).each(function (k, v) {
oldElement.attr(editable.attrKeys[k], editable.attrValues[k])
});
oldElement.html(currentContent);
editor.replaceWith(oldElement)
} else {
editor.hide()
}
}
options.onBlur(this)
}
return this
}
};
var old = $.fn.markdown;
$.fn.markdown = function (option) {
return this.each(function () {
var $this = $(this), data = $this.data("markdown"), options = typeof option == "object" && option;
if (!data) $this.data("markdown", data = new Markdown(this, options))
})
};
$.fn.markdown.messages = {};
$.fn.markdown.defaults = {
autofocus: false, hideable: false, savable: false, width: "inherit", height: "inherit", resize: "none", iconlibrary: "glyph", language: "en", initialstate: "editor", parser: null, buttons: [[{
name: "groupFont", data: [{
name: "cmdBold", hotkey: "Ctrl+B", title: "Bold", icon: {glyph: "glyphicon glyphicon-bold", fa: "fa fa-bold", "fa-3": "icon-bold"}, callback: function (e) {
var chunk, cursor, selected = e.getSelection(), content = e.getContent();
if (selected.length === 0) {
chunk = e.__localize("strong text")
} else {
chunk = selected.text
}
if (content.substr(selected.start - 2, 2) === "**" && content.substr(selected.end, 2) === "**") {
e.setSelection(selected.start - 2, selected.end + 2);
e.replaceSelection(chunk);
cursor = selected.start - 2
} else {
e.replaceSelection("**" + chunk + "**");
cursor = selected.start + 2
}
e.setSelection(cursor, cursor + chunk.length)
}
}, {
name: "cmdItalic", title: "Italic", hotkey: "Ctrl+I", icon: {glyph: "glyphicon glyphicon-italic", fa: "fa fa-italic", "fa-3": "icon-italic"}, callback: function (e) {
var chunk, cursor, selected = e.getSelection(), content = e.getContent();
if (selected.length === 0) {
chunk = e.__localize("emphasized text")
} else {
chunk = selected.text
}
if (content.substr(selected.start - 1, 1) === "_" && content.substr(selected.end, 1) === "_") {
e.setSelection(selected.start - 1, selected.end + 1);
e.replaceSelection(chunk);
cursor = selected.start - 1
} else {
e.replaceSelection("_" + chunk + "_");
cursor = selected.start + 1
}
e.setSelection(cursor, cursor + chunk.length)
}
}, {
name: "cmdHeading", title: "Heading", hotkey: "Ctrl+H", icon: {glyph: "glyphicon glyphicon-header", fa: "fa fa-header", "fa-3": "icon-font"}, callback: function (e) {
var chunk, cursor, selected = e.getSelection(), content = e.getContent(), pointer, prevChar;
if (selected.length === 0) {
chunk = e.__localize("heading text")
} else {
chunk = selected.text + "\n"
}
if ((pointer = 4, content.substr(selected.start - pointer, pointer) === "### ") || (pointer = 3, content.substr(selected.start - pointer, pointer) === "###")) {
e.setSelection(selected.start - pointer, selected.end);
e.replaceSelection(chunk);
cursor = selected.start - pointer
} else if (selected.start > 0 && (prevChar = content.substr(selected.start - 1, 1), !!prevChar && prevChar != "\n")) {
e.replaceSelection("\n\n### " + chunk);
cursor = selected.start + 6
} else {
e.replaceSelection("### " + chunk);
cursor = selected.start + 4
}
e.setSelection(cursor, cursor + chunk.length)
}
}]
}, {
name: "groupLink", data: [{
name: "cmdUrl", title: "URL/Link", hotkey: "Ctrl+L", icon: {glyph: "glyphicon glyphicon-link", fa: "fa fa-link", "fa-3": "icon-link"}, callback: function (e) {
var chunk, cursor, selected = e.getSelection(), content = e.getContent(), link;
if (selected.length === 0) {
chunk = e.__localize("enter link description here")
} else {
chunk = selected.text
}
link = prompt(e.__localize("Insert Hyperlink"), "http://");
var urlRegex = new RegExp("^((http|https)://|(mailto:)|(//))[a-z0-9]", "i");
if (link !== null && link !== "" && link !== "http://" && urlRegex.test(link)) {
var sanitizedLink = $("<div>" + link + "</div>").text();
e.replaceSelection("[" + chunk + "](" + sanitizedLink + ")");
cursor = selected.start + 1;
e.setSelection(cursor, cursor + chunk.length)
}
}
}, {
name: "cmdImage", title: "Image", hotkey: "Ctrl+G", icon: {glyph: "glyphicon glyphicon-picture", fa: "fa fa-picture-o", "fa-3": "icon-image"}, callback: function (e) {
var chunk, cursor, selected = e.getSelection(), content = e.getContent(), link;
if (selected.length === 0) {
chunk = e.__localize("enter image description here")
} else {
chunk = selected.text
}
link = prompt(e.__localize("Insert Image Hyperlink"), "http://");
var urlRegex = new RegExp("^((http|https)://|(//))[a-z0-9]", "i");
if (link !== null && link !== "" && link !== "http://" && urlRegex.test(link)) {
var sanitizedLink = $("<div>" + link + "</div>").text();
e.replaceSelection("![" + chunk + "](" + sanitizedLink + ' "' + e.__localize("enter image title here") + '")');
cursor = selected.start + 2;
e.setNextTab(e.__localize("enter image title here"));
e.setSelection(cursor, cursor + chunk.length)
}
}
}, {
name: "cmdFile", title: "Attachment File", icon: {glyph: "glyphicon glyphicon-file", fa: "fa fa-file-archive-o", "fa-3": "icon-file"}, callback: function (e) {
var chunk, cursor, selected = e.getSelection(), content = e.getContent(), link;
if (selected.length === 0) {
chunk = e.__localize("enter file description here")
} else {
chunk = selected.text
}
link = prompt(e.__localize("Insert File Hyperlink"), "http://");
var urlRegex = new RegExp("^((http|https)://|(//))[a-z0-9]", "i");
if (link !== null && link !== "" && link !== "http://" && urlRegex.test(link)) {
var sanitizedLink = $("<div>" + link + "</div>").text();
e.replaceSelection("[" + chunk + "](" + sanitizedLink + ' "' + e.__localize("enter file title here") + '")');
cursor = selected.start + 2;
e.setNextTab(e.__localize("enter file title here"));
e.setSelection(cursor, cursor + chunk.length)
}
}
}]
}, {
name: "groupMisc", data: [{
name: "cmdList", hotkey: "Ctrl+U", title: "Unordered List", icon: {glyph: "glyphicon glyphicon-list", fa: "fa fa-list", "fa-3": "icon-list-ul"}, callback: function (e) {
var chunk, cursor, selected = e.getSelection(), content = e.getContent();
if (selected.length === 0) {
chunk = e.__localize("list text here");
e.replaceSelection("- " + chunk);
cursor = selected.start + 2
} else {
if (selected.text.indexOf("\n") < 0) {
chunk = selected.text;
e.replaceSelection("- " + chunk);
cursor = selected.start + 2
} else {
var list = [];
list = selected.text.split("\n");
chunk = list[0];
$.each(list, function (k, v) {
list[k] = "- " + v
});
e.replaceSelection("\n\n" + list.join("\n"));
cursor = selected.start + 4
}
}
e.setSelection(cursor, cursor + chunk.length)
}
}, {
name: "cmdListO", hotkey: "Ctrl+O", title: "Ordered List", icon: {glyph: "glyphicon glyphicon-th-list", fa: "fa fa-list-ol", "fa-3": "icon-list-ol"}, callback: function (e) {
var chunk, cursor, selected = e.getSelection(), content = e.getContent();
if (selected.length === 0) {
chunk = e.__localize("list text here");
e.replaceSelection("1. " + chunk);
cursor = selected.start + 3
} else {
if (selected.text.indexOf("\n") < 0) {
chunk = selected.text;
e.replaceSelection("1. " + chunk);
cursor = selected.start + 3
} else {
var list = [];
list = selected.text.split("\n");
chunk = list[0];
$.each(list, function (k, v) {
list[k] = "1. " + v
});
e.replaceSelection("\n\n" + list.join("\n"));
cursor = selected.start + 5
}
}
e.setSelection(cursor, cursor + chunk.length)
}
}, {
name: "cmdCode", hotkey: "Ctrl+K", title: "Code", icon: {glyph: "glyphicon glyphicon-asterisk", fa: "fa fa-code", "fa-3": "icon-code"}, callback: function (e) {
var chunk, cursor, selected = e.getSelection(), content = e.getContent();
if (selected.length === 0) {
chunk = e.__localize("code text here")
} else {
chunk = selected.text
}
if (content.substr(selected.start - 4, 4) === "```\n" && content.substr(selected.end, 4) === "\n```") {
e.setSelection(selected.start - 4, selected.end + 4);
e.replaceSelection(chunk);
cursor = selected.start - 4
} else if (content.substr(selected.start - 1, 1) === "`" && content.substr(selected.end, 1) === "`") {
e.setSelection(selected.start - 1, selected.end + 1);
e.replaceSelection(chunk);
cursor = selected.start - 1
} else if (content.indexOf("\n") > -1) {
e.replaceSelection("```\n" + chunk + "\n```");
cursor = selected.start + 4
} else {
e.replaceSelection("`" + chunk + "`");
cursor = selected.start + 1
}
e.setSelection(cursor, cursor + chunk.length)
}
}, {
name: "cmdQuote", hotkey: "Ctrl+Q", title: "Quote", icon: {glyph: "glyphicon glyphicon-comment", fa: "fa fa-quote-left", "fa-3": "icon-quote-left"}, callback: function (e) {
var chunk, cursor, selected = e.getSelection(), content = e.getContent();
if (selected.length === 0) {
chunk = e.__localize("quote here");
e.replaceSelection("> " + chunk);
cursor = selected.start + 2
} else {
if (selected.text.indexOf("\n") < 0) {
chunk = selected.text;
e.replaceSelection("> " + chunk);
cursor = selected.start + 2
} else {
var list = [];
list = selected.text.split("\n");
chunk = list[0];
$.each(list, function (k, v) {
list[k] = "> " + v
});
e.replaceSelection("\n\n" + list.join("\n"));
cursor = selected.start + 4
}
}
e.setSelection(cursor, cursor + chunk.length)
}
}]
}, {
name: "groupUtil", data: [{
name: "cmdPreview", toggle: true, hotkey: "Ctrl+P", title: "Preview", btnText: "Preview", btnClass: "btn btn-light", icon: {glyph: "glyphicon glyphicon-search", fa: "fa fa-search", "fa-3": "icon-search"}, callback: function (e) {
var isPreview = e.$isPreview, content;
if (isPreview === false) {
e.showPreview()
} else {
e.hidePreview()
}
}
}]
}]], additionalButtons: [], reorderButtonGroups: [], hiddenButtons: [], disabledButtons: [], footer: "", fullscreen: {enable: true, icons: {fullscreenOn: {fa: "fa fa-expand", glyph: "glyphicon glyphicon-fullscreen", "fa-3": "icon-expand"}, fullscreenOff: {fa: "fa fa-compress", glyph: "glyphicon glyphicon-fullscreen", "fa-3": "icon-compress"}}}, onShow: function (e) {
}, onPreview: function (e) {
}, onSave: function (e) {
}, onBlur: function (e) {
}, onFocus: function (e) {
}, onChange: function (e) {
}, onFullscreen: function (e) {
}, onSelect: function (e) {
}
};
$.fn.markdown.Constructor = Markdown;
$.fn.markdown.noConflict = function () {
$.fn.markdown = old;
return this
};
var initMarkdown = function (el) {
var $this = el;
if ($this.data("markdown")) {
$this.data("markdown").showEditor();
return
}
$this.markdown()
};
var blurNonFocused = function (e) {
var $activeElement = $(document.activeElement);
$(document).find(".md-editor").each(function () {
var $this = $(this), focused = $activeElement.closest(".md-editor")[0] === this, attachedMarkdown = $this.find("textarea").data("markdown") || $this.find('div[data-provider="markdown-preview"]').data("markdown");
if (attachedMarkdown && !focused) {
attachedMarkdown.blur()
}
})
};
$(document).on("click.markdown.data-api", '[data-provide="markdown-editable"]', function (e) {
initMarkdown($(this));
e.preventDefault()
}).on("click focusin", function (e) {
blurNonFocused(e)
}).ready(function () {
$('textarea[data-provide="markdown"]').each(function () {
initMarkdown($(this))
})
})
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,159 @@
// https://github.com/yuezhongxin/paste-upload-image.js
(function ($) {
var isImage, isImageForDrop, getFilename, getMimeType;
isImage = function (data) {
var i, item;
i = 0;
while (i < data.clipboardData.items.length) {
item = data.clipboardData.items[i];
if (item.type.indexOf("image") !== -1) {
return item;
}
i++;
}
return false;
};
isImageForDrop = function (data) {
var i, item;
i = 0;
while (i < data.dataTransfer.files.length) {
item = data.dataTransfer.files[i];
if (item.type.indexOf("image") !== -1) {
return item;
}
i++;
}
return false;
};
getFilename = function (e) {
var value;
if (window.clipboardData && window.clipboardData.getData) {
value = window.clipboardData.getData("Text");
} else if (e.clipboardData && e.clipboardData.getData) {
value = e.clipboardData.getData("text/plain");
}
value = value.split("\r");
return value[0];
};
getMimeType = function (file, filename) {
var mimeType = file.type;
var extendName = filename.substring(filename.lastIndexOf('.') + 1);
if (mimeType != 'image/' + extendName) {
return 'image/' + extendName;
}
return mimeType;
};
$.fn.pasteUploadImage = function (options) {
options = $.extend({}, $.fn.pasteUploadImage.defaults, options, {fileType: 'image'});
return this.each(function () {
var that = $(this);
that.on('paste', function (event) {
var filename, image, pasteEvent;
pasteEvent = event.originalEvent;
if (pasteEvent.clipboardData && pasteEvent.clipboardData.items) {
image = isImage(pasteEvent);
if (image) {
event.preventDefault();
filename = getFilename(pasteEvent) || options.defaultImageName;
return that.uploadFile(image.getAsFile(), filename, options);
}
}
});
that.on('drop', function (event) {
var filename, image, pasteEvent;
pasteEvent = event.originalEvent;
if (pasteEvent.dataTransfer && pasteEvent.dataTransfer.files) {
image = isImageForDrop(pasteEvent);
if (image) {
event.preventDefault();
filename = pasteEvent.dataTransfer.files[0].name || options.defaultImageName;
return that.uploadFile(image, filename, options);
}
}
});
});
};
$.fn.insertToTextArea = function (filename, url) {
var options = $(this).data("pu-options") || $.fn.pasteUploadImage.defaults;
return $(this).val(function (index, val) {
return val.replace("{{" + filename + "(" + options.uploadingText + ")}}", (options.fileType == 'image' ? '!' : '') + "[" + (filename.match(/^[a-zA-Z0-9_\u4e00-\u9fa5\.\-]+$/) ? filename : url.substring(url.lastIndexOf('/') + 1)) + "](" + url + ")" + "\n");
});
};
$.fn.removeLoadingText = function (filename) {
var options = $(this).data("pu-options") || $.fn.pasteUploadImage.defaults;
return $(this).val(function (index, val) {
return val.replace("{{" + filename + "(" + options.uploadingText + ")}}", "\n");
});
};
$.fn.uploadFile = function (file, filename, options) {
var that = $(this);
var options = $.extend(true, {}, $.fn.pasteUploadImage.defaults, options || {});
that.data("pu-options", options);
var text = "{{" + filename + "(" + options.uploadingText + ")}}";
that.pasteText(text);
var formData = new FormData();
formData.append(options.fileName, file);
if (options.appendMimetype) {
formData.append("mimeType", getMimeType(file, filename));
}
var ajaxOptions = {
url: '',
data: formData,
type: 'post',
processData: false,
contentType: false,
dataType: 'json',
success: function (data) {
if (typeof options.success == 'function') {
if (false === options.success.apply(that, [data, filename, file])) {
return;
}
}
if (data.success) {
return that.insertToTextArea(filename, data.message, options);
}
return that.removeLoadingText(filename);
},
error: function (xOptions, textStatus) {
if (typeof options.error == 'function') {
if (false === options.error.apply(that, [{}, filename, file])) {
return;
}
}
that.removeLoadingText("");
}
};
if (typeof options.ajaxOptions === 'object') {
ajaxOptions = $.extend(true, ajaxOptions, options.ajaxOptions);
} else {
ajaxOptions.url = options.ajaxOptions;
}
$.ajax(ajaxOptions);
};
$.fn.pasteText = function (text) {
var that = $(this);
var afterSelection, beforeSelection, caretEnd, caretStart, textEnd;
caretStart = that[0].selectionStart;
caretEnd = that[0].selectionEnd;
textEnd = that.val().length;
beforeSelection = that.val().substring(0, caretStart);
afterSelection = that.val().substring(caretEnd, textEnd);
that.val(beforeSelection + text + afterSelection);
that.get(0).setSelectionRange(caretStart + text.length, caretEnd + text.length);
return that.trigger("input");
};
$.fn.pasteUploadImage.defaults = {
success: null,
error: null,
ajaxOptions: '',
fileName: 'imageFile',
appendMimetype: true,
defaultImageName: 'image.png',
uploadingText: 'uploading...',
};
})(jQuery);

File diff suppressed because it is too large Load Diff