
/*********************************************
 * ________________ Overview _________________
 *
 * The menu icon. To be distinguished:
 *  - different icon sizes (16px, 24px, 32px)
 *  - different flag colors:
 *        (note the order. the rule with
 *        the highest number will match.)
 *    (1) red: "default"
 *    (2) grey: nothing blocked
 *    (3) yellow: blocking is disabled
 *    (4) red: requests have been blocked _OR_
 *        the UI is currently being customized
 * Also to be considered:
 *  - different firefox versions
 *    - Australis (Firefox 29)
 *
 *********************************************
 * ___________ detecting Icon Size ___________
 *
 * Australis:
 *    the size/place of the buttons is detected
 *    via the "cui-areatype" attribute.
 * non-Australis:
 *    the selector includes the
 * parent toolbar[iconsize="..."]
 *
 *********************************************
 * ___________ customizing the UI ____________
 *
 * the toolbarbutton is wrapped in
 * toolbarpaletteitem[place="..."].
 * Places can be:
 *   palette (32px), panel (32px), toolbar
 * this is the same for Australs and non-
 * Australis firefox versions.
 *
 *********************************************
 */


/*
 * Case: customizing.
 * ==> red flag.
 * (the !important keyword is necessary.)
 */
toolbarpaletteitem #rpcontinuedToolbarButton,
toolbar[iconsize="small"] > toolbarpaletteitem #rpcontinuedToolbarButton {
  list-style-image:
    url(chrome://rpcontinued/skin/requestpolicy-icon-blocked.png) !important;
}
toolbar > toolbarpaletteitem #rpcontinuedToolbarButton,
toolbar[iconsize="large"] > toolbarpaletteitem #rpcontinuedToolbarButton {
  list-style-image:
    url(chrome://rpcontinued/skin/requestpolicy-icon-24-blocked.png) !important;
}
toolbarpaletteitem[place="palette"] #rpcontinuedToolbarButton,
toolbarpaletteitem[place="panel"] #rpcontinuedToolbarButton {
  list-style-image:
    url(chrome://rpcontinued/skin/requestpolicy-icon-32.png) !important;
}


/*
 * Case: "default" (no other selector matched) and
 * Case: something has been blocked
 * ==> red flag.
 */

/*** Australis only: (the new menu) ***/
/* default: */ #rpcontinuedToolbarButton[cui-areatype="menu-panel"],
/* blocked: */ #rpcontinuedToolbarButton[cui-areatype="menu-panel"][rpcontinuedBlocked="true"] {
  list-style-image:
    url(chrome://rpcontinued/skin/requestpolicy-icon-32.png);
}
/*** non-Australis only ***/
/* default: */ toolbar[iconsize="large"] #rpcontinuedToolbarButton,
/* blocked: */ toolbar[iconsize="large"] #rpcontinuedToolbarButton[rpcontinuedBlocked="true"] {
  list-style-image:
    url(chrome://rpcontinued/skin/requestpolicy-icon-24-blocked.png);
}
/*** "normal" toolbars (16px icons) ***/
/** Australis: **/
/* default: */ #rpcontinuedToolbarButton[cui-areatype="toolbar"],
/* blocked: */ #rpcontinuedToolbarButton[cui-areatype="toolbar"][rpcontinuedBlocked="true"],
/** non-Australis: **/
/* default: */ toolbar[iconsize="small"] #rpcontinuedToolbarButton,
/* blocked: */ toolbar[iconsize="small"] #rpcontinuedToolbarButton[rpcontinuedBlocked="true"] {
  list-style-image:
    url(chrome://rpcontinued/skin/requestpolicy-icon-blocked.png);
}


/*
 * Case: nothing has been blocked.
 * ==> grey flag.
 */


/*** Australis only: (the new menu) ***/
/* allowed: */ #rpcontinuedToolbarButton[cui-areatype="menu-panel"][rpcontinuedBlocked="false"] {
  list-style-image:
    url(chrome://rpcontinued/skin/requestpolicy-icon-32-allowed.png);
}
/*** non-Australis only ***/
/* allowed: */ toolbar[iconsize="large"] #rpcontinuedToolbarButton[rpcontinuedBlocked="false"] {
  list-style-image:
    url(chrome://rpcontinued/skin/requestpolicy-icon-24-allowed.png);
}
/*** "normal" toolbars (16px icons) ***/
/** selectors for Australis **/
/* allowed: */ #rpcontinuedToolbarButton[cui-areatype="toolbar"][rpcontinuedBlocked="false"],
/** selectors for non-Australis **/
/* allowed: */ toolbar[iconsize="small"] #rpcontinuedToolbarButton[rpcontinuedBlocked="false"] {
  list-style-image:
    url(chrome://rpcontinued/skin/requestpolicy-icon-allowed.png);
}

/*
 * Case: blocking is disabled.
 * ==> yellow flag.
 */

/*** Australis only: (the new menu) ***/
#rpcontinuedToolbarButton[cui-areatype="menu-panel"][rpcontinuedPermissive="true"] {
  list-style-image:
    url(chrome://rpcontinued/skin/requestpolicy-icon-32-disabled.png);
}
/*** non-Australis only ***/
toolbar[iconsize="large"] #rpcontinuedToolbarButton[rpcontinuedPermissive="true"] {
  list-style-image:
    url(chrome://rpcontinued/skin/requestpolicy-icon-24-disabled.png);
}
/*** "normal" toolbars (16px icons) ***/
/** Australis: **/
#rpcontinuedToolbarButton[cui-areatype="toolbar"][rpcontinuedPermissive="true"],
/** non-Australis: **/
toolbar[iconsize="small"] #rpcontinuedToolbarButton[rpcontinuedPermissive="true"] {
  list-style-image:
    url(chrome://rpcontinued/skin/requestpolicy-icon-disabled.png);
}
