mirror of
https://github.com/LalleSX/4chan-XZ.git
synced 2026-01-30 09:48:12 +01:00
var to const
This commit is contained in:
parent
80167e23f4
commit
b25d2023ca
@ -5,12 +5,7 @@ import $$ from "../platform/$$"
|
|||||||
import Header from "./Header"
|
import Header from "./Header"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
Very sensitive, changing var to const
|
||||||
* 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
|
|
||||||
*/
|
*/
|
||||||
const dialog = function (id, properties) {
|
const dialog = function (id, properties) {
|
||||||
const el = $.el('div', {
|
const el = $.el('div', {
|
||||||
@ -30,7 +25,7 @@ const dialog = function(id, properties) {
|
|||||||
|
|
||||||
return el
|
return el
|
||||||
}
|
}
|
||||||
|
//eslint-disable-next-line
|
||||||
var Menu = (function () {
|
var Menu = (function () {
|
||||||
let currentMenu = undefined
|
let currentMenu = undefined
|
||||||
let lastToggledButton = undefined
|
let lastToggledButton = undefined
|
||||||
@ -284,7 +279,7 @@ var Menu = (function() {
|
|||||||
return Menu
|
return Menu
|
||||||
})()
|
})()
|
||||||
|
|
||||||
export var dragstart = function (e) {
|
export const dragstart = function (e) {
|
||||||
let isTouching
|
let isTouching
|
||||||
if ((e.type === 'mousedown') && (e.button !== 0)) { return } // not LMB
|
if ((e.type === 'mousedown') && (e.button !== 0)) { return } // not LMB
|
||||||
// prevent text selection
|
// 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) {
|
for (const touch of e.changedTouches) {
|
||||||
if (touch.identifier === this.identifier) {
|
if (touch.identifier === this.identifier) {
|
||||||
drag.call(this, touch)
|
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
|
const { clientX, clientY } = e
|
||||||
|
|
||||||
let left = clientX - this.dx
|
let left = clientX - this.dx
|
||||||
@ -375,7 +370,7 @@ export var drag = function (e) {
|
|||||||
return style.bottom = bottom
|
return style.bottom = bottom
|
||||||
}
|
}
|
||||||
|
|
||||||
export var touchend = function (e) {
|
export const touchend = function (e) {
|
||||||
for (const touch of e.changedTouches) {
|
for (const touch of e.changedTouches) {
|
||||||
if (touch.identifier === this.identifier) {
|
if (touch.identifier === this.identifier) {
|
||||||
dragend.call(this)
|
dragend.call(this)
|
||||||
@ -384,7 +379,7 @@ export var touchend = function (e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export var dragend = function () {
|
export const dragend = function () {
|
||||||
if (this.isTouching) {
|
if (this.isTouching) {
|
||||||
$.off(d, 'touchmove', this.move)
|
$.off(d, 'touchmove', this.move)
|
||||||
$.off(d, 'touchend touchcancel', this.up)
|
$.off(d, 'touchend touchcancel', this.up)
|
||||||
@ -434,7 +429,7 @@ const hoverstart = function ({ root, el, latestEvent, endEvents, height, width,
|
|||||||
|
|
||||||
hoverstart.padding = 25
|
hoverstart.padding = 25
|
||||||
|
|
||||||
export var hover = function (e) {
|
export const hover = function (e) {
|
||||||
this.latestEvent = e
|
this.latestEvent = e
|
||||||
const height = (this.height || this.el.offsetHeight) + hoverstart.padding
|
const height = (this.height || this.el.offsetHeight) + hoverstart.padding
|
||||||
const width = (this.width || this.el.offsetWidth)
|
const width = (this.width || this.el.offsetWidth)
|
||||||
@ -458,7 +453,7 @@ export var hover = function (e) {
|
|||||||
return style.right = right
|
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 (((e.type === 'keydown') && (e.keyCode !== 13)) || (e.target.nodeName === "TEXTAREA")) { return }
|
||||||
if (!this.noRemove) { $.rm(this.el) }
|
if (!this.noRemove) { $.rm(this.el) }
|
||||||
$.off(this.root, this.endEvents, this.hoverend)
|
$.off(this.root, this.endEvents, this.hoverend)
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import QuickReplyPage from './QR/QuickReply.html'
|
|||||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
|
* 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'],
|
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,
|
validExtension: /\.(jpe?g|png|gif|pdf|swf|webm)$/i,
|
||||||
@ -321,7 +321,8 @@ var QR = {
|
|||||||
|
|
||||||
connectionError() {
|
connectionError() {
|
||||||
return $.el('span',
|
return $.el('span',
|
||||||
{ innerHTML:
|
{
|
||||||
|
innerHTML:
|
||||||
'Connection error while posting. ' +
|
'Connection error while posting. ' +
|
||||||
'[<a href="' + meta.faq + '#connection-errors" target="_blank">More info</a>]'
|
'[<a href="' + meta.faq + '#connection-errors" target="_blank">More info</a>]'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,7 @@ import { dict } from "../platform/helpers"
|
|||||||
<3 aeosynth
|
<3 aeosynth
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var QuoteThreading = {
|
const QuoteThreading = {
|
||||||
init() {
|
init() {
|
||||||
if (!Conf['Quote Threading'] || (g.VIEW !== 'thread')) { return }
|
if (!Conf['Quote Threading'] || (g.VIEW !== 'thread')) { return }
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import PostRedirect from "../Posting/PostRedirect"
|
|||||||
* DS102: Remove unnecessary code created because of implicit returns
|
* DS102: Remove unnecessary code created because of implicit returns
|
||||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
|
||||||
*/
|
*/
|
||||||
var QuoteYou = {
|
const QuoteYou = {
|
||||||
init() {
|
init() {
|
||||||
if (!Conf['Remember Your Posts']) { return }
|
if (!Conf['Remember Your Posts']) { return }
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import $$ from "../platform/$$"
|
|||||||
* DS102: Remove unnecessary code created because of implicit returns
|
* DS102: Remove unnecessary code created because of implicit returns
|
||||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
|
||||||
*/
|
*/
|
||||||
var Quotify = {
|
const Quotify = {
|
||||||
init() {
|
init() {
|
||||||
if (!['index', 'thread'].includes(g.VIEW) || !Conf['Resurrect Quotes']) { return }
|
if (!['index', 'thread'].includes(g.VIEW) || !Conf['Resurrect Quotes']) { return }
|
||||||
|
|
||||||
|
|||||||
@ -111,12 +111,12 @@ const Main = {
|
|||||||
if (platform === 'crx') { w = (w.wrappedJSObject || w) }
|
if (platform === 'crx') { w = (w.wrappedJSObject || w) }
|
||||||
if (`${meta.name} antidup` in w) { return }
|
if (`${meta.name} antidup` in w) { return }
|
||||||
w[`${meta.name} antidup`] = true
|
w[`${meta.name} antidup`] = true
|
||||||
} catch (error) { }
|
} catch (error) { /* empty */ }
|
||||||
|
|
||||||
// Don't run inside ad iframes.
|
// Don't run inside ad iframes.
|
||||||
try {
|
try {
|
||||||
if (window.frameElement && ['', 'about:blank'].includes(window.frameElement.src)) { return }
|
if (window.frameElement && ['', 'about:blank'].includes(window.frameElement.src)) { return }
|
||||||
} catch (error1) { }
|
} catch (error1) { /* empty */ }
|
||||||
|
|
||||||
// Detect multiple copies of 4chan X
|
// Detect multiple copies of 4chan X
|
||||||
if (doc && $.hasClass(doc, 'fourchan-x')) { return }
|
if (doc && $.hasClass(doc, 'fourchan-x')) { return }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user