Index: trunk/extensions/CentralNotice/SpecialNoticeText.php |
— | — | @@ -16,14 +16,25 @@ |
17 | 17 | } |
18 | 18 | |
19 | 19 | function getJsOutput() { |
20 | | - global $wgSiteNotice; |
21 | | - $encNotice = Xml::escapeJsString( $this->getHtmlNotice() ); |
22 | | - return <<<EOT |
23 | | -wgNotice = "$encNotice"; |
24 | | -EOT; |
| 20 | + return 'wgNotice="' . |
| 21 | + str_replace( '$quote', |
| 22 | + '"+' . $this->getJsQuoteSelector() . '+"', |
| 23 | + Xml::escapeJsString( $this->getHtmlNotice() ) ) |
| 24 | + . '";'; |
25 | 25 | } |
26 | 26 | |
| 27 | + function getJsQuoteSelector() { |
| 28 | + $quotes = $this->getQuotes(); |
| 29 | + return |
| 30 | + 'function(){' . |
| 31 | + 'var quotes=' . Xml::encodeJsVar( $quotes ) . ';' . |
| 32 | + 'return quotes[Math.floor(Math.random()*quotes.length)];' . |
| 33 | + '}()'; |
| 34 | + } |
| 35 | + |
27 | 36 | function getHtmlNotice() { |
| 37 | + $headline = $this->getHeadline(); |
| 38 | + $meter = $this->getMeter(); |
28 | 39 | return <<<EOT |
29 | 40 | <style type="text/css"> |
30 | 41 | .fundraiser-box { |
— | — | @@ -58,8 +69,7 @@ |
59 | 70 | |
60 | 71 | overflow: hidden; |
61 | 72 | } |
62 | | - |
63 | | -.fundraiser-bar { |
| 73 | +.fundraiser-meter { |
64 | 74 | margin-top: 5px; |
65 | 75 | margin-bottom: 0px; |
66 | 76 | } |
— | — | @@ -68,13 +78,13 @@ |
69 | 79 | <tr> |
70 | 80 | <td class="fundraiser-text"> |
71 | 81 | <div class="fundraiser-headline"> |
72 | | - <a href="http://fundraising.wikimedia.org/">What you didn't know about Wikipedia . . . <small>(See more)</small></a> |
| 82 | + <a href="http://fundraising.wikimedia.org/">$headline</a> |
73 | 83 | </div> |
74 | 84 | <div class='fundraiser-quote'> |
75 | | - <a href="http://fundraising.wikimedia.org/">Anonymous: Well Done! Anonymous: What on earth did we do...</a> |
| 85 | + <a href="http://fundraising.wikimedia.org/">\$quote</a> |
76 | 86 | </div> |
77 | | - <div class='fundraiser-bar'> |
78 | | - <a href="http://fundraising.wikimedia.org/"><img src="http://upload.wikimedia.org/fundraising/2007/meter.png" width='407' height='14' /></a> |
| 87 | + <div class='fundraiser-meter'> |
| 88 | + <a href="http://fundraising.wikimedia.org/">$meter</a> |
79 | 89 | </div> |
80 | 90 | </td> |
81 | 91 | <td width="109" height="75"> |
— | — | @@ -84,6 +94,21 @@ |
85 | 95 | </table> |
86 | 96 | EOT; |
87 | 97 | } |
| 98 | + |
| 99 | + function getHeadline() { |
| 100 | + return "What you didn't know about Wikipedia . . . <small>(See more)</small>"; |
| 101 | + } |
| 102 | + |
| 103 | + function getQuotes() { |
| 104 | + return array( |
| 105 | + "Anonymous: Well Done!", |
| 106 | + "Anonymous: What on earth did we do...", |
| 107 | + ); |
| 108 | + } |
| 109 | + |
| 110 | + function getMeter() { |
| 111 | + return "<img src=\"http://upload.wikimedia.org/fundraising/2007/meter.png\" width='407' height='14' />"; |
| 112 | + } |
88 | 113 | } |
89 | 114 | |
90 | 115 | ?> |
\ No newline at end of file |