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
/
fil0BF1E4021DE73CEFBD37B07B2A7AFB24
< prev
next >
Wrap
Text File
|
2010-07-12
|
7KB
|
200 lines
var YaSearchPrefs = {
nsIYa: Cc["@yandex.ru/yasearch;1"].getService(Ci.nsIYaSearch).wrappedJSObject,
setYandexAsHomepage: function YaSearchPrefs_setYandexAsHomepage() {
this.nsIYa.setHomePageUrl(true);
},
readUrlbarCorrectorState: function YaSearchPrefs_readUrlbarCorrectorState() {
return (this.nsIYa.KeyCorrector.currentState > 0);
},
writeUrlbarCorrectorState: function YaSearchPrefs_writeUrlbarCorrectorState(aCheckbox) {
let res = aCheckbox && aCheckbox.checked ? 2 : 0;
this.nsIYa.KeyCorrector.currentState = res;
return res;
},
loadHelpURI: function YaSearchPrefs_loadHelpURI() {
this.nsIYa.loadURI(this.nsIYa.getLocaleDependedUrl("HelpPageUrl"), "window", {action:3000});
},
get _toolbar() {
return Preferences.gBrowser[APP_NAME + "OverlayController"]._appToolbar;
},
_setToolbarMode: function YaSearchPrefs__setToolbarMode(aDontCheckInstApply, aMode) {
if (!(aDontCheckInstApply || Preferences.instantApply))
return;
let toolbarMode = this._toolbar.getAttribute("mode");
let changedToolbarMode = aMode || document.getElementById("misc-prefs-ui-buttons-text-checkbox")
.getAttribute("currentToolbarMode");
if (changedToolbarMode != toolbarMode) {
this._toolbar.setAttribute("mode", changedToolbarMode);
this._toolbar.ownerDocument.persist("yasearch-bar", "mode");
}
},
_inited: false,
onPaneLoad: function YaSearchPrefs_onPaneLoad() {
if (this._inited)
return;
this._inited = true;
let toolbarMode = this._toolbar.getAttribute("mode");
let showButtonsTextCheckbox = document.getElementById("misc-prefs-ui-buttons-text-checkbox");
showButtonsTextCheckbox.setAttribute("currentToolbarMode", toolbarMode);
showButtonsTextCheckbox.setAttribute("checked", (toolbarMode == "icons" ? "false" : "true"));
showButtonsTextCheckbox.setAttribute("oncommand",
"this.setAttribute('currentToolbarMode', this.checked ? 'full' : 'icons'); \
YaSearchPrefs._setToolbarMode(false);");
if (!this.nsIYa.yaGeolocation)
document.getElementById("yasearch-geolocation-checkbox").hidden = true;
},
onDialogAccept: function YaSearchPrefs_onDialogAccept() {
if (!this._inited)
return;
this._setToolbarMode(true);
},
onDialogUnload: function YaSearchPrefs_onDialogUnload() {
}
}
var StaticHelper = {
nsIYa: Cc["@yandex.ru/yasearch;1"].getService(Ci.nsIYaSearch).wrappedJSObject,
OBSERVER_SERVICE: Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService),
get browsers() {
return this.nsIYa.getWindows("navigator:browser");
},
get _toolbar() {
return Preferences.gBrowser[APP_NAME + "OverlayController"]._appToolbar;
},
onRestoreDefault: function StaticHelper_onRestoreDefault() {
let searchbox = this._toolbar.ownerDocument.getElementById("yasearchbox");
if (searchbox) {
let defWidth = parseInt(searchbox.getAttribute("yaDefaultWidth"),10);
if (defWidth) {
searchbox.setAttribute("width", defWidth);
if ("updateWidthOnResize" in searchbox)
searchbox.updateWidthOnResize();
} else {
["width", "yaSHistoryWidth"].forEach(function(aAttrName) {
if (this.hasAttribute(aAttrName))
this.removeAttribute(aAttrName);
}, searchbox);
}
}
[".general.ui.translate."]
.forEach(function(aPrefBranch) {
try {
this.resetBranch(APP_NAME + aPrefBranch);
} catch(ex) {}
}, Preferences.barCore.Preferences);
},
_inited: false,
onPaneLoad: function StaticHelper_onPaneLoad() {
if (this._inited)
return;
this._inited = true;
},
onWindowBeforeUnload: function StaticHelper_onWindowBeforeUnload() {
if (!this._inited)
return;
this._inited = false;
for each (let browser in this.browsers) {
browser.Ya.updateFeedsAttribute();
let bloggers = browser.Ya.Bloggers;
if (bloggers)
bloggers.checkWindowState();
}
this.nsIYa.refreshCYInAllBrowsers();
this.OBSERVER_SERVICE.notifyObservers(null, "Ya-Refresh-Login-Status", false);
},
syncHttpUpdateEnabled: function StaticHelper_syncHttpUpdateEnabled(aCheckbox) {
setTimeout(function(aCheckbox) {
let disabled = !aCheckbox.checked;
aCheckbox.nextSibling.disabled = disabled;
}, 1, aCheckbox);
},
Sound: {
sync: function StaticHelper_Sound_sync(aType) {
setTimeout(function() {
let prfx = "wgt-" + aType + "-soundnotification-";
let disabled = !document.getElementById(prfx + "enabled").checked;
let textbox = document.getElementById(prfx + "textbox");
document.getElementById(prfx + "select").disabled = textbox.disabled = disabled;
document.getElementById(prfx + "preview").disabled = !(!disabled && !!textbox.value);
}, 1);
},
select: function StaticHelper_Sound_select(aType) {
const nsIFilePicker = Ci.nsIFilePicker;
let filepicker = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
let stringBundle = StaticHelper.nsIYa.getStringBundle("preferences/preferences.properties");
filepicker.init(window, stringBundle.GetStringFromName("ChooseASoundFile"), nsIFilePicker.modeOpen);
filepicker.appendFilter(stringBundle.GetStringFromName("ChooseASoundFilterWav"), "*.wav;*.mp3");
filepicker.appendFilter(stringBundle.GetStringFromName("ChooseASoundFilterAll"), "*.*");
let ret = filepicker.show();
if (ret == nsIFilePicker.returnOK) {
let textbox = document.getElementById("wgt-" + aType + "-soundnotification-textbox");
textbox.value = filepicker.file.path;
textbox.doCommand();
}
this.sync(aType);
},
play: function StaticHelper_Sound_play(aType) {
StaticHelper.nsIYa.playSoundURL(document.getElementById("wgt-" + aType + "-soundnotification-textbox").value);
}
},
Container: {
_historyParamName: "yasearch-history",
_nsIFormHistory: Cc["@mozilla.org/satchel/form-history;1"].getService(Ci.nsIFormHistory2),
checkClearButtonState: function() {
document.getElementById("wgt-container-clear-history-button")
.disabled = !this._nsIFormHistory.nameExists(this._historyParamName);
},
clearSearchHistory: function() {
this._nsIFormHistory.removeEntriesForName(this._historyParamName);
this.checkClearButtonState();
}
}
};