Extension:Google News Bar
From MediaWiki.org
|
Google News Bar Release status: beta |
|
|---|---|
| Implementation | Tag |
| Description | Add a Google News Bar to your wiki pages. |
| Author(s) | csw |
| Last Version | 0.1 |
| MediaWiki | 1.6.8 and up |
| License | No license specified |
| Download | googleNewsBarExtension_0.1.txt |
| Parameters | newstitle, newskey |
Contents |
[edit] What can this extension do?
This extension adds a Google News Bar to your wiki pages.
[edit] Usage
<googleNewsBar newstitle="China Stock Market News" newskey="China Stock Market">Loading ... </googleNewsBar>
[edit] Installation
You will need a Google AJAX API key for your site (can be obtained here).
[edit] Parameters
- newstitle
- the title you want to display for your Google News Bar
- newskey
- the keywords that Google will use to fetch related news and display on your wiki page
[edit] Changes to LocalSettings.php
require_once("$IP/extensions/googleNewsBarExtension.php");
[edit] Code
<?php # Save the extension to your extensions folder as googleNewsBarExtension.php. # To activate the extension, include it from your LocalSettings.php with: # require_once("$IP/extensions/googleNewsBarExtension.php"); # Usage example: # <googleNewsBar newstitle="Baidu In The News" newskey="Baidu China">Loading ... </googleNewsBar> $wgExtensionFunctions[] = "googleNewsBarExtension"; $googleNewsBarKey = "put_your_google_api_key_here"; # Credits for 'Special:Version' page $wgExtensionCredits['other'][] = array( 'name' => 'Google News Bar', 'version' => '071007', 'author' => 'China Stock Market Wiki and others', 'description' => 'adds capability to enable Google News bar to your wiki site', 'url' => 'http://www.mediawiki.org/wiki/Extension:Google_News_Bar' ); # Register the extension with the WikiText parser function googleNewsBarExtension( ) { global $wgParser; $wgParser->setHook( "googleNewsBar", "renderGoogleNewsBar"); } # The callback function for converting the input text to HTML output function renderGoogleNewsBar( $input, $argv, &$parser ) { global $googleNewsBarKey; $output = "<div id='newsBar-bar'><span style='color:#676767;font-size:11px;margin:10px;padding:4px'>Loading...</span> </div>"; $output .= "<script src='http://www.google.com/uds/api?file=uds.js&v=1.0&source=uds-nbw&key=" . $googleNewsBarKey . "' "; $output .= "type='text/javascript'></script>"; $output .= "<style type='text/css'> @import url('http://www.google.com/uds/css/gsearch.css'); </style>"; $output .= "<script type='text/javascript'> window._uds_nbw_donotrepair = true; </script>"; $output .= "<script src='http://www.google.com/uds/solutions/newsbar/gsnewsbar.js?mode=new' type='text/javascript'></script>"; $output .= "<style type='text/css'> @import url('http://www.google.com/uds/solutions/newsbar/gsnewsbar.css'); </style>"; $output .= '<script type="text/javascript">function LoadNewsBar(){ var newsBar; var options ={largeResultSet:false, title:'; $output .= '"'.$argv['newstitle'].'"'.', horizontal:false, autoExecuteList:{executeList:'; $output .= '["'.$argv['newskey'].'"]'.'}}; newsBar=new GSnewsBar(document.getElementById("newsBar-bar"), options);}'; // for multiple keywords use newskey1="my keyword" newskey2=... and replace the line before by the next commented code : /* $output .= '['; $keyw = array(); foreach ($argv as $key => $value) { if (ereg("^newskey[0-9]*", $key)) $keyw[$key] = "\"".$value."\""; } $output .= implode(",", $keyw); $output .= ']'.'}}; newsBar=new GSnewsBar(document.getElementById("newsBar-bar"), options);}'; */ $output .= 'GSearch.setOnLoadCallback(LoadNewsBar);</script>'; return $output; }
[edit] Google Blog Bar
[edit] What can this extension do?
This extension adds a Google Blog Bar to your wiki pages. preview available on FlyerWiki
[edit] Usage
<googleblogBar newstitle="VOTE-FOR.IT AIRLINE NEWS" newskey="site:travel.vote-for.it">Loading ... </googleblogBar>
[edit] Code
<?php # Save the extension to your extensions folder as googleNewsBarExtension.php. # To activate the extension, include it from your LocalSettings.php with: # require_once("$IP/extensions/googleNewsBarExtension.php"); # Usage example: # <googleblogBar newstitle="VOTE-FOR.IT AIRLINE NEWS" newskey="site:travel.vote-for.it">Loading ... </googleblogBar> $wgExtensionFunctions[] = "googleblogBarExtension"; $googleblogBarKey = "put_your_google_api_key_here"; # Credits for 'Special:Version' page $wgExtensionCredits['other'][] = array( 'name' => 'Google News Bar', 'version' => '071007', 'author' => 'China Stock Market Wiki and others', 'description' => 'adds capability to enable Google News bar to your wiki site', 'url' => 'http://www.mediawiki.org/wiki/Extension:Google_News_Bar' ); # Register the extension with the WikiText parser function googleblogBarExtension( ) { global $wgParser; $wgParser->setHook( "googleblogBar", "renderGoogleblogBar"); } # The callback function for converting the input text to HTML output function renderGoogleblogBar( $input, $argv, &$parser ) { global $googleblogBarKey; $output = "<div id='blogBar-bar'><span style='color:#676767;font-size:11px;margin:10px;padding:4px'>Loading...</span> </div>"; $output .= "<script src='http://www.google.com/uds/api?file=uds.js&v=1.0&source=uds-blbw&key=" . $googleblogBarKey . "' "; $output .= "type='text/javascript'></script>"; $output .= "<style type='text/css'> @import url('http://www.google.com/uds/css/gsearch.css'); </style>"; $output .= "<script src='http://www.google.com/uds/solutions/blogbar/gsblogbar.js?mode=new' type='text/javascript'></script>"; $output .= "<style type='text/css'> @import url('http://www.google.com/uds/solutions/blogbar/gsblogbar.css'); </style>"; $output .= '<script type="text/javascript">function LoadblogBar(){ var blogBar; var options ={largeResultSet:false, title:'; $output .= '"'.$argv['newstitle'].'"'.', horizontal:false, autoExecuteList:{executeList:'; $output .= '["'.$argv['newskey'].'"]'.'}}; blogBar=new GSblogBar(document.getElementById("blogBar-bar"), options);}'; $output .= 'GSearch.setOnLoadCallback(LoadblogBar);</script>'; return $output; }
[edit] Who's using it?
(Please add your URL to the bottom of the list.)

