├── t.17track.net.js ├── buyer.17track.net.js ├── monkeytype.com.js ├── ycombinator.com.js ├── muambator.com.br.js └── uscloser.com.js /t.17track.net.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | const urlParams = new URLSearchParams(window.location.href.split('#')[1]); 3 | const title = urlParams.get('title'); 4 | 5 | if (title) { 6 | const el = document.querySelector('p.text-capitalize[title]'); 7 | const newTitle = `${title}
${el.textContent}`; 8 | el.innerHTML = newTitle; 9 | } 10 | })(); 11 | -------------------------------------------------------------------------------- /buyer.17track.net.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | const action = (els) => { 3 | els.forEach(el => { 4 | const link = el.getAttribute('href'); 5 | const parent = el.parentNode.parentNode.parentNode.parentNode.parentNode; 6 | const target = parent.querySelectorAll('a[data-original-title]')[0]; 7 | const title = target.getAttribute('data-original-title'); 8 | el.setAttribute('href', link + '&title=' + title); 9 | }); 10 | }; 11 | 12 | const check = () => { 13 | const els = document.querySelectorAll('div[data-name] p[title] a'); 14 | if (els.length > 0) { 15 | action(els); 16 | } else { 17 | setTimeout(() => check(), 500); 18 | } 19 | }; 20 | 21 | check(); 22 | })(); 23 | -------------------------------------------------------------------------------- /monkeytype.com.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let wpmVisible = false; 3 | function checkForWpm() { 4 | const wpmEl = document.querySelectorAll('.wpm > [data-balloon-pos="up"]'); 5 | if (wpmVisible) { 6 | if (!wpmEl || !wpmEl[0] || wpmEl[0].offsetParent === null) { 7 | console.log('WPM went away'); 8 | wpmVisible = false; 9 | } 10 | } else { 11 | if (wpmEl && wpmEl[0] && wpmEl[0].offsetParent) { 12 | const wpm = wpmEl[0].textContent; 13 | if (wpm.indexOf('-') === -1) { 14 | console.log('wpm', wpm); 15 | wpmVisible = true; 16 | fetch(`https://clackbot.herokuapp.com/finishWpm?wpm=${wpm}`); 17 | } 18 | } 19 | } 20 | setTimeout(checkForWpm, 200); 21 | } 22 | 23 | console.log('checking for wpm...'); 24 | checkForWpm(); 25 | })(); 26 | -------------------------------------------------------------------------------- /ycombinator.com.js: -------------------------------------------------------------------------------- 1 | function _waitForElement(selector, delay = 10, tries = 100) { 2 | const element = document.querySelector(selector); 3 | 4 | 5 | if (!window[`__${selector}`]) { 6 | window[`__${selector}`] = 0; 7 | window[`__${selector}__delay`] = delay; 8 | window[`__${selector}__tries`] = tries; 9 | } 10 | 11 | function _search() { 12 | return new Promise((resolve) => { 13 | window[`__${selector}`]++; 14 | setTimeout(resolve, window[`__${selector}__delay`]); 15 | }); 16 | } 17 | 18 | if (element === null) { 19 | if (window[`__${selector}`] >= window[`__${selector}__tries`]) { 20 | window[`__${selector}`] = 0; 21 | return Promise.resolve(null); 22 | } 23 | 24 | return _search().then(() => _waitForElement(selector)); 25 | } else { 26 | return Promise.resolve(element); 27 | } 28 | } 29 | 30 | async function wait() { 31 | try { 32 | const el = await _waitForElement('.footer'); 33 | el.remove(); 34 | } catch (err) { 35 | console.error('Element not found'); 36 | } 37 | } 38 | 39 | (function () { 40 | wait().catch(console.error); 41 | })(); 42 | -------------------------------------------------------------------------------- /muambator.com.br.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | // hides ad 3 | const adbar = document.getElementsByClassName('HB-Bar')[0]; 4 | console.log('adbar', adbar); 5 | if (adbar) { 6 | adbar.style = 'display: none'; 7 | } 8 | 9 | const bannerPro = document.getElementById('banner-pro'); 10 | if (bannerPro) { 11 | bannerPro.style = 'display: none'; 12 | } 13 | 14 | const faq = document.getElementsByClassName('faq-section'); 15 | console.log('faq', faq, faq.length); 16 | if (faq.length) { 17 | faq[0].style = 'display: none'; 18 | } 19 | 20 | 21 | const logoEl = document.getElementsByTagName('img')[0]; 22 | const linkEl = logoEl.parentElement; 23 | linkEl.setAttribute('href', '/pacotes/pendentes/'); 24 | 25 | const el = document.getElementsByClassName('dropdown-toggle')[0]; 26 | const parentEl = el.parentElement; 27 | 28 | const ulEl = parentEl.getElementsByTagName('ul')[0]; 29 | console.log(parentEl) 30 | console.log(ulEl) 31 | 32 | const newEl = document.createElement('a'); 33 | newEl.setAttribute('class', 'menu-item'); 34 | newEl.setAttribute('href', '/pacotes/pendentes/'); 35 | newEl.setAttribute('title', 'Pendentes'); 36 | newEl.textContent = 'Pendentes'; 37 | 38 | parentEl.removeChild(ulEl); 39 | parentEl.removeChild(el); 40 | parentEl.appendChild(newEl); 41 | })(); 42 | -------------------------------------------------------------------------------- /uscloser.com.js: -------------------------------------------------------------------------------- 1 | function query(q) { 2 | const els = Array.prototype.slice.call(document.querySelectorAll(q)); 3 | return els.length && els[0]; 4 | } 5 | 6 | function get(control) { 7 | return query(`[formarrayname="${control}"]`); 8 | } 9 | 10 | function saveItem(id, desc, value) { 11 | const savedDataStr = localStorage.getItem('$savedData'); 12 | const savedData = (savedDataStr && JSON.parse(savedDataStr)) || []; 13 | 14 | const origItem = savedData.find(d => d.id === id); 15 | const idx = origItem && savedData.indexOf(origItem); 16 | const item = origItem || {}; 17 | item.id = id; 18 | item.desc = desc; 19 | item.value = value; 20 | 21 | if (idx) { 22 | savedData[idx] = item; 23 | } else { 24 | savedData.push(item); 25 | } 26 | 27 | console.log('savedData', savedData); 28 | 29 | localStorage.setItem('$savedData', JSON.stringify(savedData)); 30 | } 31 | 32 | function save() { 33 | const descs = document.getElementsByName('descricao[]'); 34 | 35 | const savedData = []; 36 | descs.forEach(el => { 37 | const id = el.id.split('-')[1]; 38 | const desc = el.value; 39 | const value = document.getElementById(`declaracao-${id}`).value; 40 | saveItem(id, desc, value); 41 | }); 42 | } 43 | 44 | function load() { 45 | const data = localStorage.getItem('$savedData'); 46 | if (!data) { 47 | return; 48 | } 49 | const rows = JSON.parse(data); 50 | rows.forEach(row => { 51 | const desc = document.getElementById(`descricao-${row.id}`); 52 | const value = document.getElementById(`declaracao-${row.id}`); 53 | if (desc) { 54 | desc.value = row.desc; 55 | } 56 | if (value) { 57 | value.value = row.value; 58 | } 59 | }); 60 | } 61 | 62 | function insertAfter(referenceNode, newNode) { 63 | referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); 64 | } 65 | 66 | function processEndereco() { 67 | query('#endereco-label-2 input').checked = true; 68 | document.getElementById('extra_7').checked = true; 69 | document.getElementById('extra_8').checked = true; 70 | } 71 | 72 | function sendString(el, str) { 73 | for (let i = 0; i < str.length; i++) { 74 | const key = str.charAt(i); 75 | const code = str.charCodeAt(i); 76 | const ev = new KeyboardEvent('keypress', { which: code, keyCode: code, key }) 77 | el.dispatchEvent(ev); 78 | } 79 | } 80 | 81 | function processDeclaracao() { 82 | console.log('processDeclaracao'); 83 | const els = Array.prototype.slice.call(document.querySelectorAll('[formarrayname="cartitems"] img')); 84 | console.log('els', els); 85 | if (!els.length) { 86 | return setTimeout(() => processDeclaracao(), 250); 87 | } 88 | els.forEach((el, idx) => { 89 | const data = localStorage.getItem('$savedData'); 90 | if (!data) { 91 | return; 92 | } 93 | const rows = JSON.parse(data); 94 | const row = rows.find(row => row.id === el.src); 95 | 96 | const descr = document.getElementById(`descricao-declarado-${idx}`); 97 | const valor = document.getElementById(`valor-declarado-${idx}`); 98 | const quant = document.getElementById(`qtde-declarado-${idx}`); 99 | 100 | console.log('row', row); 101 | console.log('familia', familia); 102 | 103 | if (row) { 104 | descr.value = row.desc; 105 | descr.dispatchEvent(new Event('input')); 106 | 107 | sendString(descr, row.desc); 108 | if (valor.value === 'U$ 0,00') { 109 | sendString(valor, row.value); 110 | } 111 | descr.dispatchEvent(new Event('blur')); 112 | valor.dispatchEvent(new Event('blur')); 113 | } 114 | 115 | console.log('quant', quant); 116 | quant.value = '0'; 117 | quant.dispatchEvent(new Event('input')); 118 | 119 | const familias = document.querySelectorAll('[formcontrolname=familia]'); 120 | familias.forEach(select => { 121 | console.log('select', select); 122 | select.selectedIndex = 11; 123 | select.value = 'JJH'; 124 | select.dispatchEvent(new Event('change')); 125 | // select.dispatchEvent(new Event('input')); 126 | select.dispatchEvent(new Event('blur')); 127 | }); 128 | }); 129 | } 130 | 131 | function processFrete() { 132 | function hide(id) { 133 | const el = document.getElementById(id); 134 | if (!el) return; 135 | 136 | const parent = el.parentElement.parentElement.parentElement; 137 | parent.style.display = 'none'; 138 | } 139 | 140 | hide('frete_2'); 141 | hide('frete_3'); 142 | } 143 | 144 | function oldProcessDeclaracao() { 145 | const els = document.getElementsByTagName('h5'); 146 | const el = Array.prototype.slice.call(els).find(el => el.textContent && el.textContent.indexOf('Declaração') > -1); 147 | 148 | const newElements = document.createElement('div'); 149 | newElements.innerHTML = ` 150 | 151 | 152 | 153 | 154 | `; 155 | 156 | insertAfter(el, newElements); 157 | document.getElementById('clear').onclick = () => { 158 | const els = document.querySelectorAll('.valor'); 159 | els.forEach(el => el.value = null); 160 | document.getElementsByTagName('form')[0].reset(); 161 | }; 162 | 163 | document.getElementById('random').onclick = () => { 164 | const els = document.querySelectorAll('.valor'); 165 | console.log('els', els); 166 | const maxValue = 5000 / els.length; 167 | console.log('maxValue', maxValue); 168 | els.forEach(el => { 169 | const random = Math.floor(Math.random() * maxValue) + 1; 170 | el.value = String(random / 100).replace('.', ','); 171 | }); 172 | return false; 173 | }; 174 | 175 | document.getElementById('save').onclick = () => { 176 | save(); 177 | return false; 178 | }; 179 | 180 | document.getElementById('load').onclick = () => { 181 | load(); 182 | return false; 183 | }; 184 | 185 | document.getElementsByTagName('form')[0].onsubmit = () => { 186 | console.log('saving'); 187 | save(); 188 | return true; 189 | }; 190 | 191 | load(); 192 | } 193 | 194 | function processEstoque() { 195 | const dataStr = localStorage.getItem('$savedData') || '[]'; 196 | const data = JSON.parse(dataStr); 197 | 198 | const els = Array.prototype.slice.call(document.querySelectorAll('[formarrayname="items"] > div .media-body')); 199 | els.forEach(el => { 200 | if (!el.id) { 201 | return; 202 | } 203 | const id = el.id.split('-')[2]; 204 | 205 | // const refEl = document.getElementById(`item-referencia-${id}`); 206 | // const ref = refEl.innerHTML.split('REF: ')[1]; 207 | const refEl = document.querySelectorAll(`#item-image-${id} > img`)[0]; 208 | const ref = refEl.src; 209 | console.log('ref', ref); 210 | 211 | const saved = data.find(d => d.id === ref); 212 | 213 | console.log('id', id); 214 | console.log('saved', saved); 215 | 216 | const divEl = document.getElementById(`item-qtdeenviar-${id}`); 217 | 218 | console.log('ref', ref); 219 | 220 | const descId = `inserted-${id}`; 221 | console.log('x', document.getElementById(descId)); 222 | const descEl = document.getElementById(descId) || document.createElement('div'); 223 | descEl.id = descId; 224 | const desc = (saved && saved.desc) || ''; 225 | const value = (saved && saved.value) || ''; 226 | 227 | console.log('desc', desc); 228 | console.log('value', value); 229 | 230 | descEl.innerHTML = ` 231 | 232 | 233 | `; 234 | const descInput = descEl.children[0]; 235 | const valueInput = descEl.children[1]; 236 | 237 | divEl.appendChild(descEl); 238 | 239 | descInput.onblur = (e) => { 240 | const desc = e.target.value; 241 | const value = valueInput.value; 242 | console.log('id', id); 243 | console.log('desc', desc); 244 | console.log('value', value); 245 | saveItem(ref, desc, value); 246 | }; 247 | valueInput.onblur = (e) => { 248 | const value = e.target.value; 249 | const desc = descInput.value; 250 | saveItem(ref, desc, value); 251 | }; 252 | }); 253 | 254 | const items = []; 255 | const totalEl = document.createElement('button'); 256 | const toAdd = document.querySelector('body > app-root > app-full-layout > div > div.main-panel > div > div > div > app-estoque > section > form > div:nth-child(2) > div'); 257 | if (!toAdd) { 258 | setTimeout(() => { processEstoque() }, 200); 259 | return; 260 | } 261 | totalEl.className = 'btn btn-info btn-raised ml-1'; 262 | totalEl.disabled = 'true'; 263 | totalEl.innerHTML = '0.00lbs $-'; 264 | toAdd.appendChild(totalEl); 265 | document.querySelectorAll('.btn-dropbox').forEach(el => { 266 | const parent = el.parentElement.parentElement; 267 | if (parent && parent.children && parent.classList.contains('media-body')) { 268 | const children = [...parent.children]; 269 | const item = children.reduce((hash, child) => { 270 | const { tagName, id } = child; 271 | if (child.tagName !== 'P') return hash; 272 | hash[id.split('-')[1]] = child.innerText.match(/(\d+),(\d+)lbs/) 273 | ? parseFloat( 274 | child.innerText 275 | .split(': ')[1] 276 | .replace(/(\d+),(\d+)lbs/g, '$1.$2') 277 | ) 278 | : child.innerText.split(': ')[1]; 279 | const qtdEl = parent.querySelector('input'); 280 | hash.qtdEl = qtdEl; 281 | hash.getQtd = () => parseInt(hash.estoqueitem, 10) - parseInt(qtdEl.value, 10); 282 | return hash; 283 | }, {}); 284 | el.addEventListener('click', event => { 285 | if (event.target !== el) return; 286 | const pos = items.find(el => el.referencia = item.referencia); 287 | if (pos > -1) return; 288 | items.push(item); 289 | const total = 0.7 + items.reduce((t, i) => t += (i.pesoitem * i.getQtd()), 0); 290 | const cost = (15 + Math.ceil(total) * 10).toFixed(2); 291 | totalEl.innerHTML = `${total.toFixed(2)}lbs $${cost}`; 292 | }); 293 | } 294 | }); 295 | } 296 | 297 | function killNotifications() { 298 | const style = document.createElement('style'); 299 | // style.type = 'text/css'; 300 | style.innerHTML = ` 301 | .snotify-warning { display: none !important; } 302 | `; 303 | document.getElementsByTagName('head')[0].appendChild(style); 304 | } 305 | 306 | function checkCss() { 307 | const el = document.getElementById('swal2-checkbox'); 308 | if (!el) { 309 | return; 310 | } 311 | console.log('element found!'); 312 | el.checked = true; 313 | const confirm = document.getElementsByClassName('swal2-confirm')[0] 314 | confirm.dispatchEvent(new Event('click')); 315 | } 316 | 317 | function detectChanges() { 318 | checkCss(); 319 | const url = window.location.href; 320 | console.log(' *** url', url); 321 | if (url.indexOf('estoque/endereco') > -1) { 322 | return processEndereco(); 323 | } else if (url.indexOf('estoque/frete') > -1) { 324 | return processFrete(); 325 | } else if (url.indexOf('estoque/declaracao') > -1) { 326 | return processDeclaracao(); 327 | } else if (url.endsWith('estoque')) { 328 | console.log('estoque'); 329 | return processEstoque(); 330 | } 331 | } 332 | 333 | // let currentUrl; 334 | // window.onload = function () { 335 | // currentUrl = location.href; 336 | // detectChanges(); 337 | // const onChanged = () => { 338 | // if (location.href === currentUrl) { 339 | // setTimeout(() => onChanged(), 300); 340 | // return; 341 | // } 342 | // currentUrl = location.href; 343 | // setTimeout(() => { 344 | // detectChanges(); 345 | // setTimeout(() => onChanged(), 300); 346 | // }, 200); 347 | // }; 348 | // onChanged(); 349 | // }; 350 | 351 | // killNotifications(); 352 | 353 | let currentUrl; 354 | (function () { 355 | currentUrl = location.href; 356 | detectChanges(); 357 | const onChanged = () => { 358 | if (location.href === currentUrl) { 359 | setTimeout(() => onChanged(), 300); 360 | return; 361 | } 362 | currentUrl = location.href; 363 | setTimeout(() => { 364 | detectChanges(); 365 | setTimeout(() => onChanged(), 300); 366 | }, 200); 367 | }; 368 | onChanged(); 369 | 370 | window.addEventListener('DOMContentLoaded', (event) => { 371 | onChanged(); 372 | }); 373 | })(); 374 | --------------------------------------------------------------------------------