treestyletab/content/treestyletab/res/tabFx2Compatible.xul

66 lines
2.2 KiB
XML

<?xml version="1.0"?>
<!--
Firefox 2 compatible tab structure library for Firefox 3 or later
Usage:
<?xul-overlay href="tabFx2Compatible.xul"?>
lisence: The MIT License, Copyright (c) 2009 SHIMODA "Piro" Hiroshi
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/license.txt
original:
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/tabFx2Compatible.xul
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/tabFx2Compatible.xml
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/tabFx2Compatible.css
-->
<?xml-stylesheet href="tabFx2Compatible.css" type="text/css"?>
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript"><![CDATA[
window.addEventListener('DOMContentLoaded', function() {
window.removeEventListener('DOMContentLoaded', arguments.callee, true);
const currentRevision = 3;
var b = document.getElementById('content');
if (!b || b.localName != 'tabbrowser') return;
var root = document.documentElement;
var loadedRevision = root.getAttribute('tabFx2Compatible');
if (loadedRevision) {
loadedRevision = Number(loadedRevision);
if (loadedRevision >= currentRevision) {
return;
}
else if (loadedRevision < currentRevision) {
root.setAttribute('tabFx2Compatible', currentRevision);
return;
}
}
var url = window.getComputedStyle(b.selectedTab, '').getPropertyValue('-moz-binding');
url = url.match(/url\(['"]?(.+)['"]?\)/);
url = url ? url[1] : null ;
switch (url)
{
case 'chrome://browser/skin/browser.xml#tabbrowser-tab': // defied by theme
const Pref = Components.classes['@mozilla.org/preferences;1']
.getService(Components.interfaces.nsIPrefBranch);
var skin = decodeURIComponent(escape(Pref.getCharPref('general.skins.selectedSkin')));
switch (skin.toLowerCase())
{
case 'classic/1.0': // Default
case 'chromifox': // Chromifox Basic: https://addons.mozilla.org/firefox/addon/8782
break;
default:
return;
}
case 'chrome://browser/content/tabbrowser.xml#tabbrowser-tab': // built-in
root.setAttribute('tabFx2Compatible', currentRevision);
break;
}
}, true);
]]></script>
</overlay>