Skip to content

Commit

Permalink
Merge branch 'develop' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
baka-kaba committed Apr 1, 2019
2 parents 29bbf5d + 79ed6b6 commit fa5de30
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Awful.apk/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ferg.awfulapp"
android:versionCode="10007"
android:versionName="3.6.3"
android:versionCode="10008"
android:versionName="3.6.4"
android:installLocation="auto">
<supports-screens
android:smallScreens="true"
Expand Down
13 changes: 11 additions & 2 deletions Awful.apk/src/main/assets/javascript/thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,19 @@ function highlightOwnUsername(scopeElement) {
return textNodeArray;
}

/**
* Escapes a string for inserting into a regex.
* Taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
*/
function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}

var selector = 'article:not(self) .postcontent';
var username = listener.getPreference('username');

var regExp = new RegExp('\\b' + listener.getPreference('username') + '\\b', 'g');
var styled = '<span class="usernameHighlight">' + listener.getPreference('username') + '</span>';
var regExp = new RegExp('\\b' + escapeRegExp(username) + '\\b', 'g');
var styled = '<span class="usernameHighlight">' + username + '</span>';
scopeElement.querySelectorAll(selector).forEach(function eachPost(post) {
getTextNodesIn(post).forEach(function eachTextNode(node) {
if (node.wholeText.match(regExp)) {
Expand Down
1 change: 1 addition & 0 deletions Awful.apk/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@
<item>Guavanaut</item>
<item>JingleBells</item>
<item>Literal Hamster</item>
<item>Oben</item>
<item>Sereri</item>
<item>spanky the dolphin</item>
<item>The Dave</item>
Expand Down

0 comments on commit fa5de30

Please sign in to comment.