}
break;
case 2:
+ case 3:
alert(__("Can't subscribe to the specified URL."));
break;
case 0:
}
}
-/* http://textsnippets.com/posts/show/835 */
-
-Position.GetWindowSize = function(w) {
- w = w ? w : window;
- var width = w.innerWidth || (w.document.documentElement.clientWidth || w.document.body.clientWidth);
- var height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight);
- return [width, height]
-}
-
-/* http://textsnippets.com/posts/show/836 */
-
-Position.Center = function(element, parent) {
- var w, h, pw, ph;
- var d = Element.getDimensions(element);
- w = d.width;
- h = d.height;
- Position.prepare();
- if (!parent) {
- var ws = Position.GetWindowSize();
- pw = ws[0];
- ph = ws[1];
- } else {
- pw = parent.offsetWidth;
- ph = parent.offsetHeight;
- }
- element.style.top = (ph/2) - (h/2) - Position.deltaY + "px";
- element.style.left = (pw/2) - (w/2) - Position.deltaX + "px";
-}
-
-
function isCdmMode() {
return !$("headlinesList");
}
}
}
-function addLabel() {
+function addLabel(select, callback) {
try {
var query = "?op=pref-labels&subop=add&caption=" +
param_escape(caption);
+ if (select)
+ query += "&output=select";
+
notify_progress("Loading, please wait...", true);
- if (inPreferences()) active_tab = "labelConfig";
+ if (inPreferences() && !select) active_tab = "labelConfig";
new Ajax.Request("backend.php", {
parameters: query,
onComplete: function(transport) {
- if (inPreferences()) {
+ if (callback) {
+ callback(transport);
+ } else if (inPreferences()) {
infobox_submit_callback2(transport);
} else {
updateFeedList();
return false;
}
+function labelSelectOnChange(elem) {
+ try {
+ var value = elem[elem.selectedIndex].value;
+ var def = elem.getAttribute('default');
+
+ if (value == "ADD_LABEL") {
+
+ if (def)
+ dropboxSelect(elem, def);
+ else
+ elem.selectedIndex = 0;
+
+ addLabel(elem, function(transport) {
+ var response = transport.responseXML;
+
+ var payload = response.getElementsByTagName("payload")[0];
+
+ if (payload)
+ elem.innerHTML = payload.firstChild.nodeValue;
+ });
+ }
+
+ } catch (e) {
+ exception_error("catSelectOnChange", e);
+ }
+}
+
+