-
Notifications
You must be signed in to change notification settings - Fork 1
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
Unfortunate: the the un4chan userscript toolkit #12
base: master
Are you sure you want to change the base?
Conversation
happening.jpg
lots more ugliness both within c4 and the interface I just invented. It'll get better soon though
|
||
op = new DOMPost do | ||
thread-no | ||
el.querySelector( \.op ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the spacing? 10 lines below you don't space it like that anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
legacy whitespace. I'm pretty sure the DOM parser is the oldest still-active piece of code in c4/html5chan.
I'll clean it up soon(tm)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
™
as I said - why not move your helpers-thingies into some npm module as well, and require it both from unfortunate and from the other one? |
mfw i still have no idea what this means, but am excited nonetheless |
You can expect great things in @qqueue... You just need to wait a bit : d |
Couldn't think of a nice api, so I just wrapped the current api up in new naming conventions. Good enough for testing, I think.
I might, but after looking through the code several times, the helpers really aren't that much helpful, and they make the source ever-so-slightly-harder to read without familiarizing yourself with my idiosyncratic set of symbol-named functions. I might extract |
After much wrangling, I managed to get a https://gist.github.com/qqueue/0489a75a10caba0746f4 The userscript block (my code) starts at 18397 . Since it's running at It didn't quite work at first, but after liberal application of This means that my grand plan for polymer+unfortunate is likely feasible. I'll still need to to dig in to vulcanize and figure out how to output it in a userscript-friendly (styles as text, scripts inline) format, but fixing it to work with greasemonkey was at least a little easier than expected. |
Fuck chrome. |
oh ok sorry 😞 |
I'm getting the same breakage on polymer's site, though only if I have Re: chrome extensions, I've always planned to make c4 work in chrome eventally (I did have it working in tampermonkey at one point), but since my userbase has always been just me, I don't have a lot of incentive. One thing i do have incentive for is moving out of greasemonkey and into the jetpack addon API (i.e., firefox extension), which seems to have a lot better debug tooling than greasemonkey. I could also then intercept 4chan page loads in a less hacky manner, and make my SharedWorker use an actual file instead of a data URI. https://github.com/mozilla/jpm is probably worth a try. One other spec I've been keeping track of lately is ServiceWorkers, which allows you to intercept requests for a given domain and mangle the responses however you want, all from a separate javascript worker thread. If you think about it, that's pretty much what I've turned greasemonkey into with the DOM replacement trick--given a URL and the original response, output whatever you want with the old content as input. While it's not built for site augmentation like greasemonkey/addon api is, it does have some interesting parallels. |
Flipped the pref and the site now works. I must have set it when it first got announced for Firefox and never bothered reading up on it or something. I only mention Chrome because as far as I know, you can actually debug and test a lot of things within Chrome's console and stuff. But, I'm not an expert. A solo Firefox add-on might be cool, as I would assume doing so would also allow you greater control and such. The only reason I mention Chrome is because from memory, you don't need to worry about fancy stuff, and you can pretty much create one with straight HTML/CSS/JS? I don't know. You guys are the expert, I just like sitting and watching, as I've said before. 🍔 |
@qqueue Please note that there's a 5$ fee to upload extensions to the store, and that "vanilla chrome" can't install non-store extensions (even in dev. mode). You need chromium or chrome canary to dev extensions. Yes, this is awful. |
annoying, they must've changed the way that works.
Just noticed the PR title has "the" twice in it. |
breaking my ancient crufty shit. The ordering no longer works, oh well.
if you just wait 3 years, TODOs just get implemented, yo
👍 |
Since I now browse that sad board. Holy shit is livescript sugary, I can see why I liked it.
People are always posting fuck huge images in /tg/ for some reason, like 6 MB phone pics. annoying.
They finally did it. They broke my 2-year-old shit script. xhr no longer takes relative "//" urls anymore i guess, so https everywhere. I'm kind of surprised my sharedworker shit still works. I remember how terrible it all seemed when I wrote it. It probably still sux. javascript life.
i thought something was actually happening x( |
i.e., the non-ui parts of c4, so others can userscript without being tied to either 4chan's UI choices or c4's UI choices (as much as possible, anyway).
unf
for short.I aiming for this library to be usable with polymer, so one could make a Material Design(tm) userscript on top. So far so good, though polymer itself might take some convincing to work within greasemonkey though (haven't tried it yet).
Still TODO is extracting the fancy new SharedWorker-based updater into something usable. I basically want to have an API like:
which should plug in to most MVWhatever libraries (polymer, react, mithril, etc) nicely. Then, just wrap this up in a separate buildscript/repository, add npm + publishing for greasemonkey
@require
, and it's ready for use, albeit probably buggy (like c4).There are some other parts of c4 that might be worth extracting as well, such as the relative dates, lightbox/tooltips, the youtube api queue, and the posting logic. Once that's extracted, c4 is a pretty tiny codebase: some html templates, styles, and a bundle of hideous dom-mangling.
@saxamaphone69 , 4u.