|
| 1 | +// ==UserScript== |
| 2 | +// @id Marktplaats_Exchanger@https://github.com/jerone/UserScripts |
| 3 | +// @name Marktplaats Exchanger |
| 4 | +// @namespace https://github.com/jerone/UserScripts |
| 5 | +// @description Exchange Marktplaats.nl |
| 6 | +// @author jerone |
| 7 | +// @copyright 2015+, jerone (http://jeroenvanwarmerdam.nl) |
| 8 | +// @license GNU GPLv3 |
| 9 | +// @homepage https://github.com/jerone/UserScripts/tree/master/Marktplaats_Exchanger#readme |
| 10 | +// @homepageURL https://github.com/jerone/UserScripts/tree/master/Marktplaats_Exchanger#readme |
| 11 | +// @downloadURL https://github.com/jerone/UserScripts/raw/master/Marktplaats_Exchanger/Marktplaats_Exchanger.user.js |
| 12 | +// @updateURL https://github.com/jerone/UserScripts/raw/master/Marktplaats_Exchanger/Marktplaats_Exchanger.user.js |
| 13 | +// @supportURL https://github.com/jerone/UserScripts/issues |
| 14 | +// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW |
| 15 | +// @version 1.0.0 |
| 16 | +// @grant none |
| 17 | +// @run-at document-end |
| 18 | +// @include https://www.marktplaats.* |
| 19 | +// ==/UserScript== |
| 20 | + |
| 21 | +(function Marktplaats_Exchanger() { |
| 22 | +var selectAll = document.getElementById("select-all-container"); |
| 23 | +if (!selectAll) { |
| 24 | +return; |
| 25 | +} |
| 26 | + |
| 27 | +var button = document.createElement("div"); |
| 28 | +button.setAttribute("title", "Selecteer alle verkochte advertenties"); |
| 29 | +button.style.background = "transparent linear-gradient(to bottom, #FEFEFE 0%, #D9D9D9 100%) repeat scroll 0% 0%"; |
| 30 | +button.style.border = "1px solid #A1A1A1"; |
| 31 | +button.style.cssFloat = "left"; |
| 32 | +button.style.cursor = "default"; |
| 33 | +button.style.height = "30px"; |
| 34 | +button.style.marginRight = "5px"; |
| 35 | +button.style.padding = "0 8px"; |
| 36 | +selectAll.parentNode.insertBefore(button, selectAll.nextSibling); |
| 37 | + |
| 38 | +var selectInput = document.createElement("input"); |
| 39 | +selectInput.setAttribute("type", "checkbox"); |
| 40 | +selectInput.addEventListener("change", function selectInputChange() { |
| 41 | +var checked = selectInput.checked; |
| 42 | +Array.prototype.forEach.call(document.querySelectorAll(".ad-listing"), function(row) { |
| 43 | +var isRemoved = row.classList.contains("removed"); |
| 44 | +var checkbox = row.querySelector("input.kopen-select"); |
| 45 | +if (checkbox.checked !== (checked && isRemoved)) { |
| 46 | +checkbox.click(); |
| 47 | +} |
| 48 | +}); |
| 49 | +}); |
| 50 | +button.appendChild(selectInput); |
| 51 | + |
| 52 | +button.appendChild(document.createTextNode(" Verkocht")); |
| 53 | +})(); |
0 commit comments