kutia Posted August 18, 2011 Share Posted August 18, 2011 HelloIn this Bulgarian site ( http://www.yellow.bg/gossip/n336603/ ) in the text of the article is JavaScript that adds random letters into words and thus protected from plagiarism when you copy and paste into another site. How is this made JavaScript?(I learned about it when using JavaScript turned the option on browser) Link to comment Share on other sites More sharing options...
thescientist Posted August 18, 2011 Share Posted August 18, 2011 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 More sharing options...
kutia Posted August 18, 2011 Author Share Posted August 18, 2011 Do I think this is right. This puts the letters hidden in the text are not visible. What JavaScript code can guard a hidden key in the text to be displayed only when you copy and paste text to another site? Link to comment Share on other sites More sharing options...
jeffman Posted August 18, 2011 Share Posted August 18, 2011 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 More sharing options...
kutia Posted August 18, 2011 Author Share Posted August 18, 2011 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? Link to comment Share on other sites More sharing options...
thescientist Posted August 18, 2011 Share Posted August 18, 2011 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 More sharing options...
ShadowMage Posted August 18, 2011 Share Posted August 18, 2011 Although DD brings up a good point that getting the original text may not be that hard though.Unless you do this server-side using PHP (or other server-side language). Link to comment Share on other sites More sharing options...
kutia Posted August 18, 2011 Author Share Posted August 18, 2011 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 More sharing options...
thescientist Posted August 18, 2011 Share Posted August 18, 2011 Unless you do this server-side using PHP (or other server-side language).smart smart smart smart Link to comment Share on other sites More sharing options...
ShadowMage Posted August 18, 2011 Share Posted August 18, 2011 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 More sharing options...
kutia Posted August 18, 2011 Author Share Posted August 18, 2011 Thanks a lot! Do you think that this is a good method to protect content? Link to comment Share on other sites More sharing options...
boen_robot Posted August 18, 2011 Share Posted August 18, 2011 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 More sharing options...
justsomeguy Posted August 18, 2011 Share Posted August 18, 2011 Do you think that this is a good method to protect content?Not really. Why can't someone just copy and paste, then edit out the typos? All you have to do is run it through a spell checker. Link to comment Share on other sites More sharing options...
kutia Posted August 18, 2011 Author Share Posted August 18, 2011 Yes, you are right. Unfortunately, probably not a good method of protection. Thanks a lot Link to comment Share on other sites More sharing options...
ShadowMage Posted August 18, 2011 Share Posted August 18, 2011 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.