home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / AIMP2 / aimp_2.61.583.exe / $TEMP / YandexPackSetup.msi / fil333421E42BA536C82EC8E1B5D9A3510D < prev    next >
Extensible Markup Language  |  2010-07-12  |  15KB  |  490 lines

  1. <?xml version="1.0"?>
  2.  
  3. <bindings xmlns="http://www.mozilla.org/xbl"
  4.           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  5.           xmlns:xbl="http://www.mozilla.org/xbl"
  6.           xmlns:html="http://www.w3.org/1999/xhtml">
  7.   
  8.   <binding id="tab-base">
  9.     <resources>
  10.       <stylesheet src="chrome://yasearch/skin/dialogs/tabbox.css"/>
  11.     </resources>
  12.   </binding>
  13.   
  14.   <binding id="dialogcontent"
  15.            extends="chrome://yasearch/content/dialogs/tabs-bindings.xbl#tab-base">
  16.     <content>
  17.       <xul:deck flex="1" anonid="deck">
  18.         <children includes="ya:tabbox"/>
  19.       </xul:deck>
  20.       <children/>
  21.     </content>
  22.     
  23.     <implementation>
  24.       <property name="selectedIndex">
  25.         <getter><![CDATA[
  26.           var indexStr = this.getAttribute("selectedIndex");
  27.           return indexStr ? parseInt(indexStr, 10) : -1;
  28.         ]]></getter>
  29.         
  30.         <setter><![CDATA[
  31.           this.setAttribute("selectedIndex", val);
  32.           this.deck.selectedIndex = val;
  33.           return val;
  34.         ]]></setter>
  35.       </property>
  36.       
  37.       <property name="selectedPanel" readonly="true">
  38.         <getter><![CDATA[
  39.           return this.deck.panels[this.selectedIndex];
  40.         ]]></getter>
  41.       </property>
  42.       
  43.       <field name="deck">document.getAnonymousElementByAttribute(this, "anonid", "deck")</field>
  44.       
  45.       <constructor><![CDATA[
  46.         this.selectedIndex = 0;
  47.       ]]></constructor>
  48.       
  49.     </implementation>
  50.     
  51.     <handlers>
  52.       <handler event="click" button="0">
  53.       <![CDATA[
  54.         var anonid, target = event.originalTarget;
  55.         while (target && 'getAttribute' in target && !(anonid = target.getAttribute("anonid")))
  56.           target = target.parentNode;
  57.         
  58.         if (anonid == "closeButton") {
  59.           document.documentElement.cancelDialog();
  60.         }
  61.       ]]>
  62.       </handler>
  63.     </handlers>
  64.   </binding>
  65.   
  66.   <binding id="deck-stack">
  67.     <implementation>
  68.       <property name="panels" readonly="true">
  69.         <getter><![CDATA[
  70.           return Array.slice(document.getBindingParent(this)
  71.                    .getElementsByTagNameNS("http://bar.yandex.ru/firefox", "tabbox"));
  72.         ]]></getter>
  73.       </property>
  74.       
  75.       <property name="selectedIndex">
  76.         <getter><![CDATA[
  77.           var indexStr = this.getAttribute("selectedIndex");
  78.           return indexStr ? parseInt(indexStr, 10) : -1;
  79.         ]]></getter>
  80.         
  81.         <setter><![CDATA[
  82.           if (val < 0 || val >= this.panels.length)
  83.             return val;
  84.           
  85.           this.setAttribute("selectedIndex", val);
  86.           
  87.           var panelToSelect = this.panels[this.selectedIndex];
  88.           panelToSelect.setAttribute("selected", "true");
  89.           
  90.           Array.forEach(this.panels, function (aPanel) {
  91.             if (aPanel != panelToSelect)
  92.               aPanel.setAttribute("selected", "false");
  93.           });
  94.           
  95.           return val;
  96.         ]]></setter>
  97.       </property>
  98.     </implementation>
  99.   </binding>
  100.   
  101.   <binding id="tabbox"
  102.            extends="chrome://yasearch/content/dialogs/tabs-bindings.xbl#tab-base">
  103.     <content yaSingleTabbox="true">
  104.       <xul:stack anonid="title" yadraggable="true">
  105.         <xul:image anonid="title-bg"/>
  106.         <xul:vbox anonid="throbber-container" flex="1" pack="center" align="start">
  107.           <xul:image/>
  108.         </xul:vbox>
  109.         <xul:hbox anonid="label-container" flex="1" pack="center" align="center">
  110.           <xul:label xbl:inherits="value=title" flex="1"/>
  111.         </xul:hbox>
  112.         <xul:vbox flex="1" pack="center" align="end">
  113.           <html:div anonid="closeButton" yadraggable="false"/>
  114.         </xul:vbox>
  115.       </xul:stack>
  116.       <xul:stack anonid="content-stack" flex="1">
  117.         <html:div class="content-background" flex="1">
  118.           <html:img src="chrome://yasearch/skin/dialogs/images/dialog/content.bg.png"/>
  119.         </html:div>
  120.         <xul:vbox anonid="content" flex="1">
  121.           <children/>
  122.         </xul:vbox>
  123.       </xul:stack>
  124.     </content>
  125.     
  126.     <implementation>
  127.       <field name="content">document.getAnonymousElementByAttribute(this, "anonid", "content")</field>
  128.       <field name="contentTitle">document.getAnonymousElementByAttribute(this, "anonid", "title")</field>
  129.       
  130.       <property name="currentHeight" readonly="true">
  131.         <getter><![CDATA[
  132.           return this.contentTitle.boxObject.height +
  133.                  this.content.boxObject.height;
  134.         ]]></getter>
  135.       </property>
  136.       
  137.       <field name="_busy">false</field>
  138.       <field name="_busyTimeout">null</field>
  139.       
  140.       <method name="_clearBusyTimeout">
  141.         <body><![CDATA[
  142.           if (this._busyTimeout) {
  143.             window.clearTimeout(this._busyTimeout);
  144.             this._busyTimeout = null;
  145.           }
  146.         ]]></body>
  147.       </method>
  148.       
  149.       <property name="busy">
  150.         <getter><![CDATA[
  151.           return this._busy;
  152.         ]]></getter>
  153.         
  154.         <setter><![CDATA[
  155.           val = !!val;
  156.           
  157.           if (this._busy != val) {
  158.             this._busy = val;
  159.             
  160.             this._clearBusyTimeout();
  161.             this._busyTimeout = window.setTimeout(function(me) {
  162.               me.setAttribute("busy", val);
  163.             }, 1000, this)
  164.           }
  165.           
  166.           return val;
  167.         ]]></setter>
  168.       </property>
  169.       
  170.       <property name="tabs" readonly="true">
  171.         <getter><![CDATA[
  172.           return this.getElementsByTagNameNS("http://bar.yandex.ru/firefox", "tabs").item(0);
  173.         ]]></getter>
  174.       </property>
  175.       
  176.       <property name="tabpanels" readonly="true">
  177.         <getter><![CDATA[
  178.           return this.getElementsByTagNameNS("http://bar.yandex.ru/firefox", "tabpanels").item(0);
  179.         ]]></getter>
  180.       </property>
  181.       
  182.       <property name="selectedIndex">
  183.         <getter><![CDATA[
  184.           var tabs = this.tabs;
  185.           return tabs ? tabs.selectedIndex : -1;
  186.         ]]></getter>
  187.         
  188.         <setter><![CDATA[
  189.           var tabs = this.tabs;
  190.           
  191.           if (tabs)
  192.             tabs.selectedIndex = val;
  193.           
  194.           this.setAttribute("selectedIndex", val);
  195.           
  196.           return val;
  197.         ]]></setter>
  198.       </property>
  199.       
  200.       <property name="selectedTab">
  201.         <getter><![CDATA[
  202.           var tabs = this.tabs;
  203.           return tabs && tabs.selectedItem;
  204.         ]]></getter>
  205.         
  206.         <setter><![CDATA[
  207.           if (val) {
  208.             var tabs = this.tabs;
  209.             if (tabs)
  210.               tabs.selectedItem = val;
  211.           }
  212.           return val;
  213.         ]]></setter>
  214.       </property>
  215.       
  216.       <property name="selectedPanel">
  217.         <getter><![CDATA[
  218.           var tabpanels = this.tabpanels;
  219.           return tabpanels && tabpanels.selectedPanel;
  220.         ]]></getter>
  221.         
  222.         <setter><![CDATA[
  223.           if (val) {
  224.             var tabpanels = this.tabpanels;
  225.             if (tabpanels)
  226.               tabpanels.selectedPanel = val;
  227.           }
  228.           return val;
  229.         ]]></setter>
  230.       </property>
  231.       
  232.       <constructor><![CDATA[
  233.       ]]></constructor>
  234.       
  235.       <destructor><![CDATA[
  236.         this._clearBusyTimeout();
  237.       ]]></destructor>
  238.     </implementation>
  239.     
  240.   </binding>
  241.   
  242.   <binding id="tabs"
  243.            extends="chrome://yasearch/content/dialogs/tabs-bindings.xbl#tab-base">
  244.     <content>
  245.       <xul:hbox xbl:inherits="equalsize">
  246.         <children/>
  247.       </xul:hbox>
  248.     </content>
  249.     
  250.     <implementation>
  251.       <property name="tabs" readonly="true"
  252.                 onget="return this.getElementsByTagNameNS('http://bar.yandex.ru/firefox', 'tab')"/>
  253.       
  254.       <constructor><![CDATA[
  255.         for (var parent = this.parentNode; parent; parent = parent.parentNode) {
  256.           if (parent.localName == "tabbox" && parent.hasAttribute("selectedIndex")) {
  257.             var selectedIndex = parseInt(parent.getAttribute("selectedIndex"), 10);
  258.             this.selectedIndex = selectedIndex > 0 ? selectedIndex : 0;
  259.             return;
  260.           }
  261.         }
  262.         
  263.         var children = this.tabs;
  264.         var length = children.length;
  265.         for (var i = 0; i < length; i++) {
  266.           if (children[i].getAttribute("selected") == "true") {
  267.             this.selectedIndex = i;
  268.             return;
  269.           }
  270.         }
  271.         
  272.         this.selectedIndex = 0;
  273.       ]]></constructor>
  274.       
  275.       <property name="itemCount" readonly="true"
  276.                 onget="return this.tabs.length"/>
  277.       
  278.       <property name="selectedIndex">
  279.         <getter><![CDATA[
  280.           const tabs = this.tabs;
  281.           for (var i = 0; i < tabs.length; i++) {
  282.             if (tabs[i].selected)
  283.               return i;
  284.           }
  285.           return -1;
  286.         ]]></getter>
  287.         
  288.         <setter><![CDATA[
  289.           var tab = this.getItemAtIndex(val);
  290.           if (tab) {
  291.             var alreadySelected = tab.selected;
  292.             
  293.             Array.forEach(this.tabs, function (aTab) {
  294.               if (aTab.selected && aTab != tab)
  295.                 aTab._selected = false;
  296.             });
  297.             
  298.             tab._selected = true;
  299.             
  300.             for (var parent = this.parentNode; parent; parent = parent.parentNode) {
  301.               if (parent.localName == 'tabbox') {
  302.                 parent.setAttribute("selectedIndex", val);
  303.                 
  304.                 var tabpanels = parent.tabpanels;
  305.                 if (tabpanels)
  306.                   tabpanels.selectedIndex = val;
  307.                 
  308.                 break;
  309.               }
  310.             }
  311.             
  312.             if (!alreadySelected) {
  313.               var event = document.createEvent('Events');
  314.               event.initEvent('select', true, true);
  315.               this.dispatchEvent(event);
  316.             }
  317.           }
  318.           return val;
  319.         ]]></setter>
  320.       </property>
  321.       
  322.       <property name="selectedItem">
  323.         <getter><![CDATA[
  324.           const tabs = this.tabs;
  325.           for (var i = 0; i < tabs.length; i++) {
  326.             if (tabs[i].selected)
  327.               return tabs[i];
  328.           }
  329.           return null;
  330.         ]]></getter>
  331.         
  332.         <setter><![CDATA[
  333.           if (val && !val.selected) {
  334.             this.selectedIndex = this.getIndexOfItem(val);
  335.           }
  336.           return val;
  337.         ]]>
  338.         </setter>
  339.       </property>
  340.       
  341.       <method name="getIndexOfItem">
  342.         <parameter name="item"/>
  343.         <body><![CDATA[
  344.           return Array.indexOf(this.tabs, item);
  345.         ]]></body>
  346.       </method>
  347.  
  348.       <method name="getItemAtIndex">
  349.         <parameter name="index"/>
  350.         <body><![CDATA[
  351.           return this.tabs.item(index);
  352.         ]]></body>
  353.       </method>
  354.       
  355.       <method name="_selectNewTab">
  356.         <parameter name="aNewTab"/>
  357.         <parameter name="aFallbackDir"/>
  358.         <parameter name="aWrap"/>
  359.         <body><![CDATA[
  360.           this.selectedItem = aNewTab;
  361.         ]]></body>
  362.       </method>
  363.       
  364.     </implementation>
  365.   </binding>
  366.   
  367.   <binding id="tab"
  368.            extends="chrome://yasearch/content/dialogs/tabs-bindings.xbl#tab-base">
  369.     <content>
  370.       <xul:stack>
  371.         <xul:vbox anonid="tab-corner-container">
  372.           <xul:image anonid="tab-corner-image"/>
  373.         </xul:vbox>
  374.         <xul:image anonid="title-bg"/>
  375.         <xul:hbox flex="1" pack="center" align="center">
  376.           <xul:label xbl:inherits="value=label" flex="1" crop="end"/>
  377.         </xul:hbox>
  378.       </xul:stack>
  379.     </content>
  380.     
  381.     <implementation>
  382.       <property name="selected" readonly="true"
  383.                 onget="return this.getAttribute('selected') == 'true';"/>
  384.       
  385.       <property name="_selected">
  386.         <setter>
  387.           <![CDATA[
  388.           this.setAttribute("selected", val);
  389.           return val;
  390.         ]]>
  391.         </setter>
  392.       </property>
  393.     </implementation>
  394.     
  395.     <handlers>
  396.       <handler event="mousedown" button="0">
  397.       <![CDATA[
  398.         if (this.disabled)
  399.           return;
  400.         
  401.         if (this != this.parentNode.selectedItem) {
  402.           window.setTimeout(function setTab(tab) {
  403.             tab.parentNode._selectNewTab(tab);
  404.           }, 0, this);
  405.         }
  406.       ]]>
  407.       </handler>
  408.     </handlers>
  409.   </binding>
  410.   
  411.   <binding id="tabpanels"
  412.            extends="chrome://yasearch/content/dialogs/tabs-bindings.xbl#tab-base">
  413.     <content>
  414.       <xul:deck flex="1" anonid="panelsDeck" xbl:inherits="selectedIndex">
  415.         <children includes="ya:tabpanel"/>
  416.       </xul:deck>
  417.       <children/>
  418.     </content>
  419.     
  420.     <implementation>
  421.       <property name="panels" readonly="true">
  422.         <getter><![CDATA[
  423.           return this.getElementsByTagNameNS("http://bar.yandex.ru/firefox", "tabpanel");
  424.         ]]></getter>
  425.       </property>
  426.       
  427.       <property name="selectedIndex">
  428.         <getter><![CDATA[
  429.           var indexStr = this.getAttribute("selectedIndex");
  430.           return indexStr ? parseInt(indexStr, 10) : -1;
  431.         ]]></getter>
  432.         
  433.         <setter><![CDATA[
  434.           if (val < 0 || val >= this.panels.length)
  435.             return val;
  436.           
  437.           var panel = this._selectedPanel;
  438.           
  439.           this._selectedPanel = this.panels.item(val);
  440.           this.setAttribute("selectedIndex", val);
  441.           
  442.           if (this._selectedPanel != panel) {
  443.             if (panel && panel.selected)
  444.               panel._selected = false;
  445.             
  446.             this._selectedPanel.setAttribute("selected", true);
  447.           }
  448.           
  449.           return val;
  450.         ]]></setter>
  451.       </property>
  452.       
  453.       <property name="selectedPanel">
  454.         <getter><![CDATA[
  455.           return this._selectedPanel;
  456.         ]]></getter>
  457.         
  458.         <setter><![CDATA[
  459.           var selectedIndex = -1;
  460.           for (var panel = val; panel != null; panel = panel.previousSibling)
  461.             ++selectedIndex;
  462.           
  463.           this.selectedIndex = selectedIndex;
  464.           
  465.           return val;
  466.         ]]></setter>
  467.       </property>
  468.       
  469.       <field name="_selectedPanel">this.panels.item(this.selectedIndex)</field>
  470.       
  471.     </implementation>
  472.   </binding>
  473.   
  474.   <binding id="tabpanel"
  475.            extends="chrome://yasearch/content/dialogs/tabs-bindings.xbl#tab-base">
  476.     <implementation>
  477.       <property name="selected" readonly="true"
  478.                 onget="return this.getAttribute('selected') == 'true';"/>
  479.       
  480.       <property name="_selected">
  481.         <setter>
  482.           <![CDATA[
  483.           this.setAttribute("selected", val);
  484.           return val;
  485.         ]]>
  486.         </setter>
  487.       </property>
  488.     </implementation>
  489.   </binding>
  490. </bindings>