2 function close_frameset_notification_popup(frame)
4 if (frame.frameset_notification_timer)
6 frame.clearTimeout (frame.frameset_notification_timer);
7 frame.frameset_notification_timer = null;
8 frame.frameset_notification_popup.hidePopup();
12 function frameset_initialize_frame(frame) {
13 var p = frame.popups.create();
14 p.setAttribute("id", "frameset-notification");
15 p.addEventListener("popuphidden", function () {
16 frame.clearTimeout (frame.frameset_notification_timer);
17 frame.frameset_notification_timer = null;
18 }, true /* capture */, false /* don't allow untrusted */);
19 frame.frameset_notification_popup = p;
20 var desc = create_XUL(frame, "label");
21 desc.setAttribute("id", "frameset-notification-label");
23 frame.frameset_notification_label = desc;
26 add_hook("frame_initialize_hook", frameset_initialize_frame);
28 add_hook("select_buffer_hook", function (buffer) { close_frameset_notification_popup(buffer.frame); });
31 var frameset_notify_timeout = 1000;
33 function frameset_notify (frame, x, y, text) {
34 frame.frameset_notification_label.setAttribute("value", text);
35 frame.popups.show_absolute(frame.frameset_notification_popup, x, y);
36 frame.frameset_notification_timer = frame.setTimeout (
38 frame.frameset_notification_timer = null;
39 frame.frameset_notification_popup.hidePopup();
40 }, frameset_notify_timeout);
43 function frameset_find_frames_r (doc, types) {
45 for (var j = 0; j < types.length; j++) {
46 var fr = doc.getElementsByTagName (types[j]);
47 for (var i = 0; i < fr.length; i++) {
49 frames = frames.concat (frameset_find_frames_r (fr[i].contentDocument, types));
56 function next_frameset_frame (frame, prefix) {
57 var frames = frameset_find_frames_r (frame.buffers.current.content_document, ["FRAME"]);
58 if (frames.length == 0)
60 frame.minibuffer.message ("no other frameset frame");
64 var w = frame.buffers.current.focused_window();
68 for (var i = 0; i < frames.length; i++) {
69 if (w.document == frames[i].contentDocument) {
70 next = (i + prefix) % frames.length;
71 // the % operator is actually remainder in javascript, so we have
72 // to watch for negative results.
74 next += frames.length;
78 frames[next].scrollIntoView (false);
79 frames[next].contentWindow.focus();
81 var box = frames[next].ownerDocument.getBoxObjectFor (frames[next]);
83 frameset_notify (frame, box.screenX, box.screenY,
84 "frameset frame "+next);
86 interactive("next-frameset-frame", next_frameset_frame, I.current_frame, I.p);
90 function next_iframe (frame, prefix) {
91 var frames = frame.buffers.current.content_document.getElementsByTagName ("IFRAME");
92 if (frames.length == 0)
94 frame.minibuffer.message ("no other iframe");
98 var current = frame.buffers.current.focused_window();
102 for (var i = 0; i < frames.length; i++) {
103 if (current.document == frames[i].contentDocument) {
104 pnext = (i + prefix) % frames.length;
105 // the % operator is actually remainder in javascript, so we have
106 // to watch for negative results.
108 pnext += frames.length;
114 frames[next].contentWindow.focus();
116 while (frame.buffers.content.focused_window() == current)
118 next = (next + (prefix < 0 ? -1 : 1)) % frames.length;
120 next += frames.length;
123 frame.minibuffer.message ("no other iframe visible");
127 frames[next].contentWindow.focus();
130 var box = frame.buffers.current.content_document.getBoxObjectFor (frames[next]);
131 frames[next].scrollIntoView (false);
133 frameset_notify (frame, box.screenX, box.screenY,
136 interactive("next-iframe", next_iframe, I.current_frame, I.p);
139 function frameset_focus_top (b) {
140 b.content_window.focus();
141 var box = b.frame.buffers.container.boxObject;
142 frameset_notify (b.frame, box.screenX, box.screenY, "frameset top");
144 interactive("frameset-focus-top", frameset_focus_top, I.current_buffer(browser_buffer));
147 function frameset_focus_up (b) {
148 var parent = b.focused_window().parent;
150 frameset_notify (b.frame, parent.screenX, parent.screenY, "frameset up");
152 interactive("frameset-focus-up", frameset_focus_up, I.current_buffer(browser_buffer));