Jump to content

How is this made JavaScript?


kutia
 Share

Recommended Posts

I'm not really what the effect is or how to replicate it (since I don't know Bulgarian, I don't know what's supposed to be there or not). I suppose a simple algorithm could be run after the page loads to get the text and then insert random characters into it and then put that back in the element it came from.

Link to comment
Share on other sites

As a simple test, I converted this:hiinto this:h<span style="display:none">D</span>iThey are displayed the same, but when you copy the second and paste it, it looks like this:hDiSo, yes, a script could do this, and it could be written so that random characters are inserted.But if it happens in the browser, the original text should be easily available. At best you could slow down the plagiarism process, but not prevent it.

Link to comment
Share on other sites

I think all this can stop the process because the result is plagiarism when you copy and paste is as follows - Original text: "Lenovo says quarterly profit nearly doubles ..." and then copy and paste the result was: "Leanvoevyo swafyjsi qeudagrytiekrkly pvrfofhijtk ngehajrkljy daodugbblrehs ..." (Lenovo = LEnVoEvYo) This random letters inserted between each letter in the text. There is done through JavaScript. How can this be done?

Edited by kutia
Link to comment
Share on other sites

I think all this can stop the process because the result is plagiarism when you copy and paste is as follows - Original text: "Lenovo says quarterly profit nearly doubles ..." and then copy and paste the result was: "Leanvoevyo swafyjsi qeudagrytiekrkly pvrfofhijtk ngehajrkljy daodugbblrehs ..." This random letters inserted between each letter in the text. There is done through JavaScript. How can this be done?
Like I said, you have to make an algorithm to do that. Get the string, maybe turn it into an array of characters, and then loop through it and randomly insert hidden characters wrapped within span elements like DD showed, and then concatenate all that back into a string and reinsert it back into the element using innerHTML. I'm sure there are quite a few different ways to accomplish this however. Although DD brings up a good point that getting the original text may not be that hard though.
Link to comment
Share on other sites

Like I said, you have to make an algorithm to do that. Get the string, maybe turn it into an array of characters, and then loop through it and randomly insert hidden characters wrapped within span elements like DD showed, and then concatenate all that back into a string and reinsert it back into the element using innerHTML. I'm sure there are quite a few different ways to accomplish this however. Although DD brings up a good point that getting the original text may not be that hard though.
Thanks a lot. Whether you show or example code how to do this? or a link to a lesson because I do not find anywhere
Link to comment
Share on other sites

Well, let's say you have the following div:<div id='content'>This is some content</div>You can get the divs text using its innerHTML property like this:var text = document.getElementById('content').innerHTML;After you have the text, you can use the split function to make that into an array. Once you have the array, you just loop through it, probably using a for loop, and add in letters. Adding a static letter (always the same letter) after every character (or every second, or third, etc.) is pretty easy. If you wanted to add random letters in random locations, it gets a little trickier. First, as you're looping you'll need to randomly decide if you want to place a letter. That's relatively easy using Math.random. Then you'll need to choose a letter. Google should be able to help you there. Try Googling something "generate random letter in JavaScript".

Link to comment
Share on other sites

In PHP, you can do it with something like DOM (assuming you keep your pages' code well formed). After you extract the code, the steps overlap with what ShadowMage suggests for JavaScript.However, even if you do it with PHP, plagirization is still not fully prevented, but just slown down. Someone who intends to copy & paste stuff regularly can still fairly easy write a script that would eliminate non displayed elements, thus circumventing this protection. They'll be slown down the first time, but it will be a matter of a single click after they write it once. It would be even more trivial if EVERYONE actually started using this kind of protection, because there'll surely be some pre-made tools then.

Link to comment
Share on other sites

Unfortunately, probably not a good method of protection.
It would probably deter most casual plagiarists, but most certainly not the dedicated ones. That hard truth is, if somebody wants to steal your work, they're going to find a way to do it.
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

×
×
  • Create New...