Index: trunk/extensions/ShoutWikiAds/ShoutWikiAds.php |
— | — | @@ -4,8 +4,8 @@ |
5 | 5 | * |
6 | 6 | * @file |
7 | 7 | * @ingroup Extensions |
8 | | - * @version 0.1 |
9 | | - * @date 24 April 2011 |
| 8 | + * @version 0.2 |
| 9 | + * @date 4 September 2011 |
10 | 10 | * @author Jack Phoenix <jack@countervandalism.net> |
11 | 11 | * @license http://en.wikipedia.org/wiki/Public_domain Public domain |
12 | 12 | * @link http://www.mediawiki.org/wiki/Extension:ShoutWiki_Ads Documentation |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | // Extension credits that will show up on Special:Version |
20 | 20 | $wgExtensionCredits['other'][] = array( |
21 | 21 | 'name' => 'ShoutWiki Ads', |
22 | | - 'version' => '0.1', |
| 22 | + 'version' => '0.2', |
23 | 23 | 'author' => 'Jack Phoenix', |
24 | 24 | 'description' => 'Delicious advertisements for everyone!', |
25 | 25 | 'url' => 'http://www.mediawiki.org/wiki/Extension:ShoutWiki_Ads', |
— | — | @@ -44,6 +44,28 @@ |
45 | 45 | // Truglass |
46 | 46 | $wgHooks['TruglassInContent'][] = 'ShoutWikiAds::renderTruglassAd'; |
47 | 47 | |
| 48 | +// ResourceLoader support for MediaWiki 1.17+ |
| 49 | +$resourceTemplate = array( |
| 50 | + 'localBasePath' => dirname( __FILE__ ), |
| 51 | + 'remoteExtPath' => 'ShoutWikiAds' |
| 52 | +); |
| 53 | + |
| 54 | +$wgResourceModules['ext.ShoutWikiAds.monaco'] = $resourceTemplate + array( |
| 55 | + 'styles' => 'css/monaco-ads.css' |
| 56 | +); |
| 57 | + |
| 58 | +$wgResourceModules['ext.ShoutWikiAds.monobook.button'] = $resourceTemplate + array( |
| 59 | + 'styles' => 'css/monobook-button-ad.css' |
| 60 | +); |
| 61 | + |
| 62 | +$wgResourceModules['ext.ShoutWikiAds.monobook.skyscraper'] = $resourceTemplate + array( |
| 63 | + 'styles' => 'css/monobook-skyscraper-ad.css' |
| 64 | +); |
| 65 | + |
| 66 | +$wgResourceModules['ext.ShoutWikiAds.truglass'] = $resourceTemplate + array( |
| 67 | + 'styles' => 'css/truglass-ads.css' |
| 68 | +); |
| 69 | + |
48 | 70 | /* Configuration |
49 | 71 | $wgAdConfig = array( |
50 | 72 | 'enabled' => true, // enabled or not? :P |
Index: trunk/extensions/ShoutWikiAds/ShoutWikiAds.class.php |
— | — | @@ -281,28 +281,28 @@ |
282 | 282 | { |
283 | 283 | $title = $out->getTitle(); |
284 | 284 | $namespace = $title->getNamespace(); |
| 285 | + |
285 | 286 | // Okay, the variable name sucks but anyway...normal page != not login page |
286 | 287 | $isNormalPage = $title instanceof Title && |
287 | 288 | SpecialPage::resolveAlias( $title->getDBkey() ) !== 'Userlogin'; |
| 289 | + |
288 | 290 | // Load ad CSS file when ads are enabled |
289 | 291 | if( |
290 | 292 | $isNormalPage && |
291 | 293 | in_array( $namespace, $wgAdConfig['namespaces'] ) |
292 | 294 | ) |
293 | 295 | { |
294 | | - global $wgScriptPath; |
295 | | - $cssPath = $wgScriptPath . '/extensions/ShoutWikiAds/css/'; |
296 | 296 | if ( get_class( $sk ) == 'SkinMonaco' ) { // Monaco |
297 | | - $out->addExtensionStyle( $cssPath . 'monaco-ads.css' ); |
| 297 | + $out->addModuleStyles( 'ext.ShoutWikiAds.monaco' ); |
298 | 298 | } elseif( get_class( $sk ) == 'SkinMonoBook' ) { // Monobook |
299 | 299 | if ( $wgAdConfig['right-column'] ) { |
300 | | - $out->addExtensionStyle( $cssPath . 'monobook-skyscraper-ad.css' ); |
| 300 | + $out->addModuleStyles( 'ext.ShoutWikiAds.monobook.skyscraper' ); |
301 | 301 | } |
302 | 302 | if ( $wgAdConfig['toolbox-button'] ) { |
303 | | - $out->addExtensionStyle( $cssPath . 'monobook-button-ad.css' ); |
| 303 | + $out->addModuleStyles( 'ext.ShoutWikiAds.monobook.button' ); |
304 | 304 | } |
305 | 305 | } elseif ( get_class( $sk ) == 'SkinTruglass' ) { // Truglass |
306 | | - $out->addExtensionStyle( $cssPath . 'truglass-ads.css' ); |
| 306 | + $out->addModuleStyles( 'ext.ShoutWikiAds.truglass' ); |
307 | 307 | } |
308 | 308 | } |
309 | 309 | } |
Index: trunk/extensions/ShoutWikiAds/css/monobook-skyscraper-ad.css |
— | — | @@ -2,7 +2,10 @@ |
3 | 3 | * Skyscraper ad styling for Monobook skin |
4 | 4 | */ |
5 | 5 | #content { |
6 | | - margin: 2.8em 125px 0 12.2em !important; |
| 6 | + margin-top: 2.8em !important; |
| 7 | + margin-right: 125px !important; |
| 8 | + margin-bottom: 0 !important; |
| 9 | + margin-left: 12.2em !important; |
7 | 10 | } |
8 | 11 | |
9 | 12 | #content { |
— | — | @@ -13,7 +16,10 @@ |
14 | 17 | width: 120px; |
15 | 18 | clear: left; |
16 | 19 | position: absolute; |
17 | | - padding: 35px 0px 0px 3px; |
| 20 | + padding-top: 35px; |
| 21 | + padding-right: 0px; |
| 22 | + padding-bottom: 0px; |
| 23 | + padding-left: 3px; |
18 | 24 | float: right; |
19 | 25 | right: 0px; |
20 | 26 | top: 10px; |
— | — | @@ -22,24 +28,4 @@ |
23 | 29 | |
24 | 30 | #footer { |
25 | 31 | width: 91%; |
26 | | -} |
27 | | - |
28 | | -/* RTL rules */ |
29 | | -body.rtl #content { |
30 | | - margin: 2.8em 12.2em 0 125px !important; |
31 | | -} |
32 | | - |
33 | | -body.rtl #content { |
34 | | - border-left: solid 1px rgb(170,170,170); |
35 | | -} |
36 | | - |
37 | | -body.rtl #column-google { |
38 | | - width: 120px; |
39 | | - clear: right; |
40 | | - position: absolute; |
41 | | - padding: 35px 3px 0px 0px; |
42 | | - float: left; |
43 | | - left: 0px; |
44 | | - top: 10px; |
45 | | - z-index: 1; |
46 | 32 | } |
\ No newline at end of file |
Index: trunk/extensions/ShoutWikiAds/css/monobook-button-ad.css |
— | — | @@ -6,12 +6,4 @@ |
7 | 7 | top: 10px; |
8 | 8 | width: 150px; |
9 | 9 | z-index: 1; |
10 | | -} |
11 | | - |
12 | | -/* RTL rules */ |
13 | | -body.rtl #p-ads-left { |
14 | | - left: 0px; |
15 | | - top: 10px; |
16 | | - width: 150px; |
17 | | - z-index: 1; |
18 | 10 | } |
\ No newline at end of file |