How to identify duplicate Javascript functions that include an Asp.net page

I have an application that uses some javascript functions,

Since all javascripts are included in the Masterpage, most of them that come with the link are not needed, and some of them are repeated (they are used in some JS files.)

So, I want to check if there is a way to identify duplicate functions and remove them?

+5
source share
4 answers

You can check if a function exists when declaring a function, but you must change the way it works.

instead

function foo(){ something }

do

if(window.foo===undefined){
window.foo=function(){ something }
}

and you can still call him

foo();

find & replace, regexp, :)

+4

, , . , , . , javascript .

, : Ctrl+Shift+F. /, , / .

, #id .class . .cs . , # . jQuery, .

, - , , , VS 2008, .

+2

, , script.

, , .

0

It is unclear if you are using Webforms or MVC. In any case, you want to use some kind of script manager.

For MVC, I found that this study has the same problem: Simple ScriptManager for ASP.NET MVC

For web forms, erm, not sure i need to do my homework again

0
source

All Articles