Merge pull request #127 from cloudflare/page-visibility-change

Redraw alert list of user switches to unsee tab
This commit is contained in:
Łukasz Mierzwa
2017-07-06 09:17:43 -07:00
committed by GitHub
2 changed files with 17 additions and 1 deletions

View File

@@ -11,6 +11,21 @@ var Grid = (function() {
var grid;
// when user switches to a different tab but keeps unsee tab open in the background
// some browsers (like Chrome) will try to apply some forms of throttling for the JS
// code, to ensure that there are no visual artifacts (like state alerts not removed from the page)
// redraw all alerts if we detect that the user switches from a different tab to unsee
var setupPageVisibilityHandler = function() {
// based on https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
if (typeof document.hidden !== "undefined" && typeof document.addEventListener !== "undefined") {
document.addEventListener("visibilitychange", function() {
if (!document.hidden) {
Grid.Redraw();
}
}, false);
}
};
var init = function() {
grid = $(selectors.alerts).masonry({
itemSelector: selectors.incident,
@@ -24,6 +39,7 @@ var Grid = (function() {
opacity: 1
}
});
setupPageVisibilityHandler();
};
var clear = function() {

View File

@@ -458,7 +458,7 @@ func staticFiltersJs() (*asset, error) {
return a, nil
}
var _staticGridJs = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x54\xb1\x6e\xdb\x30\x10\xdd\xfd\x15\x07\xb5\x83\x64\xb8\x72\x0a\x74\x62\xe0\xa1\x48\x8b\x34\x53\x8b\x7a\xe8\xcc\x88\x67\x8b\x00\x45\x0a\x24\xe5\xd4\x0d\xfc\xef\xc5\x91\x8a\x28\xd9\x72\x12\x4e\xe4\xbb\xc7\xa7\x77\xbc\x3b\xad\x97\xb0\x57\xe6\x91\x2b\x07\x77\x46\xef\xe4\x1e\x96\xeb\xc5\x62\xbd\x04\xfc\xdb\x1a\xeb\x51\xc0\xbd\x95\x82\xc0\x03\xb7\x71\xbf\x81\x7c\xd7\xe9\xca\x4b\xa3\xf3\x02\x9e\x17\x0b\x00\x00\x8a\x3a\x54\x58\x79\x63\x1d\x6c\xe0\x39\xa0\xb4\xb8\x42\xeb\x1d\x83\xec\x43\xdc\x65\xab\x21\x24\x75\x25\x05\x6a\xcf\x20\x2b\x5f\xf6\xa3\xf0\xde\x4a\xb1\x95\xff\xd0\x52\x9c\x0e\x9f\x1c\x9d\x7a\xc6\xe9\x36\x7d\x99\x82\xa3\xa3\xd4\xd2\xc3\x06\x26\x2e\xc7\xa2\xb0\x81\x8f\xf9\xe0\xb6\x8c\xbe\x8a\xb2\xe1\xce\x68\x7b\xcc\x13\x39\x98\xf4\xd8\x6c\x7b\x2e\x4b\x39\x0e\x86\x57\x13\x76\x65\x54\xd7\xe8\x3f\x52\xf8\x7a\x4c\x1e\x52\x99\xb2\x5b\xb4\x15\x6a\xff\xcb\x38\x49\x46\x19\x78\xdb\xe1\x94\xe2\x2d\xd7\x31\xfa\xad\xb3\x3c\xb2\xb2\x9b\xf2\xcb\xf8\x1d\x69\xd5\x52\x08\xd4\x5b\x7f\x54\xc8\x60\x9a\x01\x2d\xd3\xf2\x4a\xfa\x23\x83\x9b\x49\xe8\x34\x15\x39\x48\x27\x1f\x15\xbe\xad\xf2\x79\xaa\x32\x9c\x4e\xc5\xed\x45\x71\x2a\x85\xdc\xbe\x56\x8e\xe1\xe1\x33\x8b\x8d\x39\x60\xb6\x9a\x94\xe7\xe5\xa1\x8b\x5e\x9b\xd6\x6c\xbc\x8c\xd7\xf3\x19\x0f\x16\x85\xe5\x4f\xef\x33\xa1\xf8\xd1\x74\x3e\x9b\x55\x21\xfd\xb1\x0a\x2a\x6c\xde\x91\x4e\xa0\x5d\xea\xf1\xb6\x45\x2d\x5e\xd3\x93\x3b\xc8\xe3\x5c\x96\xf7\xe8\x7f\xb6\x81\x94\xc5\x7b\xde\xb4\x59\x41\x70\x5e\x14\x67\xb5\x0a\x36\x5a\x8b\x44\x8b\x9a\xc9\x54\x0f\xa3\x98\xfa\x0a\xde\x00\x95\xc3\x39\xad\xf8\xc5\x73\xa9\x88\xce\x2a\x5d\xe4\x4a\x63\xe4\xae\x15\xc0\xa2\xef\xac\x3e\x7b\xbd\x3d\xfa\x07\x8f\xcd\x77\x85\x0d\x6a\xef\xe6\x0a\x52\x4b\x81\xd7\x34\xe7\x26\x9c\xf8\x73\xed\xe1\x6a\x73\xb5\x39\xe6\x74\x88\x7f\xae\xd3\xe7\x90\x2e\x3e\x68\xe9\x59\xf8\x17\xa5\x21\xbb\xa3\x59\x60\x71\x24\x12\xfa\x43\x0a\x64\x21\x99\x84\x6d\x6b\xf3\xc4\x82\xb1\x84\xfd\x0e\x5d\xcc\xfa\x6e\x4e\xf8\xd7\x50\x07\xd6\xf7\xd3\x98\x4f\xfd\xc7\xfa\xbe\x4d\x38\x3d\xab\x63\xb1\x24\x43\x0e\xa7\x82\x32\xfa\x1f\x00\x00\xff\xff\x0f\x6c\x55\xd9\x10\x06\x00\x00")
var _staticGridJs = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x55\xc1\x8e\xdb\x36\x10\xbd\xfb\x2b\x26\x6a\x11\xd8\x0b\x47\x4a\x81\x9e\x14\xf8\xb0\xd8\x06\xc9\x16\x05\xba\xa8\xd1\xe6\x18\xd0\xe2\x93\x44\x2c\x45\x0a\xe4\xc8\xae\x13\xf8\xdf\x0b\x4a\xb2\x25\x6b\xe5\x66\x79\x12\x87\x8f\x6f\x86\xf3\x66\x46\xc9\x1d\x15\xda\xee\x84\xf6\xf4\x60\x4d\xae\x0a\xba\x4b\x16\x8b\xe4\x8e\xf0\x6f\x6d\x1d\x43\xd2\x27\xa7\x64\x30\xee\x85\xeb\xbe\x37\xb4\xcc\x1b\x93\xb1\xb2\x66\xb9\xa2\xef\x8b\x05\x11\x51\x38\xf5\xd0\xc8\xd8\x3a\x4f\x1b\xfa\xde\x5a\xc3\x12\x1a\x8e\x7d\x4a\xd1\x4f\xdd\x57\xb4\xbe\x1c\x29\x93\x29\x09\xc3\x29\x45\xf1\xf9\x7b\x74\x5c\x38\x25\xb7\xea\x1b\x5c\x38\x0f\x9b\x77\x3e\xec\x7a\xc4\xe9\xc3\xe0\x39\x1c\xf6\xdb\x24\xa1\x43\x09\x43\x8d\x87\x23\x7f\x50\x9c\x95\xf0\xc4\x96\x04\x49\x95\xe7\x70\x30\x4c\x2c\x76\xb4\x6b\x98\x9e\x81\xda\x53\x63\x3c\xd0\xda\x6c\x0d\x43\xca\x10\x97\xa0\x9d\xc8\x9e\x0b\x67\x1b\x23\xcf\xbc\xde\x56\xa0\x9d\xb3\x07\x0f\xe7\x69\xa9\xd5\x33\xe8\xa1\x74\xb6\xc2\x8a\x0e\x4a\x6b\x62\x77\x6c\x3d\xd5\xb5\x3e\x76\xe8\xdc\xba\xca\x93\xcd\x89\x4b\x67\x99\xb5\x32\x45\xb0\xb5\x0e\x7e\xdf\x9e\x89\x33\x2b\xb1\x0e\x37\x61\x7c\xe3\x40\x5c\x0a\x0e\x10\x07\x12\x0e\x64\x2c\xed\x95\x6f\x84\x26\xe1\x58\xe5\x22\xe3\xb3\x77\xcf\x82\xd1\x67\x98\x8c\x65\x72\xa8\xec\x1e\x92\x72\x67\xab\xd6\x49\x2d\x0a\xac\xce\x7e\x1c\xa4\x13\x07\x12\x5a\x9f\xef\xa8\x9c\x0e\x20\x09\x46\xc6\x17\xb7\x93\xdc\xb5\x5c\xd3\xec\xb1\xed\xd2\x36\x12\x9f\x9b\xfa\x49\x14\xf8\x47\x79\xb5\x53\x5a\xf1\xf1\xb3\x30\x52\xc3\xd1\x86\xae\xea\xe5\x2c\x6f\x92\xd0\x4e\x78\x48\xb2\x86\x4a\xe6\xda\xa7\x49\x22\xb1\x87\xb6\x35\x5c\x5c\xd9\x6f\x4a\x6b\x11\x5b\x57\x24\x30\xef\xfe\xde\x26\xd2\x66\x3e\xf9\x82\x5d\x72\xff\xf4\x98\x04\x4f\x5f\x07\x57\x5f\xef\x9f\x1e\x87\xb2\xca\x69\xc9\xc7\x1a\x36\x27\x69\xb3\xa6\x82\xe1\xb8\x54\x52\xc2\xd0\x9b\xcd\x86\xa2\xc6\x48\xe4\xca\x40\x46\xf4\xf6\x2d\x4d\x91\x42\xca\x8f\x7b\x18\xfe\x43\x79\x86\x81\x9b\xde\x19\x3f\x21\xac\x9b\x17\x97\xd1\xfe\x12\x5f\x56\x0a\x53\x20\x5a\xcf\x67\x62\x1c\xf8\x9b\x49\xc8\x73\xb8\xb0\x42\x2b\xc6\x7f\xb5\x82\x2e\x57\x1f\x5e\x40\x4e\x57\x96\xd3\x9a\x72\xa1\x3d\x46\xc0\xd3\x8b\x26\x52\x46\xf1\x2d\xad\x8a\xae\xf1\x7f\x5e\x5e\x7a\x3c\xee\x2a\x68\x15\x57\xc2\x5b\xe3\x8e\xcb\xeb\x30\x15\xa3\xda\xf6\xd8\x74\x98\x0c\x97\x36\x5f\x5f\xa1\x33\xab\x9b\xca\x7c\x51\x92\xcb\x31\xf8\x32\x00\xae\xd1\x35\x5c\x06\xc3\x4f\xd6\xab\x10\x68\x4a\xec\x1a\x5c\x43\xd8\x09\xd3\x9d\xfe\xd6\x38\xd1\xa1\xa2\xf7\xf1\xaf\xe3\xe9\x13\x56\x97\xe3\x2d\x1f\x35\xd2\x99\x44\xdb\x5a\x64\x8a\x8f\x29\xbd\x9f\xa4\xf3\x6a\xdb\xca\xac\xf1\x63\x96\x5f\x16\xf3\x12\x9d\x46\xba\xdc\xee\xa3\xb3\xcc\x63\xcd\x32\x0d\x71\xb3\xc1\x42\xfa\x2e\xf2\x44\xdd\x68\x88\xd6\x57\x22\x9e\xe5\x58\x8d\x22\x98\x3d\x8f\xbb\xeb\x73\x31\xf4\x53\xe5\x55\x41\x68\x71\xb4\x0d\x47\xb3\x2c\x81\x7f\xcc\x02\x8d\xea\x15\xcf\x69\x61\x2f\xf9\x44\x5d\xc3\xc8\xff\xe3\x0b\xdd\xd6\xfd\xf3\xe2\x4f\xe0\x3f\xeb\x16\x14\x75\xf7\xd8\xd6\xd1\x2a\x98\x97\xab\x69\x03\xb6\x61\xd4\x0e\x01\xd6\x71\x0e\x41\xf5\x66\xc8\xeb\xb8\xda\xd8\x08\xda\x63\x8e\xab\xf3\x38\xa5\xea\xac\xb3\x4c\x2f\x3b\x97\x51\xf9\x5b\x02\x38\x70\xe3\xcc\x24\x7b\x05\xf8\x91\x51\x7d\xd4\x08\xa3\xc6\xcf\x09\x52\x2a\x89\x5b\x9c\x73\x73\x20\xe0\xe7\xca\xc3\x97\xf6\x66\x71\xcc\xf1\x04\xfc\x94\xa7\x7f\xc3\x70\xf1\xd1\x28\x4e\xdb\x89\x35\xb4\xe2\x43\xe8\x85\xb4\x6b\x89\xc1\xfa\x59\x49\xa4\xed\x63\x06\xdb\xb6\xb4\x87\xb4\x0d\x6c\xb0\x75\xa3\x34\xed\xab\x79\xb0\xdf\xb7\x3a\xa4\x7d\x3d\x8d\xf1\xa1\xfe\xd2\xbe\x6e\x07\x7b\x48\xab\x4f\x3b\x49\x2e\x6f\x38\xad\xc2\x8b\xfe\x0b\x00\x00\xff\xff\x20\x4a\x5e\x31\x6c\x09\x00\x00")
func staticGridJsBytes() ([]byte, error) {
return bindataRead(