var to const

This commit is contained in:
Lalle 2023-04-28 00:30:44 +02:00
parent 80167e23f4
commit b25d2023ca
No known key found for this signature in database
GPG Key ID: A6583D207A8F6B0D
6 changed files with 283 additions and 287 deletions

View File

@ -5,12 +5,7 @@ import $$ from "../platform/$$"
import Header from "./Header"
/*
* decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from
* DS102: Remove unnecessary code created because of implicit returns
* DS206: Consider reworking classes to avoid initClass
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
Very sensitive, changing var to const
*/
const dialog = function (id, properties) {
const el = $.el('div', {
@ -30,7 +25,7 @@ const dialog = function(id, properties) {
return el
}
//eslint-disable-next-line
var Menu = (function () {
let currentMenu = undefined
let lastToggledButton = undefined
@ -284,7 +279,7 @@ var Menu = (function() {
return Menu
})()
export var dragstart = function (e) {
export const dragstart = function (e) {
let isTouching
if ((e.type === 'mousedown') && (e.button !== 0)) { return } // not LMB
// prevent text selection
@ -330,7 +325,7 @@ export var dragstart = function (e) {
}
}
export var touchmove = function (e) {
export const touchmove = function (e) {
for (const touch of e.changedTouches) {
if (touch.identifier === this.identifier) {
drag.call(this, touch)
@ -339,7 +334,7 @@ export var touchmove = function (e) {
}
}
export var drag = function (e) {
export const drag = function (e) {
const { clientX, clientY } = e
let left = clientX - this.dx
@ -375,7 +370,7 @@ export var drag = function (e) {
return style.bottom = bottom
}
export var touchend = function (e) {
export const touchend = function (e) {
for (const touch of e.changedTouches) {
if (touch.identifier === this.identifier) {
dragend.call(this)
@ -384,7 +379,7 @@ export var touchend = function (e) {
}
}
export var dragend = function () {
export const dragend = function () {
if (this.isTouching) {
$.off(d, 'touchmove', this.move)
$.off(d, 'touchend touchcancel', this.up)
@ -434,7 +429,7 @@ const hoverstart = function ({ root, el, latestEvent, endEvents, height, width,
hoverstart.padding = 25
export var hover = function (e) {
export const hover = function (e) {
this.latestEvent = e
const height = (this.height || this.el.offsetHeight) + hoverstart.padding
const width = (this.width || this.el.offsetWidth)
@ -458,7 +453,7 @@ export var hover = function (e) {
return style.right = right
}
export var hoverend = function (e) {
export const hoverend = function (e) {
if (((e.type === 'keydown') && (e.keyCode !== 13)) || (e.target.nodeName === "TEXTAREA")) { return }
if (!this.noRemove) { $.rm(this.el) }
$.off(this.root, this.endEvents, this.hoverend)

View File

@ -25,7 +25,7 @@ import QuickReplyPage from './QR/QuickReply.html'
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
var QR = {
const QR = {
mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/vnd.adobe.flash.movie', 'application/x-shockwave-flash', 'video/webm'],
validExtension: /\.(jpe?g|png|gif|pdf|swf|webm)$/i,
@ -321,7 +321,8 @@ var QR = {
connectionError() {
return $.el('span',
{ innerHTML:
{
innerHTML:
'Connection error while posting. ' +
'[<a href="' + meta.faq + '#connection-errors" target="_blank">More info</a>]'
}

View File

@ -16,7 +16,7 @@ import { dict } from "../platform/helpers"
<3 aeosynth
*/
var QuoteThreading = {
const QuoteThreading = {
init() {
if (!Conf['Quote Threading'] || (g.VIEW !== 'thread')) { return }

View File

@ -15,7 +15,7 @@ import PostRedirect from "../Posting/PostRedirect"
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
var QuoteYou = {
const QuoteYou = {
init() {
if (!Conf['Remember Your Posts']) { return }

View File

@ -12,7 +12,7 @@ import $$ from "../platform/$$"
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
var Quotify = {
const Quotify = {
init() {
if (!['index', 'thread'].includes(g.VIEW) || !Conf['Resurrect Quotes']) { return }

View File

@ -111,12 +111,12 @@ const Main = {
if (platform === 'crx') { w = (w.wrappedJSObject || w) }
if (`${meta.name} antidup` in w) { return }
w[`${meta.name} antidup`] = true
} catch (error) { }
} catch (error) { /* empty */ }
// Don't run inside ad iframes.
try {
if (window.frameElement && ['', 'about:blank'].includes(window.frameElement.src)) { return }
} catch (error1) { }
} catch (error1) { /* empty */ }
// Detect multiple copies of 4chan X
if (doc && $.hasClass(doc, 'fourchan-x')) { return }