Index: trunk/extensions/WikiTrust/sql/create_db.php |
— | — | @@ -52,19 +52,23 @@ |
53 | 53 | exit(0); |
54 | 54 | } |
55 | 55 | |
56 | | -// Reads the root password from std in. |
57 | | -print "Enter the root mysql password:\n"; |
58 | | -$dba_pass = rtrim(shell_exec(' |
59 | | -bash -c \' |
60 | | -stty_orig=`stty -g` |
61 | | -trap "stty ${stty_orig}; exit" 1 2 3 15 |
62 | | -stty -echo <&- 2<&- |
63 | | -read -s PASS |
64 | | -stty ${stty_orig} <&- 2<&- |
65 | | -trap 1 2 3 15 |
66 | | -echo $PASS |
67 | | -\' |
68 | | -')); |
| 56 | +// Reads the root password from std in, or a file if given |
| 57 | +if (array_key_exists(4, $argv) && is_file($argv[4])){ |
| 58 | + $dba_pass = trim(file_get_contents($argv[4])); |
| 59 | +} else { |
| 60 | + print "Enter the root mysql password:\n"; |
| 61 | + $dba_pass = rtrim(shell_exec(' |
| 62 | + bash -c \' |
| 63 | + stty_orig=`stty -g` |
| 64 | + trap "stty ${stty_orig}; exit" 1 2 3 15 |
| 65 | + stty -echo <&- 2<&- |
| 66 | + read -s PASS |
| 67 | + stty ${stty_orig} <&- 2<&- |
| 68 | + trap 1 2 3 15 |
| 69 | + echo $PASS |
| 70 | + \' |
| 71 | + ')); |
| 72 | +} |
69 | 73 | |
70 | 74 | // Load all of the MW files. |
71 | 75 | include($mw_root."/maintenance/commandLine.inc"); |
— | — | @@ -104,34 +108,34 @@ |
105 | 109 | if (!$do_remove){ |
106 | 110 | // Now do the actual creating of tables. |
107 | 111 | foreach ($create_scripts as $table => $scripts) { |
108 | | - if (!$db_tables[$table]){ |
| 112 | + if (!array_key_exists($table, $db_tables)){ |
109 | 113 | foreach ($scripts as $script){ |
110 | | - $db_root->query($script); |
| 114 | + $db_root->query($script); |
111 | 115 | } |
112 | 116 | } |
113 | 117 | } |
114 | 118 | // Now do the actual creating of indexes. |
115 | 119 | foreach ($create_index_scripts as $table => $idxs){ |
116 | 120 | foreach ($idxs as $name => $idx){ |
117 | | - if(!$db_indexes[$table][$name]){ |
118 | | - $db_root->query($idx); |
| 121 | + if(!array_key_exists($name, $db_indexes[$table])){ |
| 122 | + $db_root->query($idx); |
119 | 123 | } |
120 | 124 | } |
121 | 125 | } |
122 | 126 | } else { |
123 | 127 | // Or removing. |
124 | 128 | foreach ($remove_scripts as $table => $scripts) { |
125 | | - if ($db_tables[$table]){ |
| 129 | + if (array_key_exists($table, $db_tables)){ |
126 | 130 | foreach ($scripts as $script){ |
127 | | - $db_root->query($script); |
| 131 | + $db_root->query($script); |
128 | 132 | } |
129 | 133 | } |
130 | 134 | } |
131 | 135 | // ...Of indexes. |
132 | 136 | foreach ($remove_index_scripts as $table => $idxs){ |
133 | 137 | foreach ($idxs as $name => $idx){ |
134 | | - if($db_indexes[$table][$name]){ |
135 | | - $db_root->query($idx); |
| 138 | + if(array_key_exists($name, $db_indexes[$table])){ |
| 139 | + $db_root->query($idx); |
136 | 140 | } |
137 | 141 | } |
138 | 142 | } |
Index: trunk/extensions/WikiTrust/batch/analysis/text.ml |
— | — | @@ -1053,4 +1053,21 @@ |
1054 | 1054 | |
1055 | 1055 | print_string (remove_html_comments "babba <!--gatto--->pollo\n") |
1056 | 1056 | |
1057 | | -end |
| 1057 | +end;; |
| 1058 | + |
| 1059 | +(* **************************************************************** *) |
| 1060 | +(* This code can be used to test the text splitting on very large pieces of text, |
| 1061 | + to figure out where it breaks. *) |
| 1062 | +if false then begin |
| 1063 | + let f = open_in "../../debug/big-revision.txt" in |
| 1064 | + let buf = ref (Textbuf.empty) in |
| 1065 | + let read_more = ref true in |
| 1066 | + while !read_more do begin |
| 1067 | + try |
| 1068 | + buf := Textbuf.add (input_line f) !buf |
| 1069 | + with End_of_file -> read_more := false |
| 1070 | + end done; |
| 1071 | + let text = Textbuf.get !buf in |
| 1072 | + let (word_v, _, _, _, _, _) = split_into_words_seps_and_info false text in |
| 1073 | + Printf.printf "Found %d words.\n" (Array.length word_v) |
| 1074 | +end;; |
Index: trunk/extensions/WikiTrust/batch/analysis/Makefile |
— | — | @@ -67,7 +67,7 @@ |
68 | 68 | |
69 | 69 | # Evalwiki does the batch evaluation |
70 | 70 | |
71 | | -OUR_EVALWIKI_OBJS = text.cmo textbuf.cmo prioq.cmo \ |
| 71 | +OUR_EVALWIKI_OBJS = textbuf.cmo text.cmo prioq.cmo \ |
72 | 72 | coda.cmo editlist.cmo chdiff.cmo compute_edlist.cmo timeconv.cmo \ |
73 | 73 | eval_defs.cmo author_sig.cmo rephist.cmo revision.cmo prune_analysis.cmo \ |
74 | 74 | linear_analysis.cmo circbuf_analysis.cmo reputation_analysis.cmo \ |
— | — | @@ -76,7 +76,7 @@ |
77 | 77 | trust_origin_analysis.cmo revs_to_files_analysis.cmo word_frequency.cmo \ |
78 | 78 | page_factory.cmo do_eval.cmo evalwiki.cmo |
79 | 79 | |
80 | | -OUR_OPT_EVALWIKI_OBJS = text.cmx textbuf.cmx prioq.cmx \ |
| 80 | +OUR_OPT_EVALWIKI_OBJS = textbuf.cmx text.cmx prioq.cmx \ |
81 | 81 | coda.cmx editlist.cmx chdiff.cmx compute_edlist.cmx timeconv.cmx \ |
82 | 82 | eval_defs.cmx author_sig.cmx revision.cmx rephist.cmx prune_analysis.cmx \ |
83 | 83 | linear_analysis.cmx circbuf_analysis.cmx reputation_analysis.cmx \ |
— | — | @@ -88,11 +88,11 @@ |
89 | 89 | |
90 | 90 | # Generate_Reputation computes the reputation histories |
91 | 91 | |
92 | | -OUR_GENERATE_REPUTATION_OBJS = timeconv.cmo text.cmo \ |
| 92 | +OUR_GENERATE_REPUTATION_OBJS = timeconv.cmo textbuf.cmo text.cmo \ |
93 | 93 | eval_defs.cmo rephist.cmo evaltypes.cmo wikidata.cmo \ |
94 | 94 | computestats.cmo computerep.cmo generate_reputation.cmo |
95 | 95 | |
96 | | -OUR_OPT_GENERATE_REPUTATION_OBJS = timeconv.cmx text.cmx \ |
| 96 | +OUR_OPT_GENERATE_REPUTATION_OBJS = timeconv.cmx textbuf.cmx text.cmx \ |
97 | 97 | eval_defs.cmx rephist.cmx evaltypes.cmx wikidata.cmx \ |
98 | 98 | computestats.cmx computerep.cmx generate_reputation.cmx |
99 | 99 | |
— | — | @@ -103,9 +103,9 @@ |
104 | 104 | OUR_EXTRACTWIKI_OBJS = extract_wiki_subset.cmo |
105 | 105 | OUR_OPT_EXTRACTWIKI_OBJS = extract_wiki_subset.cmx |
106 | 106 | |
107 | | -CHDIFF_OBJS = text.cmo prioq.cmo coda.cmo editlist.cmo chdiff.cmo |
| 107 | +CHDIFF_OBJS = textbuf.cmo text.cmo prioq.cmo coda.cmo editlist.cmo chdiff.cmo |
108 | 108 | |
109 | | -TEXT_OBJS = text.cmo |
| 109 | +TEXT_OBJS = textbuf.cmo text.cmo |
110 | 110 | |
111 | 111 | TIMECONV_OBJS = timeconv.cmo |
112 | 112 | |
Index: trunk/extensions/WikiTrust/batch/analysis/compute_robust_trust.ml |
— | — | @@ -387,11 +387,22 @@ |
388 | 388 | for i = 0 to len0 - 1 do begin |
389 | 389 | let old_trust = new_chunks_trust_a.(0).(i) in |
390 | 390 | if rep_float > old_trust then begin |
391 | | - let new_trust = old_trust +. (rep_float -. old_trust) *. trust_coeff_read_all in |
| 391 | + let increased_trust = old_trust +. (rep_float -. old_trust) *. trust_coeff_read_all in |
392 | 392 | (* Here I know that new_trust > old_trust *) |
393 | 393 | if new_chunks_canincrease_a.(0).(i) then begin |
394 | | - new_chunks_trust_a.(0).(i) <- new_trust; |
| 394 | + (* If the author can increase the reputation, because it does not appear in the |
| 395 | + signature, it increases it. *) |
| 396 | + new_chunks_trust_a.(0).(i) <- increased_trust; |
395 | 397 | new_chunks_hasincreased_a.(0).(i) <- true; |
| 398 | + end else begin |
| 399 | + (* The author cannot perform a normal reputation increase, because it appears in |
| 400 | + the signatures. Nevertheless, it is still reasonable to ensure that the text |
| 401 | + has at least the same trust as freshly created text by the same author. *) |
| 402 | + if old_trust < new_text_trust then begin |
| 403 | + new_chunks_trust_a.(0).(i) <- new_text_trust; |
| 404 | + (* As the signature is already present, we do not re-add it, so we do not set |
| 405 | + new_chunks_hasincreased_a.(0).(i) <- true *) |
| 406 | + end |
396 | 407 | end |
397 | 408 | end |
398 | 409 | end done; |
Index: trunk/extensions/WikiTrust/batch/analysis/README |
— | — | @@ -0,0 +1,3 @@ |
| 2 | +Debugging command line: |
| 3 | + |
| 4 | +ocamldebug -I `ocamlfind query unix` -I `ocamlfind query str` -I `ocamlfind query vec` -I `ocamlfind query mapmin` -I `ocamlfind query hashtbl_bounded` -I `ocamlfind query fileinfo` -I `ocamlfind query intvmap` -I `ocamlfind query extlib` -I `ocamlfind query mysql` -I `ocamlfind query sexplib` ./text |
Index: trunk/extensions/WikiTrust/analysis/online_types.ml |
— | — | @@ -82,6 +82,8 @@ |
83 | 83 | mutable max_del_time_chunk : float; |
84 | 84 | (** max n. of revisions for which a chunk can be deleted before being discarded *) |
85 | 85 | mutable max_del_revs_chunk : int; |
| 86 | + (** Max n. of words in a deleted chunk (if longer, it is truncated) *) |
| 87 | + mutable max_dead_chunk_len : int; |
86 | 88 | (** how much reputation is lent as trust for new text *) |
87 | 89 | mutable lends_rep : float; |
88 | 90 | (** how much the text of revised articles raises in trust towards the |
— | — | @@ -135,6 +137,7 @@ |
136 | 138 | hi_rep_list_threshold = 6.0; |
137 | 139 | max_del_time_chunk = 90. *. 24. *. 3600.; (* 3 months *) |
138 | 140 | max_del_revs_chunk = 100; |
| 141 | + max_dead_chunk_len = 10000; |
139 | 142 | lends_rep = 0.4; |
140 | 143 | read_all = 0.2; |
141 | 144 | read_part = 0.2; |
Index: trunk/extensions/WikiTrust/analysis/online_page.ml |
— | — | @@ -602,16 +602,27 @@ |
603 | 603 | (* First of all, makes a Vec of chunk_t, and copies there the information. *) |
604 | 604 | let chunk_v = ref Vec.empty in |
605 | 605 | for i = 1 to Array.length (new_chunks_a) - 1 do begin |
606 | | - let c = { |
607 | | - timestamp = 0.; (* we will fix this later *) |
608 | | - n_del_revisions = 0; (* we will fix this later *) |
609 | | - text = new_chunks_a.(i); |
610 | | - trust = new_trust_a.(i); |
611 | | - sigs = new_sigs_a.(i); |
612 | | - origin = new_origin_a.(i); |
613 | | - author = new_author_a.(i); |
614 | | - } in |
615 | | - chunk_v := Vec.append c !chunk_v |
| 606 | + (* If the chunk is too long, we truncate it. *) |
| 607 | + let c = |
| 608 | + if (Array.length new_chunks_a.(i)) > trust_coeff.max_dead_chunk_len |
| 609 | + then { |
| 610 | + timestamp = 0.; (* we will fix this later *) |
| 611 | + n_del_revisions = 0; (* we will fix this later *) |
| 612 | + text = Array.sub new_chunks_a.(i) 0 trust_coeff.max_dead_chunk_len; |
| 613 | + trust = Array.sub new_trust_a.(i) 0 trust_coeff.max_dead_chunk_len; |
| 614 | + sigs = Array.sub new_sigs_a.(i) 0 trust_coeff.max_dead_chunk_len; |
| 615 | + origin = Array.sub new_origin_a.(i) 0 trust_coeff.max_dead_chunk_len; |
| 616 | + author = Array.sub new_author_a.(i) 0 trust_coeff.max_dead_chunk_len; |
| 617 | + } else { |
| 618 | + timestamp = 0.; (* we will fix this later *) |
| 619 | + n_del_revisions = 0; (* we will fix this later *) |
| 620 | + text = new_chunks_a.(i); |
| 621 | + trust = new_trust_a.(i); |
| 622 | + sigs = new_sigs_a.(i); |
| 623 | + origin = new_origin_a.(i); |
| 624 | + author = new_author_a.(i); |
| 625 | + } |
| 626 | + in chunk_v := Vec.append c !chunk_v |
616 | 627 | end done; |
617 | 628 | let original_chunk_a = Array.of_list original_chunk_l in |
618 | 629 | (* Then, uses medit_l to update the age and timestamp information *) |
— | — | @@ -647,7 +658,7 @@ |
648 | 659 | || |
649 | 660 | (c.n_del_revisions < trust_coeff.max_del_revs_chunk) |
650 | 661 | in |
651 | | - let chunk_v' = Vec.filter p !chunk_v in |
| 662 | + let chunk_v' = Vec.filter p !chunk_v in |
652 | 663 | (* Finally, makes a list of these chunks *) |
653 | 664 | Vec.to_list chunk_v' |
654 | 665 | |
Index: trunk/extensions/WikiTrust/analysis/README |
— | — | @@ -1,13 +1,6 @@ |
2 | | -Packages to install (in Ubuntu / Debian): |
| 2 | +Debugging command line: |
3 | 3 | |
4 | | -ocaml-findlib |
5 | | -libmysql-ocaml |
6 | | -libmysql-ocaml-dev |
7 | | -libextlib-ocaml-dev |
| 4 | +ocamldebug -I `ocamlfind query unix` -I `ocamlfind query str` -I `ocamlfind query vec` -I `ocamlfind query mapmin` -I `ocamlfind query hashtbl_bounded` -I `ocamlfind query fileinfo` -I `ocamlfind query intvmap` -I `ocamlfind query extlib` -I `ocamlfind query mysql` -I `ocamlfind query sexplib` -I ../batch/analysis ./eval_online_wiki -delete_all -dump_db_calls -db_user wikiuser -db_pass localwiki -db_name wikidb -log_file ~/test/replog20.log -n_events 500 |
8 | 5 | |
9 | | -To make (both all and allopt): |
10 | 6 | |
11 | | -OcamlLdaLibs |
12 | | -batch/analysis |
13 | 7 | |
14 | | - |
Index: trunk/extensions/WikiTrust/analysis/online_revision.ml |
— | — | @@ -108,8 +108,10 @@ |
109 | 109 | (* Reads the revision text from the db, and splits it appropriately *) |
110 | 110 | method read_text : unit = |
111 | 111 | try |
112 | | - let text_vec = Vec.singleton (db#read_rev_text text_id) in |
113 | | - let (w, t, o, a, s_idx, s) = Text.split_into_words_seps_and_info false text_vec in |
| 112 | + (* We have to use Textbuf here to split text into smaller chunks, |
| 113 | + since otherwise Text chokes on it *) |
| 114 | + let buf = Textbuf.add (db#read_rev_text text_id) Textbuf.empty in |
| 115 | + let (w, t, o, a, s_idx, s) = Text.split_into_words_seps_and_info false (Textbuf.get buf) in |
114 | 116 | words <- w; |
115 | 117 | seps <- s; |
116 | 118 | sep_word_idx <- s_idx; |
— | — | @@ -133,8 +135,10 @@ |
134 | 136 | (* Not found: we parse the colored text. If this is also not found, |
135 | 137 | we let the error pop up, so that the caller knows that the revision |
136 | 138 | needs to be colored. *) |
137 | | - let text_vec = Vec.singleton (db#read_colored_markup rev_id) in |
138 | | - let (w, t, o, a, s_idx, s) = Text.split_into_words_seps_and_info false text_vec in |
| 139 | + (* We have to use Textbuf here to split text into smaller chunks, |
| 140 | + since otherwise Text chokes on it *) |
| 141 | + let buf = Textbuf.add (db#read_colored_markup rev_id) Textbuf.empty in |
| 142 | + let (w, t, o, a, s_idx, s) = Text.split_into_words_seps_and_info false (Textbuf.get buf) in |
139 | 143 | words <- w; |
140 | 144 | trust <- t; |
141 | 145 | origin <- o; |
Index: trunk/extensions/WikiTrust/mediawiki/extensions/Trust/Trust.php |
— | — | @@ -564,7 +564,10 @@ |
565 | 565 | if (!$this->title){ |
566 | 566 | $this->title = $parser->getTitle(); |
567 | 567 | } |
568 | | - |
| 568 | + |
| 569 | + // count the number of times we load this text |
| 570 | + $this->times_rev_loaded++; |
| 571 | + |
569 | 572 | // Load the current revision id. |
570 | 573 | if (!$this->current_rev){ |
571 | 574 | if ($parser->mRevisionId){ |
— | — | @@ -574,23 +577,26 @@ |
575 | 578 | $this->current_rev = $this->title->getPreviousRevisionID( PHP_INT_MAX ); |
576 | 579 | } |
577 | 580 | } |
578 | | - |
579 | | - /** |
580 | | - This method is being called multiple times for each page. |
581 | | - We only pull the colored text for the first time through. |
582 | | - */ |
583 | | - if ($this->colored){ |
584 | | - return true; |
585 | | - } |
586 | | - |
587 | | - if ($wgRequest->getVal('diff')){ |
588 | | - $this->times_rev_loaded++; |
589 | | - // For diffs, look for the absence of the diff token instead of counting |
590 | | - if(substr($text,0,3) == self::DIFF_TOKEN_TO_COLOR){ |
591 | | - return true; |
592 | | - } |
593 | | - } |
594 | | - |
| 581 | + |
| 582 | + /** |
| 583 | + This method is being called multiple times for each page. |
| 584 | + We only pull the colored text for the first time through. |
| 585 | + */ |
| 586 | + if ($this->colored){ |
| 587 | + return true; |
| 588 | + } |
| 589 | + |
| 590 | + if (strstr($text, "{{ns:project}}")) { |
| 591 | + return true; |
| 592 | + } |
| 593 | + |
| 594 | + if ($wgRequest->getVal('diff')){ |
| 595 | + // For diffs, look for the absence of the diff token instead of counting |
| 596 | + if(substr($text,0,3) == self::DIFF_TOKEN_TO_COLOR){ |
| 597 | + return true; |
| 598 | + } |
| 599 | + } |
| 600 | + |
595 | 601 | // if we made it here, we are going to color some text |
596 | 602 | $this->colored = true; |
597 | 603 | |
— | — | @@ -606,7 +612,7 @@ |
607 | 613 | |
608 | 614 | // Now update the text. |
609 | 615 | $text = $voteitText . $colored_text . "\n" . $wgTrustExplanation; |
610 | | - } else { |
| 616 | + } else { |
611 | 617 | // If the colored text is missing, generate it in the background. |
612 | 618 | // For now, return a message about the missing text. |
613 | 619 | self::runEvalEdit(self::TRUST_EVAL_MISSING); |
— | — | @@ -615,7 +621,6 @@ |
616 | 622 | } else { |
617 | 623 | return false; |
618 | 624 | } |
619 | | - |
620 | 625 | $dbr->freeResult( $res ); |
621 | 626 | return true; |
622 | 627 | } |
Index: trunk/extensions/WikiTrust/mediawiki/extensions/Trust/js/tip_centerwindow.js |
— | — | @@ -1,104 +1,104 @@ |
2 | | -/* |
3 | | -tip_centerwindow.js v. 1.21 |
4 | | - |
5 | | -The latest version is available at |
6 | | -http://www.walterzorn.com |
7 | | -or http://www.devira.com |
8 | | -or http://www.walterzorn.de |
9 | | - |
10 | | -Initial author: Walter Zorn |
11 | | -Last modified: 3.6.2008 |
12 | | - |
13 | | -Extension for the tooltip library wz_tooltip.js. |
14 | | -Centers a sticky tooltip in the window's visible clientarea, |
15 | | -optionally even if the window is being scrolled or resized. |
16 | | -*/ |
17 | | - |
18 | | -// Make sure that the core file wz_tooltip.js is included first |
19 | | -if(typeof config == "undefined") |
20 | | - alert("Error:\nThe core tooltip script file 'wz_tooltip.js' must be included first, before the plugin files!"); |
21 | | - |
22 | | -// Here we define new global configuration variable(s) (as members of the |
23 | | -// predefined "config." class). |
24 | | -// From each of these config variables, wz_tooltip.js will automatically derive |
25 | | -// a command which can be passed to Tip() or TagToTip() in order to customize |
26 | | -// tooltips individually. These command names are just the config variable |
27 | | -// name(s) translated to uppercase, |
28 | | -// e.g. from config. CenterWindow a command CENTERWINDOW will automatically be |
29 | | -// created. |
30 | | - |
31 | | -//=================== GLOBAL TOOLTIP CONFIGURATION =========================// |
32 | | -config. CenterWindow = false // true or false - set to true if you want this to be the default behaviour |
33 | | -config. CenterAlways = false // true or false - recenter if window is resized or scrolled |
34 | | -//======= END OF TOOLTIP CONFIG, DO NOT CHANGE ANYTHING BELOW ==============// |
35 | | - |
36 | | - |
37 | | -// Create a new tt_Extension object (make sure that the name of that object, |
38 | | -// here ctrwnd, is unique amongst the extensions available for |
39 | | -// wz_tooltips.js): |
40 | | -var ctrwnd = new tt_Extension(); |
41 | | - |
42 | | -// Implement extension eventhandlers on which our extension should react |
43 | | -ctrwnd.OnLoadConfig = function() |
44 | | -{ |
45 | | - if(tt_aV[CENTERWINDOW]) |
46 | | - { |
47 | | - // Permit CENTERWINDOW only if the tooltip is sticky |
48 | | - if(tt_aV[STICKY]) |
49 | | - { |
50 | | - if(tt_aV[CENTERALWAYS]) |
51 | | - { |
52 | | - // IE doesn't support style.position "fixed" |
53 | | - if(tt_ie) |
54 | | - tt_AddEvtFnc(window, "scroll", Ctrwnd_DoCenter); |
55 | | - else |
56 | | - tt_aElt[0].style.position = "fixed"; |
57 | | - tt_AddEvtFnc(window, "resize", Ctrwnd_DoCenter); |
58 | | - } |
59 | | - return true; |
60 | | - } |
61 | | - tt_aV[CENTERWINDOW] = false; |
62 | | - } |
63 | | - return false; |
64 | | -}; |
65 | | -// We react on the first OnMouseMove event to center the tip on that occasion |
66 | | -ctrwnd.OnMoveBefore = Ctrwnd_DoCenter; |
67 | | -ctrwnd.OnKill = function() |
68 | | -{ |
69 | | - if(tt_aV[CENTERWINDOW] && tt_aV[CENTERALWAYS]) |
70 | | - { |
71 | | - tt_RemEvtFnc(window, "resize", Ctrwnd_DoCenter); |
72 | | - if(tt_ie) |
73 | | - tt_RemEvtFnc(window, "scroll", Ctrwnd_DoCenter); |
74 | | - else |
75 | | - tt_aElt[0].style.position = "absolute"; |
76 | | - } |
77 | | - return false; |
78 | | -}; |
79 | | -// Helper function |
80 | | -function Ctrwnd_DoCenter() |
81 | | -{ |
82 | | - if(tt_aV[CENTERWINDOW]) |
83 | | - { |
84 | | - var x, y, dx, dy; |
85 | | - |
86 | | - // Here we use some functions and variables (tt_w, tt_h) which the |
87 | | - // extension API of wz_tooltip.js provides for us |
88 | | - if(tt_ie || !tt_aV[CENTERALWAYS]) |
89 | | - { |
90 | | - dx = tt_GetScrollX(); |
91 | | - dy = tt_GetScrollY(); |
92 | | - } |
93 | | - else |
94 | | - { |
95 | | - dx = 0; |
96 | | - dy = 0; |
97 | | - } |
98 | | - // Position the tip, offset from the center by OFFSETX and OFFSETY |
99 | | - x = (tt_GetClientW() - tt_w) / 2 + dx + tt_aV[OFFSETX]; |
100 | | - y = (tt_GetClientH() - tt_h) / 2 + dy + tt_aV[OFFSETY]; |
101 | | - tt_SetTipPos(x, y); |
102 | | - return true; |
103 | | - } |
104 | | - return false; |
105 | | -} |
| 2 | +/*
|
| 3 | +tip_centerwindow.js v. 1.21
|
| 4 | +
|
| 5 | +The latest version is available at
|
| 6 | +http://www.walterzorn.com
|
| 7 | +or http://www.devira.com
|
| 8 | +or http://www.walterzorn.de
|
| 9 | +
|
| 10 | +Initial author: Walter Zorn
|
| 11 | +Last modified: 3.6.2008
|
| 12 | +
|
| 13 | +Extension for the tooltip library wz_tooltip.js.
|
| 14 | +Centers a sticky tooltip in the window's visible clientarea,
|
| 15 | +optionally even if the window is being scrolled or resized.
|
| 16 | +*/
|
| 17 | +
|
| 18 | +// Make sure that the core file wz_tooltip.js is included first
|
| 19 | +if(typeof config == "undefined")
|
| 20 | + alert("Error:\nThe core tooltip script file 'wz_tooltip.js' must be included first, before the plugin files!");
|
| 21 | +
|
| 22 | +// Here we define new global configuration variable(s) (as members of the
|
| 23 | +// predefined "config." class).
|
| 24 | +// From each of these config variables, wz_tooltip.js will automatically derive
|
| 25 | +// a command which can be passed to Tip() or TagToTip() in order to customize
|
| 26 | +// tooltips individually. These command names are just the config variable
|
| 27 | +// name(s) translated to uppercase,
|
| 28 | +// e.g. from config. CenterWindow a command CENTERWINDOW will automatically be
|
| 29 | +// created.
|
| 30 | +
|
| 31 | +//=================== GLOBAL TOOLTIP CONFIGURATION =========================//
|
| 32 | +config. CenterWindow = false // true or false - set to true if you want this to be the default behaviour
|
| 33 | +config. CenterAlways = false // true or false - recenter if window is resized or scrolled
|
| 34 | +//======= END OF TOOLTIP CONFIG, DO NOT CHANGE ANYTHING BELOW ==============//
|
| 35 | +
|
| 36 | +
|
| 37 | +// Create a new tt_Extension object (make sure that the name of that object,
|
| 38 | +// here ctrwnd, is unique amongst the extensions available for
|
| 39 | +// wz_tooltips.js):
|
| 40 | +var ctrwnd = new tt_Extension();
|
| 41 | +
|
| 42 | +// Implement extension eventhandlers on which our extension should react
|
| 43 | +ctrwnd.OnLoadConfig = function()
|
| 44 | +{
|
| 45 | + if(tt_aV[CENTERWINDOW])
|
| 46 | + {
|
| 47 | + // Permit CENTERWINDOW only if the tooltip is sticky
|
| 48 | + if(tt_aV[STICKY])
|
| 49 | + {
|
| 50 | + if(tt_aV[CENTERALWAYS])
|
| 51 | + {
|
| 52 | + // IE doesn't support style.position "fixed"
|
| 53 | + if(tt_ie)
|
| 54 | + tt_AddEvtFnc(window, "scroll", Ctrwnd_DoCenter);
|
| 55 | + else
|
| 56 | + tt_aElt[0].style.position = "fixed";
|
| 57 | + tt_AddEvtFnc(window, "resize", Ctrwnd_DoCenter);
|
| 58 | + }
|
| 59 | + return true;
|
| 60 | + }
|
| 61 | + tt_aV[CENTERWINDOW] = false;
|
| 62 | + }
|
| 63 | + return false;
|
| 64 | +};
|
| 65 | +// We react on the first OnMouseMove event to center the tip on that occasion
|
| 66 | +ctrwnd.OnMoveBefore = Ctrwnd_DoCenter;
|
| 67 | +ctrwnd.OnKill = function()
|
| 68 | +{
|
| 69 | + if(tt_aV[CENTERWINDOW] && tt_aV[CENTERALWAYS])
|
| 70 | + {
|
| 71 | + tt_RemEvtFnc(window, "resize", Ctrwnd_DoCenter);
|
| 72 | + if(tt_ie)
|
| 73 | + tt_RemEvtFnc(window, "scroll", Ctrwnd_DoCenter);
|
| 74 | + else
|
| 75 | + tt_aElt[0].style.position = "absolute";
|
| 76 | + }
|
| 77 | + return false;
|
| 78 | +};
|
| 79 | +// Helper function
|
| 80 | +function Ctrwnd_DoCenter()
|
| 81 | +{
|
| 82 | + if(tt_aV[CENTERWINDOW])
|
| 83 | + {
|
| 84 | + var x, y, dx, dy;
|
| 85 | +
|
| 86 | + // Here we use some functions and variables (tt_w, tt_h) which the
|
| 87 | + // extension API of wz_tooltip.js provides for us
|
| 88 | + if(tt_ie || !tt_aV[CENTERALWAYS])
|
| 89 | + {
|
| 90 | + dx = tt_GetScrollX();
|
| 91 | + dy = tt_GetScrollY();
|
| 92 | + }
|
| 93 | + else
|
| 94 | + {
|
| 95 | + dx = 0;
|
| 96 | + dy = 0;
|
| 97 | + }
|
| 98 | + // Position the tip, offset from the center by OFFSETX and OFFSETY
|
| 99 | + x = (tt_GetClientW() - tt_w) / 2 + dx + tt_aV[OFFSETX];
|
| 100 | + y = (tt_GetClientH() - tt_h) / 2 + dy + tt_aV[OFFSETY];
|
| 101 | + tt_SetTipPos(x, y);
|
| 102 | + return true;
|
| 103 | + }
|
| 104 | + return false;
|
| 105 | +}
|
Index: trunk/extensions/WikiTrust/mediawiki/extensions/Trust/js/tip_followscroll.js |
— | — | @@ -1,88 +1,88 @@ |
2 | | -/* |
3 | | -tip_followscroll.js v. 1.11 |
4 | | - |
5 | | -The latest version is available at |
6 | | -http://www.walterzorn.com |
7 | | -or http://www.devira.com |
8 | | -or http://www.walterzorn.de |
9 | | - |
10 | | -Initial author: Walter Zorn |
11 | | -Last modified: 3.6.2008 |
12 | | - |
13 | | -Extension for the tooltip library wz_tooltip.js. |
14 | | -Lets a "sticky" tooltip keep its position inside the clientarea if the window |
15 | | -is scrolled. |
16 | | -*/ |
17 | | - |
18 | | -// Make sure that the core file wz_tooltip.js is included first |
19 | | -if(typeof config == "undefined") |
20 | | - alert("Error:\nThe core tooltip script file 'wz_tooltip.js' must be included first, before the plugin files!"); |
21 | | - |
22 | | -// Here we define new global configuration variable(s) (as members of the |
23 | | -// predefined "config." class). |
24 | | -// From each of these config variables, wz_tooltip.js will automatically derive |
25 | | -// a command which can be passed to Tip() or TagToTip() in order to customize |
26 | | -// tooltips individually. These command names are just the config variable |
27 | | -// name(s) translated to uppercase, |
28 | | -// e.g. from config. FollowScroll a command FOLLOWSCROLL will automatically be |
29 | | -// created. |
30 | | - |
31 | | -//=================== GLOBAL TOOLTIP CONFIGURATION ======================// |
32 | | -config. FollowScroll = false // true or false - set to true if you want this to be the default behaviour |
33 | | -//======= END OF TOOLTIP CONFIG, DO NOT CHANGE ANYTHING BELOW ==============// |
34 | | - |
35 | | - |
36 | | -// Create a new tt_Extension object (make sure that the name of that object, |
37 | | -// here fscrl, is unique amongst the extensions available for |
38 | | -// wz_tooltips.js): |
39 | | -var fscrl = new tt_Extension(); |
40 | | - |
41 | | -// Implement extension eventhandlers on which our extension should react |
42 | | -fscrl.OnShow = function() |
43 | | -{ |
44 | | - if(tt_aV[FOLLOWSCROLL]) |
45 | | - { |
46 | | - // Permit FOLLOWSCROLL only if the tooltip is sticky |
47 | | - if(tt_aV[STICKY]) |
48 | | - { |
49 | | - var x = tt_x - tt_GetScrollX(), y = tt_y - tt_GetScrollY(); |
50 | | - |
51 | | - if(tt_ie) |
52 | | - { |
53 | | - fscrl.MoveOnScrl.offX = x; |
54 | | - fscrl.MoveOnScrl.offY = y; |
55 | | - fscrl.AddRemEvtFncs(tt_AddEvtFnc); |
56 | | - } |
57 | | - else |
58 | | - { |
59 | | - tt_SetTipPos(x, y); |
60 | | - tt_aElt[0].style.position = "fixed"; |
61 | | - } |
62 | | - return true; |
63 | | - } |
64 | | - tt_aV[FOLLOWSCROLL] = false; |
65 | | - } |
66 | | - return false; |
67 | | -}; |
68 | | -fscrl.OnHide = function() |
69 | | -{ |
70 | | - if(tt_aV[FOLLOWSCROLL]) |
71 | | - { |
72 | | - if(tt_ie) |
73 | | - fscrl.AddRemEvtFncs(tt_RemEvtFnc); |
74 | | - else |
75 | | - tt_aElt[0].style.position = "absolute"; |
76 | | - } |
77 | | -}; |
78 | | -// Helper functions (encapsulate in the class to avoid conflicts with other |
79 | | -// extensions) |
80 | | -fscrl.MoveOnScrl = function() |
81 | | -{ |
82 | | - tt_SetTipPos(fscrl.MoveOnScrl.offX + tt_GetScrollX(), fscrl.MoveOnScrl.offY + tt_GetScrollY()); |
83 | | -}; |
84 | | -fscrl.AddRemEvtFncs = function(PAddRem) |
85 | | -{ |
86 | | - PAddRem(window, "resize", fscrl.MoveOnScrl); |
87 | | - PAddRem(window, "scroll", fscrl.MoveOnScrl); |
88 | | -}; |
89 | | - |
| 2 | +/*
|
| 3 | +tip_followscroll.js v. 1.11
|
| 4 | +
|
| 5 | +The latest version is available at
|
| 6 | +http://www.walterzorn.com
|
| 7 | +or http://www.devira.com
|
| 8 | +or http://www.walterzorn.de
|
| 9 | +
|
| 10 | +Initial author: Walter Zorn
|
| 11 | +Last modified: 3.6.2008
|
| 12 | +
|
| 13 | +Extension for the tooltip library wz_tooltip.js.
|
| 14 | +Lets a "sticky" tooltip keep its position inside the clientarea if the window
|
| 15 | +is scrolled.
|
| 16 | +*/
|
| 17 | +
|
| 18 | +// Make sure that the core file wz_tooltip.js is included first
|
| 19 | +if(typeof config == "undefined")
|
| 20 | + alert("Error:\nThe core tooltip script file 'wz_tooltip.js' must be included first, before the plugin files!");
|
| 21 | +
|
| 22 | +// Here we define new global configuration variable(s) (as members of the
|
| 23 | +// predefined "config." class).
|
| 24 | +// From each of these config variables, wz_tooltip.js will automatically derive
|
| 25 | +// a command which can be passed to Tip() or TagToTip() in order to customize
|
| 26 | +// tooltips individually. These command names are just the config variable
|
| 27 | +// name(s) translated to uppercase,
|
| 28 | +// e.g. from config. FollowScroll a command FOLLOWSCROLL will automatically be
|
| 29 | +// created.
|
| 30 | +
|
| 31 | +//=================== GLOBAL TOOLTIP CONFIGURATION ======================//
|
| 32 | +config. FollowScroll = false // true or false - set to true if you want this to be the default behaviour
|
| 33 | +//======= END OF TOOLTIP CONFIG, DO NOT CHANGE ANYTHING BELOW ==============//
|
| 34 | +
|
| 35 | +
|
| 36 | +// Create a new tt_Extension object (make sure that the name of that object,
|
| 37 | +// here fscrl, is unique amongst the extensions available for
|
| 38 | +// wz_tooltips.js):
|
| 39 | +var fscrl = new tt_Extension();
|
| 40 | +
|
| 41 | +// Implement extension eventhandlers on which our extension should react
|
| 42 | +fscrl.OnShow = function()
|
| 43 | +{
|
| 44 | + if(tt_aV[FOLLOWSCROLL])
|
| 45 | + {
|
| 46 | + // Permit FOLLOWSCROLL only if the tooltip is sticky
|
| 47 | + if(tt_aV[STICKY])
|
| 48 | + {
|
| 49 | + var x = tt_x - tt_GetScrollX(), y = tt_y - tt_GetScrollY();
|
| 50 | +
|
| 51 | + if(tt_ie)
|
| 52 | + {
|
| 53 | + fscrl.MoveOnScrl.offX = x;
|
| 54 | + fscrl.MoveOnScrl.offY = y;
|
| 55 | + fscrl.AddRemEvtFncs(tt_AddEvtFnc);
|
| 56 | + }
|
| 57 | + else
|
| 58 | + {
|
| 59 | + tt_SetTipPos(x, y);
|
| 60 | + tt_aElt[0].style.position = "fixed";
|
| 61 | + }
|
| 62 | + return true;
|
| 63 | + }
|
| 64 | + tt_aV[FOLLOWSCROLL] = false;
|
| 65 | + }
|
| 66 | + return false;
|
| 67 | +};
|
| 68 | +fscrl.OnHide = function()
|
| 69 | +{
|
| 70 | + if(tt_aV[FOLLOWSCROLL])
|
| 71 | + {
|
| 72 | + if(tt_ie)
|
| 73 | + fscrl.AddRemEvtFncs(tt_RemEvtFnc);
|
| 74 | + else
|
| 75 | + tt_aElt[0].style.position = "absolute";
|
| 76 | + }
|
| 77 | +};
|
| 78 | +// Helper functions (encapsulate in the class to avoid conflicts with other
|
| 79 | +// extensions)
|
| 80 | +fscrl.MoveOnScrl = function()
|
| 81 | +{
|
| 82 | + tt_SetTipPos(fscrl.MoveOnScrl.offX + tt_GetScrollX(), fscrl.MoveOnScrl.offY + tt_GetScrollY());
|
| 83 | +};
|
| 84 | +fscrl.AddRemEvtFncs = function(PAddRem)
|
| 85 | +{
|
| 86 | + PAddRem(window, "resize", fscrl.MoveOnScrl);
|
| 87 | + PAddRem(window, "scroll", fscrl.MoveOnScrl);
|
| 88 | +};
|
| 89 | +
|
Index: trunk/extensions/WikiTrust/README |
— | — | @@ -84,7 +84,7 @@ |
85 | 85 | $wgTrustTabText = "check text"; |
86 | 86 | $wgTrustExplanation = '{| border="1" cellpadding="5" cellspacing="0" style="background:lightgreen; color:black" |
87 | 87 | |- |
88 | | -| The above text is colored according to how much it has been revised. An orange background indicates new, unrevised, text; white is for text that has been revised by many reputed authors. If you click on a word, you will be redirected to the diff corresponding to the edit where the word was introduced. |
| 88 | +| The above text is colored according to how much it has been revised. An orange background indicates new, unrevised, text; white is for text that has been revised by many reputed authors. If you click on a word, you will be redirected to the diff corresponding to the edit where the word was introduced. If you hover over a word with the mouse pointer, a pop-up displays the name of the author of the word. |
89 | 89 | |- |
90 | 90 | | The text color and origin are computed by [http://trust.cse.ucsc.edu/WikiTrust WikiTrust]; if you notice problems, you can submit a bug report [http://code.google.com/p/wikitrust/issues here]. |
91 | 91 | |}'; |