107 lines
2.8 KiB
JavaScript
107 lines
2.8 KiB
JavaScript
// script à lancer dans le navigateur pour récupérer toutes les séquences d'un compte
|
|
// pour que cela fonctionne il faut aller sur la page d'un utilisateur, https://www.mapillary.com/app/user/tykayn
|
|
// puis scroller pour voir toutes les séquences
|
|
// et lancer ce script dans la console js pour avoir à la fin un tableau de toutes les séquences.
|
|
|
|
// ouvrir le drawer de séquene key
|
|
function toggle_advanced_info() {
|
|
let _dots = document.querySelector('.i2.three-dots')
|
|
_dots.click
|
|
}
|
|
|
|
sequences_list = []
|
|
missing_sequences = []
|
|
|
|
function filter_sequences_id () {
|
|
|
|
filteredArray = sequences_list.filter(function (item, pos) {
|
|
return sequences_list.indexOf(item) == pos
|
|
})
|
|
console.log('sequences_list', filteredArray)
|
|
}
|
|
|
|
function click_block_number (num) {
|
|
console.log('click block num', num)
|
|
let sequence_block = document.querySelector('drawer-sequence-item.ng-star-inserted:nth-child(' + num + ') > a:nth-child(1) > div:nth-child(1) > div:nth-child(1) > i:nth-child(2)')
|
|
if (sequence_block) {
|
|
sequence_block.click()
|
|
} else {
|
|
console.info('pas de block')
|
|
}
|
|
}
|
|
|
|
function add_sequence_id () {
|
|
check_annoying_modal()
|
|
let id_sequence_container = document.querySelector('.content > div:nth-child(1) > div:nth-child(2) > app-copy-field:nth-child(2) > div:nth-child(1) > div:nth-child(1)')
|
|
id = id_sequence_container.innerText
|
|
|
|
if(sequences_list.indexOf(id) === -1){
|
|
console.log('déjà présent: ', id)
|
|
}
|
|
sequences_list.push(id)
|
|
console.log('sequence id', id)
|
|
|
|
}
|
|
|
|
function check_annoying_modal(){
|
|
has_annoying_modal = document.querySelector('#close_dialog_box')
|
|
if (has_annoying_modal) {
|
|
|
|
has_annoying_modal.click()
|
|
let t = setTimeout(() => {
|
|
toggle_advanced_info()
|
|
clearInterval(t)
|
|
}, 100)
|
|
}
|
|
}
|
|
|
|
function iterate_blocks (initial_block = 0, max_block, waiting = 400) {
|
|
|
|
// compter les blocs
|
|
let listing_blocs = document.querySelectorAll('drawer-sequence-item')
|
|
console.log('listing_blocs', listing_blocs.length)
|
|
if(!max_block){
|
|
listing_blocs.length +1
|
|
}
|
|
|
|
// sequences_list = []
|
|
let ii = 1 * initial_block
|
|
let jj = 1 * initial_block
|
|
check_annoying_modal()
|
|
|
|
listing_blocs.forEach((elem) => {
|
|
|
|
if (ii <= max_block) {
|
|
check_annoying_modal()
|
|
console.log('set timeout', (ii * waiting - 1 * initial_block * waiting))
|
|
let t = setTimeout(() => {
|
|
|
|
check_annoying_modal()
|
|
|
|
jj++
|
|
click_block_number(jj)
|
|
add_sequence_id()
|
|
clearTimeout(t)
|
|
}, (ii * waiting - 1 * initial_block * waiting))
|
|
ii++
|
|
}
|
|
|
|
})
|
|
|
|
if (ii === max_block) {
|
|
filter_sequences_id()
|
|
}
|
|
|
|
}
|
|
|
|
// compter
|
|
document.querySelectorAll('drawer-sequence-item')
|
|
|
|
|
|
// toggle_advanced_info()
|
|
// on définit un max d'itérations à 20 pour tester, et 300 milisecondes entre chaque
|
|
// iterate_blocks(4, document.querySelectorAll('drawer-sequence-item').length + 4, 1000)
|
|
iterate_blocks(30, 60, 600)
|
|
// add_sequence_id()
|
|
filter_sequences_id()
|