├── .gitignore ├── Makefile ├── README.markdown ├── erldocs ├── priv ├── bin │ └── specs_gen.escript └── www │ └── index.html ├── rebar ├── rebar.config ├── src ├── erldocs.app.src ├── erldocs.erl └── erldocs_core.erl └── templates ├── erldocs.dtl ├── erldocs_css.dtl ├── erldocs_js.dtl └── jquery_js.dtl /.gitignore: -------------------------------------------------------------------------------- 1 | .eunit 2 | deps 3 | *.o 4 | *.beam 5 | ebin 6 | priv/www 7 | !/priv/www/index.html 8 | /.settings 9 | /.project 10 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: deps 2 | 3 | all: 4 | ./rebar compile escriptize 5 | 6 | deps: 7 | ./rebar get-deps 8 | 9 | clean: 10 | @./rebar clean 11 | 12 | distclean: clean 13 | @rm -rf erldocs deps 14 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | **NOTE: the actively used & supported version of erldocs is at https://github.com/erldocs/erldocs** 2 | 3 | Erldocs 4 | ======= 5 | 6 | This is the code used to generate documentation for erlang projects in the format of [erldocs.com](http://erldocs.com) 7 | 8 | Dependencies 9 | ============ 10 | 11 | Erlang R13B04 or greater 12 | 13 | Building 14 | ======== 15 | 16 | git clone git://github.com/daleharvey/erldocs.git 17 | cd erldocs 18 | ./rebar get-deps 19 | make 20 | 21 | or download [https://github.com/daleharvey/erldocs/raw/master/erldocs](https://github.com/daleharvey/erldocs/raw/master/erldocs) and place it in your $PATH 22 | 23 | Usage 24 | ===== 25 | 26 | Calling the erldocs script with no arguments will generate documentation for the application in the current working directory. The documentation will be output to "doc/erldocs". 27 | 28 | `./erldocs` 29 | 30 | Additional arguments can specify the location to source files to be documented 31 | 32 | `./erldocs path/to/erlang/otp/lib/* path/to/erlang/erts` 33 | 34 | You can specify the output directory with the `-o` flag 35 | 36 | `./erldocs -o path/to/output path/to/erlang/otp/lib/* path/to/erlang/erts` 37 | -------------------------------------------------------------------------------- /erldocs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daleharvey/erldocs/9a82b0b8ec1736a91f2936b01c5b573a63286770/erldocs -------------------------------------------------------------------------------- /priv/bin/specs_gen.escript: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env escript 2 | %% -*- erlang -*- 3 | %% %CopyrightBegin% 4 | %% 5 | %% Copyright Ericsson AB 2011. All Rights Reserved. 6 | %% 7 | %% The contents of this file are subject to the Erlang Public License, 8 | %% Version 1.1, (the "License"); you may not use this file except in 9 | %% compliance with the License. You should have received a copy of the 10 | %% Erlang Public License along with this software. If not, it can be 11 | %% retrieved online at http://www.erlang.org/. 12 | %% 13 | %% Software distributed under the License is distributed on an "AS IS" 14 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 15 | %% the License for the specific language governing rights and limitations 16 | %% under the License. 17 | %% 18 | %% %CopyrightEnd% 19 | 20 | %%% 107 | 108 | 109 | 110 | 111 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /rebar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daleharvey/erldocs/9a82b0b8ec1736a91f2936b01c5b573a63286770/rebar -------------------------------------------------------------------------------- /rebar.config: -------------------------------------------------------------------------------- 1 | {deps, [ 2 | {erlydtl, ".*", {git, "git://github.com/russelldb/erlydtl.git", "master"}} 3 | ]}. 4 | 5 | {escript_incl_apps, [erlydtl]}. 6 | -------------------------------------------------------------------------------- /src/erldocs.app.src: -------------------------------------------------------------------------------- 1 | {application, erldocs, 2 | [ 3 | {description, ""}, 4 | {vsn, "1"}, 5 | {registered, []}, 6 | {applications, [ 7 | kernel, 8 | stdlib 9 | ]}, 10 | {mod, { erldocs_app, []}}, 11 | {env, []} 12 | ]}. 13 | -------------------------------------------------------------------------------- /src/erldocs.erl: -------------------------------------------------------------------------------- 1 | -module(erldocs). 2 | -export([main/1]). 3 | 4 | -record(conf, {dirs = [], destination = cwd() ++ "/docs/erldocs"}). 5 | 6 | %% @doc Called automatically by escript 7 | -spec main(list()) -> ok. 8 | main(Args) -> 9 | parse(Args, #conf{}). 10 | 11 | parse([], #conf{destination = Destination} = Conf) -> 12 | Dirs = case Conf#conf.dirs of 13 | [] -> [cwd()]; 14 | Else -> Else 15 | end, 16 | run([{apps, Dirs}, {dest, filename:absname(Destination)}]); 17 | 18 | parse(["-o", Dest | Rest], Conf) -> 19 | parse(Rest, Conf#conf{destination=Dest}); 20 | 21 | parse([Dir | Rest], #conf{dirs = Dirs} = Conf) -> 22 | parse(Rest, Conf#conf{dirs = [Dir | Dirs]}). 23 | 24 | 25 | run(Conf) -> 26 | try erldocs_core:dispatch(Conf) 27 | catch Type:Error -> 28 | log("Error running script:~n~p~n~p~n", 29 | [erlang:get_stacktrace(), {Type, Error}]) 30 | end. 31 | 32 | -spec log(string(), [_]) -> ok. 33 | log(Str, Args) -> 34 | io:format(Str, Args). 35 | 36 | cwd() -> 37 | element(2, file:get_cwd()). 38 | -------------------------------------------------------------------------------- /src/erldocs_core.erl: -------------------------------------------------------------------------------- 1 | -module(erldocs_core). 2 | -export([copy_static_files/1, build/1, dispatch/1]). 3 | -export([mapreduce/4, pmapreduce/4, pmapreduce/5]). 4 | -include_lib("kernel/include/file.hrl"). 5 | 6 | -define(LOG(Str, Args), io:format(Str, Args)). 7 | -define(LOG(Str), io:format(Str)). 8 | 9 | %% @doc Copy static files 10 | -spec copy_static_files(list()) -> ok. 11 | copy_static_files(Conf) -> 12 | {ok, ErlDocsCSS} = erldocs_css_dtl:render([]), 13 | edoc_lib:write_file(ErlDocsCSS, dest(Conf), "erldocs.css"), 14 | {ok, ErlDocsJS} = erldocs_js_dtl:render([]), 15 | edoc_lib:write_file(ErlDocsJS, dest(Conf), "erldocs.js"), 16 | {ok, Jquery} = jquery_js_dtl:render([]), 17 | edoc_lib:write_file(Jquery, dest(Conf), "jquery.js"), 18 | ok. 19 | 20 | %% @doc Parses arguments passed to script and calls 21 | %% appropriate function. 22 | -spec dispatch(list()) -> ok. 23 | dispatch(Conf) -> 24 | Start = erlang:now(), 25 | build(Conf), 26 | Diff = timer:now_diff(erlang:now(), Start), 27 | Mins = trunc(Diff * 1.667e-8), 28 | log("Woot, finished in ~p Minutes ~p Seconds~n", 29 | [Mins, trunc((Diff * 1.0e-6) - (Mins * 60))]). 30 | 31 | 32 | %% @doc Build everything 33 | -spec build(list()) -> ok. 34 | build(Conf) -> 35 | filelib:ensure_dir(dest(Conf)), 36 | 37 | Fun = fun(X, Y) -> build_apps(Conf, X, Y) end, 38 | Index = strip_cos(lists:foldl(Fun, [], app_dirs(Conf))), 39 | 40 | ok = module_index(Conf, Index), 41 | ok = javascript_index(Conf, Index), 42 | ok = copy_static_files(Conf). 43 | 44 | build_apps(Conf, App, Index) -> 45 | AppName = bname(App), 46 | log("Building ~s~n", [AppName]), 47 | Files = ensure_docsrc(App, Conf), 48 | Map = fun (F) -> build_file_map(Conf, AppName, F) end, 49 | [["app", AppName, AppName, "[application]"] | 50 | pmapreduce(Map, fun lists:append/2, [], Files) ++ Index]. 51 | 52 | build_file_map(Conf, AppName, File) -> 53 | log("Generating HTML - ~s~n", [bname(File, ".xml")]), 54 | {Type, _Attr, Content} = read_xml(Conf, File), 55 | 56 | TypeSpecsFile = filename:join([dest(Conf), ".xml", "specs_" ++ bname(File)]), 57 | TypeSpecs = case read_xml(Conf, TypeSpecsFile) of 58 | {error, _, _} -> []; 59 | {module, _, Specs} -> strip_whitespace(Specs) 60 | end, 61 | 62 | case lists:member(Type, buildable()) of 63 | false -> []; 64 | true -> 65 | 66 | Module = bname(File, ".xml"), 67 | Xml = strip_whitespace(Content), 68 | 69 | Sum2 = case Type of 70 | erlref -> 71 | {modulesummary, [], Sum} 72 | = lists:keyfind(modulesummary,1, Xml), 73 | unicode:characters_to_list(Sum); 74 | cref -> 75 | {libsummary, [], Sum} 76 | = lists:keyfind(libsummary, 1, Xml), 77 | Sum 78 | end, 79 | 80 | Sum1 = lists:flatten(Sum2), 81 | 82 | % strip silly shy characters 83 | Funs = get_funs(AppName, Module, lists:keyfind(funcs, 1, Xml)), 84 | 85 | ok = render(Type, AppName, Module, Content, TypeSpecs, Conf), 86 | 87 | case lists:member({AppName, Module}, ignore()) of 88 | true -> []; 89 | false -> [ ["mod", AppName, Module, Sum1] | Funs] 90 | end 91 | end. 92 | 93 | %% @doc strip out the cos* files from the index, who the hell needs them 94 | %% anyway 95 | -spec strip_cos(list()) -> list(). 96 | strip_cos(Index) -> 97 | [X || X = [_, App |_] <- Index, nomatch == re:run(App, "^cos") ]. 98 | 99 | ensure_docsrc(AppDir, Conf) -> 100 | 101 | % List any doc/src/*.xml files that exist in the source files 102 | XMLFiles = filelib:wildcard(filename:join([AppDir, "doc", "src", "*.xml"])), 103 | HandWritten = [bname(File, ".xml") || File <- XMLFiles], 104 | 105 | ErlFiles = filelib:wildcard(filename:join([AppDir, "*.erl"])) ++ 106 | filelib:wildcard(filename:join([AppDir, "src", "*.erl"])), 107 | 108 | % Generate any missing module XML 109 | SrcFiles = [filename:absname(File) || 110 | File <- ErlFiles, 111 | not lists:member(bname(File, ".erl"), HandWritten)], 112 | 113 | % Output XML files to destination folder 114 | % This prevents polluting the source files 115 | XMLDir = filename:join([dest(Conf), ".xml", bname(AppDir)]), 116 | filelib:ensure_dir(XMLDir ++ "/"), 117 | 118 | SpecsDest = filename:join([dest(Conf), ".xml"]), 119 | 120 | [ begin 121 | log("Generating Type Specs - ~s~n", [File]), 122 | Args = "-I" ++ AppDir ++ "/include -o" ++ SpecsDest ++ " " ++ File, 123 | os:cmd("./priv/bin/specs_gen.escript " ++ Args) 124 | end || File <- ErlFiles], 125 | 126 | %% Return the complete list of XML files 127 | XMLFiles ++ tmp_cd(XMLDir, fun() -> gen_docsrc(AppDir, SrcFiles, XMLDir) end). 128 | 129 | 130 | gen_docsrc(AppDir, SrcFiles, Dest) -> 131 | Opts = [{includes, filelib:wildcard(AppDir ++ "/include")}, 132 | {sort_functions,false}], 133 | 134 | lists:foldl(fun(File, Acc) -> 135 | log("Generating XML - ~s~n", [bname(File, ".erl")]), 136 | case (catch docb_gen:module(File, Opts)) of 137 | ok -> 138 | [filename:join([Dest, bname(File, ".erl")]) ++ ".xml"|Acc]; 139 | Error -> 140 | log("Error generating XML (~p): ~p~n", [File, Error]), 141 | Acc 142 | end 143 | end, [], SrcFiles). 144 | 145 | %% @doc run a function with the cwd set, ensuring the cwd is reset once 146 | %% finished (some dumb functions require to be ran from a particular dir) 147 | -spec tmp_cd(list(), fun()) -> term(). 148 | tmp_cd(Dir, Fun) -> 149 | 150 | {ok, OldDir} = file:get_cwd(), 151 | 152 | ok = filelib:ensure_dir(Dir), 153 | ok = file:set_cwd(Dir), 154 | 155 | try 156 | Result = Fun(), 157 | ok = file:set_cwd(OldDir), 158 | Result 159 | catch 160 | Type:Err -> 161 | ok = file:set_cwd(OldDir), 162 | throw({Type, Err}) 163 | end. 164 | 165 | 166 | module_index(Conf, Index) -> 167 | 168 | log("Creating index.html ...~n"), 169 | 170 | Html = "

Module Index



" 171 | ++ xml_to_str(emit_index(Index)) 172 | ++ "
", 173 | 174 | Args = [{base, "./"}, 175 | {title, "Module Index"}, 176 | {content, Html}, 177 | {funs, ""}], 178 | 179 | {ok, Data} = erldocs_dtl:render(Args), 180 | ok = file:write_file([dest(Conf), "/index.html"], Data). 181 | 182 | emit_index(L) -> 183 | lists:flatmap( 184 | fun index_html/1, 185 | lists:sort(fun sort_index/2, L)). 186 | 187 | index_html(["app", App, _, _Sum]) -> 188 | [{a, [{name, App}]}, {h4, [], [App]}]; 189 | index_html(["mod", App, Mod, Sum]) -> 190 | Url = App ++ "/" ++ Mod ++ ".html", 191 | [{p,[], [{a, [{href, Url}], [Mod]}, {br,[],[]}, Sum]}]; 192 | index_html(_) -> 193 | []. 194 | 195 | type_ordering("app") -> 1; 196 | type_ordering("mod") -> 2; 197 | type_ordering("fun") -> 3. 198 | 199 | index_ordering([Type, App, Mod, _Sum]) -> 200 | [string:to_lower(App), 201 | type_ordering(Type), 202 | string:to_lower(Mod)]. 203 | 204 | sort_index(A, B) -> 205 | index_ordering(A) =< index_ordering(B). 206 | 207 | html_encode(Str) -> 208 | re:replace(Str, "'", "", [{return, list}, global]). 209 | 210 | javascript_index(Conf, FIndex) -> 211 | 212 | log("Creating erldocs_index.js ...~n"), 213 | 214 | F = fun([Else, App, NMod, Sum]) -> 215 | [Else, App, NMod, fmt("~ts", [string:substr(Sum, 1, 50)])] 216 | end, 217 | 218 | Index = 219 | lists:map( 220 | fun([A,B,C,[]]) -> 221 | fmt("['~s','~s','~s',[]]", [A,B,C]); 222 | ([A,B,C,D]) -> 223 | fmt("['~s','~s','~s','~s']", [A,B,C,html_encode(D)]) 224 | end, 225 | lists:sort(fun sort_index/2, lists:map(F, FIndex))), 226 | 227 | Js = re:replace(fmt("var index = [~s];", [string:join(Index, ",")]), 228 | "\\n|\\r", "", [{return,list}, global]), 229 | 230 | ok = file:write_file([dest(Conf), "/erldocs_index.js"], Js). 231 | 232 | render(cref, App, Mod, Xml, Types, Conf) -> 233 | render(erlref, App, Mod, Xml, Types, Conf); 234 | 235 | render(erlref, App, Mod, Xml, Types, Conf) -> 236 | 237 | File = filename:join([dest(Conf), App, Mod ++ ".html"]), 238 | ok = filelib:ensure_dir(filename:dirname(File) ++ "/"), 239 | 240 | Acc = [{ids,[]}, {list, ul}, {functions, []}, {types, Types}], 241 | 242 | {[_Id, _List, {functions, Funs}, {types, _}], NXml} 243 | = render(fun tr_erlref/2, Xml, Acc), 244 | 245 | XmlFuns = [{li, [], [{a, [{href, "#"++X}], [X]}]} 246 | || X <- lists:reverse(Funs) ], 247 | 248 | Args = [{base, "../"}, 249 | {title, Mod ++ " (" ++ App ++ ") - "}, 250 | {content, xml_to_str(NXml)}, 251 | {funs, xml_to_str({ul, [{id, "funs"}], XmlFuns})}], 252 | 253 | {ok, Data} = erldocs_dtl:render(Args), 254 | ok = file:write_file(File, Data). 255 | 256 | render(Fun, List, Acc) when is_list(List) -> 257 | case io_lib:char_list(List) of 258 | true -> 259 | {Acc, List}; 260 | false -> 261 | F = fun(X, {Ac, L}) -> 262 | {NAcc, NEl} = render(Fun, X, Ac), 263 | {NAcc, [NEl | L]} 264 | end, 265 | 266 | {Ac, L} = lists:foldl(F, {Acc, []}, List), 267 | {Ac, lists:reverse(L)} 268 | end; 269 | 270 | render(Fun, Element, Acc) -> 271 | 272 | % this is nasty 273 | F = fun(ignore, NAcc) -> 274 | {NAcc, ""}; 275 | ({NEl, NAttr, NChild}, NAcc) -> 276 | {NNAcc, NNChild} = render(Fun, NChild, NAcc), 277 | {NNAcc, {NEl, NAttr, NNChild}}; 278 | (Else, NAcc) -> 279 | {NAcc, Else} 280 | end, 281 | 282 | case Fun(Element, Acc) of 283 | {El, NAcc} -> F(El, NAcc); 284 | El -> F(El, Acc) 285 | end. 286 | 287 | get_funs(_App, _Mod, false) -> 288 | []; 289 | get_funs(App, Mod, {funcs, [], Funs}) -> 290 | lists:foldl( 291 | fun(X, Acc) -> fun_stuff(App, Mod, X) ++ Acc end, 292 | [], Funs). 293 | 294 | fun_stuff(App, Mod, {func, [], Child}) -> 295 | 296 | {fsummary, [], Xml} = lists:keyfind(fsummary, 1, Child), 297 | Summary = string:substr(xml_to_str(Xml), 1, 50), 298 | 299 | F = fun({name, [], Name}, Acc) -> 300 | case make_name(Name) of 301 | ignore -> Acc; 302 | NName -> [ ["fun", App, Mod++":"++NName, Summary] | Acc ] 303 | end; 304 | ({name, [{name, Name}, {arity, Arity}], []}, Acc) -> 305 | [ ["fun", App, Mod++":"++Name++"/"++Arity, Summary] | Acc ]; 306 | (_Else, Acc) -> Acc 307 | end, 308 | 309 | lists:foldl(F, [], Child); 310 | fun_stuff(_App, _Mod, _Funs) -> 311 | []. 312 | 313 | make_name(Name) -> 314 | Tmp = lists:flatten(Name), 315 | case string:chr(Tmp, 40) of 316 | 0 -> 317 | ignore; 318 | Pos -> 319 | {Name2, Rest2} = lists:split(Pos-1, Tmp), 320 | Name3 = lists:last(string:tokens(Name2, ":")), 321 | Args = string:substr(Rest2, 2, string:chr(Rest2, 41)-2), 322 | NArgs = length(string:tokens(Args, ",")), 323 | Name3 ++ "/" ++ integer_to_list(NArgs) 324 | end. 325 | 326 | app_dirs(Conf) -> 327 | Fun = fun(Path, Acc) -> 328 | Acc ++ [X || X <- filelib:wildcard(Path), filelib:is_dir(X)] 329 | end, 330 | lists:foldl(Fun, [], kf(apps, Conf)). 331 | 332 | add_html("#"++Rest) -> 333 | "#"++Rest; 334 | add_html(Link) -> 335 | case string:tokens(Link, "#") of 336 | [Tmp] -> Tmp++".html"; 337 | [N1, N2] -> lists:flatten([N1, ".html#", N2]) 338 | end. 339 | 340 | %% Transforms erlang xml format to html 341 | tr_erlref({type_desc, [{variable, Name}], [Desc]}, _Acc) -> 342 | {'div', [{class, "type_desc"}], [{code, [], [Name, " = ",Desc]}]}; 343 | tr_erlref({header,[],_Child}, _Acc) -> 344 | ignore; 345 | tr_erlref({marker, [{id, Marker}], []}, _Acc) -> 346 | {span, [{id, Marker}], [" "]}; 347 | tr_erlref({term,[{id, Term}], _Child}, _Acc) -> 348 | Term; 349 | tr_erlref({lib,[],Lib}, _Acc) -> 350 | {h1, [], [lists:flatten(Lib)]}; 351 | tr_erlref({module,[],Module}, _Acc) -> 352 | {h1, [], [lists:flatten(Module)]}; 353 | tr_erlref({modulesummary, [], Child}, _Acc) -> 354 | {h2, [{class, "modsummary"}], Child}; 355 | tr_erlref({c, [], Child}, _Acc) -> 356 | {code, [], Child}; 357 | tr_erlref({section, [], Child}, _Acc) -> 358 | {'div', [{class, "section"}], Child}; 359 | tr_erlref({title, [], Child}, _Acc) -> 360 | {h4, [], [Child]}; 361 | tr_erlref({type, [], Child}, _Acc) -> 362 | {ul, [{class, "type"}], Child}; 363 | tr_erlref({v, [], []}, _Acc) -> 364 | {li, [], [" "]}; 365 | tr_erlref({v, [], Child}, _Acc) -> 366 | {li, [], [{code, [], Child}]}; 367 | tr_erlref({seealso, [{marker, Marker}], Child}, _Acc) -> 368 | N = case string:tokens(Marker, ":") of 369 | [] -> add_html(lists:flatten(Child)); 370 | [Tmp] -> add_html(Tmp); 371 | [Ap | Md] -> "../"++Ap++"/" ++ add_html(lists:flatten(Md)) 372 | end, 373 | {a, [{href, N}, {class, "seealso"}], Child}; 374 | tr_erlref({desc, [], Child}, _Acc) -> 375 | {'div', [{class, "description"}], Child}; 376 | tr_erlref({description, [], Child}, _Acc) -> 377 | {'div', [{class, "description"}], Child}; 378 | tr_erlref({funcs, [], Child}, _Acc) -> 379 | {'div', [{class,"functions"}], [{h4, [], ["Functions"]}, 380 | {hr, [], []} | Child]}; 381 | tr_erlref({func, [], Child}, _Acc) -> 382 | {'div', [{class,"function"}], Child}; 383 | tr_erlref({tag, [], Child}, _Acc) -> 384 | {dt, [], Child}; 385 | tr_erlref({taglist, [], Child}, [Ids, _List, Funs]) -> 386 | { {dl, [], Child}, [Ids, {list, dl}, Funs] }; 387 | tr_erlref({input, [], Child}, _Acc) -> 388 | {code, [], Child}; 389 | tr_erlref({item, [], Child}, [_Ids, {list, dl}, _Funs]) -> 390 | {dd, [], Child}; 391 | tr_erlref({item, [], Child}, [_Ids, {list, ul}, _Funs]) -> 392 | {li, [], Child}; 393 | tr_erlref({list, _Type, Child}, [Ids, _List, Funs]) -> 394 | { {ul, [], Child}, [Ids, {list, ul}, Funs] }; 395 | tr_erlref({code, [{type, "none"}], Child}, _Acc) -> 396 | {pre, [{class, "sh_erlang"}], Child}; 397 | tr_erlref({pre, [], Child}, _Acc) -> 398 | {pre, [{class, "sh_erlang"}], Child}; 399 | tr_erlref({note, [], Child}, _Acc) -> 400 | {'div', [{class, "note"}], [{h2, [], ["Note!"]} | Child]}; 401 | tr_erlref({warning, [], Child}, _Acc) -> 402 | {'div', [{class, "warning"}], [{h2, [], ["Warning!"]} | Child]}; 403 | tr_erlref({name, [], [{ret,[],[Ret]}, {nametext,[],[Desc]}]}, _Acc) -> 404 | {pre, [], [Ret ++ " " ++ Desc]}; 405 | tr_erlref({name, [{name, Name}, {arity, N}], []}, Acc) -> 406 | [{ids, Ids}, List, {functions, Funs}, {types, Types}] = Acc, 407 | PName = case find_spec(Name, N, Types) of 408 | {ok, Tmp} -> Tmp; 409 | _ -> Name ++ "/" ++ N 410 | end, 411 | NName = inc_name(Name, Ids, 0), 412 | { {h3, [{id, Name ++ "/" ++ N}], [PName]}, 413 | [{ids, [NName | Ids]}, List, {functions, [NName|Funs]}, {types, Types}]}; 414 | tr_erlref({name, [], Child}, [{ids, Ids}, List, {functions, Funs}, {types, Types}]) -> 415 | case make_name(Child) of 416 | ignore -> ignore; 417 | Name -> 418 | NName = inc_name(Name, Ids, 0), 419 | { {h3, [{id, NName}], [Child]}, 420 | [{ids, [NName | Ids]}, List, {functions, [NName|Funs]}, {types, Types}]} 421 | end; 422 | tr_erlref({fsummary, [], _Child}, _Acc) -> 423 | ignore; 424 | tr_erlref(Else, _Acc) -> 425 | Else. 426 | 427 | find_spec(_Name, _Arity, []) -> 428 | spec_not_found; 429 | 430 | find_spec(Name, Arity, [{spec, [], Specs} | Rest]) -> 431 | {name, _, [SpecName]} = lists:keyfind(name, 1, Specs), 432 | {arity, _, [ArityName]} = lists:keyfind(arity, 1, Specs), 433 | case SpecName =:= Name andalso ArityName =:= Arity of 434 | true -> 435 | {contract, _, Contracts} = lists:keyfind(contract, 1, Specs), 436 | {clause, _, Clause} = lists:keyfind(clause, 1, Contracts), 437 | {head, _, Head} = lists:keyfind(head, 1, Clause), 438 | case io_lib:deep_char_list(Head) of 439 | true -> {ok, lists:flatten(Head)}; 440 | false -> invalid_name 441 | end; 442 | false -> 443 | find_spec(Name, Arity, Rest) 444 | end; 445 | find_spec(Name, Arity, [_ | Rest]) -> 446 | find_spec(Name, Arity, Rest). 447 | 448 | 449 | nname(Name, 0) -> Name; 450 | nname(Name, Acc) -> Name ++ "-" ++ integer_to_list(Acc). 451 | 452 | inc_name(Name, List, Acc) -> 453 | case lists:member(nname(Name, Acc), List) of 454 | true -> inc_name(Name, List, Acc+1); 455 | false -> nname(Name, Acc) 456 | end. 457 | 458 | %% Strips xml children that are entirely whitespace (space, tabs, newlines) 459 | strip_whitespace(List) when is_list(List) -> 460 | [ strip_whitespace(X) || X <- List, is_whitespace(X) ]; 461 | strip_whitespace({El,Attr,Children}) -> 462 | {El, Attr, strip_whitespace(Children)}; 463 | strip_whitespace(Else) -> 464 | Else. 465 | 466 | is_whitespace(X) when is_tuple(X); is_number(X) -> 467 | true; 468 | is_whitespace(X) -> 469 | nomatch == re:run(X, "^[ \n\t]*$", [unicode]). %" 470 | 471 | %% rather basic xml to string converter, takes xml of the form 472 | %% {tag, [{listof, "attributes"}], ["list of children"]} 473 | %% into list of children 474 | xml_to_str(Xml) -> 475 | xml_to_html(Xml). 476 | 477 | xml_to_html({Tag, Attr}) -> 478 | %% primarily for cases such as 479 | fmt("<~ts ~ts>", [Tag, atos(Attr)]); 480 | xml_to_html({Tag, Attr, []}) -> 481 | fmt("<~ts ~ts />", [Tag, atos(Attr)]); 482 | xml_to_html({Tag, [], []}) -> 483 | fmt("<~ts />", [Tag]); 484 | xml_to_html({Tag, [], Child}) -> 485 | fmt("<~ts>~ts", [Tag, xml_to_html(Child), Tag]); 486 | xml_to_html({Tag, Attr, Child}) -> 487 | fmt("<~ts ~ts>~ts", [Tag, atos(Attr), xml_to_html(Child), Tag]); 488 | xml_to_html(List) when is_list(List) -> 489 | case io_lib:char_list(List) of 490 | true -> htmlchars(List); 491 | false -> lists:flatten([ xml_to_html(X) || X <- List]) 492 | end. 493 | 494 | atos([]) -> ""; 495 | atos(List) when is_list(List) -> string:join([ atos(X) || X <- List ], " "); 496 | atos({Name, Val}) -> atom_to_list(Name) ++ "=\""++Val++"\"". 497 | 498 | %% convert ascii into html characters 499 | htmlchars(List) -> 500 | htmlchars(List, []). 501 | 502 | htmlchars([], Acc) -> 503 | lists:flatten(lists:reverse(Acc)); 504 | 505 | htmlchars([$< | Rest], Acc) -> htmlchars(Rest, ["<" | Acc]); 506 | htmlchars([$> | Rest], Acc) -> htmlchars(Rest, [">" | Acc]); 507 | htmlchars([160 | Rest], Acc) -> htmlchars(Rest, [" " | Acc]); 508 | htmlchars([Else | Rest], Acc) -> htmlchars(Rest, [Else | Acc]). 509 | 510 | %% @doc parse xml file against otp's dtd, need to cd into the 511 | %% source directory because files are addressed relative to it 512 | -spec read_xml(list(), list()) -> tuple(). 513 | read_xml(_Conf, XmlFile) -> 514 | 515 | Opts = [{fetch_path, [code:lib_dir(docbuilder, dtd)]}, 516 | {encoding, "latin1"}], 517 | %Opts = [{fetch_path, [code:lib_dir(docbuilder, dtd)]}], 518 | 519 | {Xml, _} = xmerl_scan:file(XmlFile, Opts), 520 | xmerl_lib:simplify_element(Xml). 521 | 522 | %% lazy shorthand 523 | fmt(Format, Args) -> 524 | lists:flatten(io_lib:format(Format, Args)). 525 | 526 | log(Str) -> 527 | ?LOG(Str). 528 | log(Str, Args) -> 529 | ?LOG(Str, Args). 530 | 531 | %% @doc shorthand for lists:keyfind 532 | -spec kf(term(), list()) -> term(). 533 | kf(Key, Conf) -> 534 | {Key, Val} = lists:keyfind(Key, 1, Conf), 535 | Val. 536 | 537 | %% @doc path to the destination folder 538 | -spec dest(list()) -> list(). 539 | dest(Conf) -> 540 | [kf(dest, Conf)]. 541 | 542 | bname(Name) -> 543 | filename:basename(Name). 544 | bname(Name, Ext) -> 545 | filename:basename(Name, Ext). 546 | 547 | % List of the type of xml files erldocs can build 548 | buildable() -> 549 | [ erlref, cref ]. 550 | 551 | ignore() -> 552 | [{"kernel", "init"}, 553 | {"kernel", "zlib"}, 554 | {"kernel", "erlang"}, 555 | {"kernel", "erl_prim_loader"}]. 556 | 557 | -type map_fun(D, R) :: fun((D) -> R). 558 | -type reduce_fun(T) :: fun((T, _) -> _). 559 | 560 | -spec pmapreduce(map_fun(T, R), reduce_fun(R), R, [T]) -> [R]. 561 | pmapreduce(Map, Reduce, Acc0, L) -> 562 | pmapreduce(Map, Reduce, Acc0, L, 4). 563 | 564 | -spec pmapreduce(map_fun(T, R), reduce_fun(R), R, [T], pos_integer()) -> [R]. 565 | pmapreduce(Map, Reduce, Acc0, L, N) -> 566 | Keys = [rpc:async_call(node(), ?MODULE, mapreduce, 567 | [Map, Reduce, Acc0, Segment]) 568 | || Segment <- segment(L, N)], 569 | mapreduce(fun rpc:yield/1, Reduce, Acc0, Keys). 570 | 571 | -spec mapreduce(map_fun(T, R), reduce_fun(R), R, [T]) -> [R]. 572 | mapreduce(Map, Reduce, Acc0, L) -> 573 | F = fun (Elem, Acc) -> 574 | Reduce(Map(Elem), Acc) 575 | end, 576 | lists:foldl(F, Acc0, lists:reverse(L)). 577 | 578 | -spec segment([T], pos_integer()) -> [[T]]. 579 | segment(List, Segments) -> 580 | segment(List, length(List) div Segments, Segments). 581 | 582 | -spec segment([T], non_neg_integer(), pos_integer()) -> [[T]]. 583 | segment(List, _N, 1) -> 584 | [List]; 585 | segment(List, N, Segments) -> 586 | {Front, Back} = lists:split(N, List), 587 | [Front | segment(Back, N, Segments - 1)]. 588 | -------------------------------------------------------------------------------- /templates/erldocs.dtl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{ title }} - erldocs.com (Erlang Documentation) 7 | 9 | 10 | 11 | 12 | 13 | 18 | 19 |
20 |
21 | {{ content }} 22 |
23 |
24 | View Functions 25 | {{ funs }} 26 |
27 |
28 | 29 | 32 | 33 | 34 | 35 | 36 | 37 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /templates/erldocs_css.dtl: -------------------------------------------------------------------------------- 1 | * { 2 | padding : 0px; 3 | margin : 0px; 4 | } 5 | 6 | body { 7 | font-family : verdana, Arial, sans-serif; 8 | font-size : 13px; 9 | font-size-adjust : none; 10 | font-style : normal; 11 | font-variant : normal; 12 | font-weight : normal; 13 | line-height : 1.3; 14 | color : #222; 15 | } 16 | 17 | h1, h2, h3, h4, h5, h6 { 18 | color : #333; 19 | font-weight : normal; 20 | } 21 | 22 | p { 23 | margin : 7px 0px 12px 0px; 24 | color : #222; 25 | line-height:135%; 26 | } 27 | 28 | h1 { 29 | display:inline; 30 | font-size : 24px; 31 | font-weight : bold; 32 | } 33 | 34 | h2 { 35 | margin-top : 0px; 36 | font-size : 17px; 37 | font-weight : normal; 38 | } 39 | 40 | hr { 41 | height : 1px; 42 | background : #AAA; 43 | color : #AAA; 44 | } 45 | 46 | dl { 47 | margin : 15px 20px; 48 | } 49 | 50 | dt { 51 | margin : 2px 0px; 52 | } 53 | 54 | dd { 55 | margin-bottom : 8px; 56 | } 57 | 58 | h4 a { 59 | color:black; 60 | font-weight:bold; 61 | /* font-size:80%; */ 62 | } 63 | a { 64 | color : #B22222; 65 | } 66 | 67 | a:visited { 68 | color : #CD5C5C; 69 | border-bottom : 1px dotted #CD5C5C; 70 | text-decoration : none; 71 | } 72 | 73 | ul { 74 | margin : 10px 0px; 75 | } 76 | 77 | code { 78 | font-family : "Courier New","Andale Mono",monospace; 79 | background : #EEFFCC none repeat scroll 0 0; 80 | border-bottom : 1px dotted #AADD99; 81 | } 82 | 83 | pre code { 84 | background : none; 85 | border : none; 86 | } 87 | 88 | pre { 89 | margin : 10px 0px; 90 | padding : 5px; 91 | border-left : 2px solid #ccc; 92 | background : #EFEFEF; 93 | margin-left : 10px; 94 | color : #111; 95 | font-family : "Courier New","Andale Mono",monospace; 96 | font-size : 13px; 97 | line-height : normal; 98 | overflow : auto; 99 | } 100 | 101 | td { 102 | padding: 5px; 103 | } 104 | 105 | .copystuff { 106 | padding : 2px 0px 0px 4px; 107 | font-size : 10px; 108 | } 109 | 110 | .copystuff a { 111 | text-decoration : none; 112 | } 113 | 114 | #content li { 115 | margin : 0px 25px; 116 | } 117 | 118 | #content { 119 | bottom :0px; 120 | right :0px; 121 | left :240px; 122 | overflow :auto; 123 | padding :0; 124 | position :fixed; 125 | top :0; 126 | outline : none; 127 | } 128 | 129 | #content h4 { 130 | color : #444; 131 | margin-top : 25px; 132 | font-size : 14px; 133 | } 134 | 135 | h2.modsummary { 136 | font-size : 11px; 137 | border-bottom : 1px solid #999; 138 | margin-bottom : 15px; 139 | margin-top : 10px; 140 | } 141 | 142 | .functions { 143 | margin-top : 15px; 144 | } 145 | 146 | .function h3 { 147 | margin-top : 5px; 148 | font-size : 14px; 149 | font-weight : bold; 150 | } 151 | 152 | .function { 153 | margin : 25px 0px; 154 | } 155 | 156 | .function p { 157 | padding-left : 10px; 158 | } 159 | 160 | .function em { 161 | font-style : normal; 162 | font-weight : bold; 163 | } 164 | 165 | .function ul { 166 | list-style-type : none; 167 | } 168 | 169 | .seealso li { 170 | float : left; 171 | font-style : normal; 172 | margin-left : 10px; 173 | } 174 | 175 | .note { 176 | border : 1px solid #E1E4EA; 177 | padding : 10px; 178 | margin : 10px 8%; 179 | background : #EFF3F8; 180 | } 181 | 182 | .note h2 { 183 | font-size : 14px; 184 | font-weight : bold; 185 | display : inline; 186 | } 187 | 188 | .warning { 189 | border : 1px solid #E8DFDF; 190 | padding : 10px; 191 | margin : 10px 8%; 192 | background : #FBF4E9; 193 | } 194 | 195 | .warning h2 { 196 | font-size : 14px; 197 | font-weight : bold; 198 | display : inline; 199 | } 200 | 201 | #sidebar { 202 | overflow-y : hidden; 203 | overflow-x : hidden; 204 | position : fixed; 205 | border-right : 1px solid #999; 206 | width : 240px; 207 | padding : 0px; 208 | background : #EEE; 209 | height : 100%; 210 | } 211 | 212 | #sidebar.inactive { 213 | opacity:0.5; 214 | } 215 | 216 | #search { 217 | -moz-border-radius : 5px; 218 | -webkit-border-radius : 5px; 219 | display : block; 220 | width : 228px; 221 | float : left; 222 | outline : none; 223 | font-family : 13px Arial, sans-serif; 224 | padding : 2px; 225 | text-indent : 2px; 226 | margin : 3px; 227 | border : 1px solid; 228 | border-color : #CCC #999 #999 #CCC; 229 | } 230 | 231 | 232 | /* #sidebar input:focus { */ 233 | /* color:black; */ 234 | /* font-style:normal; */ 235 | /* -moz-box-shadow : 0px 0px 1px #888; */ 236 | /* -webkit-box-shadow : 0px 0px 1px #888; */ 237 | /* } */ 238 | 239 | #expand { 240 | -moz-border-radius : 5px; 241 | -webkit-border-radius : 5px; 242 | display : block; 243 | width : 15px; 244 | background : #FFF; 245 | height : 12px; 246 | cursor : pointer; 247 | color : #333; 248 | line-height : 13px; 249 | float : right; 250 | outline : none; 251 | font-family : 13px Arial, sans-serif; 252 | padding : 2px; 253 | text-indent : 5px; 254 | margin : 3px; 255 | border : 1px solid; 256 | border-color : #CCC #999 #999 #CCC; 257 | text-decoration : none; 258 | } 259 | 260 | #expand:hover { 261 | border-color : #AAA #777 #777 #AAA; 262 | -moz-box-shadow : 0px 0px 1px #888; 263 | -webkit-box-shadow : 0px 0px 1px #888; 264 | } 265 | 266 | #results { 267 | clear : both; 268 | height : 100%; 269 | overflow-y : scroll; 270 | overflow-x : hidden; 271 | list-style-type : none; 272 | border-top : 1px solid #999; 273 | border-bottom : 1px solid #999; 274 | } 275 | 276 | #results li a { 277 | display : block; 278 | padding : 3px 0px 3px 5px; 279 | position : relative; 280 | text-decoration : none; 281 | color : #555; 282 | text-shadow : #DDD 1px 1px 1px; 283 | border-bottom : 1px solid #AAA; 284 | overflow : hidden; 285 | } 286 | 287 | #results .name { 288 | color : #000; 289 | padding-left : 0px; 290 | } 291 | 292 | #results li:hover { 293 | background : #DDD !important; 294 | } 295 | 296 | #results li.selected { 297 | background : #333 !important; 298 | background : -moz-linear-gradient(top, #222222, #333333) !important; 299 | } 300 | 301 | #results li.selected .sub, #results li.selected span { 302 | color : #FFF !important; 303 | text-shadow : #000 1px 1px 1px; 304 | } 305 | 306 | .sub { 307 | color : #555; 308 | font-size : 10px; 309 | white-space : nowrap; 310 | } 311 | 312 | #results .dat { 313 | -moz-border-radius : 3px; 314 | -webkit-border-radius : 3px; 315 | font-size : 11px; 316 | color : #777; 317 | line-height : 11px; 318 | padding : 2px; 319 | position : absolute; 320 | display : block; 321 | width : 25px; 322 | margin : 2px 5px 0px 0px; 323 | text-align : center; 324 | } 325 | 326 | #results li.fun { 327 | background : #E6FFCC; 328 | } 329 | 330 | #results li.mod { 331 | background: #CCE6FF; 332 | } 333 | 334 | #results li.app .dat { 335 | background : red; 336 | } 337 | 338 | .app .sub { 339 | position:absolute; 340 | top:5px; 341 | right:5px; 342 | color:#999; 343 | text-shadow:none; 344 | } 345 | 346 | #sideinfo { 347 | position : absolute; 348 | top : 26px; 349 | width : 230px; 350 | display : none; 351 | background : white; 352 | padding : 5px; 353 | height : 100%; 354 | z-index : 999; 355 | font-size : 11px; 356 | } 357 | 358 | .info li { 359 | margin : 5px 0px 5px 20px; 360 | } 361 | 362 | #funs { 363 | position:relative; 364 | top:-30px; 365 | bottom:60px; 366 | right:0px; 367 | height:100%; 368 | list-style-type : none; 369 | overflow : auto; 370 | background : white; 371 | padding-bottom : 10px; 372 | padding-left : 20px; 373 | border-top : 1px solid #999; 374 | background : #eee; 375 | } 376 | 377 | #funs li { 378 | display : block; 379 | width : 80px; 380 | margin : 0px 5px; 381 | overflow : hidden; 382 | float : left; 383 | padding : 0px; 384 | } 385 | 386 | #funs li a { 387 | font-size : 9px; 388 | } 389 | 390 | #funwrapper { 391 | position : fixed; 392 | top : 75%; 393 | left : 241px; 394 | right : 0px; 395 | bottom : 0px; 396 | display : none; 397 | } 398 | 399 | #viewfuns { 400 | display : block; 401 | text-align : center; 402 | width : 80px; 403 | background : #eee; 404 | border : 1px solid #999; 405 | border-bottom-width : 0px; 406 | font-size : 10px; 407 | padding : 4px 5px 1px 5px; 408 | cursor : pointer; 409 | position : relative; 410 | top : -19px; 411 | right : -20px; 412 | z-index : 99; 413 | -moz-border-radius-topleft : 4px; 414 | -moz-border-radius-topright : 4px; 415 | -webkit-border-radius-topleft : 4px; 416 | -webkit-border-radius-topright : 4px; 417 | } 418 | 419 | .main { 420 | padding: 10px 20px !important; 421 | font-family:"Myriad Pro",arial,sans-serif; 422 | font-weight:normal; 423 | } 424 | 425 | .main h1 { font-size: 30px; margin-bottom: 8px; line-height:30px;} 426 | .main h2 { font-size: 20px; margin-top:20px;} 427 | 428 | .notes { opacity:0.6; } 429 | 430 | .type_desc { 431 | margin-left:30px; 432 | } 433 | h3 + .type_desc { 434 | margin-top:10px; 435 | } 436 | 437 | pre.sh_sourceCode { 438 | color : black; 439 | font-style : normal; 440 | font-weight : normal; 441 | } 442 | 443 | pre.sh_sourceCode .sh_keyword { color: blue; font-weight: bold; } 444 | pre.sh_sourceCode .sh_type { color: darkgreen; } 445 | pre.sh_sourceCode .sh_usertype { color: teal; } 446 | pre.sh_sourceCode .sh_string { color: red; font-family: monospace; } 447 | pre.sh_sourceCode .sh_regexp { color: orange; font-family: monospace; } 448 | pre.sh_sourceCode .sh_specialchar { color: pink; font-family: monospace; } 449 | pre.sh_sourceCode .sh_comment { color: brown; font-style: italic; } 450 | pre.sh_sourceCode .sh_number { color: purple; } 451 | pre.sh_sourceCode .sh_preproc { color: darkblue; font-weight: bold; } 452 | pre.sh_sourceCode .sh_symbol { color: darkred; } 453 | pre.sh_sourceCode .sh_function { color: #32656A; font-weight: bold; } 454 | pre.sh_sourceCode .sh_cbracket { color: red; } 455 | pre.sh_sourceCode .sh_todo { font-weight: bold; background-color: cyan; } 456 | 457 | /* Predefined variables and functions (for instance glsl) */ 458 | pre.sh_sourceCode .sh_predef_var { color: darkblue; } 459 | pre.sh_sourceCode .sh_predef_func { color: darkblue; font-weight: bold; } 460 | 461 | /* for OOP */ 462 | pre.sh_sourceCode .sh_classname { color: teal; } 463 | 464 | /* line numbers (not yet implemented) */ 465 | pre.sh_sourceCode .sh_linenum { color: black; font-family: monospace; } 466 | 467 | /* Internet related */ 468 | pre.sh_sourceCode .sh_url { color: blue; text-decoration: underline; font-family: monospace; } 469 | 470 | /* for ChangeLog and Log files */ 471 | pre.sh_sourceCode .sh_date { color: blue; font-weight: bold; } 472 | pre.sh_sourceCode .sh_time, pre.sh_sourceCode .sh_file { color: darkblue; font-weight: bold; } 473 | pre.sh_sourceCode .sh_ip, pre.sh_sourceCode .sh_name { color: darkgreen; } 474 | 475 | /* for Prolog, Perl... */ 476 | pre.sh_sourceCode .sh_variable { color: darkgreen; } 477 | 478 | /* for LaTeX */ 479 | pre.sh_sourceCode .sh_italics { color: darkgreen; font-style: italic; } 480 | pre.sh_sourceCode .sh_bold { color: darkgreen; font-weight: bold; } 481 | pre.sh_sourceCode .sh_underline { color: darkgreen; text-decoration: underline; } 482 | pre.sh_sourceCode .sh_fixed { color: green; font-family: monospace; } 483 | pre.sh_sourceCode .sh_argument { color: darkgreen; } 484 | pre.sh_sourceCode .sh_optionalargument { color: purple; } 485 | pre.sh_sourceCode .sh_math { color: orange; } 486 | pre.sh_sourceCode .sh_bibtex { color: blue; } 487 | 488 | /* for diffs */ 489 | pre.sh_sourceCode .sh_oldfile { color: orange; } 490 | pre.sh_sourceCode .sh_newfile { color: darkgreen; } 491 | pre.sh_sourceCode .sh_difflines { color: blue; } 492 | 493 | /* for css */ 494 | pre.sh_sourceCode .sh_selector { color: purple; } 495 | pre.sh_sourceCode .sh_property { color: blue; } 496 | pre.sh_sourceCode .sh_value { color: darkgreen; font-style: italic; } 497 | 498 | /* other */ 499 | pre.sh_sourceCode .sh_section { color: black; font-weight: bold; } 500 | pre.sh_sourceCode .sh_paren { color: red; } 501 | pre.sh_sourceCode .sh_attribute { color: darkgreen; } 502 | 503 | .sh_sourceCode{ font-weight:normal; font-style:normal}.sh_sourceCode .sh_symbol,.sh_sourceCode .sh_cbracket{ color:#32656a}.sh_sourceCode .sh_keyword{ font-style:italic}.sh_sourceCode .sh_function{ font-weight:bold}.sh_sourceCode .sh_preproc{ font-weight:bold; color:#32656a}.sh_sourceCode .sh_string,.sh_sourceCode .sh_regexp,.sh_sourceCode .sh_specialchar{ color:#94E343}.sh_sourceCode .sh_number{ color:#a67}.sh_sourceCode .sh_comment{ color:#999} 504 | -------------------------------------------------------------------------------- /templates/erldocs_js.dtl: -------------------------------------------------------------------------------- 1 | var ErlDocs = (function(index) { 2 | 3 | /* Search box height? */ 4 | var RESULT_OFFSET_Y = 26; 5 | 6 | /* Human readable keyCode index */ 7 | var KEY = {'BACKSPACE': 8, 'TAB': 9, 'NUM_PAD_CLEAR': 12, 'ENTER': 13, 'SHIFT': 16, 'CTRL': 17, 'ALT': 18, 'PAUSE': 19, 'CAPS_LOCK': 20, 'ESCAPE': 27, 'SPACEBAR': 32, 'PAGE_UP': 33, 'PAGE_DOWN': 34, 'END': 35, 'HOME': 36, 'ARROW_LEFT': 37, 'ARROW_UP': 38, 'ARROW_RIGHT': 39, 'ARROW_DOWN': 40, 'PRINT_SCREEN': 44, 'INSERT': 45, 'DELETE': 46, 'SEMICOLON': 59, 'WINDOWS_LEFT': 91, 'WINDOWS_RIGHT': 92, 'SELECT': 93, 'NUM_PAD_ASTERISK': 106, 'NUM_PAD_PLUS_SIGN': 107, 'NUM_PAD_HYPHEN-MINUS': 109, 'NUM_PAD_FULL_STOP': 110, 'NUM_PAD_SOLIDUS': 111, 'NUM_LOCK': 144, 'SCROLL_LOCK': 145, 'SEMICOLON': 186, 'EQUALS_SIGN': 187, 'COMMA': 188, 'HYPHEN-MINUS': 189, 'FULL_STOP': 190, 'SOLIDUS': 191, 'GRAVE_ACCENT': 192, 'LEFT_SQUARE_BRACKET': 219, 'REVERSE_SOLIDUS': 220, 'RIGHT_SQUARE_BRACKET': 221, 'APOSTROPHE': 222}; 8 | 9 | (function () { 10 | /* 0 - 9 */ 11 | for (var i = 48; i <= 57; i++) { 12 | KEY['' + (i - 48)] = i; 13 | } 14 | /* A - Z */ 15 | for (i = 65; i <= 90; i++) { 16 | KEY['' + String.fromCharCode(i)] = i; 17 | } 18 | /* NUM_PAD_0 - NUM_PAD_9 */ 19 | for (i = 96; i <= 105; i++) { 20 | KEY['NUM_PAD_' + (i - 96)] = i; 21 | } 22 | /* F1 - F12 */ 23 | for (i = 112; i <= 123; i++) { 24 | KEY['F' + (i - 112 + 1)] = i; 25 | } 26 | })(); 27 | 28 | var $search = $("#search"), 29 | $results = $("#results"), 30 | searchActive = false, 31 | selected = null, 32 | resultsCount = 0, 33 | showingFuns = true; 34 | 35 | 36 | var getDetails = function() { 37 | return showingFuns 38 | ? {"text":"Hide Functions", "cBottom": "25%", fTop: "75%"} 39 | : {"text":"View Functions", "cBottom": "0px", fTop: "100%"}; 40 | }; 41 | 42 | var setDetails = function(details, fun) { 43 | $("#viewfuns").text(details.text); 44 | $("#content").css({"bottom":details.cBottom}); 45 | $("#funwrapper").animate({"top":details.fTop}, "normal", fun); 46 | }; 47 | 48 | function scrollIntoView($parent, $child, force) { 49 | 50 | var childTop = $child.position().top - RESULT_OFFSET_Y, 51 | scrollTop = $parent[0].scrollTop, 52 | childHeight = $child.height(), 53 | parentHeight = $parent.height(), 54 | newTop = null; 55 | 56 | if (force) { 57 | $parent[0].scrollTop = scrollTop + childTop; 58 | return; 59 | } 60 | 61 | if (childTop < 0) { 62 | newTop = scrollTop + childTop; 63 | } else if (childTop + childHeight > parentHeight) { 64 | newTop = scrollTop + ((childTop + childHeight) - parentHeight); 65 | } 66 | 67 | if (newTop !== null) { 68 | if (Math.abs(newTop - scrollTop) > 200) { 69 | $parent.animate({"scrollTop": newTop}, 'fast'); 70 | } else { 71 | $parent[0].scrollTop = newTop; 72 | } 73 | } 74 | }; 75 | 76 | function setSelected(x, force) { 77 | 78 | var sel, children = $results.children("li"); 79 | 80 | if (x >= 0 && x < resultsCount) { 81 | if (selected !== null) { 82 | children.eq(selected).removeClass("selected"); 83 | } 84 | selected = x; 85 | sel = children.eq(x).addClass("selected"); 86 | if (sel.length > 0) { 87 | scrollIntoView($results, sel, force); 88 | } 89 | } 90 | }; 91 | 92 | function keypress(e) { 93 | 94 | var tmp, blockedKeys = [0, KEY.TAB, KEY.CTRL, KEY.ALT, 95 | KEY.WINDOWS_LEFT, KEY.GRAVE_ACCENT]; 96 | 97 | if (!($.inArray(e.keyCode, blockedKeys) === -1)) { 98 | return; 99 | } 100 | 101 | if (e.keyCode === KEY.ARROW_DOWN) { setSelected(selected + 1); 102 | } else if (e.keyCode === KEY.ARROW_UP) { setSelected(selected - 1); 103 | } else if (e.keyCode === KEY.PAGE_DOWN) { setSelected(selected + 7); 104 | } else if (e.keyCode === KEY.PAGE_UP) { setSelected(selected - 7); 105 | } else if (e.keyCode === KEY.ENTER) { 106 | tmp = $results.children(".selected"); 107 | if (tmp.length > 0) { 108 | document.location.href = tmp.find("a").attr("href"); 109 | } 110 | } else { 111 | filter($search.val()); 112 | } 113 | }; 114 | 115 | function windowResize() { 116 | $results.height($(window).height() - RESULT_OFFSET_Y); 117 | }; 118 | 119 | function showModules() { 120 | 121 | var i, item, len = index.length, 122 | results = []; 123 | 124 | for (i = 0; i < len; i += 1) { 125 | item = index[i]; 126 | if (item[0] === "mod" || item[0] === "app") { 127 | results.push(item); 128 | } 129 | } 130 | return results; 131 | }; 132 | 133 | function searchApps(str) { 134 | 135 | var i, count, item, 136 | len = index.length, 137 | results = [], 138 | terms = str.split(" "); 139 | 140 | for (i = 0, count = 0; i < len; i += 1) { 141 | item = index[i]; 142 | if (match(item[2], terms)) { 143 | results.push(item); 144 | if (count++ > 100) { 145 | break; 146 | } 147 | } 148 | } 149 | return results; 150 | }; 151 | 152 | function formatResults(results, str) { 153 | 154 | var i, item, hash, url, path, html = "", 155 | len = results.length, 156 | searchStr = isSearchStr(str) ? "&search="+str : ""; 157 | 158 | for (i = 0; i < len; i += 1) { 159 | 160 | item = results[i]; 161 | 162 | if (item[0] === "app") { 163 | hash = "#" + item[1]; 164 | path = "index"; 165 | } else { 166 | hash = (item[0] === "fun") ? "#" + item[2].split(":")[1] : ""; 167 | path = item[1] + "/" + item[2].split(":")[0]; 168 | } 169 | url = CURRENT_ROOT + path + ".html?i=" + i + searchStr + hash; 170 | 171 | html += '
  • ' 172 | + '' + item[2] + "" 173 | + '
    ' + item[3] + '' 174 | + '
  • '; 175 | } 176 | 177 | return html; 178 | }; 179 | 180 | function isSearchStr(str) { 181 | return typeof str !== "undefined" && str !== ""; 182 | } 183 | 184 | function filter(str) { 185 | 186 | var results = isSearchStr(str) ? searchApps(str) : showModules(), 187 | html = formatResults(results, str); 188 | 189 | $results[0].innerHTML = html; 190 | setSelected(0); 191 | resultsCount = results.length; 192 | }; 193 | 194 | function match(str, terms) { 195 | for (var i = 0, len = terms.length; i < len; i += 1) { 196 | if (str.match(new RegExp(terms[i], "i")) === null) { 197 | return false; 198 | } 199 | } 200 | return true; 201 | }; 202 | 203 | function parseQuery(url) { 204 | 205 | var arr, query, i, len, tmp, 206 | qs = url.split("?")[1]; 207 | 208 | if (typeof qs !== "undefined") { 209 | arr = qs.split("&"); 210 | query = {}; 211 | for (i = 0, len = arr.length; i < len; i += 1) { 212 | tmp = arr[i].split("="); 213 | query[tmp[0]] = tmp[1]; 214 | } 215 | return query; 216 | } 217 | return false; 218 | }; 219 | 220 | function strToBool(val) { 221 | return val === "true"; 222 | }; 223 | 224 | function updateTitle() { 225 | var app, idx, mod, $t, i, j, results, len; 226 | results = showModules(); 227 | len = results.length; 228 | $t = $("body h1"), 229 | mod = $t.text(); 230 | for (i = 0; i < len; i++) { 231 | idx = results[i]; 232 | if (idx[0] !== "mod" || idx[2] !== mod) continue; 233 | app = idx[1]; 234 | for (j = i - 1; j >= 0; j--) { 235 | idx = results[j]; 236 | if (idx[0] !== "app" || idx[1] !== app) continue; 237 | $t.after(' (' + app + ')'); 238 | return; 239 | } 240 | } 241 | } 242 | 243 | function init() { 244 | 245 | var val, qs = parseQuery(document.location.search); 246 | 247 | if (qs && qs.search && $search.val() === "") { 248 | val = decodeURIComponent(qs.search.replace(/\+/g, " ")); 249 | $search.val(val); 250 | filter(val); 251 | 252 | // If a search parameter is specified and hash doesnt already 253 | // exist, jump to first match 254 | if (document.location.hash === "") { 255 | document.location.hash = 256 | $("#results li:first-child a").attr("href").split("#")[1]; 257 | } 258 | 259 | } else { 260 | filter(); 261 | } 262 | 263 | if (qs && qs.i) { 264 | setSelected(parseInt(qs.i, 10), true); 265 | } else { 266 | setSelected(0); 267 | } 268 | 269 | if (qs && (qs.i || qs.search)) { 270 | $search[0].focus(); 271 | } else { 272 | document.body.focus(); 273 | } 274 | }; 275 | 276 | $search.keydown(function (e) { 277 | 278 | // Run First keydown 279 | setTimeout(function () { keypress(e); }, 0); 280 | 281 | // // Set up a timer to repeat (holding down arrow keys etc) 282 | var timer = null, timeout = null, 283 | repeatKeys = [KEY.PAGE_UP, KEY.PAGE_DOWN, 284 | KEY.ARROW_UP, KEY.ARROW_DOWN, 285 | KEY.BACKSPACE], 286 | set_interval = function () { 287 | timer = setInterval(function () { keypress(e); }, 60); 288 | }; 289 | 290 | if ($.inArray(e.keyCode, repeatKeys) === -1) { 291 | return; 292 | } 293 | 294 | function cleanup() { 295 | window.clearTimeout(timeout); 296 | $(document).unbind("keyup", cleanup); 297 | clearInterval(timer); 298 | } 299 | 300 | $search.bind("keyup", cleanup); 301 | timeout = window.setTimeout(set_interval, 300); 302 | }); 303 | 304 | $search.focus(function () { 305 | $search[0].focus(); 306 | $("#sidebar").removeClass("inactive"); 307 | searchActive = true; 308 | }); 309 | 310 | $search.blur(function () { 311 | $("#sidebar").addClass("inactive"); 312 | searchActive = false; 313 | document.body.focus(); 314 | }); 315 | 316 | $(document).bind("keypress", function(e) { 317 | 318 | if (e.keyCode === KEY.TAB && !e.metaKey) { 319 | 320 | e.preventDefault(); 321 | e.stopPropagation(); 322 | 323 | if(searchActive) { 324 | $search.blur(); 325 | $("#content")[0].focus(); 326 | } else { 327 | $search[0].focus(); 328 | } 329 | 330 | return false; 331 | } 332 | return true; 333 | }); 334 | 335 | showingFuns = !!window.localStorage && 336 | strToBool(window.localStorage.footer); 337 | 338 | if (document.title.match("Module Index") === null) { 339 | updateTitle(); 340 | setDetails(getDetails(), function() { 341 | $("#funwrapper").css({"display":"block"}); 342 | }); 343 | } 344 | 345 | $("#viewfuns").bind("mousedown", function(e) { 346 | 347 | showingFuns = !showingFuns; 348 | setDetails(getDetails(), null); 349 | 350 | if (!!window.localStorage) { 351 | window.localStorage.footer = showingFuns; 352 | } 353 | }); 354 | 355 | $(window).bind('resize', windowResize); 356 | windowResize(); 357 | 358 | init(); 359 | 360 | })(index); 361 | 362 | /* Copyright (C) 2007, 2008 gnombat@users.sourceforge.net */ 363 | /* License: http://shjs.sourceforge.net/doc/gplv3.html */ 364 | 365 | if(!this.sh_languages){this.sh_languages={}}var sh_requests={};function sh_isEmailAddress(a){if(/^mailto:/.test(a)){return false}return a.indexOf("@")!==-1}function sh_setHref(b,c,d){var a=d.substring(b[c-2].pos,b[c-1].pos);if(a.length>=2&&a.charAt(0)==="<"&&a.charAt(a.length-1)===">"){a=a.substr(1,a.length-2)}if(sh_isEmailAddress(a)){a="mailto:"+a}b[c-2].node.href=a}function sh_konquerorExec(b){var a=[""];a.index=b.length;a.input=b;return a}function sh_highlightString(B,o){if(/Konqueror/.test(navigator.userAgent)){if(!o.konquered){for(var F=0;FI){x(g.substring(I,E.index),null)}var e=O[u];var J=e[1];var b;if(J instanceof Array){for(var L=0;L0){var e=b.split(" ");for(var c=0;c0){a.push(e[c])}}}return a}function sh_addClass(c,a){var d=sh_getClasses(c);for(var b=0;b element with class="'+h+'", but no such language exists'}}break}}}}; 366 | 367 | sh_languages['erlang'] = [ 368 | [ 369 | [ 370 | /\b(?:div|default|rem|or|xor|bor|bxor|bsl|bsr|and|band|not|bnot|abs|alive|apply|atom_to_list|binary_to_list|binary_to_term|concat_binary|date|disconnect_node|element|erase|exit|float|float_to_list|get|get_keys|group_leader|halt|hd|integer_to_list|is_alive|length|link|list_to_atom|list_to_binary|list_to_float|list_to_integer|list_to_pid|list_to_tuple|load_module|make_ref|monitor_node|node|nodes|now|open_port|pid_to_list|process_flag|process_info|process|put|register|registered|round|self|setelement|size|spawn|spawn_link|split_binary|statistics|term_to_binary|throw|time|tl|trunc|tuple_to_list|unlink|unregister|whereis|atom|binary|constant|function|integer|list|number|pid|ports|port_close|port_info|reference|record|check_process_code|delete_module|get_cookie|hash|math|module_loaded|preloaded|processes|purge_module|set_cookie|set_node|acos|asin|atan|atan2|cos|cosh|exp|log|log10|pi|pow|power|sin|sinh|sqrt|tan|tanh|call|module_info|parse_transform|undefined_function|error_handler|after|begin|case|catch|cond|end|fun|if|let|of|query|receive|when|creation|current_function|dictionary|group_leader|heap_size|high|initial_call|linked|low|memory_in_use|message_queue|net_kernel|node|normal|priority|reductions|registered_name|runnable|running|stack_trace|status|timer|trap_exit|waiting|command|count_in|count_out|creation|in|in_format|linked|node|out|owner|packeting|atom_tables|communicating|creation|current_gc|current_reductions|current_runtime|current_wall_clock|distribution_port|entry_points|error_handler|friends|garbage_collection|magic_cookie|magic_cookies|module_table|monitored_nodes|name|next_ref|ports|preloaded|processes|reductions|ref_state|registry|runtime|wall_clock|apply_lambda|module_info|module_lambdas|record|record_index|record_info|badarg|nocookie|false|fun|true|badsig|kill|killed|exit|normal)\b/g, 371 | 'sh_keyword', 372 | -1 373 | ], 374 | [ 375 | /%/g, 376 | 'sh_comment', 377 | 1 378 | ], 379 | [ 380 | /\(|\)|\{|\}|\[|\]|\||;|,|\?|#/g, 381 | 'sh_normal', 382 | -1 383 | ], 384 | [ 385 | /\b[+-]?(?:(?:0x[A-Fa-f0-9]+)|(?:(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?))u?(?:(?:int(?:8|16|32|64))|L)?\b|\$\x+/g, 386 | 'sh_number', 387 | -1 388 | ], 389 | [ 390 | /"/g, 391 | 'sh_string', 392 | 2 393 | ], 394 | [ 395 | /\'/g, 396 | 'sh_string', 397 | 3 398 | ], 399 | [ 400 | /\w+(?:\s+)?[:@](?:\s+)?\w+/g, 401 | 'sh_function', 402 | -1 403 | ], 404 | [ 405 | /-compile|-define|-else|-endif|-export|-file|-ifdef|-ifndef|-import|-include|-include_lib|-module|-record|-undef|-author|-copyright|-doc/g, 406 | 'sh_preproc', 407 | -1 408 | ], 409 | [ 410 | /\+|-|\*|\/|==|=|=:=|=\/=|<|=<|>|>=|\+\+|--|=|!|<-|->|:|_|@|\\|\"|\./g, 411 | 'sh_symbol', 412 | -1 413 | ] 414 | ], 415 | [ 416 | [ 417 | /$/g, 418 | null, 419 | -2 420 | ] 421 | ], 422 | [ 423 | [ 424 | /\\(?:\\|")/g, 425 | null, 426 | -1 427 | ], 428 | [ 429 | /"/g, 430 | 'sh_string', 431 | -2 432 | ] 433 | ], 434 | [ 435 | [ 436 | /\\(?:\\|\')/g, 437 | null, 438 | -1 439 | ], 440 | [ 441 | /\'/g, 442 | 'sh_string', 443 | -2 444 | ] 445 | ] 446 | ]; 447 | sh_highlightDocument(); 448 | -------------------------------------------------------------------------------- /templates/jquery_js.dtl: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery JavaScript Library v1.3.2 3 | * http://jquery.com/ 4 | * 5 | * Copyright (c) 2009 John Resig 6 | * Dual licensed under the MIT and GPL licenses. 7 | * http://docs.jquery.com/License 8 | * 9 | * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) 10 | * Revision: 6246 11 | */ 12 | (function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
    "]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
    ","
    "]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); 13 | /* 14 | * Sizzle CSS Selector Engine - v0.9.3 15 | * Copyright 2009, The Dojo Foundation 16 | * Released under the MIT, BSD, and GPL Licenses. 17 | * More information: http://sizzlejs.com/ 18 | */ 19 | (function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

    ";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
    ";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
    ").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
    ';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); --------------------------------------------------------------------------------