diff --git a/docs/user-guide/inspecting.md b/docs/user-guide/inspecting.md index 3f3553d848..5b446d46ed 100644 --- a/docs/user-guide/inspecting.md +++ b/docs/user-guide/inspecting.md @@ -1,10 +1,21 @@ # Inspecting results -## g2html +## HTML +1. Run Goblint with additional `--html` argument. +2. Run `python3 -m http.server --directory result 8080` + or `npx http-server -c-1 result`. +3. Inspect results at . + +Modern browsers' security settings forbid some file access which is necessary for the HTML output to work, hence the need for serving the results via Python's `http.server` (or similar). + +## g2html (legacy) +If there are problems with the above HTML output, the legacy g2html output (using an external Java component) is still possible. +The frontend of the above HTML output is reused from g2html, so the two look the same (except for code highlighting). + 1. First time run: `make jar`. -2. Run Goblint with additional `--html` argument. +2. Run Goblint with additional `--set result g2html` arguments. 3. Run `python3 -m http.server --directory result 8080` - or `npx http-server -c-1 result`. + or `npx http-server -c-1 result`. 4. Inspect results at . Modern browsers' security settings forbid some file access which is necessary for g2html to work, hence the need for serving the results via Python's `http.server` (or similar). diff --git a/dune-project b/dune-project index 96019eaa24..4b224a4ce1 100644 --- a/dune-project +++ b/dune-project @@ -82,7 +82,8 @@ Goblint includes analyses for assertions, overflows, deadlocks, etc and can be e ) (sites (share lib) - (share conf)) + (share conf) + (share xslt)) ) ; (map_workspace_root false) ;uncomment to enable breakpoints diff --git a/make.sh b/make.sh index 404c409789..2d87dbd509 100755 --- a/make.sh +++ b/make.sh @@ -74,7 +74,7 @@ rule() { } ;; setup) echo "Make sure you have the following installed: opam >= 2.0.0, git, patch, m4, autoconf, libgmp-dev, libmpfr-dev, pkg-config" - echo "For the --html output you also need: javac, ant, dot (graphviz)" + echo "For the --html output you also need: graphviz and python3-pygments (optional)" echo "For running the regression tests you also need: ruby, gem, curl, and the `os` gem" echo "For reference see ./Dockerfile or ./scripts/travis-ci.sh" opam_setup diff --git a/src/common/framework/cfgTools.ml b/src/common/framework/cfgTools.ml index dad34d6c87..32e3bed5cd 100644 --- a/src/common/framework/cfgTools.ml +++ b/src/common/framework/cfgTools.ml @@ -654,12 +654,12 @@ let sprint_fundec_html_dot (module Cfg : CfgBidir) live fd = fprint_fundec_html_dot (module Cfg) live fd Format.str_formatter; Format.flush_str_formatter () -let dead_code_cfg (module FileCfg: MyCFG.FileCfg) live = +let dead_code_cfg ~path (module FileCfg: MyCFG.FileCfg) live = iterGlobals FileCfg.file (fun glob -> match glob with | GFun (fd,loc) -> (* ignore (Printf.printf "fun: %s\n" fd.svar.vname); *) - let base_dir = GobSys.mkdir_or_exists_absolute (Fpath.v "cfgs") in + let base_dir = GobSys.mkdir_or_exists_absolute path in let c_file_name = Str.global_substitute (Str.regexp Filename.dir_sep) (fun _ -> "%2F") loc.file in let dot_file_name = fd.svar.vname^".dot" in let file_dir = GobSys.mkdir_or_exists_absolute Fpath.(base_dir / c_file_name) in diff --git a/src/config/options.schema.json b/src/config/options.schema.json index 74dfcd88cd..aa020370ff 100644 --- a/src/config/options.schema.json +++ b/src/config/options.schema.json @@ -81,7 +81,7 @@ "description": "Result style: none, fast_xml, json, pretty, pretty-deterministic, json-messages, sarif.", "type": "string", - "enum": ["none", "fast_xml", "json", "pretty", "pretty-deterministic", "json-messages", "sarif"], + "enum": ["none", "fast_xml", "g2html", "xslt", "json", "pretty", "pretty-deterministic", "json-messages", "sarif"], "default": "none" }, "solver": { @@ -117,12 +117,6 @@ "enum": ["auto", "always", "never"], "default": "auto" }, - "g2html": { - "title": "g2html", - "description": "Run g2html.jar on the generated xml.", - "type": "boolean", - "default": false - }, "save_run": { "title": "save_run", "description": diff --git a/src/framework/analysisResult.ml b/src/framework/analysisResult.ml index c8834e1472..85a72183ca 100644 --- a/src/framework/analysisResult.ml +++ b/src/framework/analysisResult.ml @@ -1,4 +1,4 @@ -(** Analysis result output. *) +(** Analysis results. *) open GoblintCil open Pretty @@ -32,164 +32,22 @@ sig val result_name: string end -module Result (Range: Printable.S) (C: ResultConf) = -struct - include BatHashtbl.Make (ResultNode) - type nonrec t = Range.t t (* specialize polymorphic type for Range values *) - - let pretty () mapping = - let f key st dok = - dok ++ dprintf "%a ->@? @[%a@]\n" ResultNode.pretty key Range.pretty st - in - let content () = fold f mapping nil in - let defline () = dprintf "OTHERS -> Not available\n" in - dprintf "@[Mapping {\n @[%t%t@]}@]" content defline - - let pretty_deterministic () mapping = - let bindings = - to_list mapping - |> List.sort [%ord: ResultNode.t * Range.t] - in - let f dok (key, st) = - dok ++ dprintf "%a ->@? @[%a@]\n" ResultNode.pretty key Range.pretty st - in - let content () = List.fold_left f nil bindings in - let defline () = dprintf "OTHERS -> Not available\n" in - dprintf "@[Mapping {\n @[%t%t@]}@]" content defline +module type Result = +sig + include ResultConf + module Range: Printable.S + module H: BatHashtbl.S with type key := ResultNode.t + include BatHashtbl.S with type 'a t := 'a H.t and type key := ResultNode.t + type t = Range.t H.t +end +module Result (Range: Printable.S) (C: ResultConf): Result with module Range = Range = +struct include C - - let printXml f xs = - let print_one n v = - (* Not using Node.location here to have updated locations in incremental analysis. - See: https://github.com/goblint/analyzer/issues/290#issuecomment-881258091. *) - let loc = UpdateCil.getLoc n in - BatPrintf.fprintf f "\n" (Node.show_id n) loc.file loc.line loc.byte loc.column loc.endLine loc.endColumn loc.synthetic; - BatPrintf.fprintf f "%a\n" Range.printXml v - in - iter print_one xs - - let printJson f xs = - let print_one n v = - (* Not using Node.location here to have updated locations in incremental analysis. - See: https://github.com/goblint/analyzer/issues/290#issuecomment-881258091. *) - let loc = UpdateCil.getLoc n in - BatPrintf.fprintf f "{\n\"id\": \"%s\", \"file\": \"%s\", \"line\": \"%d\", \"byte\": \"%d\", \"column\": \"%d\", \"states\": %s\n},\n" (Node.show_id n) loc.file loc.line loc.byte loc.column (Yojson.Safe.to_string (Range.to_yojson v)) - in - iter print_one xs - - let printXmlWarning f () = - let one_text f Messages.Piece.{loc; text = m; _} = - match loc with - | Some loc -> - let l = Messages.Location.to_cil loc in - BatPrintf.fprintf f "\n%s" l.file l.line l.column (XmlUtil.escape m) - | None -> - () (* TODO: not outputting warning without location *) - in - let one_w f (m: Messages.Message.t) = match m.multipiece with - | Single piece -> one_text f piece - | Group {group_text = n; pieces = e; group_loc} -> - let group_loc_text = match group_loc with - | None -> "" - | Some group_loc -> GobPretty.sprintf " (%a)" CilType.Location.pretty (Messages.Location.to_cil group_loc) - in - BatPrintf.fprintf f "%a\n" n group_loc_text (BatList.print ~first:"" ~last:"" ~sep:"" one_text) e - in - let one_w f x = BatPrintf.fprintf f "\n%a" one_w x in - List.iter (one_w f) !Messages.Table.messages_list - - let output table gtable gtfxml (file: file) = - let out = Messages.get_out result_name !Messages.out in - match get_string "result" with - | "pretty" -> ignore (fprintf out "%a\n" pretty (Lazy.force table)) - | "pretty-deterministic" -> ignore (fprintf out "%a\n" pretty_deterministic (Lazy.force table)) - | "fast_xml" -> - let module SH = BatHashtbl.Make (Basetype.RawStrings) in - let file2funs = SH.create 100 in - let funs2node = SH.create 100 in - iter (fun n _ -> SH.add funs2node (Node.find_fundec n).svar.vname n) (Lazy.force table); - iterGlobals file (function - | GFun (fd,loc) -> SH.add file2funs loc.file fd.svar.vname - | _ -> () - ); - let p_node f n = BatPrintf.fprintf f "%s" (Node.show_id n) in - let p_nodes f xs = - List.iter (BatPrintf.fprintf f "\n" p_node) xs - in - let p_funs f xs = - let one_fun n = - BatPrintf.fprintf f "\n%a\n" n p_nodes (SH.find_all funs2node n) - in - List.iter one_fun xs - in - let write_file f fn = - Messages.xml_file_name := fn; - Logs.info "Writing xml to temp. file: %s" fn; - BatPrintf.fprintf f ""; - BatPrintf.fprintf f "%s" GobSys.command_line; - BatPrintf.fprintf f ""; - let timing_ppf = BatFormat.formatter_of_out_channel f in - Timing.Default.print timing_ppf; - Format.pp_print_flush timing_ppf (); - BatPrintf.fprintf f ""; - BatPrintf.fprintf f "\n"; - BatEnum.iter (fun b -> BatPrintf.fprintf f "\n%a\n" (Filename.basename b) b p_funs (SH.find_all file2funs b)) (BatEnum.uniq @@ SH.keys file2funs); (* nosemgrep: batenum-module *) - BatPrintf.fprintf f "%a" printXml (Lazy.force table); - gtfxml f gtable; - printXmlWarning f (); - BatPrintf.fprintf f "\n"; - BatPrintf.fprintf f "%!" - in - if get_bool "g2html" then - BatFile.with_temporary_out ~mode:[`create;`text;`delete_on_exit] write_file - else - let f = BatIO.output_channel out in - write_file f (get_string "outfile") - | "json" -> - let open BatPrintf in - let module SH = BatHashtbl.Make (Basetype.RawStrings) in - let file2funs = SH.create 100 in - let funs2node = SH.create 100 in - iter (fun n _ -> SH.add funs2node (Node.find_fundec n).svar.vname n) (Lazy.force table); - iterGlobals file (function - | GFun (fd,loc) -> SH.add file2funs loc.file fd.svar.vname - | _ -> () - ); - let p_enum p f xs = BatEnum.print ~first:"[\n " ~last:"\n]" ~sep:",\n " p f xs in (* nosemgrep: batenum-module *) - let p_list p f xs = BatList.print ~first:"[\n " ~last:"\n]" ~sep:",\n " p f xs in - (*let p_kv f (k,p,v) = fprintf f "\"%s\": %a" k p v in*) - (*let p_obj f xs = BatList.print ~first:"{\n " ~last:"\n}" ~sep:",\n " p_kv xs in*) - let p_node f n = BatPrintf.fprintf f "\"%s\"" (Node.show_id n) in - let p_fun f x = fprintf f "{\n \"name\": \"%s\",\n \"nodes\": %a\n}" x (p_list p_node) (SH.find_all funs2node x) in - (*let p_fun f x = p_obj f [ "name", BatString.print, x; "nodes", p_list p_node, SH.find_all funs2node x ] in*) - let p_file f x = fprintf f "{\n \"name\": \"%s\",\n \"path\": \"%s\",\n \"functions\": %a\n}" (Filename.basename x) x (p_list p_fun) (SH.find_all file2funs x) in - let write_file f fn = - Logs.info "Writing json to temp. file: %s" fn; - fprintf f "{\n \"parameters\": \"%s\",\n " GobSys.command_line; - fprintf f "\"files\": %a,\n " (p_enum p_file) (SH.keys file2funs); - fprintf f "\"results\": [\n %a\n]\n" printJson (Lazy.force table); - (*gtfxml f gtable;*) - (*printXmlWarning f ();*) - fprintf f "}\n"; - in - if get_bool "g2html" then - BatFile.with_temporary_out ~mode:[`create;`text;`delete_on_exit] write_file - else - let f = BatIO.output_channel out in - write_file f (get_string "outfile") - | "sarif" -> - Logs.result "Writing Sarif to file: %s" (get_string "outfile"); - Yojson.Safe.to_channel ~std:true out (Sarif.to_yojson (List.rev !Messages.Table.messages_list)); - | "json-messages" -> - let json = `Assoc [ - ("files", Preprocessor.dependencies_to_yojson ()); - ("messages", Messages.Table.to_yojson ()); - ] - in - Yojson.Safe.to_channel ~std:true out json - | "none" -> () - | s -> failwith @@ "Unsupported value for option `result`: "^s + module Range = Range + module H = BatHashtbl.Make (ResultNode) + include H + type t = Range.t H.t end module ResultType2 (S: Analyses.Spec) = diff --git a/src/framework/analysisResultOutput.ml b/src/framework/analysisResultOutput.ml new file mode 100644 index 0000000000..e7b9eb6bd6 --- /dev/null +++ b/src/framework/analysisResultOutput.ml @@ -0,0 +1,97 @@ +(** Analysis result output. *) + +open GoblintCil +open Pretty +open GobConfig +open AnalysisResult + +module Make (Result: Result) = +struct + open Result + + let pretty () mapping = + let f key st dok = + dok ++ dprintf "%a ->@? @[%a@]\n" ResultNode.pretty key Range.pretty st + in + let content () = fold f mapping nil in + let defline () = dprintf "OTHERS -> Not available\n" in + dprintf "@[Mapping {\n @[%t%t@]}@]" content defline + + let pretty_deterministic () mapping = + let bindings = + to_list mapping + |> List.sort [%ord: ResultNode.t * Range.t] + in + let f dok (key, st) = + dok ++ dprintf "%a ->@? @[%a@]\n" ResultNode.pretty key Range.pretty st + in + let content () = List.fold_left f nil bindings in + let defline () = dprintf "OTHERS -> Not available\n" in + dprintf "@[Mapping {\n @[%t%t@]}@]" content defline + + + let printJson f xs = + let print_one n v = + (* Not using Node.location here to have updated locations in incremental analysis. + See: https://github.com/goblint/analyzer/issues/290#issuecomment-881258091. *) + let loc = UpdateCil.getLoc n in + BatPrintf.fprintf f "{\n\"id\": \"%s\", \"file\": \"%s\", \"line\": \"%d\", \"byte\": \"%d\", \"column\": \"%d\", \"states\": %s\n},\n" (Node.show_id n) loc.file loc.line loc.byte loc.column (Yojson.Safe.to_string (Range.to_yojson v)) + in + iter print_one xs + + + let output table live gtable gtfxml (module FileCfg: MyCFG.FileCfg) = + let file = FileCfg.file in + let out = Messages.get_out result_name !Messages.out in + match get_string "result" with + | "pretty" -> ignore (fprintf out "%a\n" pretty (Lazy.force table)) + | "pretty-deterministic" -> ignore (fprintf out "%a\n" pretty_deterministic (Lazy.force table)) + | "fast_xml" + | "g2html" -> + let module Output = XsltResultOutput.Make (Result) in + Output.output table live gtable gtfxml (module FileCfg) + | "xslt" -> + let module Output = XsltResultOutput.Make2 (Result) in + Output.output table live gtable gtfxml (module FileCfg) + | "json" -> + let open BatPrintf in + let module SH = BatHashtbl.Make (Basetype.RawStrings) in + let file2funs = SH.create 100 in + let funs2node = SH.create 100 in + iter (fun n _ -> SH.add funs2node (Node.find_fundec n).svar.vname n) (Lazy.force table); + iterGlobals file (function + | GFun (fd,loc) -> SH.add file2funs loc.file fd.svar.vname + | _ -> () + ); + let p_enum p f xs = BatEnum.print ~first:"[\n " ~last:"\n]" ~sep:",\n " p f xs in (* nosemgrep: batenum-module *) + let p_list p f xs = BatList.print ~first:"[\n " ~last:"\n]" ~sep:",\n " p f xs in + (*let p_kv f (k,p,v) = fprintf f "\"%s\": %a" k p v in*) + (*let p_obj f xs = BatList.print ~first:"{\n " ~last:"\n}" ~sep:",\n " p_kv xs in*) + let p_node f n = BatPrintf.fprintf f "\"%s\"" (Node.show_id n) in + let p_fun f x = fprintf f "{\n \"name\": \"%s\",\n \"nodes\": %a\n}" x (p_list p_node) (SH.find_all funs2node x) in + (*let p_fun f x = p_obj f [ "name", BatString.print, x; "nodes", p_list p_node, SH.find_all funs2node x ] in*) + let p_file f x = fprintf f "{\n \"name\": \"%s\",\n \"path\": \"%s\",\n \"functions\": %a\n}" (Filename.basename x) x (p_list p_fun) (SH.find_all file2funs x) in + let write_file f fn = + Logs.info "Writing json to temp. file: %s" fn; + fprintf f "{\n \"parameters\": \"%s\",\n " GobSys.command_line; + fprintf f "\"files\": %a,\n " (p_enum p_file) (SH.keys file2funs); + fprintf f "\"results\": [\n %a\n]\n" printJson (Lazy.force table); + (*gtfxml f gtable;*) + (*printXmlWarning f ();*) + fprintf f "}\n"; + in + let f = BatIO.output_channel out in + write_file f (get_string "outfile") + | "sarif" -> + Logs.result "Writing Sarif to file: %s" (get_string "outfile"); + Yojson.Safe.to_channel ~std:true out (Sarif.to_yojson (List.rev !Messages.Table.messages_list)); + | "json-messages" -> + let json = `Assoc [ + ("files", Preprocessor.dependencies_to_yojson ()); + ("messages", Messages.Table.to_yojson ()); + ] + in + Yojson.Safe.to_channel ~std:true out json + | "none" -> () + | s -> failwith @@ "Unsupported value for option `result`: "^s +end diff --git a/src/framework/control.ml b/src/framework/control.ml index 9112713d4e..576c7b62a1 100644 --- a/src/framework/control.ml +++ b/src/framework/control.ml @@ -102,6 +102,7 @@ struct module LT = SetDomain.HeadlessSet (RT) (* Analysis result structure---a hashtable from program points to [LT] *) module Result = AnalysisResult.Result (LT) (struct let result_name = "analysis" end) + module ResultOutput = AnalysisResultOutput.Make (Result) module Query = ResultQuery.Query (SpecSys) @@ -753,7 +754,7 @@ struct in if get_bool "exp.cfgdot" then - CfgTools.dead_code_cfg (module FileCfg) liveness; + CfgTools.dead_code_cfg ~path:(Fpath.v "cfgs") (module FileCfg) liveness; let warn_global g v = (* Logs.debug "warn_global %a %a" EQSys.GVar.pretty_trace g EQSys.G.pretty v; *) @@ -829,7 +830,7 @@ struct if get_string "result" <> "none" then Logs.debug "Generating output: %s" (get_string "result"); Messages.finalize (); - Timing.wrap "result output" (Result.output (lazy local_xml) gh make_global_fast_xml) file + Timing.wrap "result output" (ResultOutput.output (lazy local_xml) liveness gh make_global_fast_xml) (module FileCfg) end (* This function was originally a part of the [AnalyzeCFG] module, but diff --git a/src/framework/xsltResultOutput.ml b/src/framework/xsltResultOutput.ml new file mode 100644 index 0000000000..f1a8cea2ab --- /dev/null +++ b/src/framework/xsltResultOutput.ml @@ -0,0 +1,326 @@ +(** XSLT analysis result output. *) + +open GoblintCil +open Pretty +open GobConfig +open AnalysisResult + +module Make (Result: Result) = +struct + open Result + + let printXml_node f n v = + (* Not using Node.location here to have updated locations in incremental analysis. + See: https://github.com/goblint/analyzer/issues/290#issuecomment-881258091. *) + let loc = UpdateCil.getLoc n in + BatPrintf.fprintf f {xml| +%a +|xml} + (Node.show_id n) loc.file loc.line loc.byte loc.column loc.endLine loc.endColumn loc.synthetic + Range.printXml v + + let printXml f xs = + iter (printXml_node f) xs + + let printXmlWarning_one_text f Messages.Piece.{loc; text = m; _} = + match loc with + | Some loc -> + let l = Messages.Location.to_cil loc in + BatPrintf.fprintf f {xml| +%s|xml} + l.file l.line l.column (XmlUtil.escape m) + | None -> + () (* TODO: not outputting warning without location *) + + let printXml_warn f (m: Messages.Message.t) = match m.multipiece with + | Single piece -> printXmlWarning_one_text f piece + | Group {group_text = n; pieces = e; group_loc} -> + let group_loc_text = match group_loc with + | None -> "" + | Some group_loc -> GobPretty.sprintf " (%a)" CilType.Location.pretty (Messages.Location.to_cil group_loc) + in + BatPrintf.fprintf f {xml|%a +|xml} + n group_loc_text (BatList.print ~first:"" ~last:"" ~sep:"" printXmlWarning_one_text) e + + let printXml_warn f x = + BatPrintf.fprintf f {xml| +%a|xml} + printXml_warn x + + let printXmlWarning f () = + List.iter (printXml_warn f) !Messages.Table.messages_list + + let do_html_output () = + let g2html_path = get_string "exp.g2html_path" in + let g2html_path = + if g2html_path = "" then + GobSys.exe_dir + else + Fpath.v g2html_path + in + let jar = Fpath.(g2html_path / "g2html.jar") in + if Sys.file_exists (Fpath.to_string jar) then ( + let command = Filename.quote_command "java" [ + "-jar"; Fpath.to_string jar; + "--num-threads"; string_of_int (jobs ()); + "--dot-timeout"; "0"; + "--result-dir"; "result"; + !Messages.xml_file_name + ] + in + match Timing.wrap "g2html" Unix.system command with + | Unix.WEXITED 0 -> () + | _ -> Logs.error "HTML generation failed! Command: %s" command + | exception Unix.Unix_error (e, f, a) -> + Logs.error "%s at syscall %s with argument \"%s\"." (Unix.error_message e) f a + ) else + Logs.Format.error "Warning: jar file %a not found." Fpath.pp jar + + let output table live gtable gtfxml (module FileCfg: MyCFG.FileCfg) = + let file = FileCfg.file in + let out = Messages.get_out result_name !Messages.out in + let module SH = BatHashtbl.Make (Basetype.RawStrings) in + let file2funs = SH.create 100 in + let funs2node = SH.create 100 in + iter (fun n _ -> SH.add funs2node (Node.find_fundec n).svar.vname n) (Lazy.force table); + iterGlobals file (function + | GFun (fd,loc) -> SH.add file2funs loc.file fd.svar.vname + | _ -> () + ); + let p_node f n = BatPrintf.fprintf f "%s" (Node.show_id n) in + let p_nodes f xs = + List.iter (BatPrintf.fprintf f "\n" p_node) xs + in + let p_funs f xs = + let one_fun n = + BatPrintf.fprintf f "\n%a\n" n p_nodes (SH.find_all funs2node n) + in + List.iter one_fun xs + in + let write_file f fn = + Messages.xml_file_name := fn; + Logs.info "Writing xml to temp. file: %s" fn; + BatPrintf.fprintf f ""; + BatPrintf.fprintf f "%s" GobSys.command_line; + BatPrintf.fprintf f ""; + let timing_ppf = BatFormat.formatter_of_out_channel f in + Timing.Default.print timing_ppf; + Format.pp_print_flush timing_ppf (); + BatPrintf.fprintf f ""; + BatPrintf.fprintf f "\n"; + BatEnum.iter (fun b -> BatPrintf.fprintf f "\n%a\n" (Filename.basename b) b p_funs (SH.find_all file2funs b)) (BatEnum.uniq @@ SH.keys file2funs); (* nosemgrep: batenum-module *) + BatPrintf.fprintf f "%a" printXml (Lazy.force table); + gtfxml f gtable; + printXmlWarning f (); + BatPrintf.fprintf f "\n"; + BatPrintf.fprintf f "%!" + in + if get_string "result" = "g2html" then ( + BatFile.with_temporary_out ~mode:[`create;`text;`delete_on_exit] write_file; + CfgTools.dead_code_cfg ~path:(Fpath.v "cfgs") (module FileCfg) live; + do_html_output () + ) + else + let f = BatIO.output_channel out in + write_file f (get_string "outfile") +end + +module Make2 (Result: Result) = +struct + open Result + open Make (Result) + + module SH = GobHashtbl.Make (Basetype.RawStrings) + module FundecSet = BatSet.Make (CilType.Fundec) + module IH = BatHashtbl.Make (struct type t = int [@@deriving hash, eq] end) + + let write_index ~result_dir ~file2funs = + let printXml_fun f fd = BatPrintf.fprintf f {xml||xml} fd.svar.vname in + let printXml_file f file funs = + BatPrintf.fprintf f {xml| +%a +|xml} + file (FundecSet.print ~first:"" ~sep:"\n" ~last:"\n" printXml_fun) funs + in + + let index_file = Fpath.(result_dir / "index.xml") in + BatFile.with_file_out (Fpath.to_string index_file) (fun f -> + BatPrintf.fprintf f {xml| + +|xml}; + (* TODO: exclude dead files/functions? *) + (* g2html has full path in name field *) + (* for g2html we have path field for , but this doesn't seem necessary *) + (* for g2html we add s into each , but these aren't necessary because they aren't shown *) + SH.iter (printXml_file f) file2funs; + BatPrintf.fprintf f ""; + ) + + let write_globals ~result_dir ~gtfxml ~gtable = + let nodes_dir = Fpath.(result_dir / "nodes") in + GobSys.mkdir_or_exists nodes_dir; + let globals_file = Fpath.(nodes_dir / "globals.xml") in + BatFile.with_file_out (Fpath.to_string globals_file) (fun f -> + BatPrintf.fprintf f {xml| + +%a|xml} gtfxml gtable + ) + + let write_node ~nodes_dir n v = + let node_file = Fpath.(nodes_dir / Node.show_id n + "xml") in + BatFile.with_file_out (Fpath.to_string node_file) (fun f -> + BatPrintf.fprintf f {xml| + +%a|xml} (Fun.flip printXml_node n) v + (* g2html adds fun attribute to (inside printXml_node), but this doesn't seem to be necessary *) + ) + + let write_nodes ~result_dir ~table = + let nodes_dir = Fpath.(result_dir / "nodes") in + GobSys.mkdir_or_exists nodes_dir; + let file2line2nodes: Node.t IH.t SH.t = SH.create 10 in + iter (fun n v -> + write_node ~nodes_dir n v; + let loc = UpdateCil.getLoc n in (* from printXml_node *) + let line2nodes = SH.find_or_add_default_delayed file2line2nodes loc.file ~default:(fun () -> IH.create 100) in + IH.add line2nodes loc.line n + ) (Lazy.force table); + file2line2nodes + + let write_warn ~warn_dir i w = + let warn_file = Fpath.(warn_dir / Printf.sprintf "warn%d.xml" i) in + BatFile.with_file_out (Fpath.to_string warn_file) (fun f -> + BatPrintf.fprintf f {xml| +%a|xml} printXml_warn w + ) + + let write_warns ~result_dir = + let warn_dir = Fpath.(result_dir / "warn") in + GobSys.mkdir_or_exists warn_dir; + let file2line2warns: int IH.t SH.t = SH.create 10 in + List.iteri (fun i w -> + write_warn ~warn_dir (i + 1) w; + let locs = + match w.multipiece with + | Single piece -> [piece.loc] + | Group {pieces; _} -> List.map (fun p -> p.Messages.Piece.loc) pieces (* TODO: add group_loc, old doesn't *) + in + List.iter (fun (loc: Messages.Location.t) -> + let loc = Messages.Location.to_cil loc in + let line2warns = SH.find_or_add_default_delayed file2line2warns loc.file ~default:(fun () -> IH.create 100) in + IH.add line2warns loc.line (i + 1) + ) (List.filter_map Fun.id locs) + ) !Messages.Table.messages_list; + file2line2warns + + let empty_line2nodes = IH.create 0 + let empty_line2warns = IH.create 0 + + let xmlify_file_name = Str.global_substitute (Str.regexp Filename.dir_sep) (fun _ -> "%2F") + + let write_file ~files_dir ~file2line2nodes ~file2line2warns ~live ~code_highlighter file = + let line2nodes = SH.find_default file2line2nodes file empty_line2nodes in + let line2warns = SH.find_default file2line2warns file empty_line2warns in + + let printXml_node f node = BatPrintf.fprintf f ""%s"" (Node.show_id node) in + let printXml_warn f w = BatPrintf.fprintf f ""warn%d"" w in + let printXml_line f line text = + let nodes = IH.find_all line2nodes (line + 1) |> BatList.unique ~eq:Node.equal in + let warns = IH.find_all line2warns (line + 1) |> BatList.unique in + let dead = nodes <> [] && not (List.exists live nodes) in + BatPrintf.fprintf f {xml|%s +|xml} + (line + 1) + (BatList.print ~first:"[" ~sep:"," ~last:"]" printXml_node) nodes + (BatList.print ~first:"[" ~sep:"," ~last:"]" printXml_warn) warns + dead text + in + + let file_file = Fpath.(files_dir / xmlify_file_name file + "xml") in + BatFile.with_file_out (Fpath.to_string file_file) (fun f -> + BatPrintf.fprintf f {xml| + + +|xml}; + Timing.wrap "highlighter" (fun () -> + let lines = code_highlighter (Fpath.v file) in + BatEnum.iteri (printXml_line f) lines (* nosemgrep: batenum-module *) + ) (); + BatPrintf.fprintf f ""; + ) + + let write_files ~result_dir ~file2funs ~file2line2nodes ~file2line2warns ~live = + let files_dir = Fpath.(result_dir / "files") in + GobSys.mkdir_or_exists files_dir; + let style_css_file = Fpath.(result_dir / "pyg.css") in + let code_highlighter = CodeHighlighter.make ~style_css_file in + Seq.iter (write_file ~files_dir ~file2line2nodes ~file2line2warns ~live ~code_highlighter) (SH.to_seq_keys file2funs) + + let write_dot ~dot_dir (module FileCfg: MyCFG.FileCfg) ~live fd file = + let dot_file_dir = GobSys.mkdir_or_exists_absolute Fpath.(dot_dir / xmlify_file_name file) in + let dot_file = Fpath.(dot_file_dir / fd.svar.vname + "dot") in + BatFile.with_file_out (Fpath.to_string dot_file) (fun f -> + let ppf = BatFormat.formatter_of_output f in + CfgTools.fprint_fundec_html_dot (module FileCfg.Cfg) live fd ppf; + Format.pp_print_flush ppf (); + ); + dot_file + + let cfg_task ~cfgs_dir ~dot_file fd file: ProcessPool.task = + let cfgs_file_dir = GobSys.mkdir_or_exists_absolute Fpath.(cfgs_dir / xmlify_file_name file) in + let svg_file = Fpath.(cfgs_file_dir / fd.svar.vname + "svg") in + { + command = Filename.quote_command "dot" [Fpath.to_string dot_file; "-Tsvg"; "-o"; Fpath.to_string svg_file]; + cwd = None; + } + + let write_dots_cfgs ~result_dir (module FileCfg: MyCFG.FileCfg) ~live ~file2funs = + let dot_dir = GobSys.mkdir_or_exists_absolute Fpath.(result_dir / "dot") in + let cfgs_dir = GobSys.mkdir_or_exists_absolute Fpath.(result_dir / "cfgs") in + let tasks = SH.fold (fun file funs acc -> + FundecSet.fold (fun fd acc -> + let dot_file = write_dot ~dot_dir (module FileCfg) ~live fd file in + cfg_task ~cfgs_dir ~dot_file fd file :: acc + ) funs acc + ) file2funs [] + in + Timing.wrap "graphviz" (ProcessPool.run ~jobs:(GobConfig.jobs ())) tasks + + let copy_resources ~result_dir = + let xslt_dirs = Fpath.(parent (v Sys.executable_name) / "xslt") :: Goblint_sites.xslt in + let xslt_dir = List.find_opt (fun dir -> + let dir_str = Fpath.to_string dir in + Sys.file_exists dir_str && Sys.is_directory dir_str + ) xslt_dirs + in + match xslt_dir with + | Some xslt_dir -> + Sys.readdir (Fpath.to_string xslt_dir) + |> Array.to_seq + |> Seq.filter ((<>) "dune") + |> Seq.map (Fpath.add_seg xslt_dir) + |> Seq.map Fpath.to_string + |> List.of_seq + |> Fun.flip FileUtil.cp (Fpath.to_string result_dir) + | None -> + failwith "xslt/ not found" + + let output table live gtable gtfxml (module FileCfg: MyCFG.FileCfg) = + let result_dir = Fpath.(v "result") in + GobSys.rmdir_recursive_if_exists result_dir; + GobSys.mkdir_or_exists result_dir; + let file = FileCfg.file in + let file2funs = SH.create 100 in + iterGlobals file (function + | GFun (fd, loc) -> SH.modify_def FundecSet.empty loc.file (FundecSet.add fd) file2funs + | _ -> () + ); + write_index ~result_dir ~file2funs; + write_globals ~result_dir ~gtfxml ~gtable; + let file2line2nodes = write_nodes ~result_dir ~table in + let file2line2warns = write_warns ~result_dir in + write_files ~result_dir ~file2funs ~file2line2nodes ~file2line2warns ~live; + write_dots_cfgs ~result_dir (module FileCfg) ~live ~file2funs; + copy_resources ~result_dir +end \ No newline at end of file diff --git a/src/goblint.ml b/src/goblint.ml index 2a0ab3ce0f..0eb9a315bd 100644 --- a/src/goblint.ml +++ b/src/goblint.ml @@ -61,7 +61,6 @@ let main () = if get_string "ana.specification" <> "" then AutoSoundConfig.enableAnalysesForSpecification (); if get_bool "ana.autotune.enabled" then AutoTune.chooseConfig file; file |> do_analyze changeInfo; - do_html_output (); do_gobview file; do_stats (); Goblint_timing.teardown_tef (); diff --git a/src/goblint_lib.ml b/src/goblint_lib.ml index 60dd07f68d..50f8fe9c33 100644 --- a/src/goblint_lib.ml +++ b/src/goblint_lib.ml @@ -337,6 +337,11 @@ module CompilationDatabase = CompilationDatabase module MakefileUtil = MakefileUtil module TerminationPreprocessing = TerminationPreprocessing +(** {2 Results} *) + +module AnalysisResultOutput = AnalysisResultOutput +module XsltResultOutput = XsltResultOutput + (** {2 Witnesses} Witnesses are an exchangeable format for analysis results. *) @@ -412,6 +417,7 @@ module Timeout = Timeout module TimeUtil = TimeUtil module MessageUtil = MessageUtil module AnsiColors = AnsiColors +module CodeHighlighter = CodeHighlighter module XmlUtil = XmlUtil module GobExn = GobExn diff --git a/src/maingoblint.ml b/src/maingoblint.ml index 861f51ad5a..5152a22435 100644 --- a/src/maingoblint.ml +++ b/src/maingoblint.ml @@ -59,13 +59,7 @@ let rec option_spec_list: Arg_complete.speclist Lazy.t = lazy ( else (Logs.error "Goblint has been compiled without tracing, recompile in trace profile (./scripts/trace_on.sh)"; raise Stdlib.Exit) in let configure_html () = - if (get_string "outfile" = "") then - set_string "outfile" "result"; - if get_string "exp.g2html_path" = "" then - set_string "exp.g2html_path" (Fpath.to_string GobSys.exe_dir); - set_bool "exp.cfgdot" true; - set_bool "g2html" true; - set_string "result" "fast_xml" + set_string "result" "xslt" in let configure_sarif () = if (get_string "outfile" = "") then @@ -528,7 +522,7 @@ let reset_stats () = (** Perform the analysis over the merged AST. *) let do_analyze change_info merged_AST = (* direct the output to file if requested *) - if not (get_bool "g2html" || get_string "outfile" = "") then ( + if get_string "outfile" <> "" then ( if !Messages.out <> Legacy.stdout then Legacy.close_out !Messages.out; Messages.out := Legacy.open_out (get_string "outfile")); @@ -570,27 +564,6 @@ let do_analyze change_info merged_AST = Timing.wrap "analysis" (control_analyze merged_AST) funs ) -let do_html_output () = - if get_bool "g2html" then ( - let jar = Fpath.(v (get_string "exp.g2html_path") / "g2html.jar") in - if Sys.file_exists (Fpath.to_string jar) then ( - let command = Filename.quote_command "java" [ - "-jar"; Fpath.to_string jar; - "--num-threads"; string_of_int (jobs ()); - "--dot-timeout"; "0"; - "--result-dir"; get_string "outfile"; - !Messages.xml_file_name - ] - in - match Timing.wrap "g2html" Unix.system command with - | Unix.WEXITED 0 -> () - | _ -> Logs.error "HTML generation failed! Command: %s" command - | exception Unix.Unix_error (e, f, a) -> - Logs.error "%s at syscall %s with argument \"%s\"." (Unix.error_message e) f a - ) else - Logs.Format.error "Warning: jar file %a not found." Fpath.pp jar - ) - let do_gobview cilfile = let gobview = GobConfig.get_bool "gobview" in if gobview then ( diff --git a/src/sites/goblint_sites.ml b/src/sites/goblint_sites.ml index 15bac1ae13..07c01e58df 100644 --- a/src/sites/goblint_sites.ml +++ b/src/sites/goblint_sites.ml @@ -5,3 +5,4 @@ let lib_stub_src = List.map (fun p -> Fpath.(p / "stub" / "src")) lib let lib_runtime_include = List.map (fun p -> Fpath.(p / "runtime" / "include")) lib let lib_runtime_src = List.map (fun p -> Fpath.(p / "runtime" / "src")) lib let conf = List.map Fpath.v Dunesite.Sites.conf +let xslt = List.map Fpath.v Dunesite.Sites.xslt diff --git a/src/sites/goblint_sites.mli b/src/sites/goblint_sites.mli index f02445f8b5..abd5bcd356 100644 --- a/src/sites/goblint_sites.mli +++ b/src/sites/goblint_sites.mli @@ -4,3 +4,4 @@ val lib_stub_src: Fpath.t list val lib_runtime_include: Fpath.t list val lib_runtime_src: Fpath.t list val conf: Fpath.t list +val xslt: Fpath.t list diff --git a/src/util/codeHighlighter.ml b/src/util/codeHighlighter.ml new file mode 100644 index 0000000000..ca3298755d --- /dev/null +++ b/src/util/codeHighlighter.ml @@ -0,0 +1,26 @@ +type t = Fpath.t -> string BatEnum.t + +let none: t = fun file -> + BatFile.lines_of (Fpath.to_string file) + |> BatEnum.map XmlUtil.escape (* nosemgrep: batenum-module *) + +let pygments_command = "pygmentize" +let pygments_style = "default" +let pygments_arguments = ["-f"; "html"; "-O"; "nowrap,classprefix=pyg-"] + +let make_pygments ~(style_css_file): t option = + let command = Filename.quote_command pygments_command ("-S" :: pygments_style :: pygments_arguments) ~stdout:(Fpath.to_string style_css_file) in + match Sys.command command with + | 0 -> + let pygments file = + let command = Filename.quote_command pygments_command (Fpath.to_string file :: pygments_arguments) in + let ic = Unix.open_process_in command in + let ic' = BatIO.input_channel ic in + BatIO.lines_of ic' + in + Some pygments + | _ -> + None + +let make ~(style_css_file): t = + Option.value (make_pygments ~style_css_file) ~default:none diff --git a/src/util/codeHighlighter.mli b/src/util/codeHighlighter.mli new file mode 100644 index 0000000000..90940c91fe --- /dev/null +++ b/src/util/codeHighlighter.mli @@ -0,0 +1,7 @@ +(** C code highlighting. *) + +type t = Fpath.t -> string BatEnum.t + +val none: t +val make_pygments: style_css_file:Fpath.t -> t option +val make: style_css_file:Fpath.t -> t diff --git a/src/util/std/gobHashtbl.ml b/src/util/std/gobHashtbl.ml index c93244eb47..4214abc3c9 100644 --- a/src/util/std/gobHashtbl.ml +++ b/src/util/std/gobHashtbl.ml @@ -3,3 +3,17 @@ module Pretty = GoblintCil.Pretty let pretty_statistics () (s: Hashtbl.statistics) = let load_factor = float_of_int s.num_bindings /. float_of_int s.num_buckets in Pretty.dprintf "bindings=%d buckets=%d max_length=%d histo=%a load=%f" s.num_bindings s.num_buckets s.max_bucket_length (Pretty.docList (Pretty.dprintf "%d")) (Array.to_list s.bucket_histogram) load_factor + + +module Make (H: Hashtbl.HashedType) = +struct + include BatHashtbl.Make (H) + + let find_or_add_default_delayed ~default ht key = + match find_option ht key with + | Some value -> value + | None -> + let value = default () in + replace ht key value; + value +end diff --git a/src/util/std/gobSys.ml b/src/util/std/gobSys.ml index a2c69419c4..7e92ed54c9 100644 --- a/src/util/std/gobSys.ml +++ b/src/util/std/gobSys.ml @@ -25,7 +25,8 @@ let rmdir_if_empty dirname = with Unix.Unix_error (Unix.ENOTEMPTY, _, _) -> () -(** Remove directory and its content, as "rm -rf" would do. *) +(** Remove directory and its content, as "rm -rf" would do. + @raise Sys_error if [path] doesn't exist. *) let rmdir_recursive path = let rec f path = let path_str = Fpath.to_string path in @@ -38,6 +39,12 @@ let rmdir_recursive path = in f path +let rmdir_recursive_if_exists path = + try + rmdir_recursive path + with Sys_error _ -> + () + let exe_dir = Fpath.(parent (v Sys.executable_name)) diff --git a/xslt/AlegreyaSans400.woff b/xslt/AlegreyaSans400.woff new file mode 100644 index 0000000000..821b66006e Binary files /dev/null and b/xslt/AlegreyaSans400.woff differ diff --git a/xslt/AlegreyaSans500.woff b/xslt/AlegreyaSans500.woff new file mode 100644 index 0000000000..431e1503a8 Binary files /dev/null and b/xslt/AlegreyaSans500.woff differ diff --git a/xslt/UbuntuMonoBold.woff b/xslt/UbuntuMonoBold.woff new file mode 100644 index 0000000000..cf726303d0 Binary files /dev/null and b/xslt/UbuntuMonoBold.woff differ diff --git a/xslt/UbuntuMonoRegular.woff b/xslt/UbuntuMonoRegular.woff new file mode 100644 index 0000000000..bcb2790f75 Binary files /dev/null and b/xslt/UbuntuMonoRegular.woff differ diff --git a/xslt/dune b/xslt/dune new file mode 100644 index 0000000000..0636c816d3 --- /dev/null +++ b/xslt/dune @@ -0,0 +1,9 @@ +(install + (section (site (goblint xslt))) + (files + (glob_files *.xsl) + (glob_files *.html) + (glob_files *.js) + (glob_files *.css) + (glob_files *.svg) + (glob_files *.woff))) diff --git a/xslt/file.xsl b/xslt/file.xsl new file mode 100644 index 0000000000..e6768f6507 --- /dev/null +++ b/xslt/file.xsl @@ -0,0 +1,77 @@ + + + + + + + sh + + + + + + + +
+ + + + + + select_line(,,) + + + + ln + + + + sl-nr dead + + + sl-nr + + + sl-nr live + + + + + + + + sl-nowarn + + + sl-warn + + + + + + +
+
+
+ + + + + + + + + + + + + + Analysis Result + + + +
+ +
+
+
+
+ + + diff --git a/xslt/globals.xsl b/xslt/globals.xsl new file mode 100644 index 0000000000..7fedbd0a16 --- /dev/null +++ b/xslt/globals.xsl @@ -0,0 +1,144 @@ + + + + + + + + map: + + + + +
+ + → + + + + +
+
+ +
+ + → + + + + +
+
+
+
+ +
+ + ∅ + +
+
+ + + + + + set: + +
+ +
+
+
+ + ∅ + +
+
+ + + + +
+ + + → +
+ +
+
+
+ +
+ + + → + + + +
+
+
+
+ + + + + + +
+ + + → + + + + + + + +
+ + + → + + + +
+
+ +
+ + + → + + + +
+
+
+ + +
+
+
+
+
+ + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/xslt/iframeResizer.contentWindow.min.js b/xslt/iframeResizer.contentWindow.min.js new file mode 100755 index 0000000000..9330e0fa21 --- /dev/null +++ b/xslt/iframeResizer.contentWindow.min.js @@ -0,0 +1,10 @@ +/*! iFrame Resizer (iframeSizer.contentWindow.min.js) - v3.5.3 - 2016-02-23 + * Desc: Include this file in any page being loaded into an iframe + * to force the iframe to resize to the content size. + * Requires: iframeResizer.min.js on host page. + * Copyright: (c) 2016 David J. Bradshaw - dave@bradshaw.net + * License: MIT + */ + +!function(a){"use strict";function b(b,c,d){"addEventListener"in a?b.addEventListener(c,d,!1):"attachEvent"in a&&b.attachEvent("on"+c,d)}function c(b,c,d){"removeEventListener"in a?b.removeEventListener(c,d,!1):"detachEvent"in a&&b.detachEvent("on"+c,d)}function d(a){return a.charAt(0).toUpperCase()+a.slice(1)}function e(a){var b,c,d,e=null,f=0,g=function(){f=Fa(),e=null,d=a.apply(b,c),e||(b=c=null)};return function(){var h=Fa();f||(f=h);var i=xa-(h-f);return b=this,c=arguments,0>=i||i>xa?(e&&(clearTimeout(e),e=null),f=h,d=a.apply(b,c),e||(b=c=null)):e||(e=setTimeout(g,i)),d}}function f(a){return ma+"["+oa+"] "+a}function g(b){la&&"object"==typeof a.console&&console.log(f(b))}function h(b){"object"==typeof a.console&&console.warn(f(b))}function i(){j(),g("Initialising iFrame ("+location.href+")"),k(),n(),m("background",W),m("padding",$),A(),s(),t(),o(),C(),u(),ia=B(),N("init","Init message from host page"),Da()}function j(){function a(a){return"true"===a?!0:!1}var b=ha.substr(na).split(":");oa=b[0],X=void 0!==b[1]?Number(b[1]):X,_=void 0!==b[2]?a(b[2]):_,la=void 0!==b[3]?a(b[3]):la,ja=void 0!==b[4]?Number(b[4]):ja,U=void 0!==b[6]?a(b[6]):U,Y=b[7],fa=void 0!==b[8]?b[8]:fa,W=b[9],$=b[10],ua=void 0!==b[11]?Number(b[11]):ua,ia.enable=void 0!==b[12]?a(b[12]):!1,qa=void 0!==b[13]?b[13]:qa,Aa=void 0!==b[14]?b[14]:Aa}function k(){function b(){var b=a.iFrameResizer;g("Reading data from page: "+JSON.stringify(b)),Ca="messageCallback"in b?b.messageCallback:Ca,Da="readyCallback"in b?b.readyCallback:Da,ta="targetOrigin"in b?b.targetOrigin:ta,fa="heightCalculationMethod"in b?b.heightCalculationMethod:fa,Aa="widthCalculationMethod"in b?b.widthCalculationMethod:Aa}"iFrameResizer"in a&&Object===a.iFrameResizer.constructor&&b(),g("TargetOrigin for parent set to: "+ta)}function l(a,b){return-1!==b.indexOf("-")&&(h("Negative CSS value ignored for "+a),b=""),b}function m(a,b){void 0!==b&&""!==b&&"null"!==b&&(document.body.style[a]=b,g("Body "+a+' set to "'+b+'"'))}function n(){void 0===Y&&(Y=X+"px"),m("margin",l("margin",Y))}function o(){document.documentElement.style.height="",document.body.style.height="",g('HTML & body height set to "auto"')}function p(e){function f(){N(e.eventName,e.eventType)}var h={add:function(c){b(a,c,f)},remove:function(b){c(a,b,f)}};e.eventNames&&Array.prototype.map?(e.eventName=e.eventNames[0],e.eventNames.map(h[e.method])):h[e.method](e.eventName),g(d(e.method)+" event listener: "+e.eventType)}function q(a){p({method:a,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]}),p({method:a,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]}),p({method:a,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]}),p({method:a,eventType:"Input",eventName:"input"}),p({method:a,eventType:"Mouse Up",eventName:"mouseup"}),p({method:a,eventType:"Mouse Down",eventName:"mousedown"}),p({method:a,eventType:"Orientation Change",eventName:"orientationchange"}),p({method:a,eventType:"Print",eventName:["afterprint","beforeprint"]}),p({method:a,eventType:"Ready State Change",eventName:"readystatechange"}),p({method:a,eventType:"Touch Start",eventName:"touchstart"}),p({method:a,eventType:"Touch End",eventName:"touchend"}),p({method:a,eventType:"Touch Cancel",eventName:"touchcancel"}),p({method:a,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]}),p({method:a,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]}),p({method:a,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]}),"child"===qa&&p({method:a,eventType:"IFrame Resized",eventName:"resize"})}function r(a,b,c,d){return b!==a&&(a in c||(h(a+" is not a valid option for "+d+"CalculationMethod."),a=b),g(d+' calculation method set to "'+a+'"')),a}function s(){fa=r(fa,ea,Ga,"height")}function t(){Aa=r(Aa,za,Ha,"width")}function u(){!0===U?(q("add"),F()):g("Auto Resize disabled")}function v(){g("Disable outgoing messages"),ra=!1}function w(){g("Remove event listener: Message"),c(a,"message",S)}function x(){null!==Z&&Z.disconnect()}function y(){q("remove"),x(),clearInterval(ka)}function z(){v(),w(),!0===U&&y()}function A(){var a=document.createElement("div");a.style.clear="both",a.style.display="block",document.body.appendChild(a)}function B(){function c(){return{x:void 0!==a.pageXOffset?a.pageXOffset:document.documentElement.scrollLeft,y:void 0!==a.pageYOffset?a.pageYOffset:document.documentElement.scrollTop}}function d(a){var b=a.getBoundingClientRect(),d=c();return{x:parseInt(b.left,10)+parseInt(d.x,10),y:parseInt(b.top,10)+parseInt(d.y,10)}}function e(a){function b(a){var b=d(a);g("Moving to in page link (#"+c+") at x: "+b.x+" y: "+b.y),R(b.y,b.x,"scrollToOffset")}var c=a.split("#")[1]||a,e=decodeURIComponent(c),f=document.getElementById(e)||document.getElementsByName(e)[0];void 0!==f?b(f):(g("In page link (#"+c+") not found in iFrame, so sending to parent"),R(0,0,"inPageLink","#"+c))}function f(){""!==location.hash&&"#"!==location.hash&&e(location.href)}function i(){function a(a){function c(a){a.preventDefault(),e(this.getAttribute("href"))}"#"!==a.getAttribute("href")&&b(a,"click",c)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),a)}function j(){b(a,"hashchange",f)}function k(){setTimeout(f,ba)}function l(){Array.prototype.forEach&&document.querySelectorAll?(g("Setting up location.hash handlers"),i(),j(),k()):h("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}return ia.enable?l():g("In page linking not enabled"),{findTarget:e}}function C(){g("Enable public methods"),Ba.parentIFrame={autoResize:function(a){return!0===a&&!1===U?(U=!0,u()):!1===a&&!0===U&&(U=!1,y()),U},close:function(){R(0,0,"close"),z()},getId:function(){return oa},getPageInfo:function(a){"function"==typeof a?(Ea=a,R(0,0,"pageInfo")):(Ea=function(){},R(0,0,"pageInfoStop"))},moveToAnchor:function(a){ia.findTarget(a)},reset:function(){Q("parentIFrame.reset")},scrollTo:function(a,b){R(b,a,"scrollTo")},scrollToOffset:function(a,b){R(b,a,"scrollToOffset")},sendMessage:function(a,b){R(0,0,"message",JSON.stringify(a),b)},setHeightCalculationMethod:function(a){fa=a,s()},setWidthCalculationMethod:function(a){Aa=a,t()},setTargetOrigin:function(a){g("Set targetOrigin: "+a),ta=a},size:function(a,b){var c=""+(a?a:"")+(b?","+b:"");N("size","parentIFrame.size("+c+")",a,b)}}}function D(){0!==ja&&(g("setInterval: "+ja+"ms"),ka=setInterval(function(){N("interval","setInterval: "+ja)},Math.abs(ja)))}function E(){function b(a){function b(a){!1===a.complete&&(g("Attach listeners to "+a.src),a.addEventListener("load",f,!1),a.addEventListener("error",h,!1),k.push(a))}"attributes"===a.type&&"src"===a.attributeName?b(a.target):"childList"===a.type&&Array.prototype.forEach.call(a.target.querySelectorAll("img"),b)}function c(a){k.splice(k.indexOf(a),1)}function d(a){g("Remove listeners from "+a.src),a.removeEventListener("load",f,!1),a.removeEventListener("error",h,!1),c(a)}function e(a,b,c){d(a.target),N(b,c+": "+a.target.src,void 0,void 0)}function f(a){e(a,"imageLoad","Image loaded")}function h(a){e(a,"imageLoadFailed","Image load failed")}function i(a){N("mutationObserver","mutationObserver: "+a[0].target+" "+a[0].type),a.forEach(b)}function j(){var a=document.querySelector("body"),b={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};return m=new l(i),g("Create body MutationObserver"),m.observe(a,b),m}var k=[],l=a.MutationObserver||a.WebKitMutationObserver,m=j();return{disconnect:function(){"disconnect"in m&&(g("Disconnect body MutationObserver"),m.disconnect(),k.forEach(d))}}}function F(){var b=0>ja;a.MutationObserver||a.WebKitMutationObserver?b?D():Z=E():(g("MutationObserver not supported in this browser!"),D())}function G(a,b){function c(a){var c=/^\d+(px)?$/i;if(c.test(a))return parseInt(a,V);var d=b.style.left,e=b.runtimeStyle.left;return b.runtimeStyle.left=b.currentStyle.left,b.style.left=a||0,a=b.style.pixelLeft,b.style.left=d,b.runtimeStyle.left=e,a}var d=0;return b=b||document.body,"defaultView"in document&&"getComputedStyle"in document.defaultView?(d=document.defaultView.getComputedStyle(b,null),d=null!==d?d[a]:0):d=c(b.currentStyle[a]),parseInt(d,V)}function H(a){a>xa/2&&(xa=2*a,g("Event throttle increased to "+xa+"ms"))}function I(a,b){for(var c=b.length,e=0,f=0,h=d(a),i=Fa(),j=0;c>j;j++)e=b[j].getBoundingClientRect()[a]+G("margin"+h,b[j]),e>f&&(f=e);return i=Fa()-i,g("Parsed "+c+" HTML elements"),g("Element position calculated in "+i+"ms"),H(i),f}function J(a){return[a.bodyOffset(),a.bodyScroll(),a.documentElementOffset(),a.documentElementScroll()]}function K(a,b){function c(){return h("No tagged elements ("+b+") found on page"),da}var d=document.querySelectorAll("["+b+"]");return 0===d.length?c():I(a,d)}function L(){return document.querySelectorAll("body *")}function M(a,b,c,d){function e(){da=l,ya=m,R(da,ya,a)}function f(){function a(a,b){var c=Math.abs(a-b)<=ua;return!c}return l=void 0!==c?c:Ga[fa](),m=void 0!==d?d:Ha[Aa](),a(da,l)||_&&a(ya,m)}function h(){return!(a in{init:1,interval:1,size:1})}function i(){return fa in pa||_&&Aa in pa}function j(){g("No change in size detected")}function k(){h()&&i()?Q(b):a in{interval:1}||j()}var l,m;f()||"init"===a?(O(),e()):k()}function N(a,b,c,d){function e(){a in{reset:1,resetPage:1,init:1}||g("Trigger event: "+b)}function f(){return va&&a in aa}f()?g("Trigger event cancelled: "+a):(e(),Ia(a,b,c,d))}function O(){va||(va=!0,g("Trigger event lock on")),clearTimeout(wa),wa=setTimeout(function(){va=!1,g("Trigger event lock off"),g("--")},ba)}function P(a){da=Ga[fa](),ya=Ha[Aa](),R(da,ya,a)}function Q(a){var b=fa;fa=ea,g("Reset trigger event: "+a),O(),P("reset"),fa=b}function R(a,b,c,d,e){function f(){void 0===e?e=ta:g("Message targetOrigin: "+e)}function h(){var f=a+":"+b,h=oa+":"+f+":"+c+(void 0!==d?":"+d:"");g("Sending message to host page ("+h+")"),sa.postMessage(ma+h,e)}!0===ra&&(f(),h())}function S(b){function c(){return ma===(""+b.data).substr(0,na)}function d(){ha=b.data,sa=b.source,i(),ca=!1,setTimeout(function(){ga=!1},ba)}function e(){ga?g("Page reset ignored by init"):(g("Page size reset by host page"),P("resetPage"))}function f(){N("resizeParent","Parent window requested size check")}function j(){var a=l();ia.findTarget(a)}function k(){return b.data.split("]")[1].split(":")[0]}function l(){return b.data.substr(b.data.indexOf(":")+1)}function m(){return"iFrameResize"in a}function n(){var a=l();g("MessageCallback called from parent: "+a),Ca(JSON.parse(a)),g(" --")}function o(){var a=l();g("PageInfoFromParent called from parent: "+a),Ea(JSON.parse(a)),g(" --")}function p(){return b.data.split(":")[2]in{"true":1,"false":1}}function q(){switch(k()){case"reset":e();break;case"resize":f();break;case"moveToAnchor":j();break;case"message":n();break;case"pageInfo":o();break;default:m()||p()||h("Unexpected message ("+b.data+")")}}function r(){!1===ca?q():p()?d():g('Ignored message of type "'+k()+'". Received before initialization.')}c()&&r()}function T(){"loading"!==document.readyState&&a.parent.postMessage("[iFrameResizerChild]Ready","*")}var U=!0,V=10,W="",X=0,Y="",Z=null,$="",_=!1,aa={resize:1,click:1},ba=128,ca=!0,da=1,ea="bodyOffset",fa=ea,ga=!0,ha="",ia={},ja=32,ka=null,la=!1,ma="[iFrameSizer]",na=ma.length,oa="",pa={max:1,min:1,bodyScroll:1,documentElementScroll:1},qa="child",ra=!0,sa=a.parent,ta="*",ua=0,va=!1,wa=null,xa=16,ya=1,za="scroll",Aa=za,Ba=a,Ca=function(){h("MessageCallback function not defined")},Da=function(){},Ea=function(){},Fa=Date.now||function(){return(new Date).getTime()},Ga={bodyOffset:function(){return document.body.offsetHeight+G("marginTop")+G("marginBottom")},offset:function(){return Ga.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,J(Ga))},min:function(){return Math.min.apply(null,J(Ga))},grow:function(){return Ga.max()},lowestElement:function(){return Math.max(Ga.bodyOffset(),I("bottom",L()))},taggedElement:function(){return K("bottom","data-iframe-height")}},Ha={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(Ha.bodyScroll(),Ha.documentElementScroll())},max:function(){return Math.max.apply(null,J(Ha))},min:function(){return Math.min.apply(null,J(Ha))},rightMostElement:function(){return I("right",L())},taggedElement:function(){return K("right","data-iframe-width")}},Ia=e(M);b(a,"message",S),T()}(window||{}); +//# sourceMappingURL=iframeResizer.contentWindow.map \ No newline at end of file diff --git a/xslt/jquery-2.1.0.min.js b/xslt/jquery-2.1.0.min.js new file mode 100644 index 0000000000..2adda35a5b --- /dev/null +++ b/xslt/jquery-2.1.0.min.js @@ -0,0 +1,4 @@ +/*! jQuery v2.1.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k="".trim,l={},m=a.document,n="2.1.0",o=function(a,b){return new o.fn.init(a,b)},p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};o.fn=o.prototype={jquery:n,constructor:o,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=o.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return o.each(this,a,b)},map:function(a){return this.pushStack(o.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},o.extend=o.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||o.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(o.isPlainObject(d)||(e=o.isArray(d)))?(e?(e=!1,f=c&&o.isArray(c)?c:[]):f=c&&o.isPlainObject(c)?c:{},g[b]=o.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},o.extend({expando:"jQuery"+(n+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===o.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return a-parseFloat(a)>=0},isPlainObject:function(a){if("object"!==o.type(a)||a.nodeType||o.isWindow(a))return!1;try{if(a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(b){return!1}return!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=o.trim(a),a&&(1===a.indexOf("use strict")?(b=m.createElement("script"),b.text=a,m.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":k.call(a)},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?o.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),o.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||o.guid++,f):void 0},now:Date.now,support:l}),o.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=o.type(a);return"function"===c||o.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s="sizzle"+-new Date,t=a.document,u=0,v=0,w=eb(),x=eb(),y=eb(),z=function(a,b){return a===b&&(j=!0),0},A="undefined",B=1<<31,C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=D.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",M=L.replace("w","w#"),N="\\["+K+"*("+L+")"+K+"*(?:([*^$|!~]?=)"+K+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+M+")|)|)"+K+"*\\]",O=":("+L+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+N.replace(3,8)+")*)|.*)\\)|)",P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(O),U=new RegExp("^"+M+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L.replace("w","w*")+")"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=/'|\\/g,ab=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),bb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{G.apply(D=H.call(t.childNodes),t.childNodes),D[t.childNodes.length].nodeType}catch(cb){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function db(a,b,d,e){var f,g,h,i,j,m,p,q,u,v;if((b?b.ownerDocument||b:t)!==l&&k(b),b=b||l,d=d||[],!a||"string"!=typeof a)return d;if(1!==(i=b.nodeType)&&9!==i)return[];if(n&&!e){if(f=Z.exec(a))if(h=f[1]){if(9===i){if(g=b.getElementById(h),!g||!g.parentNode)return d;if(g.id===h)return d.push(g),d}else if(b.ownerDocument&&(g=b.ownerDocument.getElementById(h))&&r(b,g)&&g.id===h)return d.push(g),d}else{if(f[2])return G.apply(d,b.getElementsByTagName(a)),d;if((h=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(h)),d}if(c.qsa&&(!o||!o.test(a))){if(q=p=s,u=b,v=9===i&&a,1===i&&"object"!==b.nodeName.toLowerCase()){m=ob(a),(p=b.getAttribute("id"))?q=p.replace(_,"\\$&"):b.setAttribute("id",q),q="[id='"+q+"'] ",j=m.length;while(j--)m[j]=q+pb(m[j]);u=$.test(a)&&mb(b.parentNode)||b,v=m.join(",")}if(v)try{return G.apply(d,u.querySelectorAll(v)),d}catch(w){}finally{p||b.removeAttribute("id")}}}return xb(a.replace(P,"$1"),b,d,e)}function eb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function fb(a){return a[s]=!0,a}function gb(a){var b=l.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function hb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function ib(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||B)-(~a.sourceIndex||B);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function jb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function kb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function lb(a){return fb(function(b){return b=+b,fb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function mb(a){return a&&typeof a.getElementsByTagName!==A&&a}c=db.support={},f=db.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},k=db.setDocument=function(a){var b,e=a?a.ownerDocument||a:t,g=e.defaultView;return e!==l&&9===e.nodeType&&e.documentElement?(l=e,m=e.documentElement,n=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){k()},!1):g.attachEvent&&g.attachEvent("onunload",function(){k()})),c.attributes=gb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=gb(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(e.getElementsByClassName)&&gb(function(a){return a.innerHTML="
",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=gb(function(a){return m.appendChild(a).id=s,!e.getElementsByName||!e.getElementsByName(s).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==A&&n){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){var c=typeof a.getAttributeNode!==A&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==A?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==A&&n?b.getElementsByClassName(a):void 0},p=[],o=[],(c.qsa=Y.test(e.querySelectorAll))&&(gb(function(a){a.innerHTML="",a.querySelectorAll("[t^='']").length&&o.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||o.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll(":checked").length||o.push(":checked")}),gb(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&o.push("name"+K+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||o.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),o.push(",.*:")})),(c.matchesSelector=Y.test(q=m.webkitMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector||m.msMatchesSelector))&&gb(function(a){c.disconnectedMatch=q.call(a,"div"),q.call(a,"[s!='']:x"),p.push("!=",O)}),o=o.length&&new RegExp(o.join("|")),p=p.length&&new RegExp(p.join("|")),b=Y.test(m.compareDocumentPosition),r=b||Y.test(m.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},z=b?function(a,b){if(a===b)return j=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===t&&r(t,a)?-1:b===e||b.ownerDocument===t&&r(t,b)?1:i?I.call(i,a)-I.call(i,b):0:4&d?-1:1)}:function(a,b){if(a===b)return j=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],k=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:i?I.call(i,a)-I.call(i,b):0;if(f===g)return ib(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)k.unshift(c);while(h[d]===k[d])d++;return d?ib(h[d],k[d]):h[d]===t?-1:k[d]===t?1:0},e):l},db.matches=function(a,b){return db(a,null,null,b)},db.matchesSelector=function(a,b){if((a.ownerDocument||a)!==l&&k(a),b=b.replace(S,"='$1']"),!(!c.matchesSelector||!n||p&&p.test(b)||o&&o.test(b)))try{var d=q.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return db(b,l,null,[a]).length>0},db.contains=function(a,b){return(a.ownerDocument||a)!==l&&k(a),r(a,b)},db.attr=function(a,b){(a.ownerDocument||a)!==l&&k(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!n):void 0;return void 0!==f?f:c.attributes||!n?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},db.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},db.uniqueSort=function(a){var b,d=[],e=0,f=0;if(j=!c.detectDuplicates,i=!c.sortStable&&a.slice(0),a.sort(z),j){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return i=null,a},e=db.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=db.selectors={cacheLength:50,createPseudo:fb,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ab,bb),a[3]=(a[4]||a[5]||"").replace(ab,bb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||db.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&db.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return V.CHILD.test(a[0])?null:(a[3]&&void 0!==a[4]?a[2]=a[4]:c&&T.test(c)&&(b=ob(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ab,bb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=w[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&w(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==A&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=db.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),t=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&t){k=q[s]||(q[s]={}),j=k[a]||[],n=j[0]===u&&j[1],m=j[0]===u&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[u,n,m];break}}else if(t&&(j=(b[s]||(b[s]={}))[a])&&j[0]===u)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(t&&((l[s]||(l[s]={}))[a]=[u,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||db.error("unsupported pseudo: "+a);return e[s]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?fb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:fb(function(a){var b=[],c=[],d=g(a.replace(P,"$1"));return d[s]?fb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:fb(function(a){return function(b){return db(a,b).length>0}}),contains:fb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:fb(function(a){return U.test(a||"")||db.error("unsupported lang: "+a),a=a.replace(ab,bb).toLowerCase(),function(b){var c;do if(c=n?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===m},focus:function(a){return a===l.activeElement&&(!l.hasFocus||l.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:lb(function(){return[0]}),last:lb(function(a,b){return[b-1]}),eq:lb(function(a,b,c){return[0>c?c+b:c]}),even:lb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:lb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:lb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:lb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function qb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=v++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[u,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[s]||(b[s]={}),(h=i[d])&&h[0]===u&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function rb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function sb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function tb(a,b,c,d,e,f){return d&&!d[s]&&(d=tb(d)),e&&!e[s]&&(e=tb(e,f)),fb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||wb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:sb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=sb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=sb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ub(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],i=g||d.relative[" "],j=g?1:0,k=qb(function(a){return a===b},i,!0),l=qb(function(a){return I.call(b,a)>-1},i,!0),m=[function(a,c,d){return!g&&(d||c!==h)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>j;j++)if(c=d.relative[a[j].type])m=[qb(rb(m),c)];else{if(c=d.filter[a[j].type].apply(null,a[j].matches),c[s]){for(e=++j;f>e;e++)if(d.relative[a[e].type])break;return tb(j>1&&rb(m),j>1&&pb(a.slice(0,j-1).concat({value:" "===a[j-2].type?"*":""})).replace(P,"$1"),c,e>j&&ub(a.slice(j,e)),f>e&&ub(a=a.slice(e)),f>e&&pb(a))}m.push(c)}return rb(m)}function vb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,i,j,k){var m,n,o,p=0,q="0",r=f&&[],s=[],t=h,v=f||e&&d.find.TAG("*",k),w=u+=null==t?1:Math.random()||.1,x=v.length;for(k&&(h=g!==l&&g);q!==x&&null!=(m=v[q]);q++){if(e&&m){n=0;while(o=a[n++])if(o(m,g,i)){j.push(m);break}k&&(u=w)}c&&((m=!o&&m)&&p--,f&&r.push(m))}if(p+=q,c&&q!==p){n=0;while(o=b[n++])o(r,s,g,i);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=E.call(j));s=sb(s)}G.apply(j,s),k&&!f&&s.length>0&&p+b.length>1&&db.uniqueSort(j)}return k&&(u=w,h=t),r};return c?fb(f):f}g=db.compile=function(a,b){var c,d=[],e=[],f=y[a+" "];if(!f){b||(b=ob(a)),c=b.length;while(c--)f=ub(b[c]),f[s]?d.push(f):e.push(f);f=y(a,vb(e,d))}return f};function wb(a,b,c){for(var d=0,e=b.length;e>d;d++)db(a,b[d],c);return c}function xb(a,b,e,f){var h,i,j,k,l,m=ob(a);if(!f&&1===m.length){if(i=m[0]=m[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&c.getById&&9===b.nodeType&&n&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(ab,bb),b)||[])[0],!b)return e;a=a.slice(i.shift().value.length)}h=V.needsContext.test(a)?0:i.length;while(h--){if(j=i[h],d.relative[k=j.type])break;if((l=d.find[k])&&(f=l(j.matches[0].replace(ab,bb),$.test(i[0].type)&&mb(b.parentNode)||b))){if(i.splice(h,1),a=f.length&&pb(i),!a)return G.apply(e,f),e;break}}}return g(a,m)(f,b,!n,e,$.test(a)&&mb(b.parentNode)||b),e}return c.sortStable=s.split("").sort(z).join("")===s,c.detectDuplicates=!!j,k(),c.sortDetached=gb(function(a){return 1&a.compareDocumentPosition(l.createElement("div"))}),gb(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||hb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&gb(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||hb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),gb(function(a){return null==a.getAttribute("disabled")})||hb(J,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),db}(a);o.find=t,o.expr=t.selectors,o.expr[":"]=o.expr.pseudos,o.unique=t.uniqueSort,o.text=t.getText,o.isXMLDoc=t.isXML,o.contains=t.contains;var u=o.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(o.isFunction(b))return o.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return o.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return o.filter(b,a,c);b=o.filter(b,a)}return o.grep(a,function(a){return g.call(b,a)>=0!==c})}o.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?o.find.matchesSelector(d,a)?[d]:[]:o.find.matches(a,o.grep(b,function(a){return 1===a.nodeType}))},o.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(o(a).filter(function(){for(b=0;c>b;b++)if(o.contains(e[b],this))return!0}));for(b=0;c>b;b++)o.find(a,e[b],d);return d=this.pushStack(c>1?o.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?o(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=o.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof o?b[0]:b,o.merge(this,o.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:m,!0)),v.test(c[1])&&o.isPlainObject(b))for(c in b)o.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=m.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=m,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):o.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(o):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),o.makeArray(a,this))};A.prototype=o.fn,y=o(m);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};o.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&o(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),o.fn.extend({has:function(a){var b=o(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(o.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?o(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&o.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?o.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(o(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(o.unique(o.merge(this.get(),o(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}o.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return o.dir(a,"parentNode")},parentsUntil:function(a,b,c){return o.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return o.dir(a,"nextSibling")},prevAll:function(a){return o.dir(a,"previousSibling")},nextUntil:function(a,b,c){return o.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return o.dir(a,"previousSibling",c)},siblings:function(a){return o.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return o.sibling(a.firstChild)},contents:function(a){return a.contentDocument||o.merge([],a.childNodes)}},function(a,b){o.fn[a]=function(c,d){var e=o.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=o.filter(d,e)),this.length>1&&(C[a]||o.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return o.each(a.match(E)||[],function(a,c){b[c]=!0}),b}o.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):o.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){o.each(b,function(b,c){var d=o.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&o.each(arguments,function(a,b){var c;while((c=o.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?o.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},o.extend({Deferred:function(a){var b=[["resolve","done",o.Callbacks("once memory"),"resolved"],["reject","fail",o.Callbacks("once memory"),"rejected"],["notify","progress",o.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return o.Deferred(function(c){o.each(b,function(b,f){var g=o.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&o.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?o.extend(a,d):d}},e={};return d.pipe=d.then,o.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&o.isFunction(a.promise)?e:0,g=1===f?a:o.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&o.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;o.fn.ready=function(a){return o.ready.promise().done(a),this},o.extend({isReady:!1,readyWait:1,holdReady:function(a){a?o.readyWait++:o.ready(!0)},ready:function(a){(a===!0?--o.readyWait:o.isReady)||(o.isReady=!0,a!==!0&&--o.readyWait>0||(H.resolveWith(m,[o]),o.fn.trigger&&o(m).trigger("ready").off("ready")))}});function I(){m.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),o.ready()}o.ready.promise=function(b){return H||(H=o.Deferred(),"complete"===m.readyState?setTimeout(o.ready):(m.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},o.ready.promise();var J=o.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===o.type(c)){e=!0;for(h in c)o.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,o.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(o(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};o.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=o.expando+Math.random()}K.uid=1,K.accepts=o.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,o.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(o.isEmptyObject(f))o.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,o.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{o.isArray(b)?d=b.concat(b.map(o.camelCase)):(e=o.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!o.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?o.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}o.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),o.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length; +while(c--)d=g[c].name,0===d.indexOf("data-")&&(d=o.camelCase(d.slice(5)),P(f,d,e[d]));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=o.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),o.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||o.isArray(c)?d=L.access(a,b,o.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=o.queue(a,b),d=c.length,e=c.shift(),f=o._queueHooks(a,b),g=function(){o.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:o.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),o.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length",l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";l.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return m.activeElement}catch(a){}}o.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=o.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof o!==U&&o.event.triggered!==b.type?o.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],n=q=h[1],p=(h[2]||"").split(".").sort(),n&&(l=o.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=o.event.special[n]||{},k=o.extend({type:n,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&o.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(n,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),o.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],n=q=h[1],p=(h[2]||"").split(".").sort(),n){l=o.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||o.removeEvent(a,n,r.handle),delete i[n])}else for(n in i)o.event.remove(a,n+b[j],c,d,!0);o.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,p=[d||m],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||m,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+o.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[o.expando]?b:new o.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:o.makeArray(c,[b]),n=o.event.special[q]||{},e||!n.trigger||n.trigger.apply(d,c)!==!1)){if(!e&&!n.noBubble&&!o.isWindow(d)){for(i=n.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||m)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:n.bindType||q,l=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),l&&l.apply(g,c),l=k&&g[k],l&&l.apply&&o.acceptData(g)&&(b.result=l.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||n._default&&n._default.apply(p.pop(),c)!==!1||!o.acceptData(d)||k&&o.isFunction(d[q])&&!o.isWindow(d)&&(h=d[k],h&&(d[k]=null),o.event.triggered=q,d[q](),o.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=o.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=o.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=o.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((o.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?o(e,this).index(i)>=0:o.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*\s*$/g,ib={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return o.nodeName(a,"table")&&o.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)o.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=o.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&o.nodeName(a,b)?o.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}o.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=o.contains(a.ownerDocument,a);if(!(l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||o.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,n=a.length;n>m;m++)if(e=a[m],e||0===e)if("object"===o.type(e))o.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1>")+h[2],j=h[0];while(j--)f=f.lastChild;o.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===o.inArray(e,d))&&(i=o.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f,g,h=o.event.special,i=0;void 0!==(c=a[i]);i++){if(o.acceptData(c)&&(f=c[L.expando],f&&(b=L.cache[f]))){if(d=Object.keys(b.events||{}),d.length)for(g=0;void 0!==(e=d[g]);g++)h[e]?o.event.remove(c,e):o.removeEvent(c,e,b.handle);L.cache[f]&&delete L.cache[f]}delete M.cache[c[M.expando]]}}}),o.fn.extend({text:function(a){return J(this,function(a){return void 0===a?o.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?o.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||o.cleanData(ob(c)),c.parentNode&&(b&&o.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(o.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return o.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(o.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,o.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,k=this.length,m=this,n=k-1,p=a[0],q=o.isFunction(p);if(q||k>1&&"string"==typeof p&&!l.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(k&&(c=o.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=o.map(ob(c,"script"),kb),g=f.length;k>j;j++)h=c,j!==n&&(h=o.clone(h,!0,!0),g&&o.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,o.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&o.contains(i,h)&&(h.src?o._evalUrl&&o._evalUrl(h.src):o.globalEval(h.textContent.replace(hb,"")))}return this}}),o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){o.fn[a]=function(a){for(var c,d=[],e=o(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),o(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d=o(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:o.css(d[0],"display");return d.detach(),e}function tb(a){var b=m,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||o(""); + + // fix breadcrumbs: function -- not avaliable + $('#function-button').css("display","none"); + $('#function-slash').css("display","none"); + } + } +} + + +// select lines from the code-listing +var old_line = 0; +function select_line(n,xs,ys) { + // update background color to show selected line + $("#ln"+old_line).css("background-color","transparent"); + $("#ln"+n).css("background-color",selectColor); + old_line = n; + + // load data nodes by posting messages + window.parent.postMessage("load:clear","*"); + for (var i = 0; i < xs.length; i++ ) { + window.parent.postMessage("load:"+i+":"+xs[i],"*"); + } + + // show warnings if present + $(".inline-warning").remove(); + for (var i = 0; i < ys.length; i++ ) { + var newid = "ln"+n+"_warn"+i; + $("#ln"+n).append(""); + $("#"+newid).iFrameResize({log:false}); + } +} + + +// messages to handle data nodes +function loadMessage(event){ + // clear event to remove all displayed nodes + if (event.data == "load:clear") { + $("#data-frame-div").empty(); + } else { + // in case it is "load::", show node y, as the x-th data node + var xs = event.data.split(":") + if (xs.length==3 && xs[0]=="load") { + var newid = "data-frame"+xs[1]; + $("#data-frame-div").append(""); + $("#"+newid).iFrameResize({log:false}); + } + } +} + +// highlight the selected line if possible +function init_file(){ + if (getURLParameter("line") != null) + $("#ln"+getURLParameter("line")).click(); + +} + +// used on load of frames.html +function init_frames(){ + // wait for events from file listings or such + window.addEventListener("message", loadMessage, false); + + // fix breadcrumbs: file + $('#file-button').text(getURLParameter("file")); + $('#file-button').attr("href","frame.html?file="+getURLParameter("file")); + + // if we know the function then show the graph, else try to show the whole file + if (getURLParameter("file")!=null) { + if (getURLParameter("fun")!=null) { + // we know the function so we can show the graph + $('#file-view-frame-div').load("cfgs/"+encodeURIComponent(encodeURIComponent(getURLParameter("file")))+"/"+getURLParameter("fun")+'.svg', + function f(){ + $("#file-view-frame-div svg").attr("width","100%"); + $("#file-view-frame-div svg").attr("height","100%"); + svgPanZoom.init({selector:"#file-view-frame-div svg"}); + }); + $('#function-button').text(getURLParameter("fun")); + $('#function-button').attr("href","frame.html?fun="+getURLParameter("fun")+"&file="+getURLParameter("file")); + } else { + // we know the file only, so we show the file listing + $('#file-view-frame-div').empty(); + $('#file-view-frame-div').append(""); + + // fix breadcrumbs: function -- not avaliable + $('#function-button').css("display","none"); + $('#function-slash').css("display","none"); + } + } + + // if a node is given as an argument, show it + if (getURLParameter("node")!= null) + setTimeout(function () { + show_info(getURLParameter("node")); + },100); + + + // initialize the drag-bar + $('#dragbar').mousedown(function(e){ + e.preventDefault(); + $('body').mousemove(function(e){ + $('#dragbar').css("left",e.pageX-8); + $('#data-frame-div').css("width",e.pageX-22); + $('#file-view-frame-div').css("left",e.pageX+10); + }) + }); + $('body').mouseup(function(e){ + $('body').unbind('mousemove'); + }); +} + + + diff --git a/xslt/style.css b/xslt/style.css new file mode 100644 index 0000000000..001face686 --- /dev/null +++ b/xslt/style.css @@ -0,0 +1,307 @@ +@font-face { + font-family: 'Ubuntu Mono'; + font-style: normal; + font-weight: 400; + src: local('Ubuntu Mono'), local('UbuntuMono-Regular'), url(UbuntuMonoRegular.woff) format('woff'); +} +@font-face { + font-family: 'Ubuntu Mono'; + font-style: normal; + font-weight: 700; + src: local('Ubuntu Mono Bold'), local('UbuntuMono-Bold'), url(UbuntuMonoBold.woff) format('woff'); +} + +@font-face { + font-family: 'Alegreya Sans'; + font-style: normal; + font-weight: 400; + src: local('Alegreya Sans'), local('AlegreyaSans-Regular'), url(AlegreyaSans400.woff) format('woff'); +} + +@font-face { + font-family: 'Alegreya Sans'; + font-style: normal; + font-weight: 500; + src: local('Alegreya Sans Medium'), local('AlegreyaSans-Medium'), url(AlegreyaSans500.woff) format('woff'); +} + +text { + font-family:'Alegreya Sans', sans-serif; +} + +ul { + margin: 0; + padding: 0; +} + +html , body { + font-family:'Alegreya Sans', sans-serif; + font-weight:400; + font-size:10pt; + margin: 0; + padding: 0; +} + +.toggle, .nontoggle { + padding-left: 0.6em; + padding-right: 0.6em; + margin-top: 0.2em; + margin-bottom: 0.2em; +} + +.toggle { + border-style: solid none solid none; + border-width:1px; + border-color:#ccc; + -webkit-border-radius: 7px; + -moz-border-radius: 7px; + border-radius: 7px; +} + +.emph { + font-weight:500; +} + +.fill { + height:100%; + width:100%; +} + +.fillW { + width:100%; +} + +.borderless { + border-style:none; + border-width:0px; +} + +.node-wrap { + margin:4px; + padding:4px; + border-style: none solid none solid; + border-width:3px; + border-color:#555; + -webkit-border-radius: 9px; + -moz-border-radius: 9px; + border-radius: 9px; + display:block; + text-decoration:none; +} + +#top-frame-div { + border-style: none none solid none; + border-width:5px; + color:gray; + -webkit-border-radius: 9px; + -moz-border-radius: 9px; + border-radius: 9px; + width:100%; + height: 35px; + font-size:19pt; +} + +#data-frame-div { + margin-left:10px; + margin-top:0px; + margin-bottom:0px; + width:240px; + float: left; + position: absolute; + top:40px; + bottom: 10px; + overflow-x:auto; + overflow-y:auto; +} + +#file-view-frame-div { + float: right; + position: absolute; + top:40px; + bottom: 10px; + right: 5; + left:275px; + overflow-x:auto; + overflow-y:auto; +} + + +#footer{ + border-style: solid none none none; + border-width:5px; + color:gray; + -webkit-border-radius: 7px; + -moz-border-radius: 7px; + border-radius: 7px; + width:100%; + height: 10px; + bottom:0; + position:absolute; +} + +#dragbar{ + margin: 0px 5px 0px 5px; + background-color:gray; + position: absolute; + float:left; + top:40px; + left:255px; + bottom:10px; + width: 5px; + cursor: col-resize; +} + +.red-bg { + background: #f77; +} + +.blue-bg { + background: #39d; +} + +.green-bg { + background: #693; +} + +.yellow-bg { + background: #982; +} + +.button { + margin: 8px 8px 8px 7px; + padding: 3px 15px; + -webkit-border-radius: 7px; + -moz-border-radius: 7px; + border-radius: 7px; + color: white; + font-size: 14px; + font-weight:500; + text-decoration: none; + vertical-align: middle; +} + +.button:hover { + opacity:0.6; + cursor:pointer; +} + +.button:active { + border-top-color: #1b435e; + background: #1b435e; +} + +.bg1 { + background-color: #daede2; +/* background-color: #efe;*/ +} + +.bg2 { +} + +.bg3 { +} + +.nothing { + text-align: center; + vertical-align: middle; + line-height: 100px; + color:#ddd; +} +.node-location { + font-size:8px; +} + +.node-id { + font-size:14px; +} + +.source-block { + font-family:'Ubuntu Mono', sans-serif; + width:100%; + padding-top:1em; + padding-bottom:1em; + font-size:12pt; + display:table; +} +.sl-nr { + display:inline-block; + width:3em; + padding-right:0.4em; + text-align:right; +} + +.sl-data { + white-space:pre-wrap; + padding-left:0.4em; + width:100%; +} + +.sl { + cursor:pointer; + display:table-row; +} + +.sl-warn { + display:inline-block; + cursor:pointer; + width:0.5em; + height:0.5em; + margin:1px 0px 4px 0px; + vertical-align:middle; + background-color:#E00; + border-color:#500; + border-style:solid; + border-width:1.5px; +} + +.sl-nowarn { + display:inline-block; + cursor:pointer; + width:0.5em; + height:0.5em; + margin:1px 0px 4px 0px; + vertical-align:middle; + background-color:transparent; + border-color:transparent; + border-style:solid; + border-width:1px; +} + +.inline-warning { + display:block; + border-style:dashed none none none; + border-width:2px; + width:100%; + height: 1.5em; + padding:0px; + background-color: #fcc; + -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */ + -moz-box-sizing: border-box; /* Firefox, other Gecko */ + box-sizing: border-box; /* Opera/IE 8+ */ +} + +#global-button { + float:right +} + +.live{ + font-weight:700; +} +.dead { + font-weight:700; + color:red; +} + +.hidden { + display:none; +} + +.nr { color : #A00 ; font-weight:400; } +.pp { color : #808 ; font-weight:500; } +.tk { color : #088 ; font-weight:500; } +.sk { color : #080 ; font-weight:500; } +.op { color : #00A ; font-weight:500; } +.sp { color : #D50 ; font-weight:500; } +.cm { color : #555 ; font-weight:400; } +.st { color : #900 ; font-weight:500; } + diff --git a/xslt/svg-pan-zoom.js b/xslt/svg-pan-zoom.js new file mode 100644 index 0000000000..88c37e0f01 --- /dev/null +++ b/xslt/svg-pan-zoom.js @@ -0,0 +1,663 @@ +svgPanZoom = function(){ + + /** + * This code is licensed under the following BSD license: + * + * Copyright 2009-2010 Andrea Leofreddi . All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY Andrea Leofreddi ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Andrea Leofreddi OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of Andrea Leofreddi. + */ + + 'use strict'; + + var state = 'none', viewportCTM, stateTarget, stateOrigin, stateTf; + + /// CONFIGURATION + /// ====> + + var panEnabled = true; // true or false: enable or disable panning (default enabled) + var zoomEnabled = true; // true or false: enable or disable zooming (default enabled) + var dragEnabled = false; // true or false: enable or disable dragging (default disabled) + var zoomScaleSensitivity = 0.2; // Zoom sensitivity + var minZoom = 0.5; // Minimum Zoom + var maxZoom = 10; // Maximum Zoom + var onZoom = null; // Zoom callback + + /// <==== + /// END OF CONFIGURATION + + /** + * Enable svgPanZoom + */ + + function init(args) { + args = args || {}; + getSvg(args.selector, function(err, svg) { + if (args.hasOwnProperty('panEnabled')) { + panEnabled = args.panEnabled; + } + if (args.hasOwnProperty('zoomEnabled')) { + zoomEnabled = args.zoomEnabled; + } + if (args.hasOwnProperty('dragEnabled')) { + dragEnabled = args.dragEnabled; + } + if (args.hasOwnProperty('zoomScaleSensitivity')) { + zoomScaleSensitivity = args.zoomScaleSensitivity; + } + if (args.hasOwnProperty('onZoom')) { + onZoom = args.onZoom; + } + if (args.hasOwnProperty('minZoom')) { + minZoom = args.minZoom; + } + if (args.hasOwnProperty('maxZoom')) { + maxZoom = args.maxZoom; + } + setupHandlers(svg); + if (!!svg.ownerDocument.documentElement.tagName.toLowerCase() !== 'svg') { + svg.ownerDocument.defaultView.svgPanZoom = svgPanZoom; + } + }); + } + + /** + * Change settings + */ + + function setZoomScaleSensitivity(newZoomScaleSensitivity) { + zoomScaleSensitivity = newZoomScaleSensitivity; + } + + function enablePan() { + panEnabled = true; + } + + function disablePan() { + panEnabled = false; + } + + function enableZoom() { + zoomEnabled = true; + } + + function disableZoom() { + zoomEnabled = false; + } + + function enableDrag() { + dragEnabled = true; + } + + function disableDrag() { + dragEnabled = false; + } + + /** + * Register handlers + */ + + function setupHandlers(svg){ + setAttributes(svg, { + 'onmouseup': 'svgPanZoom.handleMouseUp(evt)', + 'onmousedown': 'svgPanZoom.handleMouseDown(evt)', + 'onmousemove': 'svgPanZoom.handleMouseMove(evt)', + 'onmouseleave' : 'svgPanZoom.handleMouseUp(evt)', // Decomment this to stop the pan functionality when dragging out of the SVG element; Note that 'onmouseleave' works over parent svg and all children. + }); + + svg.setAttribute('xmlns', 'http://www.w3.org/1999/xlink') + svg.setAttributeNS('xmlns', 'xlink', 'http://www.w3.org/1999/xlink') + svg.setAttributeNS('xmlns', 'ev', 'http://www.w3.org/2001/xml-events') + + if(navigator.userAgent.toLowerCase().indexOf('webkit') >= 0) { + svg.addEventListener('mousewheel', handleMouseWheel, false); // Chrome/Safari + } + else { + svg.addEventListener('DOMMouseScroll', handleMouseWheel, false); // Others + } + } + + /** + * Retrieves the svg element for SVG manipulation. The element is then cached into the viewport global variable. + */ + + function getViewport(svg) { + var initialViewportCTM, svgViewBox; + if (!svg.__viewportElement) { + svg.__viewportElement = svg.getElementById('viewport'); + if (!svg.__viewportElement) { + + // If no g container with id 'viewport' exists, as last resort, use first g element. + + svg.__viewportElement = svg.getElementsByTagName('g')[0] + } + + if (!svg.__viewportElement) { + + // TODO could automatically move all elements from SVG into a newly created viewport g element. + + throw new Error('No g element containers in SVG document to use for viewport.'); + } + + svgViewBox = svg.getAttribute('viewBox'); + if (svgViewBox) { + svg.__viewportElement.setAttribute('viewBox', svgViewBox); + svg.removeAttribute('viewBox'); + } + } + + viewportCTM = svg.__viewportElement.getCTM(); + return svg.__viewportElement; + } + + /** + * Get an SVGPoint of the mouse co-ordinates of the event, relative to the SVG element. + */ + + function getRelativeMousePoint(evt) { + var svg = (evt.target.tagName === 'svg' || evt.target.tagName === 'SVG') ? evt.target : evt.target.ownerSVGElement || evt.target.correspondingElement.ownerSVGElement; + var point = svg.createSVGPoint(); + point.x = evt.clientX + point.y = evt.clientY; + point = point.matrixTransform(svg.getScreenCTM().inverse()); + return point; + }; + + /** + * Instance an SVGPoint object with given event coordinates. + */ + + function getEventPoint(evt) { + var svg = (evt.target.tagName === 'svg' || evt.target.tagName === 'SVG') ? evt.target : evt.target.ownerSVGElement || evt.target.correspondingElement.ownerSVGElement; + + var p = svg.createSVGPoint(); + + p.x = evt.clientX; + p.y = evt.clientY; + + return p; + } + + /** + * Sets the current transform matrix of an element. + */ + + function setCTM(element, matrix) { + var s = 'matrix(' + matrix.a + ',' + matrix.b + ',' + matrix.c + ',' + matrix.d + ',' + matrix.e + ',' + matrix.f + ')'; + element.setAttribute('transform', s); + } + + /** + * Dumps a matrix to a string (useful for debug). + */ + + function dumpMatrix(matrix) { + var s = '[ ' + matrix.a + ', ' + matrix.c + ', ' + matrix.e + '\n ' + matrix.b + ', ' + matrix.d + ', ' + matrix.f + '\n 0, 0, 1 ]'; + return s; + } + + /** + * Sets attributes of an element. + */ + function setAttributes(element, attributes){ + for (var i in attributes) + element.setAttributeNS(null, i, attributes[i]); + } + + function findFirstSvg(callback) { + var i, candidateSvg, foundSvg; + var candidateSvg = document.querySelector('svg'); + if (!!candidateSvg) { + foundSvg = candidateSvg; + callback(foundSvg); + } + + var candidateObjectElements = document.querySelectorAll('object'); + i = 0; + do { + i += 1; + getSvg('object:nth-of-type(' + i + ')', function(err, candidateSvg) { + if (!!candidateSvg) { + foundSvg = candidateSvg; + callback(foundSvg); + } + }); + } while (i < candidateObjectElements.length); + + var candidateEmbedElements = document.querySelectorAll('embed'); + i = 0; + do { + i += 1; + getSvg('embed:nth-of-type(' + i + ')', function(err, candidateSvg) { + if (!!candidateSvg) { + foundSvg = candidateSvg; + callback(foundSvg); + } + }); + } while (i < candidateEmbedElements.length); + + // TODO add a timeout + } + + function getSvg(selector, callback) { + var target, err, svg; + if (!selector) { + if(typeof console !== "undefined") { + console.warn('No selector specified for getSvg(). Using first svg element found.'); + } + target = findFirstSvg(function(svg) { + if (!svg) { + err = new Error('No SVG found in this document.'); + } + if (!!callback) { + callback(err, svg); + } + else { + if (!svg) { + throw err; + } + return svg; + } + }); + } + else { + target = document.querySelector(selector); + if (!!target) { + if (target.tagName.toLowerCase() === 'svg') { + svg = target; + } + else { + if (target.tagName.toLowerCase() === 'object') { + svg = target.contentDocument.documentElement; + } + else { + if (target.tagName.toLowerCase() === 'embed') { + svg = target.getSVGDocument().documentElement; + } + else { + if (target.tagName.toLowerCase() === 'img') { + throw new Error('Cannot script an SVG in an "img" element. Please use an "object" element or an in-line SVG.'); + } + else { + throw new Error('Cannot get SVG.'); + } + } + } + } + } + if (!svg) { + err = new Error('No SVG found in this document.'); + } + + if (!!callback) { + callback(err, svg); + } + else { + if (!svg) { + throw err; + } + return svg; + } + } + } + + function pan(selector, direction) { + if (!direction) { + throw new Error('No direction specified for direction of panning. Please enter a string value of up, right, down or left.'); + } + var tx, ty; + var panIncrement = 0.1; + var directionToXYMapping = { + 'top':{ + 'x': 0, + 'y': -1 + }, + 't':{ + 'x': 0, + 'y': -1 + }, + 'up':{ + 'x': 0, + 'y': -1 + }, + 'u':{ + 'x': 0, + 'y': -1 + }, + 'right':{ + 'x': 1, + 'y': 0 + }, + 'r':{ + 'x': 1, + 'y': 0 + }, + 'bottom':{ + 'x': 0, + 'y': 1 + }, + 'b':{ + 'x': 0, + 'y': 1 + }, + 'down':{ + 'x': 0, + 'y': 1 + }, + 'd':{ + 'x': 0, + 'y': 1 + }, + 'left':{ + 'x': -1, + 'y': 0 + }, + 'l':{ + 'x': -1, + 'y': 0 + } + }; + + var directionXY = directionToXYMapping[direction]; + + if (!directionXY) { + throw new Error('Direction specified was not understood. Please enter a string value of up, right, down or left.'); + } + + getSvg(selector, function(err, svg) { + var viewport = getViewport(svg); + tx = svg.getBBox().width * panIncrement * directionXY.x; + ty = svg.getBBox().height * panIncrement * directionXY.y; + viewportCTM.e += tx; + viewportCTM.f += ty; + setCTM(viewport, viewportCTM); + }); + } + + function zoom(args) { + if (!args.scale) { + throw new Error('No scale specified for zoom. Please enter a number.'); + } + getSvg(args.selector, function(err, svg) { + var viewport = getViewport(svg); + viewportCTM.a = viewportCTM.d = args.scale; + if ( viewportCTM.a < minZoom ) { viewportCTM.a = viewportCTM.d = minZoom ; } + if ( viewportCTM.a > maxZoom ) { viewportCTM.a = viewportCTM.d = maxZoom ; } + setCTM(viewport, viewportCTM); + if (onZoom) { onZoom(viewportCTM.a); } + }); + } + + function zoomIn(selector) { + + // TODO zoom origin isn't center of screen + + getSvg(selector, function(err, svg) { + var viewport = getViewport(svg); + viewportCTM.a = viewportCTM.d = (1 + zoomScaleSensitivity) * viewportCTM.a; + if ( viewportCTM.a > maxZoom ) { viewportCTM.a = viewportCTM.d = maxZoom ; } + setCTM(viewport, viewportCTM); + if (onZoom) { onZoom(viewportCTM.a); } + }); + } + + function zoomOut(selector) { + + // TODO zoom origin isn't center of screen + + getSvg(selector, function(err, svg) { + var viewport = getViewport(svg); + viewportCTM.a = viewportCTM.d = (1/(1 + zoomScaleSensitivity)) * viewportCTM.a; + if ( viewportCTM.a < minZoom ) { viewportCTM.a = viewportCTM.d = minZoom ; } + setCTM(viewport, viewportCTM); + if (onZoom) { onZoom(viewportCTM.a); } + }); + } + + function resetZoom(selector) { + var oldCTM, newCTM; + getSvg(selector, function(err, svg) { + var viewport = getViewport(svg); + + var bBox = svg.getBBox(); + var boundingClientRect = svg.getBoundingClientRect(); + oldCTM = newCTM = viewportCTM; + var newScale = Math.min(boundingClientRect.width/bBox.width, boundingClientRect.height/bBox.height); + newCTM.a = newScale * oldCTM.a; //x-scale + newCTM.d = newScale * oldCTM.d; //y-scale + newCTM.e = oldCTM.e * newScale - (boundingClientRect.width - bBox.width * newScale)/2 - bBox.x * newScale; //x-transform + newCTM.f = oldCTM.f * newScale - (boundingClientRect.height - bBox.height * newScale)/2 - bBox.y * newScale; //y-transform + setCTM(viewport, newCTM); + if (onZoom) { onZoom(newCTM.a); } + }); + } + + /** + * Handle mouse wheel event. + */ + + function handleMouseWheel(evt) { + if(!zoomEnabled) { + return; + } + + if(evt.preventDefault) { + evt.preventDefault(); + } + else { + evt.returnValue = false; + } + + var svg = (evt.target.tagName === 'svg' || evt.target.tagName === 'SVG') ? evt.target : evt.target.ownerSVGElement || evt.target.correspondingElement.ownerSVGElement; + + var delta; + + if(evt.wheelDelta) + delta = evt.wheelDelta / 360; // Chrome/Safari + else + delta = evt.detail / -9; // Mozilla + + var z = Math.pow(1 + zoomScaleSensitivity, delta); + + var g = getViewport(svg); + + var p = getRelativeMousePoint(evt); + p = p.matrixTransform(g.getCTM().inverse()); + + // Compute new scale matrix in current mouse position + var k = svg.createSVGMatrix().translate(p.x, p.y).scale(z).translate(-p.x, -p.y); + var wasZoom = g.getCTM(); + var setZoom = g.getCTM().multiply(k); + + if ( setZoom.a < minZoom ) { setZoom.a = setZoom.d = wasZoom.a } + if ( setZoom.a > maxZoom ) { setZoom.a = setZoom.d = wasZoom.a } + if ( setZoom.a != wasZoom.a ) { setCTM(g, setZoom) } + + if(typeof(stateTf) == 'undefined') + stateTf = g.getCTM().inverse(); + + stateTf = stateTf.multiply(k.inverse()); + if (onZoom) { onZoom(g.getCTM().a); } + } + + /** + * Handle mouse move event. + */ + + function handleMouseMove(evt) { + if(evt.preventDefault) { + evt.preventDefault(); + } + else { + evt.returnValue = false; + } + + var svg = (evt.target.tagName === 'svg' || evt.target.tagName === 'SVG') ? evt.target : evt.target.ownerSVGElement || evt.target.correspondingElement.ownerSVGElement; + + var g = getViewport(svg); + + if(state == 'pan' && panEnabled) { + // Pan mode + var p = getEventPoint(evt).matrixTransform(stateTf); + + setCTM(g, stateTf.inverse().translate(p.x - stateOrigin.x, p.y - stateOrigin.y)); + } else if(state == 'drag' && dragEnabled) { + // Drag mode + var p = getEventPoint(evt).matrixTransform(g.getCTM().inverse()); + + setCTM(stateTarget, svg.createSVGMatrix().translate(p.x - stateOrigin.x, p.y - stateOrigin.y).multiply(g.getCTM().inverse()).multiply(stateTarget.getCTM())); + + stateOrigin = p; + } + } + +/** + * Handle double click event. + * See handleMouseDown() for alternate detection method. + */ + + function handleDblClick(evt) { + if(evt.preventDefault) { + evt.preventDefault(); + } + else { + evt.returnValue = false; + } + + var svg = (evt.target.tagName === 'svg' || evt.target.tagName === 'SVG') ? evt.target : evt.target.ownerSVGElement || evt.target +.correspondingElement.ownerSVGElement; + + var zoomFactor = 4; // 4x zoom! + if(evt.shiftKey){ + zoomFactor = -1.66; // zoom out when shift key pressed + } + + var z = 1 + zoomScaleSensitivity * zoomFactor; + + var g = getViewport(svg); + + var p = getEventPoint(evt); + + p = p.matrixTransform(g.getCTM().inverse()); + + // Compute new scale matrix in current mouse position + var k = svg.createSVGMatrix().translate(p.x, p.y).scale(z).translate(-p.x, -p.y); + var wasZoom = g.getCTM(); + var setZoom = g.getCTM().multiply(k); + + if ( setZoom.a < minZoom ) { setZoom.a = setZoom.d = wasZoom.a } + if ( setZoom.a > maxZoom ) { setZoom.a = setZoom.d = wasZoom.a } + if ( setZoom.a != wasZoom.a ) { setCTM(g, setZoom) } + + if(typeof(stateTf) == 'undefined') + stateTf = g.getCTM().inverse(); + + stateTf = stateTf.multiply(k.inverse()); + if (onZoom) { onZoom(g.getCTM().a); } + } + + /** + * Handle click event. + */ + + function handleMouseDown(evt) { + // Double click detection; more consistent than ondblclick + if(evt.detail==2){ + handleDblClick(evt); + } + + if(evt.preventDefault) { + evt.preventDefault(); + } + else { + evt.returnValue = false; + } + + var svg = (evt.target.tagName === 'svg' || evt.target.tagName === 'SVG') ? evt.target : evt.target.ownerSVGElement || evt.target.correspondingElement.ownerSVGElement; + + var g = getViewport(svg); + + if( + evt.target.tagName == 'svg' + || !dragEnabled // Pan anyway when drag is disabled and the user clicked on an element + ) { + // Pan mode + state = 'pan'; + + stateTf = g.getCTM().inverse(); + + stateOrigin = getEventPoint(evt).matrixTransform(stateTf); + } else { + // Drag mode + state = 'drag'; + + stateTarget = evt.target; + + stateTf = g.getCTM().inverse(); + + stateOrigin = getEventPoint(evt).matrixTransform(stateTf); + } + } + + /** + * Handle mouse button release event. + */ + + function handleMouseUp(evt) { + if(evt.preventDefault) { + evt.preventDefault(); + } + else { + evt.returnValue = false; + } + + var svg = (evt.target.tagName === 'svg' || evt.target.tagName === 'SVG') ? evt.target : evt.target.ownerSVGElement || evt.target.correspondingElement.ownerSVGElement; + + if(state == 'pan' || state == 'drag') { + // Quit pan mode + state = ''; + } + } + + return{ + init:init, + handleMouseUp:handleMouseUp, + handleMouseDown:handleMouseDown, + handleMouseMove:handleMouseMove, + handleDblClick:handleDblClick, + pan:pan, + zoom:zoom, + zoomIn:zoomIn, + zoomOut:zoomOut, + resetZoom:resetZoom, + setZoomScaleSensitivity:setZoomScaleSensitivity, + enablePan:enablePan, + disablePan:disablePan, + enableZoom:enableZoom, + disableZoom:disableZoom, + enableDrag:enableDrag, + disableDrag:disableDrag + }; +}(); \ No newline at end of file diff --git a/xslt/warn.xsl b/xslt/warn.xsl new file mode 100644 index 0000000000..120eef430e --- /dev/null +++ b/xslt/warn.xsl @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + +
  • + + ../frame.html?file=&line= + @ + : + +
  • +
    + + + : +
      + +
    +
    + + + + + +