Craigslist Better Styles

Moves the 'hide' button to standard location for faster hiding of items

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Craigslist Better Styles
// @namespace    craigslist_better_styles
// @description  Moves the 'hide' button to standard location for faster hiding of items
// @homepageURL  https://github.com/daraeman/craigslist_better_styles
// @author       daraeman
// @version      1.2
// @date         2019-03-17
// @include      https://*.craigslist.org/*
// ==/UserScript==

const script_id = "craigslist_better_styles";
const styles = {
	search: "."+ script_id +" .banish { float: left; margin-right: 5px; margin-top: 3px; }",
};

function createStyles( styles ) {
	let style_el = document.createElement( "style" );
	style_el.textContent = styles;
	style_el.className = script_id;
	document.head.appendChild( style_el );
}

function getPage() {
	return ( /search/.test( document.body.className ) ) ? "search" : false;
}

function doSearchPage() {
	document.body.className = document.body.className + " " + script_id;
	createStyles( styles.search );
}

function init() {
	let page = getPage();
	if ( page === "search" ) {
		doSearchPage();
	}
}

init();