|
@ -87,28 +87,8 @@ function setUserSetting(setting, value) { |
|
|
|
|
|
|
|
|
/******************************************************************************/ |
|
|
/******************************************************************************/ |
|
|
|
|
|
|
|
|
var matrixSnapshotChanged = function() { |
|
|
|
|
|
if ( typeof matrixSnapshot !== 'object' ) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if ( matrixSnapshot.mtxContentModified ) { |
|
|
|
|
|
makeMenu(); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if ( matrixSnapshot.mtxCountModified ) { |
|
|
|
|
|
updateMatrixCounts(); |
|
|
|
|
|
} |
|
|
|
|
|
if ( matrixSnapshot.mtxColorModified ) { |
|
|
|
|
|
updateMatrixColors(); |
|
|
|
|
|
updateMatrixBehavior(); |
|
|
|
|
|
updateMatrixButtons(); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
function updateMatrixSnapshot() { |
|
|
function updateMatrixSnapshot() { |
|
|
matrixSnapshotPoller.pollNow(matrixSnapshotChanged); |
|
|
|
|
|
|
|
|
matrixSnapshotPoller.pollNow(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/******************************************************************************/ |
|
|
/******************************************************************************/ |
|
@ -1209,20 +1189,39 @@ var onMatrixSnapshotReady = function(response) { |
|
|
var matrixSnapshotPoller = (function() { |
|
|
var matrixSnapshotPoller = (function() { |
|
|
var timer = null; |
|
|
var timer = null; |
|
|
|
|
|
|
|
|
var snapshotPolled = function(response) { |
|
|
|
|
|
timer = null; |
|
|
|
|
|
if ( typeof response === 'object' ) { |
|
|
|
|
|
|
|
|
var processPollResult = function(response) { |
|
|
|
|
|
if ( typeof response !== 'object' ) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if ( |
|
|
|
|
|
response.mtxContentModified === false && |
|
|
|
|
|
response.mtxCountModified === false && |
|
|
|
|
|
response.mtxColorModified === false |
|
|
|
|
|
) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
matrixSnapshot = response; |
|
|
matrixSnapshot = response; |
|
|
matrixSnapshotChanged(); |
|
|
|
|
|
|
|
|
if ( response.mtxContentModified ) { |
|
|
|
|
|
makeMenu(); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if ( response.mtxCountModified ) { |
|
|
|
|
|
updateMatrixCounts(); |
|
|
|
|
|
} |
|
|
|
|
|
if ( response.mtxColorModified ) { |
|
|
|
|
|
updateMatrixColors(); |
|
|
|
|
|
updateMatrixBehavior(); |
|
|
|
|
|
updateMatrixButtons(); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var pollNow = function(callback) { |
|
|
|
|
|
unpollAsync(); |
|
|
|
|
|
var onPolled = function(response) { |
|
|
var onPolled = function(response) { |
|
|
callback(response); |
|
|
|
|
|
|
|
|
processPollResult(response); |
|
|
pollAsync(); |
|
|
pollAsync(); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var pollNow = function() { |
|
|
|
|
|
unpollAsync(); |
|
|
messager.send({ |
|
|
messager.send({ |
|
|
what: 'matrixSnapshot', |
|
|
what: 'matrixSnapshot', |
|
|
tabId: matrixSnapshot.tabId, |
|
|
tabId: matrixSnapshot.tabId, |
|
@ -1234,7 +1233,7 @@ var matrixSnapshotPoller = (function() { |
|
|
|
|
|
|
|
|
var poll = function() { |
|
|
var poll = function() { |
|
|
timer = null; |
|
|
timer = null; |
|
|
pollNow(snapshotPolled); |
|
|
|
|
|
|
|
|
pollNow(); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var pollAsync = function() { |
|
|
var pollAsync = function() { |
|
@ -1276,7 +1275,9 @@ var matrixSnapshotPoller = (function() { |
|
|
}, snapshotFetched); |
|
|
}, snapshotFetched); |
|
|
})(); |
|
|
})(); |
|
|
|
|
|
|
|
|
return pollNow; |
|
|
|
|
|
|
|
|
return { |
|
|
|
|
|
pollNow: pollNow |
|
|
|
|
|
}; |
|
|
})(); |
|
|
})(); |
|
|
|
|
|
|
|
|
/******************************************************************************/ |
|
|
/******************************************************************************/ |
|
|