fix: dateFormat without issue

feat/fix/umd
SukkaW 7 years ago
parent 9b11c5d59e
commit 5cc7de57ea

226
dist/disqus.js vendored

File diff suppressed because one or more lines are too long

6
dist/disqusjs.css vendored

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
let gulp = require('gulp');
let uglify = require('gulp-uglify');
let buble = require('gulp-buble');
let babel = require('gulp-babel');
let autoprefixer = require('gulp-autoprefixer');
let cleanCSS = require('gulp-clean-css');
let header = require('gulp-header');
@ -33,14 +33,18 @@ var configs = {
'Safari >= 8',
],
cleanCSS: {
compatibility: 'ie10'
compatibility: 'ie9'
},
};
gulp.task('minify-js', () => {
return gulp.src('src/**/*.js')
.pipe(buble({
transforms: { dangerousForOf: true }
.pipe(babel({
"presets": [
["@babel/env", {
"targets": configs.browsers
}]
]
}))
.pipe(uglify({
keep_fnames: false

@ -1,6 +1,6 @@
{
"name": "disqusjs",
"version": "0.2.4",
"version": "1.0.0-rc-1",
"description": "Alternative DISQUS - Render comments components from Disqus API",
"main": "dist/disqus.js",
"scripts": {
@ -19,15 +19,17 @@
"JSON"
],
"author": "Sukka",
"license": "GPL-3.0",
"license": "MIT",
"bugs": {
"url": "https://github.com/SukkaW/DisqusJS/issues"
},
"homepage": "https://github.com/SukkaW/DisqusJS#readme",
"dependencies": {
"@babel/core": "^7.1.2",
"@babel/preset-env": "^7.1.0",
"gulp": "4",
"gulp-autoprefixer": "^6.0.0",
"gulp-buble": "^0.9.0",
"gulp-babel": "^8.0.0",
"gulp-clean-css": "^3.10.0",
"gulp-header": "^2.0.5",
"gulp-uglify": "^3.0.1"

@ -93,13 +93,14 @@ function DisqusJS(config) {
* @return {string} - 格式化后的日期
*/
const dateFormat = (date) => {
date = new Date(date + 28800000);
let y = date.getFullYear();
let m = date.getMonth() + 1;
m = m < 10 ? (`0${m}`) : m;
let m = date.getUTCMonth() + 1;
if (m < 10) m = `0${m}`;
let d = date.getDate();
d = d < 10 ? (`0${d}`) : d;
let h = date.getHours() + 8;
h = h < 10 ? (`0${h}`) : h;
if (d < 10) d = `0${d}`;
let h = date.getHours();
if (h < 10) h = `0${h}`;
let minute = date.getMinutes();
minute = minute < 10 ? (`0${minute}`) : minute;
return `${y}-${m}-${d} ${h}:${minute}`;
@ -409,7 +410,7 @@ function DisqusJS(config) {
</div>
</div>
*/
let html = `<div class="dsqjs-post-item dsqjs-clearfix"><div class="dsqjs-post-avatar">${s.avatarEl}</div><div class="dsqjs-post-body"><div class="dsqjs-post-header">${s.authorEl} <span class="dsqjs-bullet"></span> <span class="dsqjs-meta"><time>${dateFormat(new Date(s.createdAt))}</time></span></div><div class="dsqjs-post-content">${s.message}</div></div></div>`
let html = `<div class="dsqjs-post-item dsqjs-clearfix"><div class="dsqjs-post-avatar">${s.avatarEl}</div><div class="dsqjs-post-body"><div class="dsqjs-post-header">${s.authorEl} <span class="dsqjs-bullet"></span> <span class="dsqjs-meta"><time>${dateFormat(Date.parse(new Date(s.createdAt)))}</time></span></div><div class="dsqjs-post-content">${s.message}</div></div></div>`
return html;
}
@ -510,6 +511,6 @@ function DisqusJS(config) {
loadDsqjs();
} else {
// 没有在 localStorage 中找到 disqusjs_mode 相关内容,开始检查访客的 Disqus 可用性
// checkDisqus();
checkDisqus();
}
}

@ -243,7 +243,6 @@
#dsqjs footer {
text-align: right;
line-height: 1.5;
padding-right: 4px;
padding-top: 12px;
font-weight: 700;
font-size: 16px;
@ -251,7 +250,7 @@
}
#dsqjs .dsqjs-disqus-logo {
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 438 80"><path fill="#575B5D" d="M30.2 1.6H1v76h28.9C57 77.6 73 61.3 73 39.4v-.2c0-22-15.7-37.6-42.9-37.6zm21.3 38.1c0 12.3-8.4 19.3-21 19.3H22V20.3h8.5c12.6 0 21 7 21 19.2v.2zm35.6 38h21.2V1.5H87.1v76zm70-47.4c-10.4-2.4-13-4-13-7.4v-.2c0-2.7 2.4-5 7.6-5 6.7 0 14.3 2.7 21.2 7.6l10.6-14.9A47.9 47.9 0 0 0 152.2.3c-18.3 0-29.4 10.2-29.4 24.3v.2c0 15.7 12.4 20.3 28.6 24 10.4 2.3 12.9 4 12.9 7.2v.2c0 3.3-3 5.2-8.7 5.2-8.8 0-17.2-3.1-24.7-9l-11.7 14a53.1 53.1 0 0 0 35.6 12.5c18.5 0 30.7-9.2 30.7-24.7V54c0-14.3-10.8-20-28.3-23.7zm120.7 9.3v-.2A39.5 39.5 0 0 0 236.9.1c-23.4 0-41 17.7-41 39.5v.2a39.5 39.5 0 0 0 40.8 39.4c8.7 0 16.6-2.5 23.1-6.8l8.4 7.5L279 68.1l-7.9-6.6a38 38 0 0 0 6.8-21.9zm-21.4.5c0 2.6-.5 5-1.3 7.3l-10.4-9.3-10.6 12 10.5 9a21.7 21.7 0 0 1-7.7 1.4c-11.6 0-19.4-9.7-19.4-20.7v-.2c0-11 7.7-20.5 19.2-20.5 11.7 0 19.7 9.7 19.7 20.7v.3zm83.5 4.3c0 10.6-5.5 15.6-14 15.6s-14-5.2-14-16.1V1.6h-21.4v42.7C290.5 68 304 79 325.7 79s35.6-10.8 35.6-35.3V1.5h-21.4v42.8zm68.9-14.1c-10.6-2.4-13.2-4-13.2-7.4v-.2c0-2.7 2.5-5 7.6-5 6.8 0 14.4 2.7 21.3 7.6l10.6-14.9A47.9 47.9 0 0 0 403.8.3c-18.3 0-29.5 10.2-29.5 24.3v.2c0 15.7 12.5 20.3 28.7 24 10.3 2.3 12.8 4 12.8 7.2v.2c0 3.3-3 5.3-8.7 5.3-8.8 0-17.1-3.2-24.6-9.2l-11.7 14A53.1 53.1 0 0 0 406.4 79c18.5 0 30.7-9.2 30.7-24.7V54c0-14.3-10.8-20-28.3-23.7z"/></svg>');
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 438 80"><path fill="%23575B5D" d="M30.2 1.6H1v76h28.9C57 77.6 73 61.3 73 39.4v-.2c0-22-15.7-37.6-42.9-37.6zm21.3 38.1c0 12.3-8.4 19.3-21 19.3H22V20.3h8.5c12.6 0 21 7 21 19.2v.2zm35.6 38h21.2V1.5H87.1v76zm70-47.4c-10.4-2.4-13-4-13-7.4v-.2c0-2.7 2.4-5 7.6-5 6.7 0 14.3 2.7 21.2 7.6l10.6-14.9A47.9 47.9 0 0 0 152.2.3c-18.3 0-29.4 10.2-29.4 24.3v.2c0 15.7 12.4 20.3 28.6 24 10.4 2.3 12.9 4 12.9 7.2v.2c0 3.3-3 5.2-8.7 5.2-8.8 0-17.2-3.1-24.7-9l-11.7 14a53.1 53.1 0 0 0 35.6 12.5c18.5 0 30.7-9.2 30.7-24.7V54c0-14.3-10.8-20-28.3-23.7zm120.7 9.3v-.2A39.5 39.5 0 0 0 236.9.1c-23.4 0-41 17.7-41 39.5v.2a39.5 39.5 0 0 0 40.8 39.4c8.7 0 16.6-2.5 23.1-6.8l8.4 7.5L279 68.1l-7.9-6.6a38 38 0 0 0 6.8-21.9zm-21.4.5c0 2.6-.5 5-1.3 7.3l-10.4-9.3-10.6 12 10.5 9a21.7 21.7 0 0 1-7.7 1.4c-11.6 0-19.4-9.7-19.4-20.7v-.2c0-11 7.7-20.5 19.2-20.5 11.7 0 19.7 9.7 19.7 20.7v.3zm83.5 4.3c0 10.6-5.5 15.6-14 15.6s-14-5.2-14-16.1V1.6h-21.4v42.7C290.5 68 304 79 325.7 79s35.6-10.8 35.6-35.3V1.5h-21.4v42.8zm68.9-14.1c-10.6-2.4-13.2-4-13.2-7.4v-.2c0-2.7 2.5-5 7.6-5 6.8 0 14.4 2.7 21.3 7.6l10.6-14.9A47.9 47.9 0 0 0 403.8.3c-18.3 0-29.5 10.2-29.5 24.3v.2c0 15.7 12.5 20.3 28.7 24 10.3 2.3 12.8 4 12.8 7.2v.2c0 3.3-3 5.3-8.7 5.3-8.8 0-17.1-3.2-24.6-9.2l-11.7 14A53.1 53.1 0 0 0 406.4 79c18.5 0 30.7-9.2 30.7-24.7V54c0-14.3-10.8-20-28.3-23.7z"/></svg>');
background-position: 50% 50%;
background-repeat: no-repeat;
display: inline-block;

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save