Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
eai04191 committed May 25, 2021
1 parent 4a1a35a commit deadea1
Show file tree
Hide file tree
Showing 30 changed files with 93 additions and 93 deletions.
4 changes: 2 additions & 2 deletions userscript/bookmeter.hontoSearch.user.js
Expand Up @@ -10,7 +10,7 @@
// @grant none
// ==/UserScript==

(function() {
(function () {
"use strict";

function addHonto() {
Expand Down Expand Up @@ -58,7 +58,7 @@
childList: true,
subtree: true,
};
const observer = new MutationObserver(function() {
const observer = new MutationObserver(function () {
observer.disconnect();
addHonto();
observer.observe(document.body, config);
Expand Down
2 changes: 1 addition & 1 deletion userscript/creativemarket.freeItemsAutoBuy.user.js
Expand Up @@ -9,7 +9,7 @@
// @run-at document-idle
// ==/UserScript==

(function() {
(function () {
"use strict";

const isLoggedin = !document.querySelector("#user-menus a[href='/sign-in']");
Expand Down
8 changes: 4 additions & 4 deletions userscript/discord.image.user.js
Expand Up @@ -8,14 +8,14 @@
// @grant none
// ==/UserScript==

(function() {
(function () {
"use strict";
window.addEventListener(
"load",
function() {
function () {
class discordImagemate {
constructor() {
this.mutationObserver = new MutationObserver(mutations =>
this.mutationObserver = new MutationObserver((mutations) =>
this.onUpdate(mutations)
);
}
Expand All @@ -34,7 +34,7 @@
"a[class*='imageWrapper-'][href$='.png'], a[class*='imageWrapper-'][href$='.jpg']"
);
if (imageNodelist != 0) {
imageNodelist.forEach(a => {
imageNodelist.forEach((a) => {
if (!a.classList.contains("imageMate-processed")) {
console.log(a);
a.classList.add("imageMate-processed");
Expand Down
2 changes: 1 addition & 1 deletion userscript/fanbox.countTotalsupport.user.js
Expand Up @@ -15,7 +15,7 @@ GM_registerMenuCommand("合計額を計算する", () => {
" クリエイター\n" +
"合計 ¥" +
[...document.querySelectorAll("span")]
.filter(span => span.innerText.startsWith("¥"))
.filter((span) => span.innerText.startsWith("¥"))
.reduce((a, x) => (a += parseInt(x.innerText.replace("¥", ""))), 0) +
"/月"
);
Expand Down
19 changes: 8 additions & 11 deletions userscript/fantia.archiveDownloader.user.js
Expand Up @@ -15,7 +15,7 @@
/*global GM_download*/
/*global JSZip*/

(function() {
(function () {
"use strict";

const archviedFlag = "archived";
Expand Down Expand Up @@ -75,10 +75,7 @@
? post.querySelector(".post-content-title").innerText
: el.closest(".post-content-body").previousElementSibling.innerText;
const postId = isBacknumberPage()
? el
.closest(".post-content")
.querySelector("a")
.href.match(/(\d+)/)[0]
? el.closest(".post-content").querySelector("a").href.match(/(\d+)/)[0]
: document
.querySelector('link[rel="canonical"]')
.href.match(/https:\/\/fantia\.jp\/posts\/(?<postId>\d+)/u).groups.postId;
Expand All @@ -92,7 +89,7 @@
const gallery = post.querySelector(".type-photo-gallery");
const thambnails = gallery.querySelectorAll(".image-module img");
const imageIds = [...thambnails].map(
img =>
(img) =>
img.src.match(
/https:\/\/cc\.fantia\.jp\/uploads\/post_content_photo\/file\/(?<imageId>\d+)\//
).groups.imageId
Expand All @@ -110,7 +107,7 @@
const zip = new JSZip();

// 詰める
files.forEach(file => {
files.forEach((file) => {
const { filename, blob } = file;
zip.file(filename, blob, { binary: true });
console.log(`${filename} added to zip.`);
Expand Down Expand Up @@ -146,10 +143,10 @@
// htmlを取得・パースしてフル画像のURLを取得する
function getFullImageUrls(postId, imageIds) {
const fullPageUrls = imageIds.map(
imageId => `https://fantia.jp/posts/${postId}/post_content_photo/${imageId}`
(imageId) => `https://fantia.jp/posts/${postId}/post_content_photo/${imageId}`
);
return Promise.all(
fullPageUrls.map(async url => {
fullPageUrls.map(async (url) => {
const response = await GM_fetch(url);
const html = await response.text();
const doc = document.createRange().createContextualFragment(html);
Expand All @@ -163,13 +160,13 @@
// 返り値はblobのarray
function getBlobs(urls) {
return Promise.all(
urls.map(url => {
urls.map((url) => {
return new Promise((resolve, reject) => {
GM_xmlhttpRequest({
url: url,
method: "GET",
responseType: "blob",
onload: response => {
onload: (response) => {
console.log("GM_xmlhttpRequest", response);
if (response.status === 200) {
resolve(response.response);
Expand Down
4 changes: 2 additions & 2 deletions userscript/github.relativeTime.user.js
Expand Up @@ -8,13 +8,13 @@
// @grant none
// ==/UserScript==

(function() {
(function () {
"use strict";

window.addEventListener("DOMNodeInserted", replaceRelativeTime, false);

function replaceRelativeTime() {
document.querySelectorAll("relative-time").forEach(function(element) {
document.querySelectorAll("relative-time").forEach(function (element) {
element.innerText = element.title
.replace("JST", "")
.replace("日", "")
Expand Down
4 changes: 2 additions & 2 deletions userscript/gumroad.permalinkInLibrary.user.js
Expand Up @@ -6,9 +6,9 @@
// @match https://gumroad.com/library*
// ==/UserScript==

(function() {
(function () {
"use strict";
document.querySelectorAll(".product-main").forEach(product => {
document.querySelectorAll(".product-main").forEach((product) => {
const permalink = product
.querySelector(".preview-container")
.getAttribute("data-product-permalink");
Expand Down
2 changes: 1 addition & 1 deletion userscript/hatena.hatenaKeywordRemover.user.js
Expand Up @@ -17,6 +17,6 @@ document
.querySelectorAll(
".keyword[href^='/keyword'], .keyword[href^='http://d.hatena.ne.jp/keyword'], .keyword[href^='https://d.hatena.ne.jp/keyword']"
)
.forEach(link => {
.forEach((link) => {
link.replaceWith(document.createTextNode(link.innerText));
});
10 changes: 4 additions & 6 deletions userscript/lib/player.js
Expand Up @@ -5,23 +5,21 @@

window.player = {};

player.play = function(
player.play = function (
source,
{ volume = 0.5, controls = false, removePlayerAfterPlayed = true },
insertNode = document.body,
referenceNode = null
) {
return new Promise(resolve => {
return new Promise((resolve) => {
const player = document.createElement("audio");
player.addEventListener("ended", () => {
if (removePlayerAfterPlayed) {
this.remove(player.id);
}
resolve(player);
});
player.id = Math.random()
.toString(32)
.substring(2);
player.id = Math.random().toString(32).substring(2);
player.src = source;
player.autoplay = true;
player.controls = controls;
Expand All @@ -30,6 +28,6 @@ player.play = function(
});
};

player.remove = function(id) {
player.remove = function (id) {
document.getElementById(id).remove();
};
6 changes: 4 additions & 2 deletions userscript/mastodon.bigben.user.js
Expand Up @@ -15,10 +15,12 @@

window.addEventListener(
"load",
function() {
function () {
class BigBen {
constructor() {
this.mutationObserver = new MutationObserver(mutations => this.onUpdate(mutations));
this.mutationObserver = new MutationObserver((mutations) =>
this.onUpdate(mutations)
);
}

start() {
Expand Down
2 changes: 1 addition & 1 deletion userscript/mastodon.donsogigi.user.js
Expand Up @@ -8,7 +8,7 @@

window.addEventListener(
"load",
function() {
function () {
addSogigiButton();
document.getElementById("sogigi").onclick = eventHandlerSogigi;

Expand Down
2 changes: 1 addition & 1 deletion userscript/mastodon.nbsp.user.js
Expand Up @@ -8,7 +8,7 @@

window.addEventListener(
"load",
function() {
function () {
addNBSPButton();
document.getElementById("nbspConvert").onclick = eventHandlerNBSP;

Expand Down
8 changes: 5 additions & 3 deletions userscript/mastodon.ussr.user.js
Expand Up @@ -16,10 +16,12 @@

window.addEventListener(
"load",
function() {
function () {
class USSR {
constructor() {
this.mutationObserver = new MutationObserver(mutations => this.onUpdate(mutations));
this.mutationObserver = new MutationObserver((mutations) =>
this.onUpdate(mutations)
);
}

start() {
Expand All @@ -44,7 +46,7 @@ window.addEventListener(
if (node.textContent.includes(lyric) || node.textContent.includes("☭")) {
this.play();
} else {
node.querySelectorAll(".status__content img.emojione").forEach(emoji => {
node.querySelectorAll(".status__content img.emojione").forEach((emoji) => {
if (emoji.alt === lyric) {
this.play();
}
Expand Down
8 changes: 5 additions & 3 deletions userscript/mastodon.xfiles.user.js
Expand Up @@ -15,10 +15,12 @@

window.addEventListener(
"load",
function() {
function () {
class Xfiles {
constructor() {
this.mutationObserver = new MutationObserver(mutations => this.onUpdate(mutations));
this.mutationObserver = new MutationObserver((mutations) =>
this.onUpdate(mutations)
);
}

start() {
Expand All @@ -40,7 +42,7 @@ window.addEventListener(
var text = node.textContent;

// 全角英数変換
text = text.replace(/[A-Za-z0-9]/g, function(s) {
text = text.replace(/[A-Za-z0-9]/g, function (s) {
return String.fromCharCode(s.charCodeAt(0) - 65248);
});

Expand Down
14 changes: 7 additions & 7 deletions userscript/mouneyou.mastodon.user.js
Expand Up @@ -12,7 +12,7 @@
/*global axios*/
/*global GM_getValue*/

(function() {
(function () {
"use strict";

const mastodon = {
Expand All @@ -39,13 +39,13 @@
function share() {
changeShareButtonStyle("progress");
uploadImage(getShareStatus().imageUrl)
.then(data => {
.then((data) => {
postWithImage(getShareStatus().text, data.id);
})
.then(() => {
changeShareButtonStyle("success");
})
.catch(error => {
.catch((error) => {
console.error(error);
changeShareButtonStyle("error");
});
Expand Down Expand Up @@ -75,19 +75,19 @@
responseType: "blob",
dataType: "binary",
})
.then(response => {
.then((response) => {
const blob = new Blob([response.data], { type: "image/png" });
const formData = new FormData();
formData.append("file", blob, "image.png");
return formData;
})
.then(formData => {
.then((formData) => {
return mastodonClient.post("/media", formData);
})
.then(response => {
.then((response) => {
return response.data;
})
.catch(error => {
.catch((error) => {
console.error(error);
});
}
Expand Down
2 changes: 1 addition & 1 deletion userscript/notestock.AutoLogin.user.js
Expand Up @@ -13,7 +13,7 @@
/*global GM_getValue*/
/*global grecaptcha*/

(function() {
(function () {
"use strict";
const mastodonClient = axios.create({
baseURL: `https://${GM_getValue("host")}/api/v1/`,
Expand Down
2 changes: 1 addition & 1 deletion userscript/notestock.loginCodeButton.user.js
Expand Up @@ -8,7 +8,7 @@
// @grant none
// ==/UserScript==

(function() {
(function () {
"use strict";

const login_code = document.getElementById("code").value;
Expand Down
12 changes: 6 additions & 6 deletions userscript/picrew.mastodonIntegration.user.js
Expand Up @@ -9,7 +9,7 @@
// ==/UserScript==
/*global axios*/

(function() {
(function () {
"use strict";

const mastodon = {
Expand Down Expand Up @@ -45,7 +45,7 @@
}

function share() {
uploadImage(getShareStatus().imageUrl).then(data => {
uploadImage(getShareStatus().imageUrl).then((data) => {
postWithImage(getShareStatus().text, data.id);
});
}
Expand All @@ -70,19 +70,19 @@
responseType: "blob",
dataType: "binary",
})
.then(function(response) {
.then(function (response) {
const blob = new Blob([response.data], { type: "image/png" });
const formData = new FormData();
formData.append("file", blob, "image.png");
return formData;
})
.then(function(formData) {
.then(function (formData) {
return mastodonClient.post("/media", formData);
})
.then(function(response) {
.then(function (response) {
return response.data;
})
.catch(function(error) {
.catch(function (error) {
console.error(error);
});
}
Expand Down

0 comments on commit deadea1

Please sign in to comment.