Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | |
michael@0 | 3 | <!-- This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | - License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> |
michael@0 | 6 | |
michael@0 | 7 | <!DOCTYPE bindings [ |
michael@0 | 8 | <!ENTITY % checkboxDTD SYSTEM "chrome://browser/locale/checkbox.dtd"> |
michael@0 | 9 | %checkboxDTD; |
michael@0 | 10 | ]> |
michael@0 | 11 | |
michael@0 | 12 | <bindings |
michael@0 | 13 | xmlns="http://www.mozilla.org/xbl" |
michael@0 | 14 | xmlns:xbl="http://www.mozilla.org/xbl" |
michael@0 | 15 | xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 16 | |
michael@0 | 17 | <binding id="checkbox-toggleswitch" display="xul:box" extends="chrome://global/content/bindings/checkbox.xml#checkbox-baseline"> |
michael@0 | 18 | <content> |
michael@0 | 19 | <xul:hbox> |
michael@0 | 20 | <xul:description anonid="offlabel" class="offlabel" value="&checkbox.off.label;" xbl:inherits="value=offlabel"/> |
michael@0 | 21 | <xul:description anonid="onlabel" class="onlabel" value="&checkbox.on.label;" xbl:inherits="value=onlabel"/> |
michael@0 | 22 | <xul:radiogroup anonid="group" xbl:inherits="disabled"> |
michael@0 | 23 | <xul:radio type="toggle" anonid="off" class="checkbox-radio-off"/> |
michael@0 | 24 | <xul:radio type="toggle" anonid="on" class="checkbox-radio-on"/> |
michael@0 | 25 | </xul:radiogroup> |
michael@0 | 26 | </xul:hbox> |
michael@0 | 27 | </content> |
michael@0 | 28 | <implementation> |
michael@0 | 29 | <constructor><![CDATA[ |
michael@0 | 30 | this.setChecked(this.checked); |
michael@0 | 31 | ]]></constructor> |
michael@0 | 32 | |
michael@0 | 33 | <field name="_group"> |
michael@0 | 34 | document.getAnonymousElementByAttribute(this, "anonid", "group"); |
michael@0 | 35 | </field> |
michael@0 | 36 | |
michael@0 | 37 | <field name="_on"> |
michael@0 | 38 | document.getAnonymousElementByAttribute(this, "anonid", "on"); |
michael@0 | 39 | </field> |
michael@0 | 40 | |
michael@0 | 41 | <field name="_onlabel"> |
michael@0 | 42 | document.getAnonymousElementByAttribute(this, "anonid", "onlabel"); |
michael@0 | 43 | </field> |
michael@0 | 44 | |
michael@0 | 45 | <field name="_off"> |
michael@0 | 46 | document.getAnonymousElementByAttribute(this, "anonid", "off"); |
michael@0 | 47 | </field> |
michael@0 | 48 | |
michael@0 | 49 | <field name="_offlabel"> |
michael@0 | 50 | document.getAnonymousElementByAttribute(this, "anonid", "offlabel"); |
michael@0 | 51 | </field> |
michael@0 | 52 | |
michael@0 | 53 | <property name="onlabel" |
michael@0 | 54 | onget="return this._onlabel.value" |
michael@0 | 55 | onset="this._offlabel.value=val"/> |
michael@0 | 56 | |
michael@0 | 57 | <property name="offlabel" |
michael@0 | 58 | onget="return this._offlabel.value" |
michael@0 | 59 | onset="this._offlabel.value=val"/> |
michael@0 | 60 | |
michael@0 | 61 | <method name="setChecked"> |
michael@0 | 62 | <parameter name="aValue"/> |
michael@0 | 63 | <body> |
michael@0 | 64 | <![CDATA[ |
michael@0 | 65 | let change = (aValue != this.checked); |
michael@0 | 66 | |
michael@0 | 67 | if (aValue) { |
michael@0 | 68 | this.setAttribute("checked", "true"); |
michael@0 | 69 | this._group.selectedItem = this._on; |
michael@0 | 70 | } else { |
michael@0 | 71 | this.removeAttribute("checked"); |
michael@0 | 72 | this._group.selectedItem = this._off; |
michael@0 | 73 | } |
michael@0 | 74 | |
michael@0 | 75 | if (change) { |
michael@0 | 76 | this.fireEvent("CheckboxStateChange"); |
michael@0 | 77 | this.fireEvent("command"); |
michael@0 | 78 | } |
michael@0 | 79 | |
michael@0 | 80 | return aValue; |
michael@0 | 81 | ]]> |
michael@0 | 82 | </body> |
michael@0 | 83 | </method> |
michael@0 | 84 | |
michael@0 | 85 | <method name="fireEvent"> |
michael@0 | 86 | <parameter name="aName"/> |
michael@0 | 87 | <body> |
michael@0 | 88 | <![CDATA[ |
michael@0 | 89 | var event = document.createEvent("Events"); |
michael@0 | 90 | event.initEvent(aName, true, true); |
michael@0 | 91 | this.dispatchEvent(event); |
michael@0 | 92 | ]]> |
michael@0 | 93 | </body> |
michael@0 | 94 | </method> |
michael@0 | 95 | |
michael@0 | 96 | <method name="_onClickOrTap"> |
michael@0 | 97 | <parameter name="aEvent"/> |
michael@0 | 98 | <body> |
michael@0 | 99 | <![CDATA[ |
michael@0 | 100 | aEvent.stopPropagation(); |
michael@0 | 101 | this.setChecked(!this.checked); |
michael@0 | 102 | ]]> |
michael@0 | 103 | </body> |
michael@0 | 104 | </method> |
michael@0 | 105 | </implementation> |
michael@0 | 106 | <handlers> |
michael@0 | 107 | <handler event="click" button="0" phase="capturing"> |
michael@0 | 108 | <![CDATA[ |
michael@0 | 109 | this._onClickOrTap(event); |
michael@0 | 110 | ]]> |
michael@0 | 111 | </handler> |
michael@0 | 112 | </handlers> |
michael@0 | 113 | </binding> |
michael@0 | 114 | |
michael@0 | 115 | <binding id="setting-fulltoggle-bool" extends="chrome://mozapps/content/extensions/setting.xml#setting-bool"> |
michael@0 | 116 | <implementation> |
michael@0 | 117 | <constructor> |
michael@0 | 118 | <![CDATA[ |
michael@0 | 119 | this.input.classList.add("toggleswitch"); |
michael@0 | 120 | ]]> |
michael@0 | 121 | </constructor> |
michael@0 | 122 | </implementation> |
michael@0 | 123 | </binding> |
michael@0 | 124 | |
michael@0 | 125 | <binding id="setting-fulltoggle-boolint" extends="chrome://mozapps/content/extensions/setting.xml#setting-boolint"> |
michael@0 | 126 | <implementation> |
michael@0 | 127 | <constructor> |
michael@0 | 128 | <![CDATA[ |
michael@0 | 129 | this.input.classList.add("toggleswitch"); |
michael@0 | 130 | ]]> |
michael@0 | 131 | </constructor> |
michael@0 | 132 | </implementation> |
michael@0 | 133 | </binding> |
michael@0 | 134 | |
michael@0 | 135 | <binding id="setting-fulltoggle-localized-bool" extends="chrome://mozapps/content/extensions/setting.xml#setting-localized-bool"> |
michael@0 | 136 | <implementation> |
michael@0 | 137 | <constructor> |
michael@0 | 138 | <![CDATA[ |
michael@0 | 139 | this.input.classList.add("toggleswitch"); |
michael@0 | 140 | ]]> |
michael@0 | 141 | </constructor> |
michael@0 | 142 | </implementation> |
michael@0 | 143 | </binding> |
michael@0 | 144 | </bindings> |