Created
July 5, 2022 01:28
-
-
Save ziyunli/2925a03d3c92c89cf5d5223ec2918ca1 to your computer and use it in GitHub Desktop.
OneTab Operations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open('onetab.txt', encoding="utf-8") as f: | |
with open('dedup.txt', 'w', encoding="utf-8") as out: | |
links = {} | |
is_linebreak = False | |
for line in f: | |
line = line.strip() | |
if not line: | |
if not is_linebreak: | |
out.write('\n') | |
is_linebreak = True | |
continue | |
tokens = [x.strip() for x in line.split(' | ', 1)] | |
url = tokens[0] | |
title = tokens[-1] | |
if url in links: | |
continue | |
links[url] = title | |
out.write(url + ' | ' + title + '\n') | |
is_linebreak = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function delete_single() { | |
for (clickable of clickables) { | |
if (!clickable || clickable.innerHTML !== "Delete all") | |
continue; | |
clickable.click(); | |
return true; | |
} | |
return false; | |
} | |
window.confirm = function() { return true; } | |
var clickables = document.getElementsByClassName("clickable"); | |
document.addEventListener('DOMNodeRemoved', delete_single, false); | |
delete_single(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment