@@ -1471,13 +1471,21 @@ tabutils._reloadEvery = function() {
1471
1471
} ) ;
1472
1472
1473
1473
gBrowser . updateAutoReloadPopup = function updateAutoReloadPopup ( aPopup ) {
1474
+ var sepCustom = aPopup . getElementsByAttribute ( "anonid" , "sep_custom" ) [ 0 ] ;
1475
+ while ( sepCustom . previousSibling . localName == "menuitem" )
1476
+ aPopup . removeChild ( sepCustom . previousSibling ) ;
1477
+
1478
+ aPopup . parentNode . getAttribute ( "list" ) . split ( "," ) . forEach ( function ( value ) {
1479
+ if ( value > 0 ) {
1480
+ let item = aPopup . insertBefore ( document . createElement ( "menuitem" ) , sepCustom ) ;
1481
+ item . value = value ;
1482
+ item . label = Label ( value ) ;
1483
+ item . setAttribute ( "type" , "radio" ) ;
1484
+ }
1485
+ } ) ;
1486
+
1474
1487
aPopup . value = gBrowser . mContextTab . _reloadInterval || TU_getPref ( "extensions.tabutils.reloadInterval" , 10 ) ;
1475
- aPopup . label = ( function ( ) {
1476
- var m = parseInt ( aPopup . value / 60 ) , s = aPopup . value % 60 ;
1477
- return ( m > 1 ? m + " " + aPopup . getAttribute ( "minutes" ) : m > 0 ? m + " " + aPopup . getAttribute ( "minute" ) : "" )
1478
- + ( m > 0 && s > 0 ? " " : "" )
1479
- + ( s > 1 ? s + " " + aPopup . getAttribute ( "seconds" ) : s > 0 ? s + " " + aPopup . getAttribute ( "second" ) : "" ) ;
1480
- } ) ( ) ;
1488
+ aPopup . label = Label ( aPopup . value ) ;
1481
1489
1482
1490
var itemEnable = aPopup . getElementsByAttribute ( "anonid" , "enable" ) [ 0 ] ;
1483
1491
itemEnable . setAttribute ( "checked" , gBrowser . mContextTabs . every ( function ( aTab ) aTab . hasAttribute ( "autoReload" ) ) ) ;
@@ -1490,15 +1498,28 @@ tabutils._reloadEvery = function() {
1490
1498
}
1491
1499
else {
1492
1500
itemCustom . setAttribute ( "checked" , true ) ;
1493
- itemCustom . setAttribute ( "value" , aPopup . value ) ;
1494
1501
}
1495
1502
1496
1503
if ( itemCustom . hasAttribute ( "checked" ) ) {
1504
+ itemCustom . setAttribute ( "value" , aPopup . value ) ;
1497
1505
itemCustom . setAttribute ( "label" , itemCustom . getAttribute ( "text" ) + ": " + aPopup . label ) ;
1498
1506
}
1499
1507
else {
1500
1508
itemCustom . setAttribute ( "label" , itemCustom . getAttribute ( "text" ) + PlacesUIUtils . ellipsis ) ;
1501
1509
}
1510
+
1511
+ function Label ( value ) {
1512
+ let m = parseInt ( value / 60 ) , s = value % 60 , result = [ ] ;
1513
+ if ( m > 0 ) {
1514
+ result . push ( m ) ;
1515
+ result . push ( aPopup . getAttribute ( m > 1 ? "minutes" : "minute" ) ) ;
1516
+ }
1517
+ if ( s > 0 || m == 0 ) {
1518
+ result . push ( s ) ;
1519
+ result . push ( aPopup . getAttribute ( s > 1 ? "seconds" : "second" ) ) ;
1520
+ }
1521
+ return result . join ( " " ) ;
1522
+ }
1502
1523
} ;
1503
1524
} ;
1504
1525
0 commit comments