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
/
filAF0BB33E9DAD0CEBC4B80E3E18AAEB34
< prev
next >
Wrap
Extensible Markup Language
|
2010-07-12
|
21KB
|
566 lines
<?xml version="1.0"?>
<!DOCTYPE bindings [
<!ENTITY % yasearchDTD SYSTEM "chrome://yasearch/locale/yasearch.dtd">
%yasearchDTD;
<!ENTITY % yasearchFTabDTD SYSTEM "chrome://yasearch/locale/ftab/ftab.dtd" >
%yasearchFTabDTD;
]>
<bindings xmlns="http://www.mozilla.org/xbl"
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="thumb">
<implementation>
<field name="controller">window.YaFTab</field>
<method name="getElementByAnonid">
<parameter name="aAnonidAttr"/>
<body><![CDATA[
let elements = this.getElementsByClassName("thumb-" + aAnonidAttr);
return elements.length ? elements[0] : null;
]]></body>
</method>
<method name="updateProps">
<parameter name="aProps"/>
<body>
<![CDATA[
for (var [propName, propValue] in Iterator(aProps)) {
propValue = (propValue||"").toString();
switch (propName) {
case "url":
propValue ? this.setAttribute("href", propValue) : this.removeAttribute("href");
break;
case "state":
this.setAttribute("yaThumbState", propValue);
break;
case "img":
var el = this.getElementByAnonid(propName);
el.removeAttributeNS("http://www.w3.org/1999/xlink", "href");
el.setAttributeNS("http://www.w3.org/1999/xlink", "href", propValue);
break;
case "title":
this.getElementByAnonid(propName).firstChild.textContent =
propValue || aProps.url || this.getAttribute("href") || "";
break;
case "index":
this.setAttribute("yaThumbIndex", propValue);
break;
}
}
]]>
</body>
</method>
<method name="click">
<parameter name="aEvent"/>
<body>
<![CDATA[
let event = aEvent && aEvent.type == "click" ? aEvent : null;
if (!this.controller.editor.showed) {
this.hasAttribute("href") ?
this.controller.loadURI(this.getAttribute("href"), event, {action:4600}, null, true) :
this.controller.showEditorForPage(this.getAttribute("yaThumbIndex"));
}
if (event) {
event.preventDefault();
event.stopPropagation();
}
]]>
</body>
</method>
</implementation>
<handlers>
<handler event="click" button="0"><![CDATA[
if (!this.controller.editor.showed) {
var target = event.originalTarget;
var anonid = target.getAttribute("class");
if (!this.hasAttribute("href")) {
anonid = "control-prefs";
}
switch (anonid) {
case "control":
break;
case "control-prefs":
this.controller.showEditorForPage(this.getAttribute("yaThumbIndex"));
break;
case "control-remove":
this.controller.removePage(this.getAttribute("yaThumbIndex"));
break;
default:
if (this.getAttribute("anonid") != "pref-thumb-holder")
this.controller.loadURI(this.getAttribute("href"), event, {action:4600}, null, true);
break;
}
}
event.preventDefault();
event.stopPropagation();
]]></handler>
</handlers>
</binding>
<binding id="editor">
<resources>
<stylesheet src="chrome://yasearch/skin/ftab/ftab-prefs.css"/>
</resources>
<content>
<xul:stack flex="1">
<div xmlns="http://www.w3.org/1999/xhtml" class="content-shadow"/>
<xul:vbox pack="center">
<div xmlns="http://www.w3.org/1999/xhtml" class="content-holder">
<table><tr><td>
<div>
<div anonid="thumb-holder-container">
<a class="thumb-holder" anonid="pref-thumb-holder"
yaThumbIndex="0" yaThumbState="">
<div class="thumb-container">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 450">
<defs>
<linearGradient id="bg-gradient-0" gradientUnits="userSpaceOnUse"
x1="0" x2="0" y1="0" y2="100%">
<stop offset="0" stop-color="rgb(246,246,246)"/>
<stop offset="8%" stop-color="rgb(240,240,240)"/>
<stop offset="15%" stop-color="rgb(232,232,232)"/>
<stop offset="35%" stop-color="rgb(225,225,225)"/>
<stop offset="40%" stop-color="rgb(230,230,230)"/>
<stop offset="60%" stop-color="rgb(243,243,243)"/>
<stop offset="100%" stop-color="rgb(246,246,246)"/>
</linearGradient>
</defs>
<rect x="0" y="0" width="100%" height="100%" style="fill:rgb(240,240,240);"/>
<rect x="0" y="0" width="100%" height="100%" fill="url(#bg-gradient-0)"/>
<image xmlns:xlink="http://www.w3.org/1999/xlink"
class="thumb-img"
x="0" y="0"
width="100%" height="100%"/>
<g class="error" style="display: none;">
<rect x="0" y="0" width="100%" height="100%" fill="rgb(246,246,248)"/>
<g transform="translate(300,200),rotate(45)">
<circle cx="0" cy="0" r="120" fill="#ccc"/>
<rect x="-90" y="-18" width="180" height="36" fill="rgb(248,248,248)"/>
<rect x="-18" y="-90" width="36" height="180" fill="rgb(248,248,248)"/>
</g>
</g>
</svg>
<div class="text-holder">
<div class="thumb-title"><p/>
<div class="shade"/>
</div>
<div class="thumb-number">
<div class="thumb-number-value"/>
</div>
</div>
<div class="throbber"/>
</div>
</a>
</div>
<h2>&yaftab.edit.caption;</h2>
<p>&yaftab.edit.history.label;:</p>
<!-- not xul:listbox -->
<div class="history-list-container">
<xul:vbox anonid="history-list"/>
</div>
<p>&yaftab.edit.url.label;:</p>
<xul:textbox class="padded"
anonid="page-url"
type="autocomplete"
autocompletesearch="history"
ontextentered="document.getBindingParent(this).hanleNewURL()"
onchange="document.getBindingParent(this).hanleNewURL()"
oninput="document.getBindingParent(this).checkAccepButton()"
maxlength="10000"/>
<p>&yaftab.edit.name.label;:</p>
<xul:textbox anonid="page-title"
onchange="document.getBindingParent(this).refreshThumbTitle()"
oninput="document.getBindingParent(this).refreshThumbTitle()"
maxlength="500"/>
<xul:hbox class="dialog-buttons">
<xul:button anonid="save-button" disabled="true"
label="&yasearch._gen.dialog.save.label;"
oncommand="document.getBindingParent(this).close()"/>
<xul:space flex="1"/>
<xul:button label="&yasearch._gen.dialog.cancel.label;"
oncommand="document.getBindingParent(this).cancel()"/>
</xul:hbox>
</div>
</td></tr></table>
</div>
</xul:vbox>
</xul:stack>
<children/>
</content>
<implementation>
<method name="getElementByAnonid">
<parameter name="aAnonidAttr"/>
<body><![CDATA[
return document.getAnonymousElementByAttribute(this, "anonid", aAnonidAttr);
]]></body>
</method>
<method name="getElementByClass">
<parameter name="aClassAttr"/>
<body><![CDATA[
return document.getAnonymousElementByAttribute(this, "class", aClassAttr);
]]></body>
</method>
<field name="_openTimestamp">null</field>
<field name="editedPageIndex">null</field>
<field name="controller">window.YaFTab</field>
<field name="thumbHolder">this.getElementByAnonid("pref-thumb-holder")</field>
<field name="_animations">[]</field>
<property name="showed">
<getter><![CDATA[
return this.style.display === "-moz-box";
]]></getter>
<setter><![CDATA[
while (this._animations.length) {
this._animations.pop().finish();
}
let show = !!val;
if (this.showed === show)
return;
let thumbContainer = this.getElementByAnonid("thumb-holder-container");
if (show) {
this._openTimestamp = Date.now();
let thumbHolder = this.thumbHolder;
let pageThumb = this.controller.thumbElements[this.editedPageIndex-1];
let width = parseInt(pageThumb.offsetWidth, 10);
thumbHolder.style.width = width + "px";
thumbContainer.style.minHeight = thumbHolder.style.height = 0.75 * width + "px";
let pageThumbNumberValue = pageThumb.getElementsByClassName("thumb-number-value")[0];
let thumbNumberValue = this.getElementByClass("thumb-number-value");
if (pageThumbNumberValue) {
thumbNumberValue.style.backgroundPosition = pageThumbNumberValue.style.backgroundPosition;
thumbNumberValue.style.display = "block";
} else {
thumbNumberValue.style.display = "none";
}
if ("updateProps" in thumbHolder)
thumbHolder.updateProps(this.controller.getPageProps(this.editedPageIndex));
this.style.display = "-moz-box";
this.getElementByAnonid("page-url").focus();
} else {
this._openTimestamp = null;
thumbContainer.style.height = "auto";
this.style.display = "none";
}
]]></setter>
</property>
<method name="toggle">
<body><![CDATA[
this.showed = !this.showed;
]]></body>
</method>
<method name="_animate">
<parameter name="aShow"/>
<body><![CDATA[
let me = this;
let thumbHolder = this.thumbHolder;
let thumbHolderStyle = thumbHolder.style;
let pageThumb = this.controller.thumbElements[this.editedPageIndex-1];
let callback;
let animateProps;
let containerBO = this.getElementByAnonid("thumb-holder-container").getBoundingClientRect();
thumbHolderStyle.position = "fixed";
if (aShow) {
thumbHolderStyle.top = pageThumb.offsetTop + "px";
thumbHolderStyle.left = pageThumb.offsetLeft + "px";
callback = function() {
thumbHolderStyle.position = "relative";
thumbHolderStyle.top = 0;
thumbHolderStyle.left = 0;
};
animateProps = { top: containerBO.top, left: containerBO.left };
} else {
thumbHolderStyle.top = containerBO.top + "px";
thumbHolderStyle.left = containerBO.left + "px";
callback = function() {
thumbHolderStyle.position = "relative";
thumbHolderStyle.top = 0;
thumbHolderStyle.left = 0;
me.style.display = "none";
};
animateProps = { top: pageThumb.offsetTop, left: pageThumb.offsetLeft };
}
this._animations.push(this.Effects.animate(thumbHolder, animateProps, 200, callback));
]]></body>
</method>
<method name="fillHistory">
<parameter name="aHistoryArray"/>
<body><![CDATA[
let historyList = this.getElementByAnonid("history-list");
while (historyList.firstChild)
historyList.removeChild(historyList.firstChild);
if (!(aHistoryArray && aHistoryArray.length))
return;
function createElement(tagName) {
return document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", tagName);
}
function createListItem(aFavicon, aURL, aTitle) {
let listItem = createElement("hbox");
listItem.setAttribute("class", "iconic-list-item");
listItem.setAttribute("yaURL", aURL || "");
listItem.setAttribute("yaTitle", aTitle || aURL || "");
listItem.setAttribute("tooltiptext", aURL || "");
let image = createElement("image");
image.setAttribute("src", aFavicon);
let label = createElement("label");
label.setAttribute("value", aTitle || aURL);
label.setAttribute("crop", "end");
listItem.appendChild(image);
listItem.appendChild(label);
return listItem;
}
aHistoryArray.forEach(function(aHistoryObject) {
historyList.appendChild(createListItem(aHistoryObject.icon, aHistoryObject.url, aHistoryObject.title));
});
]]></body>
</method>
<method name="getText">
<parameter name="aType"/>
<body><![CDATA[
let textbox = this.getElementByAnonid("page-" + aType);
return (textbox && textbox.localName == "textbox") ? textbox.value : "";
]]></body>
</method>
<method name="setText">
<parameter name="aType"/>
<parameter name="aText"/>
<parameter name="aNotModifiedManual"/>
<body><![CDATA[
let textbox = this.getElementByAnonid("page-" + aType);
if (textbox && textbox.localName == "textbox") {
if (!(aNotModifiedManual && textbox.value) || (textbox.defaultValue === textbox.value)) {
textbox.value = aText;
textbox.defaultValue = aText;
if (aType == "url")
this.hanleNewURL();
}
}
]]></body>
</method>
<method name="refreshThumbTitle">
<parameter name="aTimeoutValue"/>
<body><![CDATA[
let timeout = typeof aTimeoutValue == "number" ? aTimeoutValue : 400;
if (this._refreshThumbTitleTimeout)
window.clearTimeout(this._refreshThumbTitleTimeout);
let props = {title: this.getText("title")};
if (!timeout) {
this.thumbHolder.updateProps(props);
} else {
this._refreshThumbTitleTimeout = window.setTimeout(function(thumbHolder, props) {
thumbHolder.updateProps(props);
}, timeout, this.thumbHolder, {title: this.getText("title")});
}
]]></body>
</method>
<method name="hanleNewURL">
<body><![CDATA[
this.checkAccepButton();
let url = this.controller.getURLFromString(this.getText("url"));
if (!url)
return false;
let thumbHolder = this.thumbHolder;
if (thumbHolder.getAttribute("href") !== url) {
thumbHolder.setAttribute("href", url);
if (this.showed)
this.controller.hanleNewURL(url, true);
}
return true;
]]></body>
</method>
<method name="checkAccepButton">
<body><![CDATA[
let url = this.controller.getURLFromString(this.getText("url"));
this.getElementByAnonid("save-button").disabled = !url;
]]></body>
</method>
<method name="open">
<parameter name="aPageIndex"/>
<parameter name="aPageData"/>
<body><![CDATA[
this.editedPageIndex = aPageIndex;
this.showed = true;
this.setText("url", aPageData.url || "http://");
this.setText("title", aPageData.title || "");
let me = this;
setTimeout(function(me) {
me.controller.getSitesFromHistory(function(res){me.fillHistory(res);});
}, 0, me);
]]></body>
</method>
<method name="close">
<parameter name="aIgroneChanges"/>
<body><![CDATA[
let data = null;
if (!aIgroneChanges) {
let url = this.controller.getURLFromString(this.getText("url"));
if (url) {
data = {
url: url,
title: this.getText("title")
};
}
}
this.controller.onEditorCallback(this.editedPageIndex, data, this._openTimestamp);
this.showed = false;
]]></body>
</method>
<method name="cancel">
<body><![CDATA[
this.close(true);
]]></body>
</method>
<destructor>
<![CDATA[
this.cancel();
this.editedPageIndex = null;
]]>
</destructor>
<method name="_hitEnter">
<parameter name="aEvent"/>
<body>
<![CDATA[
if (aEvent.getPreventDefault())
return;
let saveButton = this.getElementByAnonid("save-button");
if (!saveButton.disabled)
saveButton.doCommand();
]]>
</body>
</method>
</implementation>
<handlers>
<handler event="click" button="0">
<![CDATA[
let target = event.originalTarget;
let node = target;
let level = 0;
while (level++ < 10 && node && !("hasAttribute" in node && node.hasAttribute("anonid"))) {
node = node.parentNode;
}
let anonid = node && ("getAttribute" in node) ? node.getAttribute("anonid") : null;
switch (anonid) {
case "history-list":
let hbox = target;
while (hbox && hbox.localName !== "hbox") {
hbox = hbox.parentNode;
}
this.setText("url", hbox.getAttribute("yaURL"));
this.setText("title", hbox.getAttribute("yaTitle"));
this.refreshThumbTitle(0);
break;
default:
break;
}
]]>
</handler>
<handler event="keypress" keycode="VK_ESCAPE" group="system" action="this.cancel();"/>
<handler event="keypress" keycode="VK_ENTER" group="system" action="this._hitEnter(event);"/>
<handler event="keypress" keycode="VK_RETURN" group="system" action="this._hitEnter(event);"/>
</handlers>
</binding>
</bindings>