blob: 71520137e7778b2cf890272a1800b4d7e17f6421 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 | // Copyright (c) 2019  Teddy Wing
//
// This file is part of Muttagen.
//
// Muttagen is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Muttagen is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Muttagen. If not, see <https://www.gnu.org/licenses/>.
export type GmailCSSClass = string;
type GmailCSSSelector = string;
export const TOOLS_PANEL: GmailCSSClass = 'bAw';
export const SIDEBAR: GmailCSSClass = 'aeN';
export const MESSAGE_PAGER: GmailCSSClass = 'AO';
export const INDEX: GmailCSSSelector = '.BltHke.nH.oy8Mbf[role="main"]';
export const PAGER: GmailCSSSelector = '.nH.g.id';
// export const PAGER_NEWER: GmailCSSSelector = 'div[aria-label="Newer"][role="button"]:not([aria-disabled="true"])';
export const NEWER: GmailCSSSelector = 'div[aria-label="Newer"][role="button"]';
export const OLDER: GmailCSSSelector = 'div[aria-label="Older"][role="button"]';
export function PAGER_NEWER_EL(): HTMLElement {
	return visible_element(document.querySelectorAll(NEWER)) as HTMLElement;
};
export function PAGER_OLDER_EL(): HTMLElement {
	return visible_element(document.querySelectorAll(OLDER)) as HTMLElement;
};
function visible_element(elements: NodeListOf<Element>) {
// https://stackoverflow.com/questions/13388616/firefox-query-selector-and-the-visible-pseudo-selector
	elements = Array.prototype.slice.call(elements)
		.filter(function(el, _) {
			return el.style.display !== 'none';
		});
	return elements[0];
};
// Index:
// .BltHke.nH.oy8Mbf[role="main"]
//
// Pager:
// .nH[role="main"]
// .nH.g.id
 |