-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
25 lines (23 loc) · 815 Bytes
/
index.js
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
var tabs = require('sdk/tabs');
var windows = require("sdk/windows").browserWindows;
var tmr = require('sdk/timers');
var prefix, title;
tmr.setInterval(function() {
for (let window of windows) {
// console.log(window.title);
if(window.tabs.length > 3){
for(i in window.tabs){
console.log(i + ' ' + window.tabs[i].title);
prefix = '[' + (window.tabs[i].index+1) + ']';
title = window.tabs[i].title.replace(/\[.\]/, '');
if(i < 8){
window.tabs[i].title = prefix + title;
}else if(i == 8){
window.tabs[i].title = '[9]' + title;
}else{
window.tabs[i].title = title;
}
}
}
}
}, 2000);