Swap two divs inside a parent
اعتبارا من
// ==UserScript==
// @name Show Deleted Answers at head for StackExchange
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Swap two divs inside a parent
// @author aspen138
// @match https://*.stackexchange.com/users/*/*?tab=answers&sort=newest
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
// Your code here...
window.addEventListener('load', function() {
let parentDiv = document.querySelector('.ba.bc-black-100.bar-md');
let firstDiv = document.querySelector('#js-post-summaries');
let secondDiv = document.querySelector('.bt.bc-black-075.p16');
if (parentDiv && firstDiv && secondDiv) {
parentDiv.removeChild(firstDiv);
parentDiv.removeChild(secondDiv);
parentDiv.appendChild(secondDiv);
parentDiv.appendChild(firstDiv);
}
}, false);
})();