Marktplaats Exchanger

Exchange Marktplaats.nl

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name             Marktplaats Exchanger
// @id               Marktplaats_Exchanger@https://github.com/jerone/UserScripts
// @namespace        https://github.com/jerone/UserScripts
// @description      Exchange Marktplaats.nl
// @author           jerone
// @copyright        2015+, jerone (https://github.com/jerone)
// @license          CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode
// @license          GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt
// @homepage         https://github.com/jerone/UserScripts/tree/master/Marktplaats_Exchanger#readme
// @homepageURL      https://github.com/jerone/UserScripts/tree/master/Marktplaats_Exchanger#readme
// @supportURL       https://github.com/jerone/UserScripts/issues
// @contributionURL  https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW
// @version          1.0.1
// @grant            none
// @run-at           document-end
// @include          https://www.marktplaats.*
// ==/UserScript==

// cSpell:ignore Roboto

(function Marktplaats_Exchanger() {
	var selectAll = document.getElementById("select-all-container");
	if (!selectAll) {
		return;
	}

	var button = document.createElement("div");
	button.setAttribute("title", "Selecteer alle verkochte advertenties");
	button.style.background = "#F7F7F6";
	button.style.border = "1px solid #A1A1A1";
	button.style.cssFloat = "left";
	button.style.cursor = "default";
	button.style.height = "30px";
	button.style.marginRight = "5px";
	button.style.padding = "0 8px";
	button.style.fontFamily = "Roboto";
	selectAll.parentNode.insertBefore(button, selectAll.nextSibling);

	var selectInput = document.createElement("input");
	selectInput.setAttribute("type", "checkbox");
	selectInput.addEventListener("change", function selectInputChange() {
		var checked = selectInput.checked;
		Array.prototype.forEach.call(
			document.querySelectorAll(".ad-listing"),
			function (row) {
				var isRemoved = row.classList.contains("removed");
				var checkbox = row.querySelector("input.kopen-select");
				if (checkbox.checked !== (checked && isRemoved)) {
					checkbox.click();
				}
			},
		);
	});
	button.appendChild(selectInput);

	button.appendChild(document.createTextNode(" Verkocht"));
})();