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
/
filB29E1DA6B9A8A7E8960D5369106DEA8A
< prev
next >
Wrap
Text File
|
2010-07-12
|
4KB
|
107 lines
var YaFeeds = {
nsIYa: Components.classes["@yandex.ru/yasearch;1"].getService(Components.interfaces.nsIYaSearch).wrappedJSObject,
get _list() {
return document.getElementsByTagName("menulist")[0];
},
init: function() {
this.stringBundleSet = document.getElementById("yasearch-string-bundle-feeds");
this.loader = document.getElementById("yasearch-feeds-select-group").cloneNode(true);
this.enableAcceptButton();
this.nsIYa.getFeedsGroups(this.refreshFeedsGroups);
var items = document.getElementById("yasearch-feed-label-name-replace");
window.arguments[0].id = "yasearch-feed-label-name-replace";
this.nsIYa.DOMUtils.replaceNode(window.arguments[0], items);
document.getElementById("yasearch-feed-label-page").value = window.arguments[1];
},
enableAcceptButton: function() {
document.documentElement.getButton("accept").disabled =
!!(document.getElementById("yasearch-feeds-select-group").disabled &&
document.getElementById("yasearch-feeds-add-group").value == "");
},
getFeedUrl: function() {
return this._list.selectedItem.getAttribute("tooltiptext");
},
getFeedGroupId: function() {
return document.getElementById("yasearch-feeds-select-group").selectedItem.getAttribute("group-id");
},
getString: function(aStringName) {
return this.stringBundleSet.getString(aStringName);
},
insertFeedCallback: function(error) {
switch (error) {
case "errorNewGroup1":
YaFeeds.nsIYa.promptService.alert(window,
YaFeeds.getString("ErrorAddGroupTitle"),
YaFeeds.getString("ErrorAddGroup") + " " +
YaFeeds.getString("ErrorAddFeedNoConnection"));
break;
case "errorNewGroup2":
YaFeeds.nsIYa.promptService.alert(window,
YaFeeds.getString("ErrorAddGroupTitle"),
YaFeeds.getString("ErrorAddGroup"));
break;
case "errorNewItem1":
YaFeeds.nsIYa.promptService.alert(window,
YaFeeds.getString("ErrorAddFeedTitle"),
YaFeeds.getString("ErrorAddFeed") + " " +
YaFeeds.getString("ErrorAddFeedNoConnection"));
break;
case "errorNewItem2":
YaFeeds.nsIYa.promptService.alert(window,
YaFeeds.getString("ErrorAddFeedTitle"),
YaFeeds.getString("ErrorAddFeed"));
}
setTimeout(function(){document.documentElement.cancelDialog()},2);
},
onDialogAccept: function() {
document.documentElement.getButton("accept").disabled = true;
var data = {url: this.getFeedUrl(), callback: this.insertFeedCallback};
var newGroup = document.getElementById("yasearch-feeds-add-group").value;
if (newGroup != "")
data.title = newGroup;
else
data.group_id = this.getFeedGroupId();
this.nsIYa.feedsInsertNewItem(data);
return false;
},
refreshFeedsGroups: function(data) {
if (!data) {
if (YaFeeds) {
YaFeeds.nsIYa.promptService.alert(window,
YaFeeds.getString("ErrorFeedGroupsRefreshTitle"),
YaFeeds.getString("ErrorFeedGroupsRefresh"));
setTimeout(function(){document.documentElement.cancelDialog()},2);
}
return false;
}
var menuList = document.getElementById("yasearch-feeds-select-group");
YaFeeds.nsIYa.DOMUtils.replaceNode(data, menuList);
YaFeeds.enableAcceptButton();
document.getElementById("yasearch-feeds-add-group").disabled = false;
return true;
}
};