Skip to content

Commit

Permalink
Change eslint rules.
Browse files Browse the repository at this point in the history
"one-var": [2, "always"]
  • Loading branch information
shiyiya committed Sep 16, 2018
1 parent a3c52b1 commit 07f705e
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 55 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"Prism": true
},
"rules": {
"no-unused-vars": "off"
"no-unused-vars": "off",
"one-var": [2, "always"]
}
}
17 changes: 6 additions & 11 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
var gulp = require('gulp')

var uglify = require('gulp-uglify')

var babel = require('gulp-babel')

var rename = require('gulp-rename')

var cleanCSS = require('gulp-clean-css')

var autoprefixer = require('gulp-autoprefixer')
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
babel = require('gulp-babel'),
rename = require('gulp-rename'),
cleanCSS = require('gulp-clean-css'),
autoprefixer = require('gulp-autoprefixer')

gulp.task('jscompress', function () {
return gulp
Expand Down
86 changes: 43 additions & 43 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
*/

// prettier-ignore
var c = document.getElementsByTagName('canvas')[0]
var x = c.getContext('2d')
var pr = window.devicePixelRatio || 1
var w = window.innerWidth
var h = window.innerHeight
var f = 90
var q
var m = Math
var r = 0
var u = m.PI * 2
var v = m.cos
var z = m.random
var c = document.getElementsByTagName('canvas')[0],
x = c.getContext('2d'),
pr = window.devicePixelRatio || 1,
w = window.innerWidth,
h = window.innerHeight,
f = 90,
q,
m = Math,
r = 0,
u = m.PI * 2,
v = m.cos,
z = m.random
c.width = w * pr
c.height = h * pr
x.scale(pr, pr)
Expand All @@ -33,9 +33,8 @@ function d (i, j) {
x.beginPath()
x.moveTo(i.x, i.y)
x.lineTo(j.x, j.y)
let k = j.x + (z() * 2 - 0.25) * f

let n = y(j.y)
let k = j.x + (z() * 2 - 0.25) * f,
n = y(j.y)
x.lineTo(k, n)
x.closePath()
r -= u / -50
Expand All @@ -56,9 +55,9 @@ function y (p) {
}

/** start */
const pjaxContainer = '#pjax'
const pjaxTimeout = 30000
const hostname = document.location.hostname
const pjaxContainer = '#pjax',
pjaxTimeout = 30000,
hostname = document.location.hostname

$("a:not([href*='" + hostname + "'])").attr('target', '_blank')

Expand Down Expand Up @@ -103,8 +102,8 @@ $('#top, #back-to-top').click(function () {
$('html, body').animate({ scrollTop: 0 }, 500)
})

let oldTopValue = 0
let startScroll = null
let oldTopValue = 0,
startScroll = null
$(window).scroll(function () {
if ($(window).scrollTop() > 300) {
$('#back-to-top').show()
Expand All @@ -118,8 +117,8 @@ $(window).scroll(function () {
* @return {void}
*/
function checkRobot () {
let robot = document.getElementById('robot')
let replyButton = document.getElementsByClassName('submit')[0]
let robot = document.getElementById('robot'),
replyButton = document.getElementsByClassName('submit')[0]
if (robot) {
robot.addEventListener('change', function () {
if (this.checked) {
Expand All @@ -136,16 +135,15 @@ function checkRobot () {
* @return {boolean}
*/
function isMobile () {
const Agents = navigator.userAgent

const mobileAgents = [
'Android',
'iPhone',
'SymbianOS',
'Windows Phone',
'iPad',
'iPod'
]
const Agents = navigator.userAgent,
mobileAgents = [
'Android',
'iPhone',
'SymbianOS',
'Windows Phone',
'iPad',
'iPod'
]
for (let agents of mobileAgents) {
while (Agents.includes(agents)) {
return true
Expand Down Expand Up @@ -194,22 +192,24 @@ function Scroll () {
*
*
*/
/* eslint-disable */
const start = new Date(
$('#live-time')
.text()
.trim() || '2017/11/02 11:31:29'
)
function liveTime () {
const live = Math.floor(new Date().getTime() - start.getTime())
const m = 24 * 60 * 60 * 1000

let liveDay = live / m
let mliveDay = Math.floor(liveDay)
let liveHour = (liveDay - mliveDay) * 24
let mliveHour = Math.floor(liveHour)
let liveMin = (liveHour - mliveHour) * 60
let mliveMin = Math.floor((liveHour - mliveHour) * 60)
let liveSec = Math.floor((liveMin - mliveMin) * 60)
/* eslint-disable */
function liveTime() {
const live = Math.floor(new Date().getTime() - start.getTime()),
m = 24 * 60 * 60 * 1000

let liveDay = live / m,
mliveDay = Math.floor(liveDay),
liveHour = (liveDay - mliveDay) * 24,
mliveHour = Math.floor(liveHour),
liveMin = (liveHour - mliveHour) * 60,
mliveMin = Math.floor((liveHour - mliveHour) * 60),
liveSec = Math.floor((liveMin - mliveMin) * 60)

$('#live-time').text(
"(●'◡'●) 被续 " +
Expand Down

0 comments on commit 07f705e

Please sign in to comment.