Index: branches/liquidthreads/skins/monobook/main.css |
— | — | @@ -26,6 +26,10 @@ |
27 | 27 | margin-bottom: .1em; |
28 | 28 | }*/ |
29 | 29 | |
| 30 | +.lqt_thread { |
| 31 | + display: none; |
| 32 | +} |
| 33 | + |
30 | 34 | .lqt_archive_browser { |
31 | 35 | margin-top: 1em; |
32 | 36 | margin-bottom: 1em; |
Index: branches/liquidthreads/extensions/ThreadView.php |
— | — | @@ -6,6 +6,7 @@ |
7 | 7 | protected static $callbackpost; |
8 | 8 | protected static $callbackeditpage; |
9 | 9 | |
| 10 | + protected static $stuffDoneOnceDone; |
10 | 11 | |
11 | 12 | /** |
12 | 13 | * @param $thread Thread object we're looking at. |
— | — | @@ -33,23 +34,52 @@ |
34 | 35 | $this->showNext = false; |
35 | 36 | } |
36 | 37 | |
| 38 | + function doStuffOnce() { |
| 39 | + global $wgOut, $wgJsMimeType, $wgStylePath; |
| 40 | + |
| 41 | + if (ThreadView::$stuffDoneOnceDone) return; |
| 42 | + ThreadView::$stuffDoneOnceDone = true; |
| 43 | + |
| 44 | + $s = "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/lqt.js\"><!-- lqt js --></script>\n"; |
| 45 | + $wgOut->addScript($s); |
| 46 | + |
| 47 | + $h = $wgOut->getOnloadHandler(); |
| 48 | + if ( $h != '' ) { |
| 49 | + $h .= '; '; |
| 50 | + } |
| 51 | + $h .= 'lqt_on_load();'; |
| 52 | + $wgOut->setOnloadHandler($h); |
| 53 | + } |
| 54 | + |
37 | 55 | function render() { |
38 | 56 | global $wgOut; |
39 | 57 | |
| 58 | + $this->doStuffOnce(); |
| 59 | + |
40 | 60 | // Instruct Parser not to include section edit links. |
41 | 61 | $wgOut->mParserOptions->setEditSection(false); |
42 | 62 | |
| 63 | + $thread_id_attrib = 'lqt_thread_' . $this->mThread->getID(); |
| 64 | + |
| 65 | + $wgOut->addHTML("\n\n\n"); |
| 66 | + |
43 | 67 | // Subject header: |
44 | 68 | if ( $this->mIsTopLevel ) { |
45 | 69 | if ( $this->mThread->mSubject ) |
46 | | - $wgOut->addWikiText( '=='.$this->mThread->mSubject.'==' ); |
| 70 | + $wgOut->addHTML( wfElement('h2', array('class'=>'lqt_thread_subject_header', |
| 71 | + 'onclick'=>"lqt_hide_show('$thread_id_attrib')"), |
| 72 | + $this->mThread->mSubject) ); |
47 | 73 | else |
48 | 74 | $wgOut->addWikiText( '----' ); |
49 | 75 | } |
50 | 76 | |
| 77 | + $wgOut->addHTML('<div class="lqt_thread" id="'.$thread_id_attrib.'">'); |
51 | 78 | if( $this->mFirstPost ) { |
52 | 79 | $this->renderStartingFrom( $this->mFirstPost ); |
53 | 80 | } |
| 81 | + $wgOut->addHTML('</div>'); |
| 82 | + |
| 83 | + $wgOut->addHTML("\n\n\n"); |
54 | 84 | } |
55 | 85 | |
56 | 86 | |