Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send article to new tab in jQuery mode #680

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
af023dd
Send article to new tab
Jaifroid Apr 7, 2021
cb153c4
Update app.js
Jaifroid May 4, 2021
bfba079
Avoid document write
Jaifroid May 7, 2021
7d93eb4
Clean up UI options
Jaifroid May 8, 2021
754c264
Apply styles to new window/tab
Jaifroid May 8, 2021
84fc3bb
Change description of setting
Jaifroid May 9, 2021
a0217ff
Ensure styles applied to window and iframe
Jaifroid May 9, 2021
4bb4f45
Attempting to debug tests
Jaifroid May 9, 2021
6e0e33b
Restore timings
Jaifroid May 9, 2021
047906b
Ensure scroll to top of newly loaded article
Jaifroid May 9, 2021
1a2372a
Attempt a new architecture
Jaifroid May 9, 2021
f1e5a57
Restore iframe history
Jaifroid May 9, 2021
e7ed05d
Further tweaks to load process
Jaifroid May 9, 2021
8ee285a
Add more informative system alert
Jaifroid May 9, 2021
3a64720
Interesting experiment!
Jaifroid May 9, 2021
23536d3
Open preview in new Window
Jaifroid May 9, 2021
70bf8cb
Correct syntax
Jaifroid May 9, 2021
44314eb
Relocate target reset on search
Jaifroid May 14, 2021
0fa4ac2
Improve touch detection
Jaifroid May 15, 2021
6159cc4
Add UI help
Jaifroid May 15, 2021
671d9c2
Attend to some points from self-reviw
Jaifroid May 16, 2021
6580907
Improve middle click and prevent double activation
Jaifroid May 22, 2021
d661f8f
Attempt to block launching of extraneous tabs
Jaifroid May 22, 2021
29dff7a
New UI for options
Jaifroid May 23, 2021
5aa2d6d
Attempt to rate-limit history navigation
Jaifroid May 23, 2021
8ce8418
Fix missing flag
Jaifroid May 23, 2021
74d0071
Code with logging to test on Ubuntu
Jaifroid May 23, 2021
76ff0ee
Keep chain of trust
Jaifroid May 23, 2021
1c5fa7c
Tweaks to touch on Firefox and Chrome
Jaifroid May 23, 2021
e2852fa
Refactor to improve long-press
Jaifroid May 24, 2021
9c29d91
Fix bug preventing touch navigation in some contexts
Jaifroid May 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion browser-tests/nightwatch_runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ module.exports = {
.frame('articleContent')
// Check the text in the article "Ray Charles"
.useXpath()
.waitForElementPresent("//div[@id='content']/div[@id='mw-content-text']/h2[@id='mweQ']", 40000)
.waitForElementPresent("//div[@id='content']/div[@id='mw-content-text']/h2[@id='mweQ']", 20000)
Jaifroid marked this conversation as resolved.
Show resolved Hide resolved
.assert.containsText("//div[@id='content']/div[@id='mw-content-text']/h2[@id='mweQ']", 'Life and career')
// Wait for a particular image to be visible and check its size
.useXpath()
Expand Down Expand Up @@ -107,6 +107,8 @@ module.exports = {
.frame('articleContent')
// Check the text in the article "Ray Charles"
.useXpath()
// Let's pause for a second
.pause(1000)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change possibly no longer neceesry, but maybe it does no harm?

.waitForElementPresent("//div[@id='content']/div[@id='mw-content-text']/h2[@id='mweQ']", 40000)
.assert.containsText("//div[@id='content']/div[@id='mw-content-text']/h2[@id='mweQ']", 'Life and career')
// Wait for a particular image to be visible and check its size
Expand Down
11 changes: 9 additions & 2 deletions nightwatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ module.exports = {
"enabled" : false
},
"globals": {
"waitForConditionTimeout": 600
"waitForConditionTimeout": 10000
Jaifroid marked this conversation as resolved.
Show resolved Hide resolved
},
// Configure when a request to the Selenium server should time out and optionally define the number of retries for a timed-out request
// See https://github.com/nightwatchjs/nightwatch/issues/1936
"request_timeout_options": {
"timeout": 100000,
"retry_attempts": 3
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be worth keeping these ones?

}
},
"firefox45" : {
Expand All @@ -60,7 +66,8 @@ module.exports = {
"browserName": "firefox",
"javascriptEnabled": true,
"acceptSslCerts": true,
"build": build
"build": build,
"extendedDebugging": true
}
},
"chrome58" : {
Expand Down
2 changes: 1 addition & 1 deletion www/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<title>Placeholder for injecting an article into the iframe</title>
<meta name="description" content="Placeholder for injecting an article into the iframe or window">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to avoid setting a title in the dummy article, because it sometimes sticks and doesn't get replaced by the article title when loading a new tab or window. However, we still need a string in the html that allows us to identify that the dummy article is loaded (see in code below where we search for this string).

</head>
<body></body>
</html>
1 change: 1 addition & 0 deletions www/css/kiwixJS_invert.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* along with Kiwix (file LICENSE-GPLv3.txt). If not, see <http://www.gnu.org/licenses/>
*/

html._invert,
img,
video {
filter: invert(1) hue-rotate(180deg);
Expand Down
1 change: 1 addition & 0 deletions www/css/kiwixJS_mwInvert.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* along with Kiwix (file LICENSE-GPLv3.txt). If not, see <http://www.gnu.org/licenses/>
*/

html._mwInvert,
img:not([class|="mwe-math-fallback-image"]),
video {
filter: invert(1) hue-rotate(180deg);
Expand Down
18 changes: 18 additions & 0 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,19 @@ <h3>Display settings</h3>
<div class="card card-info" id="displaySettingsDiv">
<div class="card-header">Display options:</div>
<div class="card-body">
<div class="checkbox" id="openInNewTab" title="Open article in new tab">
<label>
<input type="checkbox" name="tabOpener" id="tabOpenerCheck">
<strong>Open ZIM links in new tab</strong> with right-click, ctrl-click, middle-click or long-press
</label>
</div>
<div class="checkbox" id="openInNewWindow" hidden title="Open article in new window">
<label>
<input type="checkbox" name="windowOpener" id="winOpenerCheck">
<strong>Open in new window instead</strong>
</label>
</div>
<div id="winOpenerHelp" style="padding-bottom:1em;"></div>
<div class="checkbox">
<label>
<input type="checkbox" name="hideActiveContentWarning"
Expand Down Expand Up @@ -547,6 +560,10 @@ <h3>Expert settings</h3>
<div id="articleList" class="list-group">
</div>
</div>
<div id="systemAlert" style="display:none; margin: 0 50px;" class="alert alert-danger alert-dismissible fade show">
<button type="button" class="close" data-hide="alert">&times;</button>
<div id="alertContent"></div>
</div>
<!-- Bootstrap alert box -->
<div id="alertBoxHeader">
<div id="activeContent" style="display:none;" class="alert alert-warning alert-dismissible fade show">
Expand All @@ -557,6 +574,7 @@ <h3>Expert settings</h3>
if your platform supports it. &nbsp;[<a id="stop" href="#displaySettingsDiv" class="alert-link">Permanently hide</a>]
</div>
</div>
<div id="pagePreview" style="padding: 0 50px;"></div>
<iframe id="articleContent" class="articleIFrame" src="article.html"></iframe>
</article>
<footer>
Expand Down
Loading