468,167 Members | 1,943 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,167 developers. It's quick & easy.

Locally (to the user) control bytes.com from outside of their system.

SwissProgrammer
206 128KB
I have seen similar done in a different language.

I would like this in 32 bit, C++11, not VSC++, not .net.
  1. Subclass all Firefox (or other browser) windows as soon as Microsoft Windows assigns them a temporary handle, before they are given a permanent handle.
  2. Parse the new browser window and detect the url location, etc.
  3. Run a javascript on the web page via the browser window url location box. Yes, I have literally seen this done.
  4. Detect if gits has edited an original posting for advertising, etc. Not reply postings, just the original posting. If gits has, then blank the page of ALL messages and do not waste my time showing it to me. Just put up a text line in the web page that says something like, "Spam advertising removed."

That way, it is not dependent upon Bytes.com to do this, and the editing can be used on other sites to remove other stuff.

If someone would like to write the code, that would be nice. It could be very useful maybe to millions of people.

Thanks.
Jun 5 '20 #1

✓ answered by dev7060

Not in C++ but if you're interested, the below simple JS can be used on this site with a script manager.

Expand|Select|Wrap|Line Numbers
  1. var content = document.body.textContent || document.body.innerText;
  2. var hasText = content.indexOf("Last edited by")!==-1;
  3. var hasText2 = content.indexOf("promotion")!==-1;
  4. var hasText3 = content.indexOf("spam")!==-1;
  5. var hasText4 = content.indexOf("remove promotion link")!==-1;
  6. var hasText5 = content.indexOf("remove promotional link")!==-1;
  7. if (hasText && (hasText2 || hasText3 || hasText4 || hasText5)) {
  8.     alert("Possible promotional/spam content warning!");
  9. }
The first guess was to extract the inner html/text using an ID for accurate results but the site doesn't seem to use any associated with that particular field. The above script would depend on what the moderators prefer to put in the edit/update reason area. Some common phrases have been mentioned.

Personally I don't prefer to use any of such. Been learning JS lately, so thought it'd be fun to figure out a possible way.

3 1595
dev7060
413 Expert 256MB
Not in C++ but if you're interested, the below simple JS can be used on this site with a script manager.

Expand|Select|Wrap|Line Numbers
  1. var content = document.body.textContent || document.body.innerText;
  2. var hasText = content.indexOf("Last edited by")!==-1;
  3. var hasText2 = content.indexOf("promotion")!==-1;
  4. var hasText3 = content.indexOf("spam")!==-1;
  5. var hasText4 = content.indexOf("remove promotion link")!==-1;
  6. var hasText5 = content.indexOf("remove promotional link")!==-1;
  7. if (hasText && (hasText2 || hasText3 || hasText4 || hasText5)) {
  8.     alert("Possible promotional/spam content warning!");
  9. }
The first guess was to extract the inner html/text using an ID for accurate results but the site doesn't seem to use any associated with that particular field. The above script would depend on what the moderators prefer to put in the edit/update reason area. Some common phrases have been mentioned.

Personally I don't prefer to use any of such. Been learning JS lately, so thought it'd be fun to figure out a possible way.
Jun 6 '20 #2
SwissProgrammer
206 128KB
It has been a while since I used javascript.

You are much faster at JS than I am.

Could you put this in a single line that I can copy and paste into the url location bar like this avascript:<I do not recall this part>. Then I can type in the j in front of the line (have to do it that way for built-in universal browser security rules which do not allow pasting anything starting with the word "javascript" and running it) (I think). Then hit the enter button and run the javascript to test it.

I would have just copied the entire web page to a string and looked for the part that told me that gits found advertising, then done something. I think that your way is probably faster, and maybe more adaptable to other sites and other filters. Nice.

Thanks.
Jun 6 '20 #3
dev7060
413 Expert 256MB
Not in C++ but if you're interested, the below simple JS can be used on this site with a script manager.
^^ Install a userscript manager in the browser (I prefer Greasemonkey). Then add the above script to it.
Jun 6 '20 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

12 posts views Thread by Steve Blinkhorn | last post: by
3 posts views Thread by tshad | last post: by
10 posts views Thread by Erik Max Francis | last post: by
1 post views Thread by gcdp | last post: by
reply views Thread by gcreed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.