Skip to content

Commit 25ae33a

Browse files
committed
Merge branch 'master' into passthrough-only-on-insert
2 parents fdd276b + f9f7a21 commit 25ae33a

File tree

21 files changed

+215
-46
lines changed

21 files changed

+215
-46
lines changed

common/content/browser.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ const Browser = Module("browser", {
178178
if (path) {
179179
if (path = getParentPath(path))
180180
parent = scheme + host + "/" + path;
181-
else
181+
else
182182
parent = scheme + host + "/";
183183
}
184184
else {
@@ -207,6 +207,16 @@ const Browser = Module("browser", {
207207
liberator.assert(!/(about|mailto):/.test(uri.protocol)); // exclude these special protocols for now
208208
liberator.open(uri.protocol + "//" + (uri.host || "") + "/");
209209
});
210+
mappings.add([modes.NORMAL], ["gr"],
211+
"View current tab in Reader View",
212+
function () {
213+
let uri = content.document.location.href;
214+
if (!uri.startsWith("about:reader")) {
215+
liberator.open('about:reader?url=' + uri);
216+
} else {
217+
liberator.open(uri.substr("about:reader?url=".length));
218+
}
219+
});
210220
},
211221

212222
commands: function () {

common/content/buffer.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,13 @@ const Buffer = Module("buffer", {
281281
asyncUpdateUI.superapply(this, arguments);
282282
},
283283
setOverLink: function setOverLink(link, b) {
284-
setOverLink.superapply(this, arguments);
285284
let ssli = options["showstatuslinks"];
285+
286+
if (ssli == 3) {
287+
setOverLink.superapply(this, arguments);
288+
return;
289+
}
290+
286291
if (link && ssli) {
287292
if (ssli == 1) {
288293
statusline.updateField("location", "Link: " + link);
@@ -299,7 +304,7 @@ const Buffer = Module("buffer", {
299304
}
300305
else if (ssli == 2)
301306
modes.show();
302-
}
307+
}
303308
},
304309
},
305310

@@ -1792,8 +1797,9 @@ const Buffer = Module("buffer", {
17921797
{
17931798
completer: function (context) [
17941799
["0", "Don't show link destination"],
1795-
["1", "Show the link in the status line"],
1796-
["2", "Show the link in the command line"]
1800+
["1", "Show the link destination in the status line"],
1801+
["2", "Show the link destination in the command line"],
1802+
["3", "Show the link destination in the content area"]
17971803
]
17981804
});
17991805

common/content/commandline.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,7 @@ const CommandLine = Module("commandline", {
16171617
"stringlist", "google",
16181618
{
16191619
completer: function completer(value) {
1620-
let engines = services.get("search").getEngines({})
1620+
let engines = services.get("search").getVisibleEngines({})
16211621
.filter(function (engine) engine.supportsResponseType("application/x-suggestions+json"));
16221622

16231623
return engines.map(function (engine) [engine.alias, engine.description]);

common/content/events.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,16 +241,17 @@ const Events = Module("events", {
241241
},
242242

243243
/**
244-
* Deletes all macros matching <b>filter</b>.
244+
* Deletes the specified macros. The <b>filter</b> is a list of
245+
* macros and ranges are supported. Eg. "ab c d e-k".
246+
*
247+
* @param {string} filter The list of macros to delete.
245248
*
246-
* @param {string} filter A regular expression filter string. A null
247-
* filter deletes all macros.
248249
*/
249250
deleteMacros: function (filter) {
250-
let re = RegExp(filter);
251+
let re = RegExp("[" + filter.replace(/\s+/g, "") + "]");
251252

252253
for (let [item, ] in this._macros) {
253-
if (re.test(item) || !filter)
254+
if (re.test(item))
254255
this._macros.remove(item);
255256
}
256257
},
@@ -1181,6 +1182,7 @@ const Events = Module("events", {
11811182
this._fullscreen = window.fullScreen;
11821183
liberator.triggerObserver("fullscreen", this._fullscreen);
11831184
autocommands.trigger("Fullscreen", { state: this._fullscreen });
1185+
statusline.setVisibility(statusline.setVisibility.FULLSCREEN);
11841186
}
11851187
}
11861188
}, {

common/content/hints.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,9 @@ const Hints = Module("hints", {
13321332
completer: function (context) [
13331333
["0123456789", "Numbers only"],
13341334
["hjklasdf", "Home row"],
1335+
["dhtnaoeu", "Home row (Dvorak)"],
13351336
["hjklasdfgyuiopqwertnmzxcvb", "Smart order"],
1337+
["dhtnaoeuifgcrl',.pybm;qjkx", "Smart order (Dvorak)"],
13361338
["abcdefghijklmnopqrstuvwxyz", "Alphabetically ordered"],
13371339
],
13381340
validator: function (arg) {

common/content/modes.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ const Modes = Module("modes", {
104104
if (oldExtended & modes.HINTS)
105105
hints.hide();
106106
commandline.close();
107+
statusline.setVisibility(statusline.setVisibility.MODE_OFF);
107108
break;
108109
}
109110

@@ -119,6 +120,11 @@ const Modes = Module("modes", {
119120
} else if (newMode === modes.COMPOSE) {
120121
services.get("focus").clearFocus(window);
121122
}
123+
124+
if (newMode == modes.COMMAND_LINE) {
125+
statusline.setVisibility(statusline.setVisibility.MODE_ON);
126+
}
127+
122128
},
123129

124130
NONE: 0,

common/content/quickmarks.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ const QuickMarks = Module("quickmarks", {
158158
},
159159
{ arg: true });
160160

161+
mappings.add(myModes,
162+
["gw"], "Jump to a QuickMark in a new window",
163+
function (arg) {
164+
quickmarks.jumpTo(arg, liberator.NEW_WINDOW);
165+
},
166+
{ arg: true });
167+
161168
mappings.add(myModes,
162169
["M"], "Add new QuickMark for current URL",
163170
function (arg) {

common/content/statusline.js

Lines changed: 83 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ const StatusLine = Module("statusline", {
7272
// our status bar fields
7373
this._statusfields = {};
7474
this._statuslineWidget = document.getElementById("liberator-status");
75+
// initialize setVisibility static variables
76+
this.setVisibility(-1);
7577
},
7678

7779
/**
@@ -123,6 +125,63 @@ const StatusLine = Module("statusline", {
123125
}
124126
},
125127

128+
// set the visibility of the statusline
129+
setVisibility: function (request) {
130+
if ( typeof this.setVisibility.currVisibility == 'undefined' ) {
131+
this.setVisibility.currVisibility = true;
132+
this.setVisibility.prevVisibility = true;
133+
this.setVisibility.contentSeparator
134+
= highlight.get('ContentSeparator').value;
135+
136+
// kinds of requests
137+
this.setVisibility.MODE_ON = 0; // commandline active
138+
this.setVisibility.MODE_OFF = 1; // commandline inactive
139+
this.setVisibility.TOGGLE = 2; // toggle on or off
140+
this.setVisibility.FULLSCREEN = 3; // in or out of fullscreen
141+
}
142+
143+
const bb = document.getElementById("liberator-bottombar");
144+
const sv = this.setVisibility;
145+
146+
if (!bb) return;
147+
148+
var toggle_off = function () {
149+
bb.style.height = '0px';
150+
bb.style.overflow = 'hidden';
151+
highlight.set('ContentSeparator', 'display: none;');
152+
};
153+
154+
var toggle_on = function () {
155+
bb.style.height = '';
156+
bb.style.overflow = '';
157+
highlight.set('ContentSeparator', sv.contentSeparatorValue);
158+
};
159+
160+
switch (request) {
161+
case sv.TOGGLE:
162+
sv.currVisibility = !sv.currVisibility;
163+
if (sv.currVisibility) toggle_on();
164+
else toggle_off();
165+
break;
166+
case sv.FULLSCREEN:
167+
if (window.fullScreen) {
168+
sv.prevVisibility = sv.currVisibility;
169+
sv.currVisibility = false;
170+
toggle_off();
171+
} else {
172+
sv.currVisibility = sv.currVisibility || sv.prevVisibility;
173+
if (sv.currVisibility) toggle_on();
174+
}
175+
break;
176+
case sv.MODE_ON:
177+
if (!sv.currVisibility) toggle_on();
178+
break;
179+
case sv.MODE_OFF:
180+
if (!sv.currVisibility) toggle_off();
181+
break;
182+
}
183+
},
184+
126185
/**
127186
* Set any field in the statusbar
128187
*
@@ -155,32 +214,48 @@ const StatusLine = Module("statusline", {
155214
});
156215
statusline.addField("ssl", "The currently SSL status", "liberator-status-ssl",
157216
function updateSSLState (node, state) {
158-
var className = "";
217+
var className = "notSecure";
218+
var tooltip = gNavigatorBundle.getString("identity.unknown.tooltip");
159219
if (!state) {
160220
let securityUI = config.tabbrowser.securityUI;
161221
if (securityUI)
162222
state = securityUI.state || 0;
163223
}
164224
const WPL = Components.interfaces.nsIWebProgressListener;
165-
if (state & WPL.STATE_IDENTITY_EV_TOPLEVEL)
225+
if (state & WPL.STATE_IDENTITY_EV_TOPLEVEL) {
166226
className = "verifiedIdentity";
167-
else if (state & WPL.STATE_IS_SECURE)
227+
if (state & WPL.STATE_BLOCKED_MIXED_ACTIVE_CONTENT)
228+
className = "mixedActiveBlocked";
229+
tooltip = gNavigatorBundle.getFormattedString(
230+
"identity.identified.verifier",
231+
[gIdentityHandler.getIdentityData().caOrg]);
232+
} else if (state & WPL.STATE_IS_SECURE) {
168233
className = "verifiedDomain";
169-
else if (state & WPL.STATE_IS_BROKEN) {
170-
if ((state & WPL.STATE_LOADED_MIXED_ACTIVE_CONTENT) &&
171-
options.getPref("security.mixed_content.block_active_content", false))
234+
if (state & WPL.STATE_BLOCKED_MIXED_ACTIVE_CONTENT)
235+
className = "mixedActiveBlocked";
236+
tooltip = gNavigatorBundle.getFormattedString(
237+
"identity.identified.verifier",
238+
[gIdentityHandler.getIdentityData().caOrg]);
239+
} else if (state & WPL.STATE_IS_BROKEN) {
240+
if (state & WPL.STATE_LOADED_MIXED_ACTIVE_CONTENT)
172241
className = "mixedActiveContent";
242+
else
243+
className = "mixedDisplayContent";
244+
tooltip = gNavigatorBundle.getString("identity.unknown.tooltip");
173245
}
174-
175246
node.className = className;
247+
node.setAttribute("tooltiptext", tooltip);
176248
}, {
177249
openPopup: function (anchor) {
178250
var handler = window.gIdentityHandler;
179251
if (typeof handler === "undefiend") // Thunderbird has none
180252
return;
181253

254+
if (handler.refreshIdentityPopup)
255+
handler.refreshIdentityPopup();
256+
else
257+
handler.setPopupMessages(handler._identityBox.className);
182258
handler._identityPopup.hidden = false;
183-
handler.setPopupMessages(handler._identityBox.className);
184259
handler._identityPopup.openPopup(anchor);
185260
},
186261
});

common/content/tabs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ const Tabs = Module("tabs", {
11701170
styles.addSheet(true, "tabnumbers", "chrome://*",
11711171
// we need to change the visible of the "new tab" buttons because the "inline" "new tab" button in the toolbar
11721172
// gets moved just after the last app tab with tab numbers on
1173-
"#TabsToolbar { counter-reset:tabnumber; } #TabsToolbar tab::after { counter-increment:tabnumber; content:counter(tabnumber); font:bold 0.84em monospace; cursor: default; } #TabsToolbar tab:not([pinned])::after { display:block; padding-bottom:0.4em; } .tabs-newtab-button { display: none !important; } #new-tab-button { visibility: visible !important; }"
1173+
"#TabsToolbar { counter-reset:tabnumber; } #TabsToolbar tab::after { counter-increment:tabnumber; content:counter(tabnumber); font:bold 0.84em monospace; cursor: default; background-image: none !important; opacity: 1 !important; } #TabsToolbar tab:not([pinned])::after { display:block; padding-bottom:0.4em; } .tabs-newtab-button { display: none !important; } #new-tab-button { visibility: visible !important; }"
11741174
);
11751175
else
11761176
styles.removeSheet(true, "tabnumbers");

common/content/util.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ const Util = Module("util", {
827827
return {
828828
__proto__: ary,
829829
__iterator__: function () this.iteritems(),
830-
__noSuchMethod__: function (meth, args) {
830+
mapImpl: function (meth, args) {
831831
var res = util.Array[meth].apply(null, [this.__proto__].concat(args));
832832

833833
if (util.Array.isinstance(res))
@@ -836,7 +836,8 @@ const Util = Module("util", {
836836
},
837837
toString: function () this.__proto__.toString(),
838838
concat: function () this.__proto__.concat.apply(this.__proto__, arguments),
839-
map: function () this.__noSuchMethod__("map", Array.slice(arguments))
839+
map: function () this.mapImpl("map", Array.slice(arguments)),
840+
flatten: function () this.mapImpl("flatten", arguments)
840841
};
841842
}
842843
}, {

0 commit comments

Comments
 (0)