File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
scripts/content-scripts/scripts Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,32 @@ const UsefulScriptGlobalPageContext = {
2828 } ,
2929 } ,
3030 DOM : {
31+ // https://stackoverflow.com/a/3381522
32+ createFlashTitle ( newMsg , howManyTimes ) {
33+ var original = document . title ;
34+ var timeout ;
35+
36+ function step ( ) {
37+ document . title = document . title == original ? newMsg : original ;
38+ if ( -- howManyTimes > 0 ) {
39+ timeout = setTimeout ( step , 1000 ) ;
40+ }
41+ }
42+ howManyTimes = parseInt ( howManyTimes ) ;
43+ if ( isNaN ( howManyTimes ) ) {
44+ howManyTimes = 5 ;
45+ }
46+ clearTimeout ( timeout ) ;
47+ step ( ) ;
48+
49+ function cancel ( ) {
50+ clearTimeout ( timeout ) ;
51+ document . title = original ;
52+ }
53+
54+ return cancel ;
55+ } ,
56+
3157 deleteElements ( selector , willReRun ) {
3258 UsefulScriptGlobalPageContext . onElementsVisible (
3359 selector ,
You can’t perform that action at this time.
0 commit comments