Knowledge

User:Evad37/timeless-newMessageHighlight.js

Source 📝

58: 30:
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by
31:
others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes.
35:
to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the
68: 36: 32: 105: 126:
A script to highlight the username in yellow when there are new messages on your user talk page
64: 147:
For details on why this is not done by the skin, nor by the Echo extension, see these tasks:
133:(since the in Timeless skin, the talk page link is hidden in a dropdown). This script should 1810:
such hooks. And the mark as read/unread links aren't available till some time after the
1761:/* Clicks on the notifications menu may add/remove the yellow background from the talkpage 8: 1782:
For efficiency this is time-limited to period starting from when the notifications-alert
154:
https://phabricator.wikimedia.org/T215695 and https://phabricator.wikimedia.org/T216046
1803:
Adding a callback to a hook would be prefereable, but Echo doesn't seem to provide
140:
only be used with the Timeless skin -- add it to your timeless.js, not your common.js!
1789:
icon is clicked, and ending either when the highlighting state changes, or 60 seconds
1817:
user clicks on the bell icon, so click-event callbacks can't be used either. :(
1650:// ignore resize events as long as an actualResizeHandler execution is in the queue 1768:
link, so we do a check every 5 seconds to see if we need to reset the highlighting
366:// Reset click handler. Seems to be needed, possibly from Echo mucking about 1513:* at https://developer.mozilla.org/en-US/docs/Web/Events/resize#setTimeout 80:
After saving, you have to bypass your browser's cache to see the changes.
1506:* Derived from code by Mozilla Contributors, licensed under CC-BY-SA 2.5, 17: 104:
toolbar button. For details and instructions about other browsers, see
1499:/* Respond when the window resizes, throttled to every 0.2 seconds. 57: 768:// Mobile views (only needs styles when below breakpoint) 24: 52: 26: 1207:// Set state of desktop / mobile view styles 69:User:Evad37/timeless-newMessageHighlight 14: 67:seems to have a documentation page at 45:be executed when previewing this page. 1966:"click.highlightingCheck" 1954:'#pt-notifications-alert a' 445:"click.highlightingCheck" 433:'#pt-notifications-alert a' 417:"click.highlightingCheck" 405:'#pt-notifications-alert a' 76: 23: 112: 1994: 1918:clearRecheckingIntervalAndTimeout 1408:clearRecheckingIntervalAndTimeout 1336:clearRecheckingIntervalAndTimeout 279:clearRecheckingIntervalAndTimeout 56: 922:'background-blend-mode' 835:'background-blend-mode' 649:'background-blend-mode' 546:'background-blend-mode' 373:// with the <a> elements? 119:/* timeless-newMessageHighlight 13: 1: 1001:"rgb(255, 204, 51)" 744:"rgb(255, 204, 51)" 479:// Desktop (and tablet) views 7: 106:Knowledge:Bypass your cache 10: 1999: 1979: 1978: 1945: 1944: 1938: 1937: 1925: 1924: 1915: 1914: 1884: 1883: 1850: 1849: 1828: 1827: 1821: 1820: 1814: 1813: 1807: 1806: 1800: 1799: 1793: 1792: 1786: 1785: 1779: 1778: 1772: 1771: 1765: 1764: 1758: 1757: 1754: 1753: 1747: 1746: 1740: 1739: 1727: 1726: 1717: 1716: 1701: 1700: 1676: 1675: 1654: 1653: 1647: 1646: 1631: 1630: 1624: 1623: 1593: 1592: 1571: 1570: 992:'background-color' 906:'background-color' 819:'background-color' 735:'background-color' 633:'background-color' 530:'background-color' 1558: 1557: 1524: 1523: 1517: 1516: 1510: 1509: 1503: 1502: 1496: 1495: 1492: 1491: 1482: 1481: 1475: 1474: 1468: 1467: 1461: 1460: 1454: 1453: 1447:removeStylesForMobileView 1444: 1443: 1422: 1421: 1415: 1414: 1405: 1404: 1395: 1394: 1373: 1372: 1360: 1359: 1350: 1349: 1343: 1342: 1333: 1332: 1323: 1322: 1298: 1297: 1279: 1278: 1233: 1232: 1211: 1210: 1204: 1203: 1200: 1199: 1193: 1192: 1186: 1185: 1173:removeStylesForMobileView 1164: 1163: 1121: 1120: 1099: 1098: 1059: 1058: 1040: 1039: 1018: 1017: 1011: 1010: 968: 967: 946: 945: 939: 938: 932: 931: 919: 918: 903: 902: 881: 880: 865:removeStylesForMobileView 859: 858: 852: 851: 845: 844: 832: 831: 816: 815: 794: 793: 772: 771: 765: 764: 761: 760: 754: 753: 711: 710: 689: 688: 682: 681: 675: 674: 665:'background-clip' 662: 661: 646: 645: 630: 629: 608: 607: 586: 585: 579: 578: 572: 571: 562:'background-clip' 559: 558: 543: 542: 527: 526: 505: 504: 483: 482: 476: 475: 472: 471: 465: 464: 458: 457: 424: 423: 396: 395: 377: 376: 370: 369: 363: 362: 329: 328: 295: 294: 273: 272: 260: 259: 247: 246: 243: 242: 227: 226: 223: 222: 201: 200: 197: 196: 1972:onNotificationAlertClick 1834:onNotificationAlertClick 1260:'.mw-echo-alert' 451:onNotificationAlertClick 386:onNotificationAlertClick 172: 171: 165: 164: 158: 157: 151: 150: 144: 143: 137: 136: 130: 129: 123: 122: 116: 115: 113: 37:appropriate village pump 1431:hasMobileViewStylesSet 1108:addStylesForMobileView 1052:hasMobileViewStylesSet 980:'#personal h2' 952:hasMobileViewStylesSet 890:'#personal h2' 803:'#personal h2' 778:addStylesForMobileView 1248:'#user-tools' 568:'content-box' 168:// Wait for page load 1478:// Set initial state 1720:actualResizeHandler 1611:setMobileViewStyles 1577:actualResizeHandler 1398:removeDesktopStyles 1382:hasDesktopStylesSet 1353:setMobileViewStyles 1310:hasDesktopStylesSet 1024:setMobileViewStyles 723:'#personal' 695:hasDesktopStylesSet 617:'#personal' 592:removeDesktopStyles 514:'#personal' 1539:"resize" 841:'multiply' 552:'multiply' 100:key and click the 1871:setUpHighlighting 1485:setUpHighlighting 1217:setUpHighlighting 1148:MOBILE_BREAKPOINT 1080:MOBILE_BREAKPOINT 928:'initial' 912:'initial' 671:'initial' 655:'initial' 639:'initial' 207:MOBILE_BREAKPOINT 75: 74: 49: 48: 1990: 1984: 1983: 1977: 1976: 1973: 1970: 1967: 1964: 1961: 1958: 1955: 1952: 1949: 1943: 1942: 1936: 1935: 1932: 1929: 1923: 1922: 1919: 1913: 1912: 1909: 1906: 1903: 1900: 1897: 1894: 1891: 1888: 1882: 1881: 1878: 1875: 1872: 1869: 1866: 1863: 1860: 1857: 1854: 1848: 1847: 1844: 1841: 1838: 1835: 1832: 1826: 1825: 1819: 1818: 1812: 1811: 1805: 1804: 1798: 1797: 1791: 1790: 1784: 1783: 1777: 1776: 1770: 1769: 1763: 1762: 1756: 1752: 1751: 1745: 1744: 1738: 1737: 1734: 1731: 1725: 1724: 1721: 1715: 1714: 1711: 1708: 1705: 1699: 1698: 1695: 1692: 1689: 1686: 1683: 1680: 1674: 1673: 1670: 1667: 1664: 1661: 1658: 1652: 1651: 1645: 1644: 1641: 1638: 1635: 1629: 1628: 1622: 1621: 1618: 1615: 1612: 1609: 1606: 1603: 1600: 1599:hasTalkpageAlert 1597: 1591: 1590: 1587: 1584: 1581: 1578: 1575: 1569: 1568: 1565: 1562: 1556: 1555: 1552: 1549: 1546: 1543: 1540: 1537: 1534: 1533:addEventListener 1531: 1528: 1522: 1521: 1515: 1514: 1508: 1507: 1501: 1500: 1494: 1490: 1489: 1486: 1480: 1479: 1473: 1472: 1466: 1465: 1459: 1458: 1452: 1451: 1448: 1442: 1441: 1438: 1435: 1432: 1429: 1426: 1420: 1419: 1413: 1412: 1409: 1403: 1402: 1399: 1393: 1392: 1389: 1386: 1383: 1380: 1377: 1371: 1370: 1367: 1364: 1358: 1357: 1354: 1348: 1347: 1341: 1340: 1337: 1331: 1330: 1327: 1326:setDesktopStyles 1321: 1320: 1317: 1314: 1311: 1308: 1305: 1302: 1296: 1295: 1292: 1289: 1288:hasTalkpageAlert 1286: 1283: 1277: 1276: 1273: 1270: 1267: 1264: 1261: 1258: 1255: 1252: 1249: 1246: 1243: 1240: 1237: 1236:hasTalkpageAlert 1231: 1230: 1227: 1224: 1221: 1218: 1215: 1209: 1208: 1202: 1198: 1197: 1191: 1190: 1184: 1183: 1180: 1177: 1174: 1171: 1168: 1162: 1161: 1158: 1155: 1152: 1149: 1146: 1143: 1140: 1137: 1134: 1131: 1128: 1125: 1119: 1118: 1115: 1112: 1109: 1106: 1103: 1097: 1096: 1093: 1090: 1087: 1084: 1081: 1078: 1075: 1072: 1069: 1066: 1063: 1057: 1056: 1053: 1050: 1047: 1044: 1038: 1037: 1034: 1031: 1028: 1025: 1022: 1016: 1015: 1009: 1008: 1005: 1002: 999: 996: 993: 990: 987: 984: 981: 978: 975: 972: 966: 965: 962: 959: 956: 953: 950: 944: 943: 937: 936: 930: 929: 926: 923: 917: 916: 913: 910: 907: 901: 900: 897: 894: 891: 888: 885: 879: 878: 875: 872: 869: 866: 863: 857: 856: 850: 849: 843: 842: 839: 836: 830: 829: 826: 823: 820: 814: 813: 810: 807: 804: 801: 798: 792: 791: 788: 785: 782: 779: 776: 770: 769: 763: 759: 758: 752: 751: 748: 745: 742: 739: 736: 733: 730: 727: 724: 721: 718: 715: 709: 708: 705: 702: 699: 696: 693: 687: 686: 680: 679: 673: 672: 669: 666: 660: 659: 656: 653: 650: 644: 643: 640: 637: 634: 628: 627: 624: 621: 618: 615: 612: 606: 605: 602: 599: 596: 593: 590: 584: 583: 577: 576: 570: 569: 566: 563: 557: 556: 553: 550: 547: 541: 540: 537: 534: 531: 525: 524: 521: 518: 515: 512: 509: 503: 502: 499: 496: 493: 490: 489:setDesktopStyles 487: 481: 480: 474: 470: 469: 463: 462: 456: 455: 452: 449: 446: 443: 440: 437: 434: 431: 428: 422: 421: 418: 415: 412: 409: 406: 403: 400: 394: 393: 390: 387: 384: 381: 375: 374: 368: 367: 361: 360: 357: 354: 351: 348: 345: 342: 339: 336: 333: 327: 326: 323: 320: 317: 314: 311: 308: 305: 302: 299: 293: 292: 289: 286: 283: 280: 277: 271: 270: 267: 264: 258: 257: 254: 251: 245: 241: 240: 237: 234: 233:hasTalkpageAlert 231: 225: 221: 220: 217: 214: 211: 208: 205: 199: 195: 194: 191: 188: 185: 182: 179: 176: 170: 169: 163: 162: 156: 155: 149: 148: 142: 141: 135: 134: 128: 127: 121: 120: 109: 96:: Hold down the 60: 53: 27: 1998: 1997: 1993: 1992: 1991: 1989: 1988: 1987: 1986: 1985: 1981: 1974: 1971: 1968: 1965: 1962: 1959: 1956: 1953: 1950: 1947: 1940: 1933: 1930: 1927: 1920: 1917: 1910: 1907: 1904: 1901: 1898: 1895: 1892: 1889: 1886: 1879: 1876: 1873: 1870: 1867: 1864: 1861: 1858: 1855: 1853:recheckInterval 1852: 1845: 1842: 1839: 1836: 1833: 1830: 1823: 1816: 1809: 1802: 1795: 1788: 1781: 1774: 1767: 1760: 1749: 1742: 1735: 1732: 1729: 1722: 1719: 1712: 1709: 1706: 1703: 1696: 1693: 1690: 1687: 1684: 1681: 1678: 1671: 1668: 1665: 1662: 1659: 1656: 1649: 1642: 1639: 1637:resizeThrottler 1636: 1633: 1626: 1619: 1616: 1613: 1610: 1607: 1604: 1601: 1598: 1595: 1588: 1585: 1582: 1579: 1576: 1573: 1566: 1563: 1560: 1553: 1550: 1547: 1545:resizeThrottler 1544: 1541: 1538: 1535: 1532: 1529: 1526: 1519: 1512: 1505: 1498: 1487: 1484: 1477: 1470: 1463: 1456: 1449: 1446: 1439: 1436: 1433: 1430: 1427: 1424: 1417: 1410: 1407: 1400: 1397: 1390: 1387: 1384: 1381: 1378: 1375: 1368: 1365: 1362: 1355: 1352: 1345: 1338: 1335: 1328: 1325: 1318: 1315: 1312: 1309: 1306: 1303: 1300: 1293: 1290: 1287: 1284: 1281: 1274: 1271: 1268: 1265: 1262: 1259: 1256: 1253: 1250: 1247: 1244: 1241: 1238: 1235: 1228: 1225: 1222: 1219: 1216: 1213: 1206: 1195: 1188: 1181: 1178: 1175: 1172: 1169: 1166: 1159: 1156: 1153: 1150: 1147: 1144: 1141: 1138: 1135: 1132: 1129: 1126: 1123: 1116: 1113: 1110: 1107: 1104: 1101: 1094: 1091: 1088: 1085: 1082: 1079: 1076: 1073: 1070: 1067: 1064: 1061: 1054: 1051: 1048: 1045: 1042: 1035: 1032: 1029: 1026: 1023: 1020: 1013: 1006: 1003: 1000: 997: 994: 991: 988: 985: 982: 979: 976: 973: 970: 963: 960: 957: 954: 951: 948: 941: 934: 927: 924: 921: 914: 911: 908: 905: 898: 895: 892: 889: 886: 883: 876: 873: 870: 867: 864: 861: 854: 847: 840: 837: 834: 827: 824: 821: 818: 811: 808: 805: 802: 799: 796: 789: 786: 783: 780: 777: 774: 767: 756: 749: 746: 743: 740: 737: 734: 731: 728: 725: 722: 719: 716: 713: 706: 703: 700: 697: 694: 691: 684: 677: 670: 667: 664: 657: 654: 651: 648: 641: 638: 635: 632: 625: 622: 619: 616: 613: 610: 603: 600: 597: 594: 591: 588: 581: 574: 567: 564: 561: 554: 551: 548: 545: 538: 535: 532: 529: 522: 519: 516: 513: 510: 507: 500: 497: 494: 491: 488: 485: 478: 467: 460: 453: 450: 447: 444: 441: 438: 435: 432: 429: 426: 419: 416: 413: 410: 407: 404: 401: 398: 391: 388: 385: 382: 379: 372: 365: 358: 355: 352: 349: 346: 343: 340: 337: 334: 331: 324: 322:recheckInterval 321: 318: 315: 312: 309: 306: 304:recheckInterval 303: 300: 297: 290: 287: 284: 281: 278: 275: 268: 265: 262: 255: 253:recheckInterval 252: 249: 238: 235: 232: 229: 218: 215: 212: 209: 206: 203: 192: 189: 186: 183: 180: 177: 174: 167: 160: 153: 146: 139: 132: 125: 118: 111: 110: 99: 50: 40: 22: 21: 20: 12: 11: 5: 1996: 1887:recheckTimeout 1796:have elapsed. 825:'#fc3' 536:'#fc3' 356:recheckTimeout 338:recheckTimeout 266:recheckTimeout 114: 97: 90:Microsoft Edge 73: 72: 61: 51: 47: 46: 25: 15: 9: 6: 4: 3: 2: 1995: 1980: 1946: 1939: 1926: 1916: 1885: 1851: 1829: 1822: 1815: 1808: 1801: 1794: 1787: 1780: 1773: 1766: 1759: 1755: 1748: 1741: 1728: 1718: 1704:resizeTimeout 1702: 1679:resizeTimeout 1677: 1666:resizeTimeout 1655: 1648: 1632: 1625: 1594: 1572: 1564:resizeTimeout 1559: 1525: 1518: 1511: 1504: 1497: 1493: 1483: 1476: 1469: 1462: 1455: 1445: 1423: 1416: 1406: 1396: 1374: 1361: 1351: 1344: 1334: 1324: 1299: 1280: 1234: 1212: 1205: 1201: 1194: 1187: 1165: 1122: 1100: 1060: 1041: 1019: 1012: 969: 947: 940: 933: 920: 904: 882: 860: 853: 846: 833: 817: 795: 773: 766: 762: 755: 712: 690: 683: 676: 663: 647: 631: 609: 587: 580: 573: 560: 544: 528: 506: 484: 477: 473: 466: 459: 425: 397: 378: 371: 364: 330: 316:clearInterval 296: 274: 261: 248: 244: 228: 224: 202: 198: 173: 166: 159: 152: 145: 138: 131: 124: 117: 107: 103: 95: 91: 87: 83: 82:Google Chrome 79: 70: 66: 62: 59: 55: 54: 44: 38: 34: 29: 28: 19: 1775:(on or off). 350:clearTimeout 101: 93: 89: 85: 81: 77: 42: 1865:setInterval 65:user script 18:User:Evad37 1899:setTimeout 1685:setTimeout 1605:setTimeout 1602:&& 1167:setTimeout 1151:&& 1142:innerWidth 1102:setTimeout 1083:&& 1074:innerWidth 239:// Boolean 41:This code 1905:function 1840:function 1691:function 1634:function 1583:function 1223:function 1154:isStyled 1089:isStyled 1046:isStyled 1030:function 1007:// #fc3; 958:function 871:function 784:function 750:// #fc3; 701:function 598:function 495:function 285:function 181:function 98:⇧ Shift 86:Firefox 33:A guide 1893:window 1859:window 1596:return 1527:window 1266:length 1136:window 1068:window 971:return 714:return 344:window 310:window 102:Reload 94:Safari 1931:60000 1551:false 1077:<= 219:// px 78:Note: 63:This 16:< 1877:5000 1710:null 1366:else 1269:> 1145:> 1127:else 92:and 43:will 1982:}); 1921:(); 1831:var 1733:200 1723:(); 1574:var 1561:var 1488:(); 1450:(); 1411:(); 1401:(); 1356:(); 1339:(); 1329:(); 1254:has 1214:var 1055:(); 1043:var 1021:var 998:=== 986:css 949:var 935:}); 896:css 862:var 848:}); 809:css 775:var 741:=== 729:css 692:var 678:}); 623:css 589:var 575:}); 520:css 486:var 411:off 276:var 263:var 250:var 230:var 213:850 204:var 1975:); 1960:on 1957:). 1948:$ 1941:}; 1934:); 1928:}, 1908:() 1880:); 1843:() 1824:*/ 1736:); 1730:}, 1694:() 1657:if 1640:() 1627:}; 1620:); 1586:() 1554:); 1520:*/ 1471:}; 1434:() 1425:if 1385:() 1376:if 1313:() 1301:if 1282:if 1263:). 1251:). 1242:$ 1226:() 1196:}; 1182:); 1130:if 1117:); 1062:if 1033:() 1014:}; 983:). 974:$ 961:() 942:}; 899:({ 893:). 884:$ 874:() 855:}; 812:({ 806:). 797:$ 787:() 757:}; 726:). 717:$ 704:() 685:}; 626:({ 620:). 611:$ 601:() 582:}; 523:({ 517:). 508:$ 498:() 468:}; 454:); 439:on 436:). 427:$ 420:); 408:). 399:$ 380:if 359:); 332:if 325:); 298:if 288:() 187:$ 175:$ 161:*/ 88:, 84:, 1969:, 1963:( 1951:( 1911:{ 1902:( 1896:. 1890:= 1874:, 1868:( 1862:. 1856:= 1846:{ 1837:= 1750:} 1743:} 1713:; 1707:= 1697:{ 1688:( 1682:= 1672:{ 1669:) 1663:! 1660:( 1643:{ 1617:1 1614:, 1608:( 1589:{ 1580:= 1567:; 1548:, 1542:, 1536:( 1530:. 1464:} 1457:} 1440:{ 1437:) 1428:( 1418:} 1391:{ 1388:) 1379:( 1369:{ 1363:} 1346:} 1319:{ 1316:) 1307:! 1304:( 1294:{ 1291:) 1285:( 1275:; 1272:0 1257:( 1245:( 1239:= 1229:{ 1220:= 1189:} 1179:1 1176:, 1170:( 1160:{ 1157:) 1139:. 1133:( 1124:} 1114:1 1111:, 1105:( 1095:{ 1092:) 1086:! 1071:. 1065:( 1049:= 1036:{ 1027:= 1004:; 995:) 989:( 977:( 964:{ 955:= 925:: 915:, 909:: 887:( 877:{ 868:= 838:: 828:, 822:: 800:( 790:{ 781:= 747:; 738:) 732:( 720:( 707:{ 698:= 668:: 658:, 652:: 642:, 636:: 614:( 604:{ 595:= 565:: 555:, 549:: 539:, 533:: 511:( 501:{ 492:= 461:} 448:, 442:( 430:( 414:( 402:( 392:{ 389:) 383:( 353:( 347:. 341:) 335:( 319:( 313:. 307:) 301:( 291:{ 282:= 269:; 256:; 236:; 216:; 210:= 193:{ 190:) 184:( 178:( 108:. 71:. 39:.

Index

User:Evad37
A guide
appropriate village pump

user script
User:Evad37/timeless-newMessageHighlight
Knowledge:Bypass your cache






















Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.