Jump to content

Web Browser + Proxomitron Reborn + PtronGUI --- A How-To Guide


Recommended Posts


On 4/27/2022 at 9:01 AM, UCyborg said:

They're supposed to replace:

/(?:reddit\.com\/r\/)(?<subreddit>[\w]+)(?:\/comments\/)?(?<postId>[\w]+)?/
/(?:reddit\.com\/r\/)([\w]+)(?:\/comments\/)?([\w]+)?/

And:

var s;const{subreddit:o,postId:r}=(null===(s=t.match(i))||void 0===s?void 0:s.groups)||{};
const s=t.match(i),o=null===s[1]?void 0:s[1],r=null===s[2]?void 0:s[2];

1st line is original, 2nd is replacement.

These both work as-is for me --

image.thumb.png.90bd79d0878c8ddd6b1b8418926a9352.png

Link to comment
Share on other sites

6 hours ago, NotHereToPlayGames said:

Could also be a content-type issue.

Ohhh, thanks for the hint! Putting application/x-javascript instead of application/javascript works. Both are considered legacy though (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types - Legacy JavaScript MIME types):

Note: Even though any given user agent may support any or all of these, you should only use text/javascript. It's the only MIME type guaranteed to work now and into the future.

6 hours ago, NotHereToPlayGames said:

If memory serves, your config is a "start-from-scratch" config because the Swiss Army Knife has too many knives.

Yup, I'm clumsy and don't want to cut myself. Those rules from the starting point config break JS left and right on that site.

6 hours ago, NotHereToPlayGames said:

Can you filter ANY .js files with your config?

Sure can, this was the odd one, all because of MIME type.

Edited by UCyborg
Link to comment
Share on other sites

On 4/29/2022 at 3:14 PM, NotHereToPlayGames said:

My initial hunch is that you have to 'escape' the "=" characters.

Yes, that would be better for consistency since expecting minified JS and escaped = is taken as literal without the added documented behavior.

On 4/29/2022 at 10:07 PM, UCyborg said:

Ohhh, thanks for the hint! Putting application/x-javascript instead of application/javascript works.

Now I've put that MIME-List into use and added the following rule:

In = TRUE
Out = FALSE
Key = "Content-Type: Fix MIME types"
Match = "(*|(^?))$URL([^/]+*.([a-z0-9]+{2,5}&&$LST(MIME-List))((^?)|\?))"
Replace = "\0"
Edited by UCyborg
Threw out HTTP:// bit
Link to comment
Share on other sites

Oops, byte limit starts counting from where the match is found. Why did I bother counting preceding bytes? :blushing:

Link to comment
Share on other sites

On 4/27/2022 at 9:01 AM, UCyborg said:
[Patterns]
Name = "Reddit - comments page regex 1"
Active = TRUE
URL = "www.redditstatic.com/desktop2x/CommentsPage.*.js"
Limit = 127300
Match = "/\(\?:reddit\\.com\\/r\\/\)\(\?<subreddit>\[\\w\]\+\)\(\?:\\/comments\\/\)\?\(\?<postId>\[\\w\]\+\)\?/"
Replace = "/\(\?:reddit\\.com\\/r\\/\)\(\[\\w\]\+\)\(\?:\\/comments\\/\)\?\(\[\\w\]\+\)\?/"

Name = "Reddit - comments page regex 2"
Active = TRUE
URL = "www.redditstatic.com/desktop2x/CommentsPage.*.js"
Limit = 127700
Match = "var s;const{subreddit:o,postId:r}=\(null===\(s=t.match\(i\)\)\|\|void 0===s\?void 0:s.groups\)\|\|{};"
Replace = "const s=t.match\(i\),o=null===s\[1\]\?void 0:s\[1\],r=null===s\[2\]\?void 0:s\[2\];"

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.


×
×
  • Create New...