/**
 * StopFlash
 *
 * https://github.com/JWhile/StopFlash
 *
 * background.js
 */

var flashElements = {}; // :Map<chrome.Tab, Object>

chrome.runtime.onConnect.addListener(function(port)
{
    if(port.sender.tab != null)
    {
        port.onMessage.addListener(function(rep)
        {
            if(rep['stopflashInit'])
            {
            }

            if(rep['stopflashDataUpdate'] && rep['stopflashData'])
            {
                flashElements[port.sender.tab] = rep.stopflashData;

                port.postMessage({succes: true});
            }
        });
    }
    else
    {
        port.onMessage.addListener(function(rep)
        {
            if(rep['stopflashInit'])
            {
                port.postMessage({'stopflashDataSend': true, 'stopflashData': flashElements[port.sender.tab]});
            }

            if(rep['stopflashStillHere'])
            {
            }
        });
    }
});

@@ -77,16 +77,298 @@
 js%0A */%0A%0A
+function BackgroundFlashData(id)%0A%7B%0A    this.id = id; // :int%0A    this.changed = false; // :boolean%0A%0A    this.data = null; // :Object%0A%7D%0A// function setData(Object data):void%0ABackgroundFlashData.prototype.setData = function(data)%0A%7B%0A    this.data = data;%0A%0A    this.changed = true;%0A%7D;%0A%0A
 var flas
@@ -482,26 +482,41 @@
 ort.
-sender.tab != null
+name === 'stopflashContentScript'
 )%0A  
@@ -880,16 +880,16 @@
   %7D%0A
-
     else
 %0A   
@@ -884,16 +884,51 @@
     else
+ if(port.name === 'stopflashPopup')
 %0A    %7B%0A 

Add class BackgroundFlashData + small fix