prefs.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
  5. <!DOCTYPE bindings SYSTEM "chrome://browser/locale/statusbar/statusbar-prefs.dtd">
  6. <bindings id="status4evar-prefs-bindings"
  7. xmlns="http://www.mozilla.org/xbl"
  8. xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  9. xmlns:xbl="http://www.mozilla.org/xbl">
  10. <binding id="css-bg-editor">
  11. <content sizetopopup="pref">
  12. <xul:vbox flex="1">
  13. <xul:deck anonid="css-bg-editor-deck" flex="1">
  14. <xul:vbox>
  15. <xul:hbox align="center">
  16. <xul:label xbl:inherits="disabled">&status4evar.editor.css.color.label;</xul:label>
  17. <xul:colorpicker anonid="css-bg-editor-color" type="button" onchange="this._editor._buildCSS();" xbl:inherits="disabled" />
  18. </xul:hbox>
  19. <xul:hbox align="center">
  20. <xul:label xbl:inherits="disabled">&status4evar.editor.css.image.label;</xul:label>
  21. <xul:textbox anonid="css-bg-editor-image" readonly="true" flex="1" xbl:inherits="disabled" />
  22. <xul:button anonid="css-bg-editor-image-browse" label="&status4evar.option.browse;" oncommand="this._editor._imageBrowse();" xbl:inherits="disabled" />
  23. </xul:hbox>
  24. <xul:hbox align="center" pack="end">
  25. <xul:button anonid="css-bg-editor-image-clear" label="&status4evar.option.clear;" oncommand="this._editor._imageClear();" xbl:inherits="disabled=no-image" />
  26. </xul:hbox>
  27. <xul:hbox>
  28. <xul:groupbox pack="center">
  29. <xul:caption label="" />
  30. <xul:hbox flex="1" align="center">
  31. <xul:label>X</xul:label>
  32. </xul:hbox>
  33. <xul:separator class="groove" orient="horizontal" />
  34. <xul:hbox flex="1" align="center">
  35. <xul:label>Y</xul:label>
  36. </xul:hbox>
  37. </xul:groupbox>
  38. <xul:groupbox>
  39. <xul:caption label="&status4evar.editor.css.image.repeat;" xbl:inherits="disabled=no-image" />
  40. <xul:menulist anonid="css-bg-editor-image-repeat-x" sizetopopup="always" onselect="this._editor._buildCSS();" xbl:inherits="disabled=no-image">
  41. <xul:menupopup>
  42. <xul:menuitem label="&status4evar.option.no-repeat;" value="no-repeat" />
  43. <xul:menuitem label="&status4evar.option.repeat;" value="repeat" />
  44. <!--
  45. <xul:menuitem label="&status4evar.option.space;" value="space" />
  46. <xul:menuitem label="&status4evar.option.round;" value="round" />
  47. -->
  48. </xul:menupopup>
  49. </xul:menulist>
  50. <xul:separator class="groove" orient="horizontal" />
  51. <xul:menulist anonid="css-bg-editor-image-repeat-y" sizetopopup="always" onselect="this._editor._buildCSS();" xbl:inherits="disabled=no-image">
  52. <xul:menupopup>
  53. <xul:menuitem label="&status4evar.option.no-repeat;" value="no-repeat" />
  54. <xul:menuitem label="&status4evar.option.repeat;" value="repeat" />
  55. <!--
  56. <xul:menuitem label="&status4evar.option.space;" value="space" />
  57. <xul:menuitem label="&status4evar.option.round;" value="round" />
  58. -->
  59. </xul:menupopup>
  60. </xul:menulist>
  61. </xul:groupbox>
  62. <xul:groupbox>
  63. <xul:caption label="&status4evar.editor.css.image.position;" xbl:inherits="disabled=no-image" />
  64. <xul:menulist anonid="css-bg-editor-image-position-x" sizetopopup="always" onselect="this._editor._updatePositionX();" xbl:inherits="disabled=no-image">
  65. <xul:menupopup>
  66. <xul:menuitem label="&status4evar.option.left;" value="left" />
  67. <xul:menuitem label="&status4evar.option.center;" value="center" />
  68. <xul:menuitem label="&status4evar.option.right;" value="right" />
  69. <xul:menuitem label="&status4evar.option.offset;" value="offset" />
  70. </xul:menupopup>
  71. </xul:menulist>
  72. <xul:separator class="groove" orient="horizontal" />
  73. <xul:menulist anonid="css-bg-editor-image-position-y" sizetopopup="always" onselect="this._editor._updatePositionY();" xbl:inherits="disabled=no-image">
  74. <xul:menupopup>
  75. <xul:menuitem label="&status4evar.option.top;" value="top" />
  76. <xul:menuitem label="&status4evar.option.center;" value="center" />
  77. <xul:menuitem label="&status4evar.option.bottom;" value="bottom" />
  78. <xul:menuitem label="&status4evar.option.offset;" value="offset" />
  79. </xul:menupopup>
  80. </xul:menulist>
  81. </xul:groupbox>
  82. <xul:groupbox>
  83. <xul:caption label="&status4evar.editor.css.image.offset;" xbl:inherits="disabled=no-image" />
  84. <xul:hbox>
  85. <xul:textbox anonid="css-bg-editor-image-offset-x" type="number" size="4" min="-65535" onchange="this._editor._buildCSS();" />
  86. <xul:menulist anonid="css-bg-editor-image-offset-unit-x" sizetopopup="always" onselect="this._editor._buildCSS();">
  87. <xul:menupopup>
  88. <xul:menuitem label="%" value="%" />
  89. <xul:menuitem label="px" value="px" />
  90. <xul:menuitem label="em" value="em" />
  91. <xul:menuitem label="in" value="in" />
  92. <xul:menuitem label="cm" value="cm" />
  93. <xul:menuitem label="mm" value="mm" />
  94. <xul:menuitem label="pt" value="pt" />
  95. <xul:menuitem label="pc" value="pc" />
  96. </xul:menupopup>
  97. </xul:menulist>
  98. </xul:hbox>
  99. <xul:separator class="groove" orient="horizontal" />
  100. <xul:hbox>
  101. <xul:textbox anonid="css-bg-editor-image-offset-y" type="number" size="4" min="-65535" onchange="this._editor._buildCSS();" />
  102. <xul:menulist anonid="css-bg-editor-image-offset-unit-y" sizetopopup="always" onselect="this._editor._buildCSS();">
  103. <xul:menupopup>
  104. <xul:menuitem label="%" value="%" />
  105. <xul:menuitem label="px" value="px" />
  106. <xul:menuitem label="em" value="em" />
  107. <xul:menuitem label="in" value="in" />
  108. <xul:menuitem label="cm" value="cm" />
  109. <xul:menuitem label="mm" value="mm" />
  110. <xul:menuitem label="pt" value="pt" />
  111. <xul:menuitem label="pc" value="pc" />
  112. </xul:menupopup>
  113. </xul:menulist>
  114. </xul:hbox>
  115. </xul:groupbox>
  116. </xul:hbox>
  117. </xul:vbox>
  118. <xul:textbox anonid="css-bg-editor-css-text" multiline="true" rows="6" xbl:inherits="disabled" />
  119. </xul:deck>
  120. </xul:vbox>
  121. <xul:hbox align="center" pack="end">
  122. <children includes="progressmeter|toolbox" />
  123. <xul:label xbl:inherits="disabled">&status4evar.editor.label;</xul:label>
  124. <xul:menulist anonid="css-bg-editor-mode-menu" sizetopopup="always" onselect="this._editor._updateMode();" xbl:inherits="disabled">
  125. <xul:menupopup>
  126. <xul:menuitem label="&status4evar.option.simple;" />
  127. <xul:menuitem label="&status4evar.option.advanced;" />
  128. </xul:menupopup>
  129. </xul:menulist>
  130. </xul:hbox>
  131. </content>
  132. <implementation>
  133. <constructor><![CDATA[
  134. [
  135. "_editorColor",
  136. "_editorImageBrowse",
  137. "_editorImageClear",
  138. "_editorImageRepeatX",
  139. "_editorImageRepeatY",
  140. "_editorImagePositionX",
  141. "_editorImagePositionY",
  142. "_editorImageOffsetX",
  143. "_editorImageOffsetY",
  144. "_editorImageOffsetUnitX",
  145. "_editorImageOffsetUnitY",
  146. "_editorMode"
  147. ].forEach(function(prop)
  148. {
  149. this[prop]._editor = this;
  150. }, this);
  151. this.setAdvanced(true, false);
  152. ]]></constructor>
  153. <destructor><![CDATA[
  154. ]]></destructor>
  155. <field name="_disableBuildCSS"><![CDATA[
  156. true
  157. ]]></field>
  158. <field name="_editorColor" readonly="true"><![CDATA[
  159. document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-color");
  160. ]]></field>
  161. <field name="_editorCSS" readonly="true"><![CDATA[
  162. document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-css-text");
  163. ]]></field>
  164. <field name="_editorDeck" readonly="true"><![CDATA[
  165. document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-deck");
  166. ]]></field>
  167. <field name="_editorImage" readonly="true"><![CDATA[
  168. document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image");
  169. ]]></field>
  170. <field name="_editorImageBrowse" readonly="true"><![CDATA[
  171. document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-browse");
  172. ]]></field>
  173. <field name="_editorImageClear" readonly="true"><![CDATA[
  174. document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-clear");
  175. ]]></field>
  176. <field name="_editorImageRepeatX" readonly="true"><![CDATA[
  177. document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-repeat-x");
  178. ]]></field>
  179. <field name="_editorImageRepeatY" readonly="true"><![CDATA[
  180. document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-repeat-y");
  181. ]]></field>
  182. <field name="_editorImagePositionX" readonly="true"><![CDATA[
  183. document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-position-x");
  184. ]]></field>
  185. <field name="_editorImagePositionY" readonly="true"><![CDATA[
  186. document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-position-y");
  187. ]]></field>
  188. <field name="_editorImageOffsetX" readonly="true"><![CDATA[
  189. document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-offset-x");
  190. ]]></field>
  191. <field name="_editorImageOffsetY" readonly="true"><![CDATA[
  192. document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-offset-y");
  193. ]]></field>
  194. <field name="_editorImageOffsetUnitX" readonly="true"><![CDATA[
  195. document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-offset-unit-x");
  196. ]]></field>
  197. <field name="_editorImageOffsetUnitY" readonly="true"><![CDATA[
  198. document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-offset-unit-y");
  199. ]]></field>
  200. <field name="_editorMode" readonly="true"><![CDATA[
  201. document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-mode-menu");
  202. ]]></field>
  203. <field name="_initialized"><![CDATA[
  204. false
  205. ]]></field>
  206. <field name="_reRGB" readonly="true"><![CDATA[
  207. /^rgb\((\d+), (\d+), (\d+)\)$/
  208. ]]></field>
  209. <field name="_reURL" readonly="true"><![CDATA[
  210. /^url\(\s*['"]?(.+?)['"]?\s*\)$/
  211. ]]></field>
  212. <field name="_reBgPosition" readonly="true"><![CDATA[
  213. /^(left|center|right)? ?(-?\d+[^\s\d]+)? ?(top|center|bottom)? ?(-?\d+[^\s\d]+)?$/
  214. ]]></field>
  215. <field name="_reCSSUnit" readonly="true"><![CDATA[
  216. /^(-?\d+)([^\s\d]+)$/
  217. ]]></field>
  218. <field name="_strings" readonly="true"><![CDATA[
  219. document.getElementById("bundle_status4evar");
  220. ]]></field>
  221. <property name="value">
  222. <getter><![CDATA[
  223. return this._editorCSS.value;
  224. ]]></getter>
  225. <setter><![CDATA[
  226. this._editorCSS.value = val;
  227. if(!this._initialized)
  228. {
  229. this.setAdvanced(false, false);
  230. this._initialized = true;
  231. }
  232. return val;
  233. ]]></setter>
  234. </property>
  235. <property name="disabled">
  236. <getter><![CDATA[
  237. return this.getAttribute("disabled") == "true";
  238. ]]></getter>
  239. <setter><![CDATA[
  240. if(val)
  241. {
  242. this.setAttribute("disabled", "true");
  243. }
  244. else
  245. {
  246. this.removeAttribute("disabled");
  247. }
  248. this._updateImageControllDisable();
  249. return val;
  250. ]]></setter>
  251. </property>
  252. <method name="setAdvanced">
  253. <parameter name="aVal"/>
  254. <parameter name="aPrompt"/>
  255. <body><![CDATA[
  256. if(!aVal)
  257. {
  258. let success = this._parseCSS();
  259. if(!success)
  260. {
  261. let result = aPrompt && Services.prompt.confirm(window,
  262. this._strings.getString("simpleEditorTitle"),
  263. this._strings.getString("simpleEditorMessage"));
  264. if(result)
  265. { // Continue to simple mode
  266. this._buildCSS();
  267. }
  268. else
  269. { // Stay on advanced mode
  270. aVal = true;
  271. }
  272. }
  273. }
  274. this._disableBuildCSS = aVal;
  275. this._editorDeck.selectedIndex = ((aVal) ? 1 : 0);
  276. this._editorMode.selectedIndex = ((aVal) ? 1 : 0);
  277. ]]></body>
  278. </method>
  279. <method name="_buildCSS">
  280. <body><![CDATA[
  281. if(this._disableBuildCSS)
  282. {
  283. return;
  284. }
  285. let cssVal = this._editorColor.color;
  286. let imgVal = this._editorImage.value;
  287. if(imgVal)
  288. {
  289. cssVal += " url(\"" + imgVal + "\")";
  290. //
  291. // Print the background repeat
  292. //
  293. let bgRX = this._editorImageRepeatX.value;
  294. let bgRY = this._editorImageRepeatY.value;
  295. if(bgRX == "repeat" && bgRY == "no-repeat")
  296. {
  297. cssVal += " repeat-x";
  298. }
  299. else if(bgRX == "no-repeat" && bgRY == "repeat")
  300. {
  301. cssVal += " repeat-y";
  302. }
  303. else
  304. {
  305. cssVal += " " + bgRX;
  306. if(bgRX != bgRY)
  307. {
  308. cssVal += " " + bgRY;
  309. }
  310. }
  311. //
  312. // Print the background position
  313. //
  314. let bgPX = this._editorImagePositionX.value;
  315. let bgPOX = this._editorImageOffsetX.value;
  316. if(bgPX != "offset")
  317. {
  318. cssVal += " " + bgPX;
  319. }
  320. else
  321. {
  322. cssVal += " " + bgPOX + this._editorImageOffsetUnitX.value;
  323. }
  324. let bgPY = this._editorImagePositionY.value;
  325. let bgPOY = this._editorImageOffsetY.value;
  326. if(bgPY != "offset")
  327. {
  328. cssVal += " " + bgPY;
  329. }
  330. else
  331. {
  332. cssVal += " " + bgPOY + this._editorImageOffsetUnitY.value;
  333. }
  334. }
  335. this._editorCSS.value = cssVal;
  336. let event = document.createEvent("Event");
  337. event.initEvent("change", true, true);
  338. this._editorCSS.dispatchEvent(event);
  339. ]]></body>
  340. </method>
  341. <method name="_parseCSS">
  342. <body><![CDATA[
  343. let retVal = true;
  344. let cssParser = document.createElement("div");
  345. cssParser.style.background = this._editorCSS.value;
  346. if(!cssParser.style.background)
  347. {
  348. Components.utils.reportError("Error parsing background CSS rule: " + this._editorCSS.value);
  349. cssParser.style.background = "#33FF33";
  350. retVal = false;
  351. }
  352. //
  353. // Parse the background color
  354. //
  355. let bgC = cssParser.style.backgroundColor;
  356. if(this._reRGB.test(bgC))
  357. {
  358. let digits = this._reRGB.exec(bgC);
  359. let red = parseInt(digits[1]);
  360. let green = parseInt(digits[2]);
  361. let blue = parseInt(digits[3]);
  362. let rgb = blue | (green << 8) | (red << 16);
  363. bgC = "#" + rgb.toString(16);
  364. }
  365. else
  366. {
  367. Components.utils.reportError("Error parsing background-color value: " + bgC);
  368. bgC = "#33FF33";
  369. retVal = false;
  370. }
  371. //
  372. // Parse the background image
  373. //
  374. let bgI = cssParser.style.backgroundImage;
  375. if(bgI != "none" && !this._reURL.test(bgI))
  376. {
  377. Components.utils.reportError("Error parsing background-image value: " + bgI);
  378. bgI = "none";
  379. retVal = false;
  380. }
  381. bgI = ((bgI != "none") ? this._reURL.exec(bgI)[1].trim() : "");
  382. //
  383. // Parse the background repeat
  384. //
  385. let bgR = cssParser.style.backgroundRepeat.split(" ");
  386. let bgRX = bgR[0];
  387. if(bgRX == "repeat-x")
  388. {
  389. bgRX = "repeat";
  390. }
  391. else if(bgRX == "repeat-y")
  392. {
  393. bgRX = "no-repeat";
  394. }
  395. let bgRY = bgR[bgR.length - 1];
  396. if(bgRY == "repeat-x")
  397. {
  398. bgRY = "no-repeat";
  399. }
  400. else if(bgRY == "repeat-y")
  401. {
  402. bgRY = "repeat";
  403. }
  404. //
  405. // Parse the background position
  406. //
  407. let bgP = cssParser.style.backgroundPosition;
  408. let bgPParts = this._reBgPosition.exec(bgP);
  409. let bgPValues = new Array();
  410. for(let i = 1; i <= 4; i++)
  411. {
  412. if(bgPParts[i])
  413. {
  414. bgPValues.push({
  415. "value": bgPParts[i],
  416. "group": i
  417. });
  418. }
  419. }
  420. if(bgPValues.length == 1)
  421. {
  422. bgPValues.splice(((bgPValues[0].group == 2) ? 0 : 1), 0, {
  423. "value": "center",
  424. "group": ((bgPValues[0].group == 2) ? 0 : 2)
  425. });
  426. }
  427. if(bgPValues.length == 2 && bgPValues[1].group == 2)
  428. {
  429. bgPValues[1].group = 4;
  430. }
  431. for(let i = 0; i < 4; i++)
  432. {
  433. let group = (i + 1);
  434. if(bgPValues[i] != undefined && bgPValues[i].group == group)
  435. {
  436. continue;
  437. }
  438. let tmp = "0px";
  439. switch(i)
  440. {
  441. case 0:
  442. tmp = "offset";
  443. break;
  444. case 2:
  445. tmp = "offset";
  446. break;
  447. }
  448. bgPValues.splice(i, 0, {
  449. "value": tmp,
  450. "group": group
  451. });
  452. }
  453. let bgPOXParts = this._reCSSUnit.exec(bgPValues[1].value);
  454. let bgPOYParts = this._reCSSUnit.exec(bgPValues[3].value);
  455. //
  456. // Parse the background size
  457. //
  458. //
  459. // Initialize the UI
  460. //
  461. let disableBuildCSS = this._disableBuildCSS;
  462. this._disableBuildCSS = true;
  463. this._editorColor.color = bgC;
  464. this._editorImage.value = bgI;
  465. this._editorImageOffsetX.value = bgPOXParts[1];
  466. this._editorImageOffsetY.value = bgPOYParts[1];
  467. [
  468. [this._editorImageRepeatX, bgRX, "repeat", "repeat X"],
  469. [this._editorImageRepeatY, bgRY, "repeat", "repeat Y"],
  470. [this._editorImagePositionX, bgPValues[0].value, "left", "position X"],
  471. [this._editorImagePositionY, bgPValues[2].value, "top", "position Y"],
  472. [this._editorImageOffsetUnitX, bgPOXParts[2], "px", "offset X unit"],
  473. [this._editorImageOffsetUnitY, bgPOYParts[2], "px", "offset Y unit"]
  474. ].forEach(function(info)
  475. {
  476. if(!this._setSelectedItemSafe(info[0], info[1], info[2]))
  477. {
  478. Components.utils.reportError("Error setting " + info[3] + " to " + info[1]);
  479. retVal = false;
  480. }
  481. }, this);
  482. this._updateImageControllDisable();
  483. this._disableBuildCSS = disableBuildCSS;
  484. return retVal;
  485. ]]></body>
  486. </method>
  487. <method name="_imageBrowse">
  488. <body><![CDATA[
  489. let nsIFilePicker = Components.interfaces.nsIFilePicker;
  490. let filePicker = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
  491. filePicker.init(window, this._strings.getString("imageSelectTitle"), nsIFilePicker.modeOpen);
  492. filePicker.appendFilters(nsIFilePicker.filterImages);
  493. let res = filePicker.show();
  494. if(res == nsIFilePicker.returnOK)
  495. {
  496. this._editorImage.value = Services.io.newFileURI(filePicker.file).spec;
  497. this._updateImageControllDisable();
  498. this._buildCSS();
  499. }
  500. ]]></body>
  501. </method>
  502. <method name="_imageClear">
  503. <body><![CDATA[
  504. this._editorImage.value = "";
  505. this._editorImageRepeatX.value = "repeat";
  506. this._editorImageRepeatY.value = "repeat";
  507. this._editorImagePositionX.value = "left";
  508. this._editorImagePositionY.value = "top";
  509. this._editorImageOffsetX.value = 0;
  510. this._editorImageOffsetY.value = 0;
  511. this._editorImageOffsetUnitX.value = "px";
  512. this._editorImageOffsetUnitY.value = "px";
  513. this._updateImageControllDisable();
  514. this._buildCSS();
  515. ]]></body>
  516. </method>
  517. <method name="_processEvent">
  518. <parameter name="event"/>
  519. <body><![CDATA[
  520. if(!("css-bg-editor-css-text" == event.originalTarget.getAttribute("anonid")
  521. || "css-bg-editor-css-text" == document.getBindingParent(event.originalTarget).getAttribute("anonid")))
  522. {
  523. event.stopPropagation();
  524. }
  525. //Components.utils.reportError("Editor event " + event.type + " on " + event.originalTarget.tagName + "::" + event.originalTarget.getAttribute("anonid"));
  526. ]]></body>
  527. </method>
  528. <method name="_setSelectedItemSafe">
  529. <parameter name="aElement"/>
  530. <parameter name="aValue"/>
  531. <parameter name="aDefault"/>
  532. <body><![CDATA[
  533. aElement.value = aValue;
  534. if(!aElement.selectedItem || aElement.selectedItem.value != aValue)
  535. {
  536. aElement.value = aDefault;
  537. return false;
  538. }
  539. return true;
  540. ]]></body>
  541. </method>
  542. <method name="_updateImageControllDisable">
  543. <body><![CDATA[
  544. if(this.disabled || !this._editorImage.value)
  545. {
  546. this.setAttribute("no-image", "true");
  547. this._updatePositionOffsetXDisabled(true);
  548. this._updatePositionOffsetYDisabled(true);
  549. }
  550. else
  551. {
  552. this.removeAttribute("no-image");
  553. this._updatePositionOffsetXDisabled(false);
  554. this._updatePositionOffsetYDisabled(false);
  555. }
  556. ]]></body>
  557. </method>
  558. <method name="_updateMode">
  559. <body><![CDATA[
  560. if(this._editorMode.selectedIndex == this._editorDeck.selectedIndex)
  561. {
  562. return;
  563. }
  564. this.setAdvanced(((this._editorMode.selectedIndex == 1) ? true : false), true);
  565. ]]></body>
  566. </method>
  567. <method name="_updatePositionOffsetXDisabled">
  568. <parameter name="aVal"/>
  569. <body><![CDATA[
  570. let bgPX = this._editorImagePositionX.value;
  571. let disableOffsetX = aVal || (bgPX != "offset");// || bgPX == "center");
  572. this._editorImageOffsetX.disabled = disableOffsetX;
  573. this._editorImageOffsetUnitX.disabled = disableOffsetX;
  574. ]]></body>
  575. </method>
  576. <method name="_updatePositionOffsetYDisabled">
  577. <parameter name="aVal"/>
  578. <body><![CDATA[
  579. let bgPY = this._editorImagePositionY.value;
  580. var disableOffsetY = aVal || (bgPY != "offset");// || bgPY == "center");
  581. this._editorImageOffsetY.disabled = disableOffsetY;
  582. this._editorImageOffsetUnitY.disabled = disableOffsetY;
  583. ]]></body>
  584. </method>
  585. <method name="_updatePositionX">
  586. <body><![CDATA[
  587. this._updatePositionOffsetXDisabled(false);
  588. this._buildCSS();
  589. ]]></body>
  590. </method>
  591. <method name="_updatePositionY">
  592. <body><![CDATA[
  593. this._updatePositionOffsetYDisabled(false);
  594. this._buildCSS();
  595. ]]></body>
  596. </method>
  597. </implementation>
  598. <handlers>
  599. <handler event="command"><![CDATA[
  600. this._processEvent(event);
  601. ]]></handler>
  602. <handler event="change"><![CDATA[
  603. this._processEvent(event);
  604. ]]></handler>
  605. <handler event="input"><![CDATA[
  606. this._processEvent(event);
  607. ]]></handler>
  608. <handler event="select"><![CDATA[
  609. this._processEvent(event);
  610. ]]></handler>
  611. </handlers>
  612. </binding>
  613. </bindings>