ID:157194
 
I want to have a filter that can pull text from the browser and if forbidden text is found, it replaces it...How would I go about doing this?
You can intercept some links via client/Topic(). However, any links within a page or typing a URL directly isn't going to do jack.

Of course, neither will attempting to filter the internet.
In response to Garthor
Garthor wrote:
You can intercept some links via client/Topic(). However, any links within a page or typing a URL directly isn't going to do jack.

Of course, neither will attempting to filter the internet.

China has an alternate key. :D

If you're looking to replace text, make a list of the words and then use a library like TextHandling to go through each element of the list and replace as needed.
BananasInPajamas wrote:
I want to have a filter that can pull text from the browser and if forbidden text is found, it replaces it...How would I go about doing this?

First, get the data you're going to be putting in the browser.
If it is coming from a website then you can use world/Export to do this.

An example:
  var/http[] = world.Export("http://www.byond.com")
var/F = http["CONTENT"]
if(F)
usr << browse(F)


Next, start filtering out text.
Example of this:
mob/verb/ReplaceStuff()
var/X="Testing testing one two three"
var/Loc
do
Loc=findtext(X,"Testing")
if(Loc)
var/A=copytext(X,1,Loc)
var/B=copytext(X,Loc+length("Testing"))
X="[A]EDITED[B]"
while(Loc)
world<<"[X]"


And then display the text to the person, done with browse()

usr<<browse(X)


And there you go.


EDIT: Oh, a side note. If you're saying pull text out of an entry box that the user typed in you'd have to find a way to grab the info yourself. There are some libraries used for character creation that use browsers, so that would be a good place to look for examples of how that would be accomplished.