JS Plug-in class library organization and management (based on ASP.net management) _ Practical skills

Source: Internet
Author: User
Tags html sample
Organization and management of Testjs plug-in class library
First, for example, the calendar in the jquery plugin has to be in a page like the following code
Copy Code code as follows:

<style type= "Text/css" >
@import "Script/calendar/jquery.datepick.css";
</style>
<script type= "Text/javascript" src= "Script/jquery1.3.2.js" ></script>
<script type= "Text/javascript" src= "Script/calendar/jquery.datepick.js" ></script>
<script type= "Text/javascript" src= "Script/calendar/jquery.datepick-zh-cn.js" ></script>

Looking at the code above, the calendar code has to use four related files. Where Jquery1.3.2.js is required, Jquery.datepick-zh-cn.js relies on the Jquery.datepick.js (Calendar plug-in), and Jquery.datepick.css is the plug-in's style.
Use the above code to be very careful about the dependencies of Plug-ins, primary and secondary relationship can not be changed, moving file path also have to change the file src path, the above script download js files are single-threaded download, ideally for multi-threaded download (Firebug can see), In addition, the plugin's caching problem (plugin updated, the client may also save the original file).
Read a lot of online on this aspect of the solution, Blog Park in Smartscript and Javaeye have jsi, they seem to have a boot.js file. My solution just needs a script followed by the plug-in parameters.
Here's a solution to my problem:
<script type= "Text/javascript" src= "Script.do?plugins=calendar" ></script>
In a page only need JS application plug-ins need only script.do followed by the parameters of plug-in name parameters can be, other work is in the overall writing a plug-in resource configuration file (write plug-in configuration people have to understand the relevant resources of JS, this only needs to be configured once), as for other nothing need to get.
Plug-in resource configuration file
Copy Code code as follows:

<?xml version= "1.0" encoding= "Utf-8"?>
<script path= "script/plugins/" name= "Script/jquery1.3.2.js" lazy= "Script/plugins/lazy/jquery.lazy-1.3.1.js" >
<!--automatic completion-->
<plugin name= "autocomplete" file= "Autocomplete/jquery.autocomplete.js" >
<lazy file= "Autocomplete/jquery.autocomplete.css" ></lazy>
</plugin>
<!--calendar-->
<plugin name= "Calendar" file= "Calendar/jquery.datepick.pack.js" >
<lazy file= "Calendar/jquery.datepick.css" ></lazy>
<lazy file= "Calendar/jquery.datepick-zh-cn.js" ></lazy>
</plugin>
<!--tip Box-->
<plugin name= "Tip" file= "tip/jquery.tip.js" >
<lazy file= "Tip/bs.css" ></lazy>
</plugin>
<!--drag-->
<plugin name= "draggable" file= "Jquery.draggable.js" >
<lazy file= "Ui/ui.core.js" ></lazy>
<lazy file= "Draggable/ui.draggable.css" ></lazy>
</plugin>
<!--drag down-->
<plugin name= "droppable" file= "Jquery.droppable.js" >
<lazy file= "Ui/ui.core.js" ></lazy>
<lazy file= "Droppable/ui.droppable.css" ></lazy>
<lazy file= "Draggable/ui.draggable.js" ></lazy>
<lazy file= "Draggable/ui.draggable.css" ></lazy>
</plugin>
</script>

HTML Sample code:
Copy Code code as follows:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title> Untitled Page </title>
<%--<script type= "Text/javascript" src= "Script/jquery1.3.2.js" ></script>
<script type= "Text/javascript" src= "Script/plugins/lazy/jquery.lazy-1.3.1.js" ></script>--%>
<script type= "Text/javascript" src= "Script.do?plugins=autocomplete,tip" ></script>
<body>
<input type= "text" id= "Suggest1" style= "border:1px solid #ccc"/><br/><br/><br/><br/>& lt;br/><br/><br/><br/><br/><br/><br/><br/>
<a href= "#" title= "Basic Tool Tip" class= "Bslink" >tip1</a><br/>
</body>
<script>
var cities = [
"Aberdeen", "Ada", "Adamsville", "Addyston", "Adelphi", "Adena", "Adrian", "Akron",
"Albany", "Alexandria", "Alger", "Alledonia", "Alliance", "Alpha", "Alvada",
"Alvordton", "Amanda", "Amelia", "Amesville", "Amherst", "Amlin", "Amsden",
"Amsterdam", "Andover", "Anna", "Ansonia", "Antwerp", "Apple Creek", "Arcadia",
"Arcanum", "Archbold", "Arlington", "Ashland", "Ashley", "Ashtabula", "Ashville",
"Athens", "Attica", "Atwater", "Augusta", "Aurora", "Austinburg", "Ava", "Avon",
"Avon Lake", "Bainbridge", "Bakersville", "Baltic", "Baltimore", "Bannock",
"Barberton", "Barlow", "Barnesville", "Bartlett", "Barton", "Bascom", "Batavia",
"Bath", "Bay Village", "Beach City", "Beachwood", "Beallsville", "Beaver",
"Beaverdam", "Bedford", "Bellaire", "Bellbrook", "Belle Center", "Belle Valley",
"Bellefontaine", "Bellevue", "Bellville", "Belmont", "Belmore", "Beloit", "Belpre",
"Benton Ridge", "Bentonville", "Berea", "Bergholz", "Berkey", "Berlin",
"Berlin Center", "Berlin Heights", "Bethel", "Bethesda", "Bettsville", "Beverly",
"Bidwell", "Big Prairie", "Birmingham", "Blacklick", "Bladensburg", "Blaine",
"Blakeslee", "Blanchester", "Blissfield", "Bloomdale", "Bloomingburg",
"Bloomingdale", "Bloomville", "Blue Creek", "Blue Rock", "Bluffton",
"Bolivar", "Botkins", "Bourneville", "Bowerston", "Bowersville",
"Bowling Green", "Bradford", "Bradner", "Brady Lake", "Brecksville",
"Bremen", "Brewster", "Brice", "Bridgeport", "brilliant", "Brinkhaven",
"Bristolville", "Broadview Heights", "Broadway", "Brookfield", "Brookpark",
"Brookville", "Brownsville", "Brunswick", "Bryan", "Buchtel", "Buckeye Lake",
"Buckland", "Bucyrus", "Buffalo", "Buford", "Burbank", "Burghill", "Burgoon",
"Burkettsville", "Burton", "Butler", "Byesville", "Cable", "Cadiz", "Cairo",
"Caldwell", "Caledonia", "Cambridge", "Camden", "Cameron", "Camp Dennison",
"Campbell", "Canal Fulton", "Canal Winchester", "Canfield", "Canton", "Carbon Hill",
"Carbondale", "Cardington", "Carey", "Carroll", "Carrollton", "Casstown",
"Castalia", "Catawba", "Cecil", "Cedarville", "Celina", "Centerburg",
"Chagrin Falls", "Chandlersville", "Chardon", "Charm", "Chatfield", "Chauncey",
"Cherry Fork", "Chesapeake", "Cheshire", "Chester", "Chesterhill", "Chesterland",
"Chesterville", "Chickasaw", "Chillicothe", "Chilo", "Chippewa Lake",
"Christiansburg", "Cincinnati", "Circleville", "Clarington", "Clarksburg",
"Clarksville", "Clay Center", "Clayton", "Cleveland", "Cleves", "Clifton",
"Clinton", "Cloverdale", "Clyde", "Coal Run", "Coalton", "Coldwater", "Colerain",
"College Corner", "Collins", "Collinsville", "Colton", "Columbia Station",
"Columbiana", "Columbus", "Columbus Grove", "Commercial point", "Conesville",
"Conneaut", "Conover", "Continental", "Convoy", "Coolville", "Corning", "Cortland",
"Coshocton", "Covington", "Creola", "Crestline", "Creston", "Crooksville",
"Croton", "Crown City", "Cuba", "Cumberland", "Curtice", "Custar", "Cutler",
"Cuyahoga Falls", "Cygnet", "Cynthiana", "Dalton", "Damascus", "Danville",
"Dayton", "De Graff", "Decatur", "Deerfield", "Deersville", "Defiance",
"Delaware", "Dellroy", "Delphos", "Delta", "Dennison", "Derby", "Derwent",
"Deshler", "Dexter City", "Diamond", "Dillonvale", "Dola", "Donnelsville",
"Dorset", "Dover", "Doylestown", "Dresden", "Dublin", "Dunbridge", "Duncan Falls",
"Dundee", "Dunkirk", "Dupont", "East Claridon", "East Fultonham",
"East Liberty", "East Liverpool", "East Palestine", "East Rochester",
"East Sparta", "East Springfield", "Eastlake", "Eaton", "Edgerton", "Edison",
"Edon", "Eldorado", "Elgin", "Elkton", "Ellsworth", "Elmore", "Elyria",
"Empire", "Englewood", "Enon", "Etna", "Euclid", "Evansport", "Fairborn",
"Fairfield", "FairPoint", "Fairview", "Farmdale", "Farmer", "Farmersville",
"Fayette", "Fayetteville", "Feesburg", "Felicity", "Findlay", "Flat Rock",
"Fleming", "Fletcher", "Flushing", "Forest", "Fort Jennings", "Fort Loramie",
"Fort Recovery", "Fostoria", "Fowler", "Frankfort", "Franklin",
"Franklin Furnace", "Frazeysburg", "Fredericksburg", "Fredericktown",
"Freeport", "Fremont", "Fresno", "Friendship", "Fulton", "Fultonham",
"Galena", "Galion", "Gallipolis", "Galloway", "Gambier", "Garrettsville",
"Gates Mills", "Geneva", "Genoa", "Georgetown", "Germantown", "Gettysburg",
"Gibsonburg", "Girard", "Glandorf", "Glencoe", "Glenford", "Glenmont",
"Glouster", "Gnadenhutten", "Gomer", "Goshen", "Grafton", "Grand Rapids",
"Grand River", "Granville", "Gratiot", "gratis", "Graysville", "Graytown",
"Green", "Green Camp", "Green Springs", "Greenfield", "Greenford",
"Greentown", "Greenville", "Greenwich", "Grelton", "Grove City",
"Groveport", "Grover Hill", "Guysville", "Gypsum", "Hallsville",
"Hamden", "Hamersville", "Hamilton", "Hamler", "Hammondsville",
"Hannibal", "Hanoverton", "Harbor View", "Harlem Springs", "Harpster",
"Harrisburg", "Harrison", "Harrisville", "Harrod", "Hartford", "Hartville",
"Harveysburg", "Haskins", "Haverhill", "Haviland", "Haydenville", "Hayesville",
"Heath", "Hebron", "Helena", "Hicksville", "Higginsport", "Highland", "Hilliard",
"Hillsboro", "Hinckley", "Hiram", "Hockingport", "Holgate", "Holland",
"Hollansburg", "Holloway", "Holmesville", "Homer", "Homerville", "Homeworth",
"Hooven", "Hopedale", "Hopewell", "Houston", "Howard", "Hoytville", "Hubbard",
"Hudson", "Huntsburg", "Huntsville", "Huron", "Iberia", "independence",
"Irondale", "Ironton", "Irwin", "Isle Saint George", "Jackson", "Jackson Center",
"Jacksontown", "Jacksonville", "Jacobsburg", "Jamestown", "Jasper",
"Jefferson", "Jeffersonville", "Jenera", "Jeromesville", "Jerry City",
"Jerusalem", "Jewell", "Jewett", "Johnstown", "Junction City", "Kalida",
"Kansas", "Keene", "Kelleys Island", "Kensington", "Kent", "Kenton",
"Kerr", "Kettlersville", "Kidron", "Kilbourne", "Killbuck", "Kimbolton",
"Kings Mills", "Kingston", "Kingsville", "Kinsman", "Kipling", "Kipton",
"Kirby", "Kirkersville", "Kitts Hill", "Kunkle", "La Rue", "Lacarne",
"Lafayette", "Lafferty", "Lagrange", "Laings", "Lake Milton", "Lakemore",
"Lakeside Marblehead", "Lakeview", "Lakeville", "Lakewood", "Lancaster",
"Langsville", "Lansing", "Latham", "Latty", "Laura", "Laurelville",
"Leavittsburg", "Lebanon", "Lees Creek", "Leesburg", "Leesville",
"Leetonia", "Leipsic", "LeMoyne", "Lewis Center", "Lewisburg",
"Lewistown", "Lewisville", "Liberty Center", "Lima", "Limaville",
"Lindsey", "Lisbon", "Litchfield", "Lithopolis", "Little Hocking",
"Lockbourne", "Lodi", "Logan", "London", "Londonderry",
"Long Bottom", "Lorain", "Lore City", "Loudonville", "Louisville",
"Loveland", "Lowell", "Lowellville", "Lower Salem", "Lucas",
"Lucasville", "Luckey", "Ludlow Falls", "Lynchburg", "Lynx",
"Lyons", "Macedonia", "Macksburg", "Madison", "Magnetic Springs",
"Magnolia", "Maineville", "Malaga", "Malinta", "Malta", "Malvern",
"Manchester", "Mansfield", "Mantua", "Maple Heights", "Maplewood",
"Marathon", "Marengo", "Maria Stein", "Marietta", "Marion",
"Mark Center", "Marshallville", "Martel", "Martin", "Martins Ferry",
"Martinsburg", "Martinsville", "Marysville", "Mason", "Massillon",
"Masury", "Maumee", "Maximo", "Maynard", "MC Arthur", "MC Clure",
"MC Comb", "MC Connelsville", "MC Cutchenville", "Mc Dermott",
"MC Donald", "MC Guffey", "Mechanicsburg", "Mechanicstown",
"Medina", "Medway", "Melmore", "Melrose", "Mendon", "Mentor",
"Mesopotamia", "Metamora", "Miamisburg", "Miamitown", "Miamiville",
"Middle Bass", "Middle point", "Middlebranch", "Middleburg",
"Middlefield", "Middleport", "Middletown", "Midland", "Midvale",
"Milan", "Milford", "Milford Center", "Millbury", "Milledgeville",
"Miller City", "Millersburg", "Millersport", "Millfield",
"Milton Center", "Mineral City", "Mineral Ridge", "Minerva",
"Minford", "Mingo", "Mingo Junction", "Minster", "Mogadore",
"Monclova", "Monroe", "Monroeville", "Montezuma", "Montpelier",
"Montville", "Morral", "Morristown", "Morrow", "Moscow",
"Mount Blanchard", "Mount Cory", "Mount Eaton", "Mount Gilead",
"Mount Hope", "Mount Liberty", "Mount Orab", "Mount Perry",
"Mount Pleasant", "Mount Saint Joseph", "Mount Sterling",
"Mount Vernon", "Mount Victory", "Mowrystown", "Moxahala",
"Munroe Falls", "Murray City", "Nankin", "Napoleon", "Nashport",
"Nashville", "Navarre", "Neapolis", "Neffs", "Negley",
"Nelsonville", "Nevada", "Neville", "New Albany", "New Athens",
"New Bavaria", "New Bloomington", "New Bremen", "New Carlisle",
"New Concord", "New Hampshire", "New Haven", "New Holland",
"New Knoxville", "New Lebanon", "New Lexington", "New London",
"New Madison", "New Marshfield", "New Matamoras", "New Middletown",
"New Paris", "New Philadelphia", "New Plymouth", "New Richmond",
"New Riegel", "New Rumley", "New Springfield", "New Straitsville",
"New Vienna", "New Washington", "New Waterford", "New Weston",
"Newark", "Newbury", "Newcomerstown", "Newport", "Newton Falls",
"Newtonsville", "Ney", "Niles", "North Baltimore", "North Bend",
' North Benton ', ' North Bloomfield ', ' North Fairfield ',
' North Georgetown ', ' North Hampton ', ' North Jackson ',
' North Kingsville ', ' North Lawrence ', ' North Lewisburg ',
' North Lima ', ' North Olmsted ', ' North Ridgeville ', ' North Robinson ',
"North Royalton", "North Star", "Northfield", "Northwood", "Norwalk",
"Norwich", "Nova", "novelty", "Oak Harbor", "Oak Hill", "Oakwood",
"Oberlin", "Oceola", "Ohio City", "Okeana", "Okolona", "Old Fort",
"Old Washington", "Olmsted Falls", "Ontario", "Orangeville",
"Oregon", "Oregonia", "Orient", "Orrville", "Orwell", "Osgood",
"Ostrander", "Ottawa", "Ottoville", "Otway", "Overpeck",
"Owensville", "Oxford", "Painesville", "Palestine", "Pandora",
"Paris", "Parkman", "Pataskala", "Patriot", "Paulding", "Payne",
"Pedro", "Peebles", "Pemberton", "Pemberville", "Peninsula",
"Perry", "Perrysburg", "Perrysville", "Petersburg", "Pettisville",
"Phillipsburg", "Philo", "Pickerington", "Piedmont", "Pierpont",
"Piketon", "Piney Fork", "Pioneer", "Piqua", "Pitsburg",
"Plain City", "Plainfield", "Pleasant City", "Pleasant Hill",
"Pleasant Plain", "Pleasantville", "Plymouth", "Polk",
"Pomeroy", "Port Clinton", "Port Jefferson", "Port Washington",
"Port William", "Portage", "Portland", "Portsmouth", "Potsdam",
"Powell", "Powhatan Point", "Proctorville", "prospect", "put in Bay",
"Quaker City", "Quincy", "Racine", "Radnor", "Randolph", "Rarden",
"Ravenna", "Rawson", "Ray", "Rayland", "Raymond", "Reedsville",
"Reesville", "Reno", "Republic", "Reynoldsburg", "Richfield",
"Richmond", "Richmond Dale", "Richwood", "Ridgeville corners",
"Ridgeway", "Rio Grande", "Ripley", "RisingSun", "Rittman",
"Robertsville", "Rock Camp", "Rock Creek", "Rockbridge", "Rockford",
"Rocky Ridge", "Rocky River", "Rogers", "Rome", "Rootstown", "Roseville",
"Rosewood", "Ross", "Rossburg", "Rossford", "Roundhead", "Rudolph",
"Rushsylvania", "Rushville", "Russells Point", "Russellville", "Russia",
"Rutland", "Sabina", "Saint Clairsville", "Saint Henry", "Saint Johns",
"Saint Louisville", "Saint Marys", "Saint Paris", "Salem", "Salesville",
"Salineville", "Sandusky", "Sandyville", "Sarahsville", "Sardinia",
"Sardis", "Savannah", "Scio", "Scioto Furnace", "Scott", "Scottown",
"Seaman", "Sebring", "Sedalia", "Senecaville", "Seven Mile", "Seville",
"Shade", "Shadyside", "Shandon", "Sharon Center", "Sharpsburg",
"Shauck", "Shawnee", "Sheffield Lake", "Shelby", "Sherrodsville",
"Sherwood", "Shiloh", "Short Creek", "Shreve", "Sidney", "Sinking Spring",
"Smithfield", "Smithville", "Solon", "Somerdale", "Somerset",
"Somerville", "South Bloomingville", "South Charleston", "South Lebanon",
"South point", "South Salem", "South Solon", "South Vienna",
"South Webster", "Southington", "Sparta", "Spencer", "Spencerville",
"Spring Valley", "Springboro", "Springfield", "Stafford", "Sterling",
"Steubenville", "Stewart", "Stillwater", "Stockdale", "Stockport",
"Stone Creek", "Stony Ridge", "Stout", "Stoutsville", "Stow", "Strasburg",
"Stratton", "Streetsboro", "Strongsville", "Struthers", "Stryker",
"Sugar Grove", "Sugarcreek", "Sullivan", "Sulphur Springs", "Summerfield",
"Summit Station", "Summitville", "Sunbury", "Swanton", "Sycamore",
"Sycamore Valley", "Sylvania", "Syracuse", "Tallmadge", "Tarlton",
"Terrace Park", "The Plains", "Thompson", "Thornville", "Thurman",
"Thurston", "Tiffin", "Tiltonsville", "Tipp City", "Tippecanoe", "Tiro",
"Toledo", "Tontogany", "Torch", "Toronto", "Tremont City", "Trenton",
"Trimble", "Trinway", "Troy", "Tuppers Plains", "Tuscarawas", "Twinsburg",
"Uhrichsville", "Union City", "union Furnace", "Unionport", "Uniontown",
"Unionville", "Unionville Center", "Uniopolis", "Upper Sandusky", "Urbana",
"Utica", "Valley City", "Van Buren", "Van Wert", "Vandalia", "Vanlue",
"Vaughnsville", "Venedocia", "Vermilion", "Verona", "Versailles",
"Vickery", "Vienna", "Vincent", "Vinton", "Wadsworth", "Wakefield",
"Wakeman", "Walbridge", "Waldo", "walhonding", "Walnut Creek", "Wapakoneta",
"Warnock", "Warren", "Warsaw", "Washington Court House",
"Washingtonville", "Waterford", "Waterloo", "Watertown", "Waterville",
"Wauseon", "Waverly", "Wayland", "Wayne", "Waynesburg", "Waynesfield",
"Waynesville", "Wellington", "Wellston", "Wellsville", "West Alexandria",
"West Chester", "West Elkton", "West Farmington", "West Jefferson",
"West Lafayette", "West Liberty", "West Manchester", "West Mansfield",
"West Millgrove", "West Milton", "West Point", "West Portsmouth",
"West Rushville", "The West Salem", "The West Union", "The West Unity", "The Westerville",
"Westfield Center", "Westlake", "Weston", "Westville", "Wharton",
"Wheelersburg", "Whipple", "White Cottage", "Whitehouse", "Wickliffe",
"Wilberforce", "Wilkesville", "Willard", "Williamsburg", "Williamsfield",
"Williamsport", "Williamstown", "Williston", "Willoughby", "Willow Wood",
"Willshire", "Wilmington", "Wilmot", "Winchester", "Windham", "Windsor",
"Winesburg", "Wingett Run", "Winona", "Wolf Run", "Woodsfield",
"Woodstock", "Woodville", "Wooster", "Wren", "Xenia", "Yellow Springs",
"Yorkshire", "Yorkville", "Youngstown", "Zaleski", "Zanesfield", "Zanesville",
"Zoar"
];
$ ('. Bslink '). Tip ();
$ ("#suggest1"). AutoComplete (cities);
</script>

Related demo Download

Supplementary information
There is one less script.do file in the demo program, and you need to configure the application extensions for ". Do" in IIS by selecting the Web site that you built in IIS, and right-clicking properties as follows:
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.