View Single Post
Old 2004-06-14, 12:51 AM   #38
Entreri
WHO IS FONZY!?! Don't they teach you anything at school?
 
Join Date: Feb 2004
Posts: 42
My 2 cents

Here are my 2 cents on this thread...

1. Be sure to backup your stuff - unless you have absolute faith - before running a search-and-replace script. If you cancel the script while it is working, you might wreck one file. (Plus, without any logging or output, you cannot know which file may be messed-up)

2. The script obviously cannot strip what it doesn't know. Therefore, where you wrote the right-clicking script differently, it won't strip it. Sure, one could make the regular expression a bit more flexible but it's troubles that could be avoided.

Here are two suggestions to avoid those problems in the future :

1. If you gotta use Javascript, you might consider using *one* centralized included javascript. In our situation, you could have modified the javascript in question at will or it would make a single line to search-and-strip in all your files.

Ex.

Code:
<SCRIPT language=javascript src=http://blah/blockrightclick.js></SCRIPT>
2. Or, you could add comments that act as tags around code to clearly identify those blocks.

Code:
<!-- RightClickStart  --> 
<script>

my script to block right-click here 

</script>
<!-- RightClickEnd  -->
Then, if you think one of the files does not use the same block of code, or you want to modify the block of code, or remove it altogether, those tags make it very easy to do so.

Entreri.
Entreri is offline   Reply With Quote