473,395 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

SwissProgrammer
220 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 1975
dev7060
636 Expert 512MB
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
220 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
636 Expert 512MB
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

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

Similar topics

0
by: CBretana | last post by:
Is it possible to programmatically control the WebPartManager without being on a web page? I need to write a C# console app that will cycle through a set of objects and for each one, generate (for...
2
by: dawg1998 | last post by:
I have a page that creates dynamic textboxes based on the number of fields a user chooses to fill out. This process worked great when the page was standalone. However, when I move to a...
12
by: Steve Blinkhorn | last post by:
Does anyone know of a way of accessing and modifying variables declared static within a function from outside that function? Please no homilies on why it's bad practice: the context is very...
3
by: tshad | last post by:
I am trying to put together a user control (.ascx). Can you access an outside control from it? My control: login2.ascx ****************************************************************...
1
by: Melisa | last post by:
Hi I have a list of all activeX controls registered on my system. When i add one of these activeX controls to Windows Form on runtime , an exception is thrown if this activeX control is not...
0
by: Diego L Espiñeira | last post by:
How do I set security for content served by the use of the classes in System.Web.Hosting namespace?
10
by: Erik Max Francis | last post by:
For a file hashing system (finding similar files, rather than identical ones), I need to be able to efficiently and quickly sum the ordinals of the bytes of a file and their squares. Because of...
1
by: python1 | last post by:
Hi All, I am using a python system command to execute a C++ executable file which takes certain binary input. For example: C++ exe name is "Test" "Test" takes the following input ....
6
by: James Hahn | last post by:
That looks like proper Property set code to me. What is the line of code that the designer is generating in the Sub InitializeComponent for a color that you select in the Properties Settings? ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.