r44886 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44885‎ | r44886 | r44887 >
Date:03:29, 22 December 2008
Author:ipye
Status:deferred
Tags:
Comment:
Merge branch 'ian-luca'
Modified paths:
  • /trunk/extensions/WikiTrust/README (modified) (history)
  • /trunk/extensions/WikiTrust/analysis/README (modified) (history)
  • /trunk/extensions/WikiTrust/analysis/online_page.ml (modified) (history)
  • /trunk/extensions/WikiTrust/analysis/online_revision.ml (modified) (history)
  • /trunk/extensions/WikiTrust/analysis/online_types.ml (modified) (history)
  • /trunk/extensions/WikiTrust/batch/analysis/Makefile (modified) (history)
  • /trunk/extensions/WikiTrust/batch/analysis/README (added) (history)
  • /trunk/extensions/WikiTrust/batch/analysis/compute_robust_trust.ml (modified) (history)
  • /trunk/extensions/WikiTrust/batch/analysis/text.ml (modified) (history)
  • /trunk/extensions/WikiTrust/mediawiki/extensions/Trust/Trust.php (modified) (history)
  • /trunk/extensions/WikiTrust/mediawiki/extensions/Trust/js/tip_centerwindow.js (modified) (history)
  • /trunk/extensions/WikiTrust/mediawiki/extensions/Trust/js/tip_followscroll.js (modified) (history)
  • /trunk/extensions/WikiTrust/sql/create_db.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiTrust/sql/create_db.php
@@ -52,19 +52,23 @@
5353 exit(0);
5454 }
5555
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+}
6973
7074 // Load all of the MW files.
7175 include($mw_root."/maintenance/commandLine.inc");
@@ -104,34 +108,34 @@
105109 if (!$do_remove){
106110 // Now do the actual creating of tables.
107111 foreach ($create_scripts as $table => $scripts) {
108 - if (!$db_tables[$table]){
 112+ if (!array_key_exists($table, $db_tables)){
109113 foreach ($scripts as $script){
110 - $db_root->query($script);
 114+ $db_root->query($script);
111115 }
112116 }
113117 }
114118 // Now do the actual creating of indexes.
115119 foreach ($create_index_scripts as $table => $idxs){
116120 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);
119123 }
120124 }
121125 }
122126 } else {
123127 // Or removing.
124128 foreach ($remove_scripts as $table => $scripts) {
125 - if ($db_tables[$table]){
 129+ if (array_key_exists($table, $db_tables)){
126130 foreach ($scripts as $script){
127 - $db_root->query($script);
 131+ $db_root->query($script);
128132 }
129133 }
130134 }
131135 // ...Of indexes.
132136 foreach ($remove_index_scripts as $table => $idxs){
133137 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);
136140 }
137141 }
138142 }
Index: trunk/extensions/WikiTrust/batch/analysis/text.ml
@@ -1053,4 +1053,21 @@
10541054
10551055 print_string (remove_html_comments "babba <!--gatto--->pollo\n")
10561056
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 @@
6868
6969 # Evalwiki does the batch evaluation
7070
71 -OUR_EVALWIKI_OBJS = text.cmo textbuf.cmo prioq.cmo \
 71+OUR_EVALWIKI_OBJS = textbuf.cmo text.cmo prioq.cmo \
7272 coda.cmo editlist.cmo chdiff.cmo compute_edlist.cmo timeconv.cmo \
7373 eval_defs.cmo author_sig.cmo rephist.cmo revision.cmo prune_analysis.cmo \
7474 linear_analysis.cmo circbuf_analysis.cmo reputation_analysis.cmo \
@@ -76,7 +76,7 @@
7777 trust_origin_analysis.cmo revs_to_files_analysis.cmo word_frequency.cmo \
7878 page_factory.cmo do_eval.cmo evalwiki.cmo
7979
80 -OUR_OPT_EVALWIKI_OBJS = text.cmx textbuf.cmx prioq.cmx \
 80+OUR_OPT_EVALWIKI_OBJS = textbuf.cmx text.cmx prioq.cmx \
8181 coda.cmx editlist.cmx chdiff.cmx compute_edlist.cmx timeconv.cmx \
8282 eval_defs.cmx author_sig.cmx revision.cmx rephist.cmx prune_analysis.cmx \
8383 linear_analysis.cmx circbuf_analysis.cmx reputation_analysis.cmx \
@@ -88,11 +88,11 @@
8989
9090 # Generate_Reputation computes the reputation histories
9191
92 -OUR_GENERATE_REPUTATION_OBJS = timeconv.cmo text.cmo \
 92+OUR_GENERATE_REPUTATION_OBJS = timeconv.cmo textbuf.cmo text.cmo \
9393 eval_defs.cmo rephist.cmo evaltypes.cmo wikidata.cmo \
9494 computestats.cmo computerep.cmo generate_reputation.cmo
9595
96 -OUR_OPT_GENERATE_REPUTATION_OBJS = timeconv.cmx text.cmx \
 96+OUR_OPT_GENERATE_REPUTATION_OBJS = timeconv.cmx textbuf.cmx text.cmx \
9797 eval_defs.cmx rephist.cmx evaltypes.cmx wikidata.cmx \
9898 computestats.cmx computerep.cmx generate_reputation.cmx
9999
@@ -103,9 +103,9 @@
104104 OUR_EXTRACTWIKI_OBJS = extract_wiki_subset.cmo
105105 OUR_OPT_EXTRACTWIKI_OBJS = extract_wiki_subset.cmx
106106
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
108108
109 -TEXT_OBJS = text.cmo
 109+TEXT_OBJS = textbuf.cmo text.cmo
110110
111111 TIMECONV_OBJS = timeconv.cmo
112112
Index: trunk/extensions/WikiTrust/batch/analysis/compute_robust_trust.ml
@@ -387,11 +387,22 @@
388388 for i = 0 to len0 - 1 do begin
389389 let old_trust = new_chunks_trust_a.(0).(i) in
390390 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
392392 (* Here I know that new_trust > old_trust *)
393393 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;
395397 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
396407 end
397408 end
398409 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 @@
8383 mutable max_del_time_chunk : float;
8484 (** max n. of revisions for which a chunk can be deleted before being discarded *)
8585 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;
8688 (** how much reputation is lent as trust for new text *)
8789 mutable lends_rep : float;
8890 (** how much the text of revised articles raises in trust towards the
@@ -135,6 +137,7 @@
136138 hi_rep_list_threshold = 6.0;
137139 max_del_time_chunk = 90. *. 24. *. 3600.; (* 3 months *)
138140 max_del_revs_chunk = 100;
 141+ max_dead_chunk_len = 10000;
139142 lends_rep = 0.4;
140143 read_all = 0.2;
141144 read_part = 0.2;
Index: trunk/extensions/WikiTrust/analysis/online_page.ml
@@ -602,16 +602,27 @@
603603 (* First of all, makes a Vec of chunk_t, and copies there the information. *)
604604 let chunk_v = ref Vec.empty in
605605 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
616627 end done;
617628 let original_chunk_a = Array.of_list original_chunk_l in
618629 (* Then, uses medit_l to update the age and timestamp information *)
@@ -647,7 +658,7 @@
648659 ||
649660 (c.n_del_revisions < trust_coeff.max_del_revs_chunk)
650661 in
651 - let chunk_v' = Vec.filter p !chunk_v in
 662+ let chunk_v' = Vec.filter p !chunk_v in
652663 (* Finally, makes a list of these chunks *)
653664 Vec.to_list chunk_v'
654665
Index: trunk/extensions/WikiTrust/analysis/README
@@ -1,13 +1,6 @@
2 -Packages to install (in Ubuntu / Debian):
 2+Debugging command line:
33
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
85
9 -To make (both all and allopt):
106
11 -OcamlLdaLibs
12 -batch/analysis
137
14 -
Index: trunk/extensions/WikiTrust/analysis/online_revision.ml
@@ -108,8 +108,10 @@
109109 (* Reads the revision text from the db, and splits it appropriately *)
110110 method read_text : unit =
111111 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
114116 words <- w;
115117 seps <- s;
116118 sep_word_idx <- s_idx;
@@ -133,8 +135,10 @@
134136 (* Not found: we parse the colored text. If this is also not found,
135137 we let the error pop up, so that the caller knows that the revision
136138 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
139143 words <- w;
140144 trust <- t;
141145 origin <- o;
Index: trunk/extensions/WikiTrust/mediawiki/extensions/Trust/Trust.php
@@ -564,7 +564,10 @@
565565 if (!$this->title){
566566 $this->title = $parser->getTitle();
567567 }
568 -
 568+
 569+ // count the number of times we load this text
 570+ $this->times_rev_loaded++;
 571+
569572 // Load the current revision id.
570573 if (!$this->current_rev){
571574 if ($parser->mRevisionId){
@@ -574,23 +577,26 @@
575578 $this->current_rev = $this->title->getPreviousRevisionID( PHP_INT_MAX );
576579 }
577580 }
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+
595601 // if we made it here, we are going to color some text
596602 $this->colored = true;
597603
@@ -606,7 +612,7 @@
607613
608614 // Now update the text.
609615 $text = $voteitText . $colored_text . "\n" . $wgTrustExplanation;
610 - } else {
 616+ } else {
611617 // If the colored text is missing, generate it in the background.
612618 // For now, return a message about the missing text.
613619 self::runEvalEdit(self::TRUST_EVAL_MISSING);
@@ -615,7 +621,6 @@
616622 } else {
617623 return false;
618624 }
619 -
620625 $dbr->freeResult( $res );
621626 return true;
622627 }
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 @@
8585 $wgTrustTabText = "check text";
8686 $wgTrustExplanation = '{| border="1" cellpadding="5" cellspacing="0" style="background:lightgreen; color:black"
8787 |-
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.
8989 |-
9090 | 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].
9191 |}';

Status & tagging log