Skip to content

Instantly share code, notes, and snippets.

@iGlitch
Last active April 7, 2024 20:53
Show Gist options
  • Save iGlitch/81b20f0aa5c749de51f2331652d10456 to your computer and use it in GitHub Desktop.
Save iGlitch/81b20f0aa5c749de51f2331652d10456 to your computer and use it in GitHub Desktop.
with.is (ウィズ) ユーザースクリプト コレクション
// ==UserScript==
// @name With.is - Auto Refresh
// @namespace http://with.is/
// @version v0.1
// @description 検索ページを5分ごとに自動リフレッシュして、オンライン状態を保持しましょう。
// @author Glitch
// @match https://with.is/search*
// @icon https://www.google.com/s2/favicons?sz=64&domain=with.is
// @grant none
// ==/UserScript==
(function() {
'use strict';
setTimeout(function(){ location.href = "https://with.is/search"; }, 300*1000);
})();
// ==UserScript==
// @name With.is - Close User Page Tab after (random) few seconds
// @namespace https://with.is
// @version v0.1
// @description 自動で開いたプロフィールを自動に閉じる、「足あと」を残すため。
// @author You
// @match https://with.is/users/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=with.is
// @grant none
// ==/UserScript==
(function() {
'use strict';
function getRandomDelay(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function shouldCloseWindow() {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.has('route_code');
}
if (shouldCloseWindow()) {
setTimeout(function() {
window.close();
}, getRandomDelay(10000, 20000));
}
})();
// ==UserScript==
// @name With.is - Append URL Param to Search Results
// @namespace https://with.is
// @version v0.1
// @description 検索結果のURLに足あとのパラメータを追加する
// @author Glitch
// @match https://with.is/search
// @icon https://www.google.com/s2/favicons?sz=64&domain=with.is
// @grant none
// ==/UserScript==
(function() {
'use strict';
function cleanAndAppendData(url, dataKey, dataValue) {
let newUrl = new URL(url);
newUrl.search = '';
newUrl.searchParams.append(dataKey, dataValue);
return newUrl.toString();
}
var links = document.querySelectorAll('a');
links.forEach(function(link) {
if (link.href.includes('/users/')) {
link.href = cleanAndAppendData(link.href, 'route_code', 'footprint');
}
});
})();
// ==UserScript==
// @name With.is - Open user URLs in New Tabs
// @namespace https://with.is
// @version v0.1
// @description 検索結果を3回スクロールダウンして、全てのユーザーのURLを開く(auto-refresh.jsと一緒に使うとよい)。
// @author You
// @match https://with.is/search*
// @icon https://www.google.com/s2/favicons?sz=64&domain=with.is
// @grant none
// ==/UserScript==
(function() {
'use strict';
function scrollToBottom(times, callback) {
if (times > 0) {
window.scrollBy(0, document.body.scrollHeight);
setTimeout(() => {
scrollToBottom(times - 1, callback);
}, 2000);
} else {
callback();
}
}
function openLinks() {
const specificString = "users/";
document.querySelectorAll('a').forEach(link => {
if (link.href.includes(specificString)) {
window.open(link.href, '_blank');
}
});
}
setTimeout(() => {
scrollToBottom(3, openLinks);
}, 1500);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment