Index: trunk/extensions/Theme/monobook/dark.css |
— | — | @@ -0,0 +1,418 @@ |
| 2 | +/* |
| 3 | +** Dark theme for MonoBook |
| 4 | +** Originally from ZeldaWiki.org and modified by Skizzerz <skizzerz@shoutwiki.com> for ShoutWiki |
| 5 | +** |
| 6 | +** @date 14 September 2011 |
| 7 | +*/ |
| 8 | +div#content { |
| 9 | + background: #1c3855; |
| 10 | + color: #d2d2d2; |
| 11 | + border: 2px solid #6f7b87; |
| 12 | +} |
| 13 | + |
| 14 | +body { |
| 15 | + background: #0a2139; |
| 16 | + color: #d2d2d2; |
| 17 | +} |
| 18 | + |
| 19 | +table { |
| 20 | + background-color: #1c3855; |
| 21 | +} |
| 22 | + |
| 23 | +a { |
| 24 | + color: #e9eda6; |
| 25 | +} |
| 26 | + |
| 27 | +a:visited { |
| 28 | + color: #e6ed79; |
| 29 | +} |
| 30 | + |
| 31 | +a:active { |
| 32 | + color: #eaeda6; |
| 33 | +} |
| 34 | + |
| 35 | +a.stub { |
| 36 | + color: #eaeda6; |
| 37 | +} |
| 38 | + |
| 39 | +a.new, #p-personal a.new { |
| 40 | + color: #fe6060; |
| 41 | +} |
| 42 | + |
| 43 | +a.new:visited, #p-personal a.new:visited { |
| 44 | + color: #fe6060; |
| 45 | +} |
| 46 | + |
| 47 | +hr { |
| 48 | + background-color: #6f7b87; |
| 49 | + color: #6f7b87; |
| 50 | +} |
| 51 | + |
| 52 | +h1, h2, h3, h4, h5, h6 { |
| 53 | + border-bottom: 1px solid #485d73; |
| 54 | + color: #d2d2d2; |
| 55 | +} |
| 56 | + |
| 57 | +legend { |
| 58 | + background: #1c3855; |
| 59 | +} |
| 60 | + |
| 61 | +code { |
| 62 | + background-color: #2f6fab; |
| 63 | +} |
| 64 | + |
| 65 | +pre { |
| 66 | + background-color: #1f4973; |
| 67 | + border: 1px dashed #3b587e; |
| 68 | + color: #d2d2d2; |
| 69 | +} |
| 70 | + |
| 71 | +/* user notification thing */ |
| 72 | +.usermessage { |
| 73 | + background-color: #2f6fab; |
| 74 | + border: 1px solid #eaeda6; |
| 75 | +} |
| 76 | + |
| 77 | +.catlinks { |
| 78 | + border: 2px solid #3b587e; |
| 79 | + background-color: #1f4973; |
| 80 | +} |
| 81 | + |
| 82 | +/* |
| 83 | +** content styles |
| 84 | +*/ |
| 85 | +#toc, |
| 86 | +.toc, |
| 87 | +.mw-warning { |
| 88 | + border: 2px solid #3b587e; |
| 89 | + background-color: #1f4973; |
| 90 | +} |
| 91 | + |
| 92 | +div.thumbinner { |
| 93 | + background-color: #1f4973; |
| 94 | + border: 2px solid #3b587e; |
| 95 | +} |
| 96 | + |
| 97 | +html .thumbimage { |
| 98 | + border: 1px solid #3b587e; |
| 99 | + background-color: #1c3855; |
| 100 | +} |
| 101 | + |
| 102 | +.toccolours { |
| 103 | + border: 2px solid #3b587e; |
| 104 | + background-color: #1f4973; |
| 105 | +} |
| 106 | + |
| 107 | +/* Interwiki styling */ |
| 108 | +#bodyContent a.extiw, |
| 109 | +#bodyContent a.extiw:active { |
| 110 | + color: #e9eda6; |
| 111 | +} |
| 112 | + |
| 113 | +#bodyContent a.external { |
| 114 | + color: #e9eda6; |
| 115 | +} |
| 116 | + |
| 117 | +#bodyContent a.new { |
| 118 | + color: #fe6060; |
| 119 | +} |
| 120 | + |
| 121 | +.portlet h6 { |
| 122 | + background: #6f7b87; |
| 123 | +} |
| 124 | + |
| 125 | +.pBody { |
| 126 | + background-color: #1d3855; |
| 127 | + border: 1px solid #59697a; |
| 128 | + color: #d2d2d2; |
| 129 | +} |
| 130 | + |
| 131 | +#p-personal li { |
| 132 | + color: #1f4973; |
| 133 | +} |
| 134 | + |
| 135 | +#p-personal li a { |
| 136 | + color: #e9eda6; |
| 137 | +} |
| 138 | + |
| 139 | +#p-personal li a:hover { |
| 140 | + background-color: #1f4973; |
| 141 | +} |
| 142 | + |
| 143 | +#p-cactions li { |
| 144 | + border: 1px solid #6f7b87; |
| 145 | + background: #1d3855; |
| 146 | +} |
| 147 | + |
| 148 | +#p-cactions li.selected { |
| 149 | + border-color: #eaeda6; |
| 150 | +} |
| 151 | + |
| 152 | +#p-cactions li a { |
| 153 | + background-color: #1d3855; |
| 154 | + color: #eaeda6; |
| 155 | +} |
| 156 | + |
| 157 | +#p-cactions li.selected a { |
| 158 | + background-color: #1d3855; |
| 159 | +} |
| 160 | + |
| 161 | +#p-cactions .new a { |
| 162 | + color: #fd6060; |
| 163 | +} |
| 164 | + |
| 165 | +#p-cactions li a:hover { |
| 166 | + background-color: #254b73; |
| 167 | +} |
| 168 | + |
| 169 | +/* |
| 170 | +** footer |
| 171 | +*/ |
| 172 | +div#footer { |
| 173 | + background-color: #1c3855; |
| 174 | + border-top: 1px solid #e1eda6; |
| 175 | + border-bottom: 1px solid #e1eda6; |
| 176 | +} |
| 177 | + |
| 178 | +/* js pref toc */ |
| 179 | +#preftoc li { |
| 180 | + background-color: #1f4973; |
| 181 | + border: 1px solid #3b587e; |
| 182 | +} |
| 183 | + |
| 184 | +#preftoc li.selected { |
| 185 | + background-color: #1f4973; |
| 186 | + border: 1px solid #3b587e; |
| 187 | +} |
| 188 | + |
| 189 | +#preftoc > li.selected { |
| 190 | + border-color: #3b587e; |
| 191 | +} |
| 192 | + |
| 193 | +#preftoc a, |
| 194 | +#preftoc a:active { |
| 195 | + color: #e9eda6; |
| 196 | +} |
| 197 | + |
| 198 | +#preftoc li.selected a { |
| 199 | + color: #d2d2d2; |
| 200 | +} |
| 201 | + |
| 202 | +#preferences { |
| 203 | + border: 1px solid #3b587e; |
| 204 | + background-color: #1f4973; |
| 205 | +} |
| 206 | + |
| 207 | +.prefsection fieldset { |
| 208 | + border: 1px solid #3b587e; |
| 209 | +} |
| 210 | + |
| 211 | +.prefsection table, .prefsection legend { |
| 212 | + background-color: #1f4973; |
| 213 | + border-color: #1f4973; |
| 214 | +} |
| 215 | + |
| 216 | +div.prefsectiontip { |
| 217 | + color: #d2d2d2; |
| 218 | +} |
| 219 | + |
| 220 | +div#userloginForm form, |
| 221 | +div#userlogin form#userlogin2 { |
| 222 | + background-color: #1f4973; |
| 223 | + border: 1px solid #3b587e; |
| 224 | +} |
| 225 | + |
| 226 | +div#userloginForm table, |
| 227 | +div#userlogin form#userlogin2 table { |
| 228 | + background-color: #1c3855; |
| 229 | + border: 1px solid #3b587e; |
| 230 | +} |
| 231 | + |
| 232 | +/* @todo FIXME: review and remove unnecessary styles, this is verbatim copy of the old file */ |
| 233 | +table.gallery { |
| 234 | + border: 2px solid #3b587e; |
| 235 | + margin: 2px; |
| 236 | + padding: 2px; |
| 237 | + background-color: #1f4973; |
| 238 | +} |
| 239 | + |
| 240 | +table.gallery tr { |
| 241 | + vertical-align: top; |
| 242 | +} |
| 243 | + |
| 244 | +table.gallery td { |
| 245 | + vertical-align: top; |
| 246 | + background-color: #1f4973; |
| 247 | + border: solid 2px #3b587e; |
| 248 | +} |
| 249 | +/* Keep this temporarily so that cached pages will display right */ |
| 250 | +table.gallery td.galleryheader { |
| 251 | + text-align: center; |
| 252 | + font-weight: bold; |
| 253 | +} |
| 254 | +table.gallery caption { |
| 255 | + font-weight: bold; |
| 256 | +} |
| 257 | + |
| 258 | +div.gallerybox { |
| 259 | + margin: 2px; |
| 260 | +} |
| 261 | + |
| 262 | +div.gallerybox div.thumb { |
| 263 | + text-align: center; |
| 264 | + border: 1px solid #3b587e; |
| 265 | + background-color: #1c3855; |
| 266 | + margin: 2px; |
| 267 | +} |
| 268 | +/* </fixme> */ |
| 269 | + |
| 270 | +/* Classes for EXIF data display */ |
| 271 | +table.mw_metadata { |
| 272 | + width: 300px; /* @todo CHECKME: still needed? shared.css has 400px */ |
| 273 | +} |
| 274 | + |
| 275 | +/* filetoc */ |
| 276 | +ul#filetoc { |
| 277 | + border: 1px solid #3b587e; |
| 278 | + background-color: #1f4973; |
| 279 | +} |
| 280 | + |
| 281 | +/* noarticletext */ |
| 282 | +.noarticletext { |
| 283 | + background: #0A2139; |
| 284 | + border: #59697A 1px solid; |
| 285 | + color: #59697A; |
| 286 | +} |
| 287 | + |
| 288 | +div.multipageimagenavbox { |
| 289 | + border: 1px solid #3b587e; |
| 290 | + background: #1f4973; |
| 291 | +} |
| 292 | + |
| 293 | +/** Special:Version */ |
| 294 | +table#sv-ext, table#sv-hooks, table#sv-software { |
| 295 | + margin: 1em; |
| 296 | + padding: 0em; |
| 297 | +} |
| 298 | + |
| 299 | +#sv-ext td, #sv-hooks td, #sv-software td, |
| 300 | +#sv-ext th, #sv-hooks th, #sv-software th { |
| 301 | + border: 1px solid #A0A0A0; |
| 302 | + padding: 0 0.15em 0 0.15em; |
| 303 | +} |
| 304 | +#sv-ext th, #sv-hooks th, #sv-software th { |
| 305 | + background-color: #1F4973; |
| 306 | + color: #CBD2D2; |
| 307 | + padding: 0 0.15em 0 0.15em; |
| 308 | +} |
| 309 | +tr.sv-space { |
| 310 | + height: 0.8em; |
| 311 | + border: none; |
| 312 | +} |
| 313 | +tr.sv-space td { display: none; } |
| 314 | + |
| 315 | +/* also used on Special:Version */ |
| 316 | +table.wikitable { |
| 317 | + background-color: transparent; |
| 318 | + color: #d2d2d2; |
| 319 | +} |
| 320 | + |
| 321 | +/* Recreating-deleted-page/reupload file warning and log entries */ |
| 322 | +div#mw-upload-deleted-warn, |
| 323 | +div#mw-recreate-deleted-warn { |
| 324 | + padding: 3px; |
| 325 | + margin-bottom: 3px; |
| 326 | + border: 2px solid #2F6FAB; |
| 327 | +} |
| 328 | + |
| 329 | +/* Special:Search */ |
| 330 | +.mw-search-interwiki-project { |
| 331 | + background: #cae8ff; |
| 332 | +} |
| 333 | + |
| 334 | +span.searchmatch { |
| 335 | + color: #fe6060; |
| 336 | +} |
| 337 | + |
| 338 | +/* SendToAFriend extension */ |
| 339 | +#staf a { |
| 340 | + color: #002bb8; |
| 341 | +} |
| 342 | + |
| 343 | +/* The message that is shown after a page is deleted */ |
| 344 | +#deletedtextmessage { |
| 345 | + background: transparent; |
| 346 | +} |
| 347 | + |
| 348 | +/* AJAX pagewatch / unwatch */ |
| 349 | +div#mw-js-message { |
| 350 | + background: transparent; |
| 351 | +} |
| 352 | + |
| 353 | +/* Images */ |
| 354 | +div.thumb { |
| 355 | + border-color: transparent; |
| 356 | +} |
| 357 | +div.thumb div { |
| 358 | + background-color: transparent; |
| 359 | +} |
| 360 | + |
| 361 | +/* Captcha on Special:UserLogin/signup (ConfirmEdit extension) */ |
| 362 | +div#userlogin .captcha, div#userloginForm .captcha { |
| 363 | + background-color: transparent; |
| 364 | +} |
| 365 | + |
| 366 | +/* @todo FIXME: correct place for these rules! */ |
| 367 | +#bodyContent h4.mw-specialpagesgroup { |
| 368 | + background-color: #1f4973; |
| 369 | + border: 1px solid #3b587e; |
| 370 | +} |
| 371 | +#bodyContent table#sv-ext th, table#sv-software th, table.filehistory th { |
| 372 | + background-color: #1F4973; |
| 373 | + color: #CBD2D2; |
| 374 | + border: 1px solid #3b587e; |
| 375 | +} |
| 376 | +#bodyContent table#sv-ext td, table#sv-software td, table.filehistory td { |
| 377 | + border: 1px solid #3b587e; |
| 378 | +} |
| 379 | +#bodyContent ul#pagehistory li { |
| 380 | + background: #1f4871; |
| 381 | + border-color: #3b587e; |
| 382 | +} |
| 383 | +#bodyContent ul#pagehistory li.selected { |
| 384 | + background: #0a2139; |
| 385 | + border: 1px solid #3b587e; |
| 386 | +} |
| 387 | +#bodyContent table#allmessagestable { |
| 388 | + border: 1px solid #3b587e; |
| 389 | +} |
| 390 | +#bodyContent table#allmessagestable th { |
| 391 | + background: #0a2139; |
| 392 | + border: 1px solid #3b587e; |
| 393 | +} |
| 394 | +#bodyContent table#allmessagestable td { |
| 395 | + background: #1f4871; |
| 396 | + border: 1px solid #3b587e; |
| 397 | +} |
| 398 | +#bodyContent div.noarticletext { |
| 399 | + color: #d2d2d2; |
| 400 | + background: #1f4871; |
| 401 | + border: 2px solid #3b587e; |
| 402 | +} |
| 403 | +table.diff, td.diff-otitle, td.diff-ntitle { |
| 404 | + background: none; |
| 405 | +} |
| 406 | +td.diff-context { |
| 407 | + background: #6f7b87; |
| 408 | +} |
| 409 | +td.diff-deletedline { |
| 410 | + background: #e6ed78; |
| 411 | + color: #1c3855; |
| 412 | +} |
| 413 | +td.diff-addedline { |
| 414 | + background: #76e983; |
| 415 | + color: #1c3855; |
| 416 | +} |
| 417 | +td.diff-addedline ins, td.diff-deletedline del { |
| 418 | + color: #a33d3d; |
| 419 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/Theme/monobook/dark.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 420 | + native |
Index: trunk/extensions/Theme/monobook/pink.css |
— | — | @@ -0,0 +1,200 @@ |
| 2 | +/* |
| 3 | +** MediaWiki 'Romantic Pink' style sheet for CSS2-capable browsers. |
| 4 | +** |
| 5 | +** Developed for ShoutWiki <http://www.shoutwiki.com> |
| 6 | +** @license GPL (http://www.gnu.org/copyleft/gpl.html) |
| 7 | +** @author Jack Phoenix <jack@shoutwiki.com> |
| 8 | +** @copyright © 2007-2011 Jack Phoenix <jack@shoutwiki.com> |
| 9 | +** @date 14 September 2011 |
| 10 | +*/ |
| 11 | +div#content { |
| 12 | + background: #FFC0CB; |
| 13 | + color: black; |
| 14 | +} |
| 15 | + |
| 16 | +body { |
| 17 | + background: none !important; |
| 18 | + background-color: #FFC0CB !important; |
| 19 | +} |
| 20 | + |
| 21 | +a { |
| 22 | + color: #0066FF; |
| 23 | +} |
| 24 | + |
| 25 | +a:visited { |
| 26 | + color: #0066FF; |
| 27 | +} |
| 28 | + |
| 29 | +a:active { |
| 30 | + color: #faa700; |
| 31 | +} |
| 32 | + |
| 33 | +a.new, #p-personal a.new { |
| 34 | + color: #ba0000; |
| 35 | +} |
| 36 | + |
| 37 | +p { |
| 38 | + color: #000; |
| 39 | +} |
| 40 | + |
| 41 | +h1 { |
| 42 | + border-bottom: 1px solid #FFC0CB; |
| 43 | +} |
| 44 | + |
| 45 | +/* user notification thing */ |
| 46 | +.usermessage { |
| 47 | + background-color: #ffce7b; |
| 48 | + border: 1px solid #ffa500; |
| 49 | + color: black; |
| 50 | +} |
| 51 | + |
| 52 | +/* |
| 53 | +** content styles |
| 54 | +*/ |
| 55 | +#toc, |
| 56 | +.toc, |
| 57 | +.mw-warning { |
| 58 | + background-color: #EEC0DC; |
| 59 | +} |
| 60 | + |
| 61 | +/* thumbnails */ |
| 62 | +div.thumb { |
| 63 | + border-style: solid; |
| 64 | + border-color: transparent; |
| 65 | +} |
| 66 | + |
| 67 | +/* Interwiki styling */ |
| 68 | +#bodyContent a.extiw, |
| 69 | +#bodyContent a.extiw:active { |
| 70 | + color: #00CCFF; |
| 71 | +} |
| 72 | +#bodyContent a.external { |
| 73 | + color: #0066FF; |
| 74 | +} |
| 75 | +/* Added from original Romantic Pink CSS file */ |
| 76 | +#bodyContent a.extiw:visited { |
| 77 | + color: #0066FF; |
| 78 | +} |
| 79 | +#bodyContent a.external:visited { |
| 80 | + color: #0066FF; |
| 81 | +} |
| 82 | +#bodyContent a.stub, #bodyContent a.stub:visited { |
| 83 | + color: #FFC0CB; |
| 84 | +} |
| 85 | + |
| 86 | +.pBody { |
| 87 | + background-color: #FFC0CB; |
| 88 | + color: #FFC0CB; |
| 89 | +} |
| 90 | + |
| 91 | +#p-cactions li { |
| 92 | + background: none; /* Internet Explorer fix */ |
| 93 | +} |
| 94 | + |
| 95 | +/* @todo FIXME/CHECKME: this looks suspicious */ |
| 96 | +#p-cactions li.selected { |
| 97 | + background: white; |
| 98 | +} |
| 99 | + |
| 100 | +#p-cactions li.selected a { |
| 101 | + background-color: transparent; |
| 102 | + padding: 0 1em .2em !important;/* @todo FIXME/CHECKME: this looks suspicious */ |
| 103 | +} |
| 104 | + |
| 105 | +/* |
| 106 | +** footer |
| 107 | +*/ |
| 108 | +div#footer { |
| 109 | + background-color: #FFC0CB; |
| 110 | + border-bottom: 1px solid #FFC0CB; |
| 111 | + border-top: 1px solid #FFC0CB; |
| 112 | + color: #000000; |
| 113 | + min-height: 39px; |
| 114 | + z-index: 2 !important; |
| 115 | +} |
| 116 | + |
| 117 | +/* Classes for EXIF data display */ |
| 118 | +table.mw_metadata { |
| 119 | + width: 300px; /* @todo CHECKME: still needed? shared.css has 400px */ |
| 120 | +} |
| 121 | + |
| 122 | +/** Special:Version */ |
| 123 | +table#sv-ext, table#sv-hooks, table#sv-software { |
| 124 | + margin: 1em; |
| 125 | + padding: 0em; |
| 126 | +} |
| 127 | + |
| 128 | +#sv-ext td, #sv-hooks td, #sv-software td, |
| 129 | +#sv-ext th, #sv-hooks th, #sv-software th { |
| 130 | + border: 1px solid #A0A0A0; |
| 131 | + padding: 0 0.15em 0 0.15em; |
| 132 | +} |
| 133 | +#sv-ext th, #sv-hooks th, #sv-software th { |
| 134 | + background-color: #F0F0F0; |
| 135 | + color: black; |
| 136 | + padding: 0 0.15em 0 0.15em; |
| 137 | +} |
| 138 | +tr.sv-space { |
| 139 | + height: 0.8em; |
| 140 | + border: none; |
| 141 | +} |
| 142 | +tr.sv-space td { display: none; } |
| 143 | + |
| 144 | +/* Begin misc. hacks */ |
| 145 | +#bodyContent { |
| 146 | + background: none; |
| 147 | + background-color: #FFC0CB; |
| 148 | + color: #000000; |
| 149 | +} |
| 150 | + |
| 151 | +.selected { |
| 152 | + background-color: #333333; |
| 153 | + color: #FFC0CB; |
| 154 | + border-color: #CCCCCC; |
| 155 | +} |
| 156 | + |
| 157 | +#p-navigation a { |
| 158 | + display: inline; |
| 159 | +} |
| 160 | + |
| 161 | +#p-cactions ul li a { |
| 162 | + background-color: #FFC0CB; |
| 163 | + color: #000000; |
| 164 | +} |
| 165 | + |
| 166 | +/* I have absolutely no idea wtf this crap is */ |
| 167 | +div.header-notice, div.warning { |
| 168 | + width: 85%; |
| 169 | + margin: 1.0em auto 0.5em auto; |
| 170 | + padding: 5px; |
| 171 | + text-align: left; |
| 172 | + border: 1px inset #999999; |
| 173 | + background-color: #2A2A2A; |
| 174 | + color: #FFFFFF; |
| 175 | + line-height: 120%; |
| 176 | +} |
| 177 | + |
| 178 | +div.warning { |
| 179 | + color: red !important; |
| 180 | + font-weight: bold; |
| 181 | +} |
| 182 | + |
| 183 | +div.notice p, div.warning p { |
| 184 | + line-height: 120% !important; |
| 185 | +} |
| 186 | + |
| 187 | +/* |
| 188 | +** Diff rendering |
| 189 | +*/ |
| 190 | +table.diff, td.diff-otitle, td.diff-ntitle { |
| 191 | + background-color: transparent; |
| 192 | +} |
| 193 | + |
| 194 | +#pagehistory li .selected { |
| 195 | + background-color: transparent; |
| 196 | +} |
| 197 | + |
| 198 | +/* testing a random fix */ |
| 199 | +.selected { |
| 200 | + color: #000000; |
| 201 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/Theme/monobook/pink.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 202 | + native |
Index: trunk/extensions/Theme/Theme.php |
— | — | @@ -1,34 +1,93 @@ |
2 | 2 | <?php |
| 3 | +/** |
| 4 | + * Theme "extension" (allows using themes of skins) |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + * @version 1.5 |
| 9 | + * @author Ryan Schmidt <skizzerz at gmail dot com> |
| 10 | + * @author Jack Phoenix <jack@countervandalism.net> |
| 11 | + * @license http://en.wikipedia.org/wiki/Public_domain Public domain |
| 12 | + * @link http://www.mediawiki.org/wiki/Extension:Theme Documentation |
| 13 | + */ |
3 | 14 | |
4 | | -//Theme "extension" (allows using themes of skins) |
| 15 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 16 | + die(); |
| 17 | +} |
5 | 18 | |
| 19 | +// Extension credits that will show up on Special:Version |
6 | 20 | $wgExtensionCredits['other'][] = array( |
7 | 21 | 'name' => 'Theme', |
| 22 | + 'version' => '1.5', |
| 23 | + 'author' => array( 'Ryan Schmidt', 'Jack Phoenix' ), |
8 | 24 | 'description' => 'Theme loader extension for skins', |
9 | | - 'version' => '1.0', |
10 | | - 'author' => 'Ryan Schmidt', |
| 25 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:Theme' |
11 | 26 | ); |
12 | 27 | |
13 | | -$wgHooks['BeforePageDisplay'][] = 'efDisplayTheme'; |
| 28 | +// For ShoutWiki, $wgDefaultTheme is set in GlobalSettings.php to 'default' |
| 29 | +// For a non-ShoutWiki site where you want to use this extension, you should |
| 30 | +// set $wgDefaultTheme to the name of one of the available themes for your |
| 31 | +// $wgDefaultSkin |
14 | 32 | |
15 | | -function efDisplayTheme( &$out, &$sk ) { |
| 33 | +// Register themes for core skins here; for custom skins, do the registration |
| 34 | +// in the custom skin's Skinname.php file |
| 35 | +// |
| 36 | +// Monobook |
| 37 | +$wgResourceModules['skins.monobook.dark'] = array( |
| 38 | + 'styles' => array( |
| 39 | + 'extensions/Theme/monobook/dark.css' => array( 'media' => 'screen' ) |
| 40 | + ) |
| 41 | +); |
| 42 | + |
| 43 | +$wgResourceModules['skins.monobook.pink'] = array( |
| 44 | + 'styles' => array( |
| 45 | + 'extensions/Theme/monobook/pink.css' => array( 'media' => 'screen' ) |
| 46 | + ) |
| 47 | +); |
| 48 | + |
| 49 | +// Actual extension logic begins here |
| 50 | +$wgHooks['BeforePageDisplay'][] = 'wfDisplayTheme'; |
| 51 | + |
| 52 | +function wfDisplayTheme( &$out, &$sk ) { |
16 | 53 | global $wgRequest, $wgStylePath, $wgStyleDirectory, $wgDefaultTheme, $wgValidSkinNames; |
| 54 | + global $wgResourceModules; |
| 55 | + |
17 | 56 | $theme = $wgRequest->getVal( 'usetheme', false ); |
18 | 57 | $useskin = $wgRequest->getVal( 'useskin', false ); |
19 | 58 | $skin = $useskin ? $useskin : $sk->getSkinName(); |
| 59 | + |
20 | 60 | if( !array_key_exists( strtolower( $skin ), $wgValidSkinNames ) ) { |
21 | | - $skin = $sk->getSkinName(); //so we don't load themes for skins when we can't actually load the skin |
| 61 | + // so we don't load themes for skins when we can't actually load the skin |
| 62 | + $skin = $sk->getSkinName(); |
22 | 63 | } |
| 64 | + |
| 65 | + // Monaco is a special case, since it handles its themes in its main PHP |
| 66 | + // file instead of leaving theme handling to us (ShoutWiki bug #173) |
| 67 | + if ( strtolower( $skin ) == 'monaco' ) { |
| 68 | + return true; |
| 69 | + } |
| 70 | + |
23 | 71 | if( $theme ) { |
24 | | - $url = $skin . '/themes/' . $theme . '.css'; |
| 72 | + $themeName = $theme; |
25 | 73 | } elseif( isset( $wgDefaultTheme ) && $wgDefaultTheme != 'default' ) { |
26 | | - $url = $skin . '/themes/' . $wgDefaultTheme . '.css'; |
| 74 | + $themeName = $wgDefaultTheme; |
27 | 75 | } else { |
28 | | - $url = false; |
| 76 | + $themeName = false; |
29 | 77 | } |
30 | | - if( !$url || !file_exists( $wgStyleDirectory . '/' . $url ) ) { |
| 78 | + |
| 79 | + $moduleName = 'skins.' . strtolower( $skin ) . '.' . |
| 80 | + strtolower( $themeName ); |
| 81 | + |
| 82 | + // Check that we have something to include later on; if not, bail out |
| 83 | + if( !$themeName || !isset( $wgResourceModules[$moduleName] ) ) { |
31 | 84 | return true; |
32 | 85 | } |
33 | | - $out->addExtensionStyle( $wgStylePath . '/' . $url ); |
| 86 | + |
| 87 | + // Add the CSS file, either via ResourceLoader or the old (1.16) way. |
| 88 | + // When adding via RL, we also check that such a module has been registered |
| 89 | + // (above, in the if() loop) because RL may explode if we try to add a |
| 90 | + // module that does not exist. |
| 91 | + $out->addModuleStyles( $moduleName ); |
| 92 | + |
34 | 93 | return true; |
35 | 94 | } |
\ No newline at end of file |