Index: trunk/extensions/freenodeChat/freenodeChat_body.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | |
14 | 14 | function execute( $par ) { |
15 | 15 | global $wgOut, $wgUser; |
16 | | - global $wgFreenodeChannel; |
| 16 | + global $wgFreenodeChatChannel, $wgFreenodeChatExtraParameters; |
17 | 17 | |
18 | 18 | // Preperation. |
19 | 19 | wfLoadExtensionMessages( 'FreenodeChat' ); |
— | — | @@ -22,13 +22,12 @@ |
23 | 23 | $wgOut->addWikiMsg( 'freenodechat-header' ); |
24 | 24 | |
25 | 25 | // Prepare query string to pass to widget. |
26 | | - $queryAssoc = array( |
27 | | - 'channels' => $wgFreenodeChannel |
28 | | - ); |
29 | | - |
30 | | - if ( $wgUser->IsLoggedIn() ) $queryAssoc[ 'nick' ] = str_replace( ' ', '_', $wgUser->getName() ); |
31 | | - |
32 | | - foreach ( $queryAssoc as $parameter => $value ) { |
| 26 | + $queryAssoc = array( 'channels' => $wgFreenodeChatChannel ); |
| 27 | + if ( $wgUser->IsLoggedIn() ) $queryAssoc[ 'nick' ] = str_replace( ' ', '_', $wgUser->getName() ); |
| 28 | + if ( $wgFreenodeChatExtraParameters ) { |
| 29 | + $queryAssoc = array_merge( $queryAssoc, $wgFreenodeChatExtraParameters ); |
| 30 | + } |
| 31 | + foreach ( $queryAssoc as $parameter => $value ) { |
33 | 32 | $query[] = $parameter . '=' . urlencode( $value ); |
34 | 33 | } |
35 | 34 | $queryString = implode( '&', $query ); |
— | — | @@ -37,7 +36,24 @@ |
38 | 37 | $wgOut->addHTML( Xml::openElement( 'iframe', array( |
39 | 38 | 'width' => '1000', |
40 | 39 | 'height' => '500', |
| 40 | + 'scrolling' => 'no', |
| 41 | + 'border' => '0', |
| 42 | + 'onLoad' => 'freenodeChatExpand( this )', |
41 | 43 | 'src' => 'http://webchat.freenode.net/?' . $queryString |
42 | 44 | ) ) . Xml::closeElement( 'iframe' ) ); |
| 45 | + |
| 46 | + // Hack to make the chat area a reasonable size. |
| 47 | + $wgOut->addHTML( Xml::tags( 'script', |
| 48 | + array( 'type' => 'text/javascript' ), |
| 49 | +'/* <![CDATA[ */ |
| 50 | +function freenodeChatExpand( elem ) { |
| 51 | + height = elem.height; |
| 52 | + width = elem.width; |
| 53 | + elem.height = screen.height - 500; |
| 54 | + elem.width = screen.width - 250; |
| 55 | +} |
| 56 | +/* ]]> */' |
| 57 | + ) ); |
| 58 | + |
43 | 59 | } |
44 | 60 | } |
Index: trunk/extensions/freenodeChat/freenodeChat.php |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | 'name' => 'Freenode Chat', |
22 | 22 | 'description' => 'Adds a special page used to chat in real time with other wiki users (using freenode web IRC client).', |
23 | 23 | 'descriptionmsg' => 'freenodechat-desc', |
24 | | - 'version' => '0.1.1', |
| 24 | + 'version' => '1.0.0', |
25 | 25 | 'author' => array( 'Robert Leverington', 'Marco 27' ) |
26 | 26 | ); |
27 | 27 | |
— | — | @@ -35,8 +35,12 @@ |
36 | 36 | $wgExtensionMessagesFiles[ 'FreenodeChat' ] = $dir . 'freenodeChat.i18n.php'; |
37 | 37 | $wgExtensionAliasesFiles[ 'FreenodeChat' ] = $dir . 'freenodeChat.alias.php'; |
38 | 38 | |
| 39 | +// Default configuration. |
| 40 | +$wgFreenodeChatChannel = '#mediawiki-i18n'; |
| 41 | +$wgFreenodeChatExtraParameters = array(); |
| 42 | + |
39 | 43 | // Permissions. |
40 | 44 | $wgAvailableRights[] = 'freenodechat'; |
41 | | -$wgGroupPermissions[ '*' ][ 'freenodechat' ] = true; |
| 45 | +$wgGroupPermissions[ '*' ][ 'freenodechat' ] = false; |
42 | 46 | $wgGroupPermissions[ 'user' ][ 'freenodechat' ] = true; |
43 | 47 | $wgGroupPermissions[ 'sysop' ][ 'freenodechat' ] = true; |