r50759 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50758‎ | r50759 | r50760 >
Date:22:51, 18 May 2009
Author:dale
Status:deferred
Tags:
Comment:
updates to metavid Extension to work with new-upload branch
Modified paths:
  • /trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/MV_MagicWords.php (modified) (history)
  • /trunk/extensions/MetavidWiki/languages/MV_Messages.php (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_allpages.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/README (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/cortado_iframe.php (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_smil.smil.xml (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/i18n (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/images (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/jquery (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/jsmin.php (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libClipEdit (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedVideo (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libTimedText (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed_iframe.php (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/null_file.mov (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/simpleScriptLoader.php (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/skins (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_search.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_stream.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php
@@ -44,14 +44,15 @@
4545 }
4646 function mvSetupExtension() {
4747 global $mvVersion, $mvNamespace, $mvgIP, $wgHooks, $wgExtensionCredits, $mvMasterStore,
48 - $wgParser, $mvArticlePath, $mvgScriptPath, $wgScriptPath, $wgServer, $wgExtensionFunctions, $markerList,$wgVersion,
 48+ $wgParser, $mvArticlePath, $mvgScriptPath, $wgServer, $wgExtensionFunctions, $markerList,$wgVersion,
4949 $wgAjaxExportList, $mvEnableAutoComplete, $mvEnableJSMVDrewrite,
5050 $wgAutoloadClasses, $wgSpecialPages, $wgMediaHandlers, $wgJSAutoloadClasses,
5151 $wgAPIModules;
5252
53 - //setupMsg
54 - mvfInitMessages();
5553
 54+ mvfInitMessages();
 55+ //add the ALL page header
 56+ mvfAutoAllPageHeader();
5657
5758 /********************************
5859 * Ajax Hooks
@@ -97,65 +98,12 @@
9899 /**********************************************/
99100 /***** register autoLoad javascript Classes: */
100101 /**********************************************/
 102+ $mv_jspath = $mvgIP . '/skins/';
101103
102 - //build a shortcut to the local js extension path from the $mvgScriptPath setting:
103 - $mv_jspath = str_replace($wgScriptPath, '', $mvgScriptPath) . '/skins/';
104 - //remove leading slash
105 - if($mv_jspath[0]=='/')
106 - $mv_jspath = substr($mv_jspath, 1);
107 -
108 - $mvjsp = $mv_jspath . 'mv_embed/';
109 - //core:
110 - $wgJSAutoloadClasses['window.jQuery'] = $mvjsp . 'jquery/jquery-1.2.6.js';
111 - $wgJSAutoloadClasses['mv_embed'] = $mvjsp . 'mv_embed.js';
112 -
113104 $wgJSAutoloadClasses['mv_allpages'] = $mv_jspath . 'mv_allpages.js';
114105 $wgJSAutoloadClasses['mv_search'] = $mv_jspath . 'mv_search.js';
115 - $wgJSAutoloadClasses['mv_stream'] = $mv_jspath . 'mv_stream.js';
116 -
117 - //$wgJSAutoloadClasses['']
118 - $wgJSAutoloadClasses['j.ui'] = $mvjsp . 'jquery/jquery.ui-1.7.1/ui/ui.core.js';
119 - $wgJSAutoloadClasses['j.ui.droppable'] = $mvjsp . 'jquery/jquery.ui-1.7.1/ui/ui.droppable.js';
120 - $wgJSAutoloadClasses['j.ui.draggable'] = $mvjsp . 'jquery/jquery.ui-1.7.1/ui/ui.droppable.js';
121 - $wgJSAutoloadClasses['j.ui.sortable'] = $mvjsp . 'jquery/jquery.ui-1.7.1/ui/ui.sortable.js';
122 - $wgJSAutoloadClasses['j.ui.resizable'] = $mvjsp . 'jquery/jquery.ui-1.7.1/ui/ui.resizable.js';
123 - $wgJSAutoloadClasses['j.contextMenu'] = $mvjsp . 'jquery/plugins/jquery.contextMenu.js';
124 - $wgJSAutoloadClasses['j.fn.autocomplete'] = $mvjsp . 'jquery/plugins/jquery.autocomplete.js';
125 - $wgJSAutoloadClasses['j.fn.hoverIntent'] = $mvjsp . 'jquery/plugins/jquery.hoverIntent.js';
126 - $wgJSAutoloadClasses['j.Jcrop'] = $mvjsp . 'jquery/plugins/Jcrop/js/jquery.Jcrop.js';
127 - $wgJSAutoloadClasses['Date.fromString'] = $mvjsp . 'jquery/plugins/date.js';
128 - $wgJSAutoloadClasses['j.fn.datePicker'] = $mvjsp . 'jquery/plugins/jquery.datePicker.js';
129 -
130 - //libAddMedia:
131 - $wgJSAutoloadClasses['mvFirefogg'] = $mvjsp . 'libAddMedia/mvFirefogg.js';
132 - $wgJSAutoloadClasses['mvUploader'] = $mvjsp . 'libAddMedia/mvUploader.js';
133 - $wgJSAutoloadClasses['remoteSearchDriver'] = $mvjsp . 'libAddMedia/remoteSearchDriver.js';
134 - $wgJSAutoloadClasses['seqRemoteSearchDriver'] = $mvjsp . 'libAddMedia/seqRemoteSearchDriver.js';
135 - $wgJSAutoloadClasses['baseRemoteSearch'] = $mvjsp . 'libAddMedia/searchLibs/baseRemoteSearch.js';
136 - $wgJSAutoloadClasses['mediaWikiSearch'] = $mvjsp . 'libAddMedia/searchLibs/mediaWikiSearch.js';
137 - $wgJSAutoloadClasses['metavidSearch'] = $mvjsp . 'libAddMedia/searchLibs/metavidSearch.js';
138 - $wgJSAutoloadClasses['archiveOrgSearch'] = $mvjsp . 'libAddMedia/searchLibs/archiveOrgSearch.js';
139 - $wgJSAutoloadClasses['baseRemoteSearch'] = $mvjsp . 'libAddMedia/searchLibs/baseRemoteSearch.js';
140 -
141 - //libClipEdit:
142 - $wgJSAutoloadClasses['mvClipEdit'] = $mvjsp . 'libClipEdit/mvClipEdit.js';
143 -
144 - //libEmbedObj:
145 - $wgJSAutoloadClasses['embedVideo'] = $mvjsp . 'libEmbedObj/mv_baseEmbed.js';
146 - $wgJSAutoloadClasses['flashEmbed'] = $mvjsp . 'libEmbedObj/mv_flashEmbed.js';
147 - $wgJSAutoloadClasses['genericEmbed'] = $mvjsp . 'libEmbedObj/mv_genericEmbed.js';
148 - $wgJSAutoloadClasses['htmlEmbed'] = $mvjsp . 'libEmbedObj/mv_htmlEmbed.js';
149 - $wgJSAutoloadClasses['javaEmbed'] = $mvjsp . 'libEmbedObj/mv_javaEmbed.js';
150 - $wgJSAutoloadClasses['nativeEmbed'] = $mvjsp . 'libEmbedObj/mv_nativeEmbed.js';
151 - $wgJSAutoloadClasses['quicktimeEmbed'] = $mvjsp . 'libEmbedObj/mv_quicktimeEmbed.js';
152 - $wgJSAutoloadClasses['vlcEmbed'] = $mvjsp . 'libEmbedObj/mv_vlcEmbed.js';
 106+ $wgJSAutoloadClasses['mv_stream'] = $mv_jspath . 'mv_stream.js';
153107
154 - //libSequencer:
155 - $wgJSAutoloadClasses['mvPlayList'] = $mvjsp . 'libSequencer/mvPlayList.js';
156 - $wgJSAutoloadClasses['mvSequencer'] = $mvjsp . 'libSequencer/mvSequencer.js';
157 -
158 - //libTimedText:
159 - $wgJSAutoloadClasses['mvTextInterface'] = $mvjsp . 'libTimedText/mvTextInterface.js';
160108
161109
162110 /**********************************************/
@@ -310,10 +258,9 @@
311259 * API extension (this may be integrated into semantic wiki at some point)
312260 **************************************/
313261
314 - //add the ALL page header
315 - mvfAutoAllPageHeader();
316262
317263
 264+
318265 // $wgHooks['BeforePageDisplay'][] = 'mvDoSpecialPage';
319266 // $wgHooks['ArticleViewHeader'][] = 'mvArticleViewOpts';
320267 /**********************************************/
@@ -354,8 +301,7 @@
355302 * enables linkback and autocomplete for search
356303 */
357304 function mvfAutoAllPageHeader() {
358 - global $mvgScriptPath, $wgJsMimeType, $wgOut, $mvExtraHeader, $mvgJSDebug, $wgEnableScriptLoader, $wgRequest, $wgScriptPath;
359 -
 305+ global $mvgScriptPath, $wgJsMimeType, $wgOut, $mvExtraHeader, $wgTitle, $mvgJSDebug, $wgEnableScriptLoader, $wgRequest;;
360306 $mvgScriptPath = htmlspecialchars( $mvgScriptPath );
361307 $wgJsMimeType = htmlspecialchars( $wgJsMimeType ) ;
362308 //set the unquie request value
@@ -365,35 +311,11 @@
366312 //@@todo should read form svn version file info
367313 $unique_req_param = MV_VERSION;
368314 }
369 -
370 - //if scriptload is off manually load the requested js:
371 - if( $wgEnableScriptLoader ){
372 - /*$debug_param = ( $mvgJSDebug ||
373 - $wgRequest->getVal('debug')=='true' ||
374 - $wgRequest->getVal('debug')=='1' )
375 - ? '&debug=true' : '';
376 - $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$wgScriptPath}/mvwScriptLoader.php?" .
377 - "class=window.jQuery,j.fn.autocomplete,j.fn.hoverIntent,mv_embed,mv_allpages,mv_search" .
378 - '&urid=' .$unique_req_param . $debug_param . "\"></script>"
379 - );*/
380 - $classes = array( 'window.jQuery','j.fn.autocomplete','j.fn.hoverIntent','mv_embed','mv_allpages','mv_search');
381 - foreach($classes as $js_class){
382 - $wgOut->addScriptClass( $js_class );
383 - }
384 - }else{
385 - $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/jquery/jquery-1.3.2.min.js?{$unique_req_param}\"></script>" );
386 - $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/jquery/plugins/jquery.autocomplete.js?{$unique_req_param}\"></script>" );
387 - $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/jquery/plugins/jquery.hoverIntent.js?{$unique_req_param}\"></script>" );
 315+
 316+ $wgOut->addScriptFile( "{$mvgScriptPath}/skins/mv_allpages.js" );
 317+ $wgOut->addScriptFile( "{$mvgScriptPath}/skins/mv_search.js" );
388318
389 - $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/mv_embed.js?{$unique_req_param}\"></script>" );
390 - $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_allpages.js?{$unique_req_param}\"></script>" );
391 - $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_search.js?{$unique_req_param}\"></script>" );
392 - }
393319
394 - //temp for testing:
395 - if( $mvgJSDebug )
396 - $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/add_media_wizard.js?{$unique_req_param}\"></script>" );
397 -
398320 $mvCssUrl = $mvgScriptPath . '/skins/mv_custom.css';
399321 $wgOut->addLink( array(
400322 'rel' => 'stylesheet',
@@ -407,7 +329,7 @@
408330 function mvAddPerNamespaceJS( &$title ){
409331 global $mvgScriptPath, $wgJsMimeType, $wgOut;
410332 if( $title->getNamespace() == MV_NS_STREAM )
411 - $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_stream.js\" ></script>" );
 333+ $wgOut->addScriptFile( "{$mvgScriptPath}/skins/mv_stream.js" );
412334 }
413335 function mvAddGlobalJSVariables( $values ){
414336 global $mvGlobalJSVariables;
@@ -689,8 +611,12 @@
690612 }
691613 }
692614 function seconds2Description( $seconds, $short=false, $singular=false){
693 - $dur = time_duration_2array( $seconds );
 615+ $dur = time_duration_2array( $seconds , array('days'=> '86400', 'hours'=> 3600,'minutes' => 60,'seconds' => 1));
694616 $o='';
 617+ if( $dur['days']!=0){
 618+ $msg = ($singular)?'mv_days_singular':'mv_days';
 619+ $o.= wfMsg($msg, intval( $dur['days']) );
 620+ }
695621 if( $dur['hours'] != 0 ){
696622 $msg = ($singular)?'mv_hours_singular':'mv_hours';
697623 $o.= wfMsg($msg, intval( $dur['hours']) );
@@ -915,4 +841,4 @@
916842 return wfMsg( 'mv_viewprevnext', $plink, $nlink );
917843 }
918844 }
919 -?>
 845+?>
\ No newline at end of file
Index: trunk/extensions/MetavidWiki/includes/MV_MagicWords.php
@@ -80,14 +80,13 @@
8181 }
8282 function getTotalLength(){
8383 $dbr = & wfGetDB( DB_READ );
84 - $result =& $dbr->query(' SELECT SUM( `duration` ) as `dur`
85 -FROM `mv_streams`
86 -WHERE 1 ');
 84+ $result =& $dbr->query('SELECT SUM( `duration` ) as `dur`
 85+FROM `mv_streams` ');
8786 if ( $dbr->numRows( $result ) == 0 ) {
8887 return '';
8988 } else {
9089 $row = $dbr->fetchObject( $result );
91 - return seconds2Description ( $row->dur);
 90+ return trim( seconds2Description ( $row->dur) );
9291 }
9392 }
9493 function getBillOut() {
Index: trunk/extensions/MetavidWiki/languages/MV_Messages.php
@@ -429,6 +429,7 @@
430430
431431 'mv_other_options' => 'Other options',
432432 'mv_contextmenu_opt' => 'Enable context menus',
 433+ 'mv_days' => '$1 {{PLURAL:$1|day|days}} ',
433434 'mv_hours' => '$1 {{PLURAL:$1|hour|hours}} ',
434435 'mv_hours_singular' => '$1 hour',
435436 'mv_minutes' => '$1 {{PLURAL:$1|minute|minutes}}',
Index: trunk/extensions/MetavidWiki/skins/mv_embed/cortado_iframe.php
@@ -1,220 +0,0 @@
2 -<?php
3 -/*
4 -cortado_embed.php
5 -all file checks and conditions should be checked prior to loading this page.
6 -this page serves as a wrapper for the cortado java applet
7 -*/
8 -
9 -cortado_iframe();
10 -
11 -function cortado_iframe() {
12 - if(!function_exists('filter_input')){
13 - die('your version of php lacks <b>filter_input()</b> function</br>');
14 - }
15 - //load the http GETS:
16 - // set the parent domain if provided
17 - $parent_domain = isset( $_GET['parent_domain'] ) ? $_GET['parent_domain'] : false;
18 -
19 - //default to null media in not provided:
20 - $media_url = isset( $_GET['media_url'] ) ? $_GET['media_url'] : false;
21 - if( strval($media_url) === ''){
22 - error_out('not valid or missing media url');
23 - }
24 - //default duration to 30 seconds if not provided. (ideally cortado would read this from the video file)
25 - //$duration = (isset($_GET['duration']))?$_GET['duration']:0;
26 - $duration = filter_input(INPUT_GET, 'duration', FILTER_SANITIZE_NUMBER_INT);
27 - if( is_null($duration) || $duration===false){
28 - $duration=0;
29 - }
30 -
31 - //id (set to random if none provided)
32 - //$id = (isset($_GET['id']))?$_GET['id']:'vid_'.rand('10000000');
33 - $id = isset($_GET['id']) ? $_GET['id'] : false;
34 - if( is_null($id) || $id===false){
35 - $id = 'vid_'.rand(0,10000000);
36 - }
37 -
38 - $width = filter_input(INPUT_GET, 'width', FILTER_SANITIZE_NUMBER_INT);
39 - if( is_null($width) || $width===false){
40 - $width=320;
41 - }
42 - $height = filter_input(INPUT_GET, 'height', FILTER_SANITIZE_NUMBER_INT);
43 - //default to video:
44 - $stream_type = (isset($_GET['stream_type']))?$_GET['stream_type']:'video';
45 - if($stream_type=='video'){
46 - $audio=$video='true';
47 - if(is_null($height) || $height===false)
48 - $height = 240;
49 - } else { // if($stream_type=='audio')
50 - $audio='true';
51 - $video='false';
52 - if(is_null($height) || $height===false)
53 - $height = 20;
54 - }
55 -
56 - //everything good output page:
57 - output_page(array(
58 - 'id' => $id,
59 - 'media_url' => $media_url,
60 - 'audio' => $audio,
61 - 'video' => $video,
62 - 'duration' => $duration,
63 - 'width' => $width,
64 - 'height' => $height,
65 - 'parent_domain' => $parent_domain
66 - ));
67 -}
68 -
69 -/**
70 - * JS escape function copied from MediaWiki's Xml::escapeJsString()
71 - */
72 -function escapeJsString( $string ) {
73 - // See ECMA 262 section 7.8.4 for string literal format
74 - $pairs = array(
75 - "\\" => "\\\\",
76 - "\"" => "\\\"",
77 - '\'' => '\\\'',
78 - "\n" => "\\n",
79 - "\r" => "\\r",
80 -
81 - # To avoid closing the element or CDATA section
82 - "<" => "\\x3c",
83 - ">" => "\\x3e",
84 -
85 - # To avoid any complaints about bad entity refs
86 - "&" => "\\x26",
87 -
88 - # Work around https://bugzilla.mozilla.org/show_bug.cgi?id=274152
89 - # Encode certain Unicode formatting chars so affected
90 - # versions of Gecko don't misinterpret our strings;
91 - # this is a common problem with Farsi text.
92 - "\xe2\x80\x8c" => "\\u200c", // ZERO WIDTH NON-JOINER
93 - "\xe2\x80\x8d" => "\\u200d", // ZERO WIDTH JOINER
94 - );
95 - return strtr( $string, $pairs );
96 -}
97 -
98 -function error_out($error=''){
99 - output_page(array('error' => $error));
100 - exit();
101 -}
102 -function output_page($params){
103 - extract( $params );
104 -?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
105 - <html xmlns="http://www.w3.org/1999/xhtml">
106 - <head>
107 - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
108 - <title>cortado_embed</title>
109 - <script type="text/javascript">
110 - <? //set the parent domain:
111 - if( $parent_domain ){?>
112 - try{
113 - document.domain = '<?php echo htmlspecialchars( $parent_domain )?>';
114 - }catch (e){
115 - if( window.console )
116 - console.log('could not set domain to <?php echo htmlspecialchars( $parent_domain )?>');
117 - }
118 - <?
119 - } ?>
120 - var jPlayer = null;
121 - function setGlobalJplayer(){
122 - jPlayer = document.getElementById('<?php echo htmlspecialchars( $id ) ?>');
123 - }
124 - </script>
125 - <style type="text/css">
126 - <!--
127 - body {
128 - margin-left: 0px;
129 - margin-top: 0px;
130 - margin-right: 0px;
131 - margin-bottom: 0px;
132 - }
133 - -->
134 - </style></head>
135 - <body onload="setGlobalJplayer()" >
136 - <?php
137 - $appid = ( preg_match("/MSIE/i", getenv("HTTP_USER_AGENT")) ) ? '' : 'classid="java:com.fluendo.player.Cortado.class"';
138 - if (empty($error)){ ?>
139 - <div id="jPlayer"></div>
140 - <OBJECT id="<?php echo htmlspecialchars( $id ) ?>"
141 - code="com.fluendo.player.Cortado.class"
142 - <?php echo $appid ?>
143 - archive="binPlayers/cortado/cortado-wmf-r46643.jar"
144 - width="<?php echo htmlspecialchars( $width )?>"
145 - height="<?php echo htmlspecialchars( $height )?>" >
146 - <param name="url" value="<?php echo htmlspecialchars( $media_url )?>" />
147 - <param name="local" value="false"/>
148 - <param name="keepaspect" value="true" />
149 - <param name="video" value="<?php echo htmlspecialchars( $video )?>" />
150 - <param name="audio" value="<?php echo htmlspecialchars( $audio )?>" />
151 - <param name="seekable" value="false" />
152 - <? if($duration!=0){
153 - ?>
154 - <param name="duration" value="<?php echo htmlspecialchars( $duration )?>" />
155 - <?
156 - } ?>
157 - <param name="showStatus" value="hide" />
158 - <param name="autoPlay" value="true" />
159 - <param name="BufferSize" value="8192" />
160 - <param name="BufferHigh" value="30" />
161 - <param name="BufferLow" value="5" />
162 - </OBJECT>
163 - <? }else{ ?>
164 - <b>Error:</b> <?php echo htmlspecialchars( $error )?>
165 - <?
166 - }
167 - ?>
168 - </body>
169 - </html>
170 -<?
171 -}
172 -/*
173 -javascript envoked version:
174 - function doPlayer(){
175 - jPlayer = document.createElement('OBJECT');
176 - jPlayer.setAttribute('classid', 'java:com.fluendo.player.Cortado.class');
177 - jPlayer.type = 'application/x-java-applet';
178 - jPlayer.setAttribute('archive', this.CortadoLocation);
179 - jPlayer.id = '<?php echo htmlspecialchars( $id ) ?>';
180 - jPlayer.width = '<?php echo htmlspecialchars( $width )?>';
181 - jPlayer.height = '<?php echo htmlspecialchars( $height )?>';
182 -
183 - var params = {
184 - 'code': 'com.fluendo.player.Cortado',
185 - 'archive': 'cortado-wmf-r46643.jar',
186 - 'url': '<?php echo htmlspecialchars( $media_url )?>',
187 - 'local': 'false',
188 - 'keepAspect': 'true',
189 - 'video': '<?php echo htmlspecialchars( $video )?>',
190 - 'audio': '<?php echo htmlspecialchars( $audio )?>',
191 - 'seekable': 'false',
192 - 'showStatus': 'hide',
193 - 'autoPlay': 'true',
194 - 'bufferSize': '8192',
195 - 'BufferHigh':'30',
196 - 'BufferLow' : '5',
197 - <? if($duration!=0){
198 - ?>
199 - 'duration':'<?php echo htmlspecialchars( $duration )?>',
200 - <?
201 - } ?>
202 - 'debug': 0
203 - }
204 - for(name in params){
205 - var p = document.createElement('param');
206 - p.name = name;
207 - p.value = params[name];
208 - jPlayer.appendChild(p);
209 - }
210 - var pHolder = document.getElementById('jPlayer');
211 - if(pHolder)
212 - pHolder.appendChild( jPlayer );
213 - }
214 - doPlayer();
215 -//then in the page:
216 -<script type="text/javascript">
217 - doPlayer();
218 - </script>
219 - *
220 -*/
221 -?>
Index: trunk/extensions/MetavidWiki/skins/mv_embed/jsmin.php
@@ -1,293 +0,0 @@
2 -<?php
3 -
4 -if ( !defined( 'MEDIAWIKI' ) ) die( 1 );
5 -/**
6 - * jsmin.php - PHP implementation of Douglas Crockford's JSMin.
7 - *
8 - * This is pretty much a direct port of jsmin.c to PHP with just a few
9 - * PHP-specific performance tweaks. Also, whereas jsmin.c reads from stdin and
10 - * outputs to stdout, this library accepts a string as input and returns another
11 - * string as output.
12 - *
13 - * PHP 5 or higher is required.
14 - *
15 - * Permission is hereby granted to use this version of the library under the
16 - * same terms as jsmin.c, which has the following license:
17 - *
18 - * --
19 - * Copyright (c) 2002 Douglas Crockford (www.crockford.com)
20 - *
21 - * Permission is hereby granted, free of charge, to any person obtaining a copy of
22 - * this software and associated documentation files (the "Software"), to deal in
23 - * the Software without restriction, including without limitation the rights to
24 - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
25 - * of the Software, and to permit persons to whom the Software is furnished to do
26 - * so, subject to the following conditions:
27 - *
28 - * The above copyright notice and this permission notice shall be included in all
29 - * copies or substantial portions of the Software.
30 - *
31 - * The Software shall be used for Good, not Evil.
32 - *
33 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
36 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
38 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39 - * SOFTWARE.
40 - * --
41 - *
42 - * @package JSMin
43 - * @author Ryan Grove <ryan@wonko.com>
44 - * @copyright 2002 Douglas Crockford <douglas@crockford.com> (jsmin.c)
45 - * @copyright 2008 Ryan Grove <ryan@wonko.com> (PHP port)
46 - * @license http://opensource.org/licenses/mit-license.php MIT License
47 - * @version 1.1.1 (2008-03-02)
48 - * @link http://code.google.com/p/jsmin-php/
49 - */
50 -
51 -class JSMin {
52 - const ORD_LF = 10;
53 - const ORD_SPACE = 32;
54 -
55 - protected $a = '';
56 - protected $b = '';
57 - protected $input = '';
58 - protected $inputIndex = 0;
59 - protected $inputLength = 0;
60 - protected $lookAhead = null;
61 - protected $output = '';
62 -
63 - // -- Public Static Methods --------------------------------------------------
64 -
65 - public static function minify($js) {
66 - $jsmin = new JSMin($js);
67 - return $jsmin->min();
68 - }
69 -
70 - // -- Public Instance Methods ------------------------------------------------
71 -
72 - public function __construct($input) {
73 - $this->input = str_replace("\r\n", "\n", $input);
74 - $this->inputLength = strlen($this->input);
75 - }
76 -
77 - // -- Protected Instance Methods ---------------------------------------------
78 -
79 - protected function action($d) {
80 - switch($d) {
81 - case 1:
82 - $this->output .= $this->a;
83 -
84 - case 2:
85 - $this->a = $this->b;
86 -
87 - if ($this->a === "'" || $this->a === '"') {
88 - for (;;) {
89 - $this->output .= $this->a;
90 - $this->a = $this->get();
91 -
92 - if ($this->a === $this->b) {
93 - break;
94 - }
95 -
96 - if (ord($this->a) <= self::ORD_LF) {
97 - throw new JSMinException('Unterminated string literal.');
98 - }
99 -
100 - if ($this->a === '\\') {
101 - $this->output .= $this->a;
102 - $this->a = $this->get();
103 - }
104 - }
105 - }
106 -
107 - case 3:
108 - $this->b = $this->next();
109 -
110 - if ($this->b === '/' && (
111 - $this->a === '(' || $this->a === ',' || $this->a === '=' ||
112 - $this->a === ':' || $this->a === '[' || $this->a === '!' ||
113 - $this->a === '&' || $this->a === '|' || $this->a === '?')) {
114 -
115 - $this->output .= $this->a . $this->b;
116 -
117 - for (;;) {
118 - $this->a = $this->get();
119 -
120 - if ($this->a === '/') {
121 - break;
122 - } elseif ($this->a === '\\') {
123 - $this->output .= $this->a;
124 - $this->a = $this->get();
125 - } elseif (ord($this->a) <= self::ORD_LF) {
126 - throw new JSMinException('Unterminated regular expression '.
127 - 'literal.');
128 - }
129 -
130 - $this->output .= $this->a;
131 - }
132 -
133 - $this->b = $this->next();
134 - }
135 - }
136 - }
137 -
138 - protected function get() {
139 - $c = $this->lookAhead;
140 - $this->lookAhead = null;
141 -
142 - if ($c === null) {
143 - if ($this->inputIndex < $this->inputLength) {
144 - $c = $this->input[$this->inputIndex];
145 - $this->inputIndex += 1;
146 - } else {
147 - $c = null;
148 - }
149 - }
150 -
151 - if ($c === "\r") {
152 - return "\n";
153 - }
154 -
155 - if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) {
156 - return $c;
157 - }
158 -
159 - return ' ';
160 - }
161 -
162 - protected function isAlphaNum($c) {
163 - return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1;
164 - }
165 -
166 - protected function min() {
167 - $this->a = "\n";
168 - $this->action(3);
169 -
170 - while ($this->a !== null) {
171 - switch ($this->a) {
172 - case ' ':
173 - if ($this->isAlphaNum($this->b)) {
174 - $this->action(1);
175 - } else {
176 - $this->action(2);
177 - }
178 - break;
179 -
180 - case "\n":
181 - switch ($this->b) {
182 - case '{':
183 - case '[':
184 - case '(':
185 - case '+':
186 - case '-':
187 - $this->action(1);
188 - break;
189 -
190 - case ' ':
191 - $this->action(3);
192 - break;
193 -
194 - default:
195 - if ($this->isAlphaNum($this->b)) {
196 - $this->action(1);
197 - }
198 - else {
199 - $this->action(2);
200 - }
201 - }
202 - break;
203 -
204 - default:
205 - switch ($this->b) {
206 - case ' ':
207 - if ($this->isAlphaNum($this->a)) {
208 - $this->action(1);
209 - break;
210 - }
211 -
212 - $this->action(3);
213 - break;
214 -
215 - case "\n":
216 - switch ($this->a) {
217 - case '}':
218 - case ']':
219 - case ')':
220 - case '+':
221 - case '-':
222 - case '"':
223 - case "'":
224 - $this->action(1);
225 - break;
226 -
227 - default:
228 - if ($this->isAlphaNum($this->a)) {
229 - $this->action(1);
230 - }
231 - else {
232 - $this->action(3);
233 - }
234 - }
235 - break;
236 -
237 - default:
238 - $this->action(1);
239 - break;
240 - }
241 - }
242 - }
243 -
244 - return $this->output;
245 - }
246 -
247 - protected function next() {
248 - $c = $this->get();
249 -
250 - if ($c === '/') {
251 - switch($this->peek()) {
252 - case '/':
253 - for (;;) {
254 - $c = $this->get();
255 -
256 - if (ord($c) <= self::ORD_LF) {
257 - return $c;
258 - }
259 - }
260 -
261 - case '*':
262 - $this->get();
263 -
264 - for (;;) {
265 - switch($this->get()) {
266 - case '*':
267 - if ($this->peek() === '/') {
268 - $this->get();
269 - return ' ';
270 - }
271 - break;
272 -
273 - case null:
274 - throw new JSMinException('Unterminated comment.');
275 - }
276 - }
277 -
278 - default:
279 - return $c;
280 - }
281 - }
282 -
283 - return $c;
284 - }
285 -
286 - protected function peek() {
287 - $this->lookAhead = $this->get();
288 - return $this->lookAhead;
289 - }
290 -}
291 -
292 -// -- Exceptions ---------------------------------------------------------------
293 -class JSMinException extends Exception {}
294 -?>
\ No newline at end of file
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed_iframe.php
@@ -1,84 +0,0 @@
2 -<?php
3 -/*
4 -mv_embed_iframe.php
5 -this allows for remote embedding without exposing the hosting site to remote javascript.
6 -*/
7 -
8 -mv_embed_iframe();
9 -
10 -function mv_embed_iframe() {
11 - if(!function_exists('filter_input')){
12 - die('your version of php lacks <b>filter_input()</b> function</br>');
13 - }
14 - //default to null media in not provided:
15 - $stream_name = ( isset($_GET['sn']) )? $_GET['sn'] : die('no stream name provided');
16 - $time = ( isset($_GET['t']) )? $_GET['t']: '';
17 - $width = ( isset($_GET['width']) )? intval( $_GET['width'] ) : '400';
18 - $height = ( isset($_GET['height']) )? intval( $_GET['height'] ) : '300'; //
19 -
20 - $roe_url = 'http://metavid.org/wiki/Special:MvExportStream?feed_format=roe&stream_name=' . htmlspecialchars( $stream_name ) .
21 - '&t=' . htmlspecialchars( $time );
22 - //everything good output page:
23 - output_page(array(
24 - 'roe_url' => $roe_url,
25 - 'width' => $width,
26 - 'height' => $height,
27 - ));
28 -}
29 -function output_page($params){
30 - extract( $params );
31 -?>
32 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
33 - <html xmlns="http://www.w3.org/1999/xhtml">
34 - <head>
35 - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
36 - <title>mv_embed iframe</title>
37 - <style type="text/css">
38 - <!--
39 - body {
40 - margin-left: 0px;
41 - margin-top: 0px;
42 - margin-right: 0px;
43 - margin-bottom: 0px;
44 - }
45 - -->
46 - </style>
47 - <script type="text/javascript" src="mv_embed.js"></script>
48 - </head>
49 - <body>
50 - <video roe="<?php echo $roe_url ?>" width="<?php echo htmlspecialchars( $width )?>"
51 - height="<?php echo htmlspecialchars( $height )?>"></video>
52 - </body>
53 - </html>
54 -<?
55 -}
56 -
57 -/**
58 - * JS escape function copied from MediaWiki's Xml::escapeJsString()
59 - */
60 -function escapeJsString( $string ) {
61 - // See ECMA 262 section 7.8.4 for string literal format
62 - $pairs = array(
63 - "\\" => "\\\\",
64 - "\"" => "\\\"",
65 - '\'' => '\\\'',
66 - "\n" => "\\n",
67 - "\r" => "\\r",
68 -
69 - # To avoid closing the element or CDATA section
70 - "<" => "\\x3c",
71 - ">" => "\\x3e",
72 -
73 - # To avoid any complaints about bad entity refs
74 - "&" => "\\x26",
75 -
76 - # Work around https://bugzilla.mozilla.org/show_bug.cgi?id=274152
77 - # Encode certain Unicode formatting chars so affected
78 - # versions of Gecko don't misinterpret our strings;
79 - # this is a common problem with Farsi text.
80 - "\xe2\x80\x8c" => "\\u200c", // ZERO WIDTH NON-JOINER
81 - "\xe2\x80\x8d" => "\\u200d", // ZERO WIDTH JOINER
82 - );
83 - return strtr( $string, $pairs );
84 -}
85 -?>
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -1,1139 +0,0 @@
2 -/*
3 - * ~mv_embed version 1.0~
4 - * for details see: http://metavid.org/wiki/index.php/Mv_embed
5 - *
6 - * All Metavid Wiki code is Released under the GPL2
7 - * for more info visit http://metavid.org/wiki/Code
8 - *
9 - * @url http://metavid.org
10 - *
11 - * parseUri:
12 - * http://stevenlevithan.com/demo/parseuri/js/
13 - *
14 - * config values you can manually set the location of the mv_embed folder here
15 - * (in cases where media will be hosted in a different place than the embedding page)
16 - *
17 - */
18 -//fix multiple instances of mv_embed (ie include twice from two different servers)
19 -var MV_DO_INIT=true;
20 -if( MV_EMBED_VERSION ){
21 - js_log('mv_embed already included do nothing');
22 - MV_DO_INIT=false;
23 -}
24 -//used to grab fresh copies of scripts. (should be changed on commit)
25 -var MV_EMBED_VERSION = '1.0r15';
26 -
27 -//the name of the player skin (default is mvpcf)
28 -var mv_skin_name = 'mvpcf';
29 -
30 -//whether or not to load java from an iframe.
31 -//note: this is necessary for remote embedding because of java security model)
32 -var mv_java_iframe = true;
33 -
34 -//media_server mv_embed_path (the path on media servers to mv_embed for java iframe with leading and trailing slashes)
35 -var mv_media_iframe_path = '/mv_embed/';
36 -
37 -//the default height/width of the video (if no style or width attribute provided)
38 -var mv_default_video_size = '400x300';
39 -
40 -var mediaWiki_mvEmbed_path = 'extensions/MetavidWiki/skins/mv_embed/';
41 -
42 -var global_player_list = new Array(); //the global player list per page
43 -var global_req_cb = new Array(); //the global request callback array
44 -var _global = this; //global obj
45 -var mv_init_done=false;
46 -var global_cb_count =0;
47 -
48 -/*parseUri class parses URIs:*/
49 -var parseUri=function(d){var o=parseUri.options,value=o.parser[o.strictMode?"strict":"loose"].exec(d);for(var i=0,uri={};i<14;i++){uri[o.key[i]]=value[i]||""}uri[o.q.name]={};uri[o.key[12]].replace(o.q.parser,function(a,b,c){if(b)uri[o.q.name][b]=c});return uri};parseUri.options={strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};
50 -
51 -//get mv_embed location if it has not been set
52 -if( !mv_embed_path ){
53 - var mv_embed_path = getMvEmbedPath();
54 -}
55 -
56 -var mvLoadEvent = new Array() //the onReady global event.. @@todo should be removed and use jquery style document.ready stuff instead
57 -//the default thumbnail for missing images:
58 -var mv_default_thumb_url = mv_embed_path + 'images/vid_default_thumb.jpg';
59 -
60 -//init the global Msg if not already
61 -if(!gMsg){var gMsg={};}
62 -//laguage loader:
63 -function loadGM( msgSet ){
64 - for(var i in msgSet){
65 - gMsg[ i ] = msgSet[i];
66 - }
67 -}
68 -
69 -//all default msg in [English] should be overwritten by the CMS language msg system.
70 -loadGM({
71 - "loading_txt":"loading <blink>...</blink>",
72 -
73 - "loading_plugin" : "loading plugin<blink>...</blink>",
74 - "select_playback" : "Set Playback Preference",
75 - "link_back" : "Link Back",
76 - "error_load_lib" : "mv_embed: Unable to load required javascript libraries\n insert script via DOM has failed, try reloading? ",
77 -
78 - "error_swap_vid" : "Error:mv_embed was unable to swap the video tag for the mv_embed interface",
79 -
80 - "download_segment" : "Download Selection:",
81 - "download_full" : "Download Full Video File:",
82 - "download_clip" : "Download the Clip",
83 - "download_text" : "Download Text (<a style=\"color:white\" title=\"cmml\" href=\"http://wiki.xiph.org/index.php/CMML\">cmml</a> xml):",
84 -
85 - "clip_linkback" : "Clip Source Page",
86 -
87 - "mv_ogg-player-vlc-mozilla" : "VLC Plugin",
88 - "mv_ogg-player-videoElement" : "Native Ogg Video Support",
89 - "mv_ogg-player-vlc-activex" : "VLC ActiveX",
90 - "mv_ogg-player-oggPlugin" : "Generic Ogg Plugin",
91 - "mv_ogg-player-quicktime-mozilla" : "Quicktime Plugin",
92 - "mv_ogg-player-quicktime-activex" : "Quicktime ActiveX",
93 - "mv_ogg-player-cortado" : "Java Cortado",
94 - "mv_ogg-player-flowplayer" : "Flowplayer",
95 - "mv_ogg-player-selected" : " (selected)",
96 - 'mv_ogg-player-omtkplayer': "OMTK Flash Vorbis",
97 - "mv_generic_missing_plugin" : "You browser does not appear to support playback type: <b>$1</b><br> visit the <a href=\"http://metavid.org/wiki/Client_Playback\">Playback Methods</a> page to download a player<br>",
98 -
99 - "add_to_end_of_sequence" : "Add to End of Sequence",
100 -
101 - "missing_video_stream" : "The video file for this stream is missing",
102 -
103 - "select_transcript_set" : "Select Text Layers",
104 - "auto_scroll" : "auto scroll",
105 - "close" : "close",
106 - "improve_transcript" : "Improve Transcript",
107 -
108 - "next_clip_msg" : "Play Next Clip",
109 - "prev_clip_msg" : "Play Previous Clip",
110 - "current_clip_msg" : "Continue Playing this Clip",
111 - "seek_to" : "Seek to",
112 -
113 - "size-gigabytes": "$1 GB",
114 - "size-megabytes": "$1 MB",
115 - "size-kilobytes": "$1 K",
116 - "size-bytes": "$1 B"
117 -});
118 -
119 -/**
120 - * Language Functions:
121 - *
122 - * These functions try to losely mirro the functionality of Language.php in mediaWiki
123 - */
124 -function gM( key , args ) {
125 - var ms ='';
126 - if ( key in gMsg ) {
127 - ms = gMsg[ key ];
128 - if(typeof args == 'object' || typeof args == 'array'){
129 - for(var v in args){
130 - var rep = '\$'+ ( parseInt(v) + 1 );
131 - //msg test replace arguments start at 1 insted of zero:
132 - ms = ms.replace( rep, args[v]);
133 - }
134 - }else if(typeof args =='string' || typeof args =='number'){
135 - ms = ms.replace(/\$1/, args);
136 - }
137 - return ms;
138 - } else{
139 - //key is missing return indication:
140 - return '[' + key + ']';
141 - }
142 -}
143 -/*
144 - * msgSet is either a string corresponding to a single msg to load
145 - * or msgSet is an array with set of msg to load
146 - */
147 -function gMsgLoadRemote(msgSet, callback){
148 - var ammessages = '';
149 - if(typeof msgSet == 'object' ){
150 - for(var i in msgSet){
151 - ammessages += msgSet[i];
152 - }
153 - }else if(typeof msgSet == 'string'){
154 - ammessages += msgSet;
155 - }
156 - if(ammessages=='')
157 - return js_log('gMsgLoadRemote::no msg set requested');
158 -
159 - do_api_req({
160 - 'data':{'meta':'allmessages', 'ammessages':ammessages}
161 - },function(data){
162 - if(data.query.allmessages){
163 - var msgs = data.query.allmessages;
164 - for(var i in msgs){
165 - var ld = {};
166 - ld[ msgs[i]['name'] ] = msgs[i]['*'];
167 - loadGM( ld );
168 - }
169 - }
170 - //load the result into local msg var
171 - callback();
172 - });
173 -}
174 -
175 -/**
176 - * Format a size in bytes for output, using an appropriate
177 - * unit (B, KB, MB or GB) according to the magnitude in question
178 - *
179 - * @param size Size to format
180 - * @return string Plain text (not HTML)
181 - */
182 -function formatSize( size ) {
183 - // For small sizes no decimal places necessary
184 - var round = 0;
185 - var msg = '';
186 - if( size > 1024 ) {
187 - size = size / 1024;
188 - if( size > 1024 ) {
189 - size = size / 1024;
190 - // For MB and bigger two decimal places are smarter
191 - round = 2;
192 - if( size > 1024 ) {
193 - size = size / 1024;
194 - msg = 'size-gigabytes';
195 - } else {
196 - msg = 'size-megabytes';
197 - }
198 - } else {
199 - msg = 'size-kilobytes';
200 - }
201 - } else {
202 - msg = 'size-bytes';
203 - }
204 - //javascript does not let you do precession points in rounding
205 - var p = Math.pow(10,round);
206 - var size = Math.round( size * p ) / p;
207 - //@@todo we need a formatNum and we need to request some special packaged info to deal with that case.
208 - return gM( msg , size );
209 -}
210 -
211 -//gets the loading image:
212 -function mv_get_loading_img( style , class_attr ){
213 - var style_txt = (style)?style:'';
214 - var class_attr = (class_attr)?'class="'+class_attr+'"':'class="mv_loading_img"';
215 - return '<div '+class_attr+' style="' + style +'"></div>';
216 -}
217 -
218 -function mv_set_loading(target, load_id){
219 - var id_attr = ( load_id )?' id="' + load_id + '" ':'';
220 - $j(target).append('<div '+id_attr+' style="position:absolute;top:0px;left:0px;height:100%;width:100%;'+
221 - 'background-color:#FFF;">' +
222 - mv_get_loading_img('top:30px;left:30px') +
223 - '</div>');
224 -}
225 -
226 -/**
227 - * mvJsLoader class handles initialization and js file loads
228 - */
229 -var mvJsLoader = {
230 - libreq:{},
231 - libs:{},
232 - //base lib flags:
233 - onReadyEvents:new Array(),
234 - //to keep consistency across threads:
235 - ptime:0,
236 - ctime:0,
237 - load_error:false,//load error flag (false by default)
238 - load_time:0,
239 - callbacks:new Array(),
240 - doLoad:function(libs, callback){
241 - this.ctime++;
242 - if(libs){ //setup this.libs:
243 - //first check if we already have this lib loaded
244 - var all_libs_loaded=true;
245 - for(var i in libs){
246 - //check if the lib is already loaded:
247 - if( ! this.checkObjPath( i ) ){
248 - all_libs_loaded=false;
249 - }
250 - }
251 - if( all_libs_loaded ){
252 - js_log('all libs already loaded skipping...' + libs);
253 - callback();
254 - return ;
255 - }
256 - //check if we should use the script loader to combine all the requests into one:
257 - var slpath = getScriptLoaderPath();
258 - if( slpath ){
259 - var class_set = '';
260 - var last_class = '';
261 - var coma = '';
262 - for( var i in libs ){
263 - //only add if not included yet:
264 - if( ! this.checkObjPath( i ) ){
265 - class_set+=coma + i ;
266 - last_class=i;
267 - coma=',';
268 - }
269 - }
270 - var dbug_attr = (parseUri( getMvEmbedURL() ).queryKey['debug'])?'&debug=true':'';
271 - this.libs[ last_class ] = slpath + '?class=' + class_set +
272 - '&urid=' + getMvUniqueReqId() + dbug_attr;
273 -
274 - }else{
275 - //do many requests:
276 - for(var i in libs){ //for in loop oky on object
277 - // do a direct load of the file (pass along unique id from request or mv_embed Version )
278 - var qmark = (libs[i].indexOf('?')!==true)?'?':'&';
279 - this.libs[i] = getMvEmbedPath() + libs[i] + qmark + 'urid='+ getMvUniqueReqId();
280 - }
281 - }
282 - }
283 - if( callback ){
284 - this.callbacks.push(callback);
285 - }
286 - if( mvJsLoader.checkLoading() ){
287 - if( this.load_time++ > 3000){ //time out after ~30seconds
288 - js_error( gM('error_load_lib') + this.cur_path );
289 - this.load_error=true;
290 - }else{
291 - setTimeout( 'mvJsLoader.doLoad()', 25 );
292 - }
293 - }else{
294 - //js_log('checkLoading passed for: do run callbacks');
295 - //only do callback if we are in the same instance (weird concurency issue)
296 - var cb_count=0;
297 - for(var i=0; i < this.callbacks.length; i++)
298 - cb_count++;
299 - //js_log('REST LIBS: loading is: '+ loading + ' run callbacks: '+cb_count +' p:'+ this.ptime +' c:'+ this.ctime);
300 - //reset the libs
301 - this.libs={};
302 - //js_log('done loading do call: ' + this.callbacks[0] );
303 - while( this.callbacks.length !=0 ){
304 - if( this.ptime== ( this.ctime-1) ){ //enforce thread consistency
305 - this.callbacks.pop()();
306 - //func = this.callbacks.pop();
307 - //js_log(' run: '+this.ctime+ ' p: ' + this.ptime + ' ' +loading+ ' :'+ func);
308 - //func();
309 - }else{
310 - //re-issue doLoad ( ptime will be set to ctime so we should catch up)
311 - setTimeout( 'mvJsLoader.doLoad()', 25 );
312 - break;
313 - }
314 - }
315 - }
316 - this.ptime=this.ctime;
317 - },
318 - checkLoading:function(){
319 - var loading=0;
320 - var i=null;
321 - for(var i in this.libs){ //for in loop oky on object
322 - if( ! this.checkObjPath( i ) ){
323 - if(!this.libreq[i]) loadExternalJs( this.libs[i] );
324 - this.libreq[i]=1;
325 - //js_log("has not yet loaded: " + i);
326 - loading=1;
327 - }
328 - }
329 - return loading;
330 - },
331 - checkObjPath:function( libVar ){
332 - var objPath = libVar.split('.')
333 - var cur_path ='';
334 - for(var p=0; p < objPath.length; p++){
335 - cur_path = (cur_path=='')?cur_path+objPath[p]:cur_path+'.'+objPath[p];
336 - eval( 'var ptest = typeof ( '+ cur_path + ' ); ');
337 - if( ptest == 'undefined'){
338 - return false;
339 - }
340 - }
341 - this.cur_path = cur_path;
342 - return true;
343 - },
344 - /**
345 - * checks for jQuery and adds the $j noConflict var
346 - */
347 - jQueryCheck:function(callback){
348 - var _this = this;
349 - _this.doLoad({
350 - 'window.jQuery' :'jquery/jquery-1.3.2.js'
351 - },function(){
352 - _global['$j'] = jQuery.noConflict();
353 - //set up ajax to not send dynamic urls for loading scripts (we control that with the scriptLoader)
354 - $j.ajaxSetup({
355 - cache: true
356 - });
357 - js_log('jquery loaded');
358 - //run the callback
359 - callback();
360 - });
361 - },
362 - embedVideoCheck:function( callback ){
363 - var _this = this;
364 - //issue a style sheet request (no load checks on style sheets):
365 - if(!styleSheetPresent( mv_embed_path + 'skins/'+mv_skin_name+'/styles.css'))
366 - loadExternalCss( mv_embed_path + 'skins/'+mv_skin_name+'/styles.css');
367 - //make sure we have jQuery
368 - _this.jQueryCheck(function(){
369 - _this.doLoad({
370 - 'embedVideo' : 'libEmbedVideo/mv_baseEmbed.js',
371 - '$j.ui.mouse' : 'jquery/jquery.ui-1.7.1/ui/ui.core.js',
372 - '$j.ui.droppable' : 'jquery/jquery.ui-1.7.1/ui/ui.droppable.js',
373 - '$j.ui.draggable' : 'jquery/jquery.ui-1.7.1/ui/ui.draggable.js'
374 - },function(){
375 - js_log('embedVideo libs ready run callback:: ');
376 - callback();
377 - });
378 - });
379 - },
380 - addLoadEvent:function(fn){
381 - this.onReadyEvents.push(fn);
382 - },
383 - runQuededFunctions:function(){
384 - js_log('runQuededFunctions:: onReadyEvents');
385 - while( this.onReadyEvents.length ){
386 - this.onReadyEvents.shift()();
387 - }
388 - }
389 -}
390 -
391 -
392 -
393 -
394 -function getCookie ( cookieName ) {
395 - var m = document.cookie.match( cookieName + '=(.*?)(;|$)' );
396 - //js_log('getCookie:' + cookieName + ' v:' + (m ? unescape( m[1] ) : false));
397 - return m ? unescape( m[1] ) : false;
398 -}
399 -
400 -function setCookie(name, value, expiry, path, domain, secure) {
401 - js_log('setCookie:' + name + ' v:' + value);
402 - var expiryDate = false;
403 - if ( expiry ) {
404 - expiryDate = new Date();
405 - expiryDate.setTime( expiryDate.getTime() + expiry );
406 - }
407 - document.cookie = name + "=" + escape(value) +
408 - (expiryDate ? ("; expires=" + expiryDate.toGMTString()) : "") +
409 - (path ? ("; path=" + path) : "") +
410 - (domain ? ("; domain=" + domain) : "") +
411 - (secure ? "; secure" : "");
412 -}
413 -
414 -//load an external JS (similar to jquery .require plugin)
415 -//but checks for object availability rather than load state
416 -
417 -/*********** INITIALIZATION CODE *************
418 - * this will get called when DOM is ready
419 - *********************************************/
420 -/* jQuery .ready does not work when jQuery is loaded dynamically
421 - * for an example of the problem see:1.1.3 working:http://pastie.caboo.se/92588
422 - * and >= 1.1.4 not working: http://pastie.caboo.se/92595
423 - * $j(document).ready( function(){ */
424 -function init_mv_embed(force){
425 - js_log('f:init_mv_embed');
426 - if( !force && mv_init_done ){
427 - js_log("mv_init_done do nothing...");
428 - return false;
429 - }
430 - mv_init_done=true;
431 - //check if this page does have video or playlist
432 - if(document.getElementsByTagName("video").length!=0 ||
433 - document.getElementsByTagName("playlist").length!=0){
434 - js_log('we have vids to process');
435 - //load libs and proccess:
436 - mvJsLoader.embedVideoCheck(function(){
437 - //run any queded global events:
438 - mv_embed( function(){
439 - while(mvLoadEvent.length){
440 - mvLoadEvent.pop()();
441 - }
442 - });
443 - });
444 - }else{
445 - //run any queded global events:
446 - while(mvLoadEvent.length){
447 - mvLoadEvent.pop()();
448 - }
449 - }
450 -}
451 -/*
452 - * this function allows for targeted rewriting
453 - */
454 -function rewrite_by_id( vid_id, ready_callback ){
455 - js_log('f:rewrite_by_id: ' + vid_id);
456 - //force a recheck of the dom for playlist or video element:
457 - mvJsLoader.embedVideoCheck(function(){
458 - mv_embed(ready_callback, vid_id );
459 - });
460 -}
461 -function rewrite_for_oggHanlder( vidIdList ){
462 - for(var i = 0; i < vidIdList.length ; i++){
463 - var vidId = vidIdList[i];
464 - js_log('looking at vid: ' + i +' ' + vidId);
465 - //grab the thumbnail and src video
466 - var pimg = $j('#'+vidId + ' img');
467 - var poster_attr = 'poster = "' + pimg.attr('src') + '" ';
468 - var pwidth = pimg.attr('width');
469 - var pheight = pimg.attr('height');
470 -
471 - var type_attr = '';
472 - //check for audio
473 - if( pwidth=='22' && pheight=='22'){
474 - pwidth='400';
475 - pheight='300';
476 - type_attr = 'type="audio/ogg"';
477 - poster_attr = '';
478 - }
479 -
480 - //parsed values:
481 - var src = '';
482 - var duration = '';
483 -
484 - var re = new RegExp( /videoUrl(&quot;:?\s*)*([^&]*)/ );
485 - src = re.exec( $j('#'+vidId).html() )[2];
486 -
487 - var re = new RegExp( /length(&quot;:?\s*)*([^&]*)/ );
488 - duration = re.exec( $j('#'+vidId).html() )[2];
489 -
490 - var re = new RegExp( /offset(&quot;:?\s*)*([^&]*)/ );
491 - offset = re.exec( $j('#'+vidId).html() )[2];
492 - var offset_attr = (offset)? 'startOffset="'+ offset + '"': '';
493 -
494 - if( src ){
495 - //replace the top div with mv_embed based player:
496 - var vid_html = '<video id="vid_' + i +'" '+
497 - 'src="' + src + '" ' +
498 - poster_attr + ' ' +
499 - type_attr + ' ' +
500 - offset_attr + ' ' +
501 - 'duration="' + duration + '" ' +
502 - 'style="width:' + pwidth + 'px;height:' +
503 - pheight + 'px;"></video>';
504 - //js_log("video html: " + vid_html);
505 - $j('#'+vidId).html( vid_html );
506 - }
507 -
508 - //rewrite that video id:
509 - rewrite_by_id('vid_' + i);
510 - }
511 -}
512 -
513 -
514 -/*********** INITIALIZATION CODE *************
515 - * set DOM ready callback to init_mv_embed
516 - *********************************************/
517 -// for Mozilla browsers
518 -if (document.addEventListener ) {
519 - document.addEventListener("DOMContentLoaded", function(){init_mv_embed()}, false);
520 -}else{
521 - //backup "onload" method in case on DOMContentLoaded does not exist
522 - window.onload = function(){ init_mv_embed() };
523 -}
524 -//for IE (temporarily disabled causing empty document rewrites:
525 -/*if (document.all && !window.opera){ //Crude test for IE
526 - js_log('doing IE on ready');
527 -//Define a "blank" external JavaScript tag
528 - document.write('<script type="text/javascript" id="contentloadtag" defer="defer" src="javascript:void(0)"><\/script>')
529 - var contentloadtag=document.getElementById("contentloadtag")
530 - contentloadtag.onreadystatechange=function(){
531 - if (this.readyState=="complete" || this.readyState=='loaded')
532 - init_mv_embed();
533 - }
534 -}*/
535 -//safari now supports dom injection (code removed below)
536 -
537 -/*
538 -* Converts all occurrences of <video> tag into video object
539 -*/
540 -function mv_embed(swap_done_callback, force_id){
541 - mvEmbed.init( swap_done_callback, force_id );
542 -}
543 -mvEmbed = {
544 - flist:new Array(),
545 - init:function( swap_done_callback, force_id ){
546 - if(swap_done_callback)
547 - mvEmbed.flist.push( swap_done_callback );
548 - //get mv_embed location if it has not been set
549 - js_log('mv_embed ' + MV_EMBED_VERSION);
550 -
551 - this.swap_done_callback = swap_done_callback;
552 -
553 - var loadPlaylistLib=false;
554 - //set up the jQuery selector:
555 - if( force_id == null && force_id != '' ){
556 - var j_selector = 'video,audio,playlist';
557 - }else{
558 - var j_selector = '#'+force_id;
559 - }
560 -
561 - js_log('SELECTOR: '+ j_selector);
562 -
563 - //process selected elements:
564 - $j(j_selector).each(function(){
565 - js_log( "Do SWAP: " + $j(this).attr("id") + ' tag: '+ this.tagName.toLowerCase() );
566 -
567 - if( $j(this).attr("id") == '' ){
568 - $j(this).attr("id", 'v'+ global_player_list.length);
569 - }
570 - //stre a global reference to the id
571 - global_player_list.push( $j(this).attr("id") );
572 - //add loading: (pre-loading div)
573 - /*$j(this).after('<div id="pre_loading_div_'+elm_id + '">'+
574 - gM('loading_txt')+'</div>' );
575 - */
576 -
577 - //if video doSwap
578 - switch( this.tagName.toLowerCase()){
579 - case 'video':
580 - var videoInterface = new embedVideo(this);
581 - mvEmbed.swapEmbedVideoElement( this, videoInterface );
582 - break;
583 - case 'audio':
584 - var videoInterface = new embedVideo(this);
585 - videoInterface.type ='audio';
586 - mvEmbed.swapEmbedVideoElement( this, videoInterface );
587 - break;
588 - case 'playlist':
589 - loadPlaylistLib=true;
590 - break;
591 - }
592 - });
593 - if(loadPlaylistLib){
594 - mvJsLoader.doLoad({ 'mvPlayList' : 'libSequencer/mvPlayList.js' },function(){
595 - $j('playlist').each(function(){
596 - //check if we are in sequence mode load sequence libs (if not already loaded)
597 - if( $j(this).attr('sequencer')=="true" ){
598 - var pl_element = this;
599 - //load the mv_sequencer and the json util lib:
600 - mvJsLoader.doLoad({
601 - 'mvSeqPlayList':'libSequencer/mvSequencer.js'
602 - },function(){
603 - var seqObj = new mvSeqPlayList( pl_element );
604 - mvEmbed.swapEmbedVideoElement( pl_element, seqObj );
605 - }
606 - );
607 - }else{
608 - //create new playlist interface:
609 - var plObj = new mvPlayList( this );
610 - mvEmbed.swapEmbedVideoElement(this, plObj);
611 - var added_height = plObj.pl_layout.title_bar_height + plObj.pl_layout.control_height;
612 - //move into a blocking display container with height + controls + title height:
613 - $j('#'+plObj.id).wrap('<div style="display:block;height:' + (plObj.height + added_height) + 'px;"></div>');
614 - }
615 - });
616 - });
617 - }
618 - this.checkClipsReady();
619 - },
620 - /*
621 - * swapEmbedVideoElement
622 - * takes a video element as input and swaps it out with
623 - * an embed video interface based on the video_elements attributes
624 - */
625 - swapEmbedVideoElement:function(video_element, videoInterface){
626 - js_log('do swap ' + videoInterface.id + ' for ' + video_element);
627 - embed_video = document.createElement('div');
628 - //make sure our div has a hight/width set:
629 -
630 - $j(embed_video).css({
631 - 'width':videoInterface.width,
632 - 'height':videoInterface.height
633 - });
634 - //inherit the video interface
635 - for(var method in videoInterface){ //for in loop oky in Element context
636 - if(method!='readyState'){ //readyState crashes IE
637 - if(method=='style'){
638 - embed_video.setAttribute('style', videoInterface[method]);
639 - }else if(method=='class'){
640 - if( $j.browser.msie )
641 - embed_video.setAttribute("className", videoInterface['class']);
642 - else
643 - embed_video.setAttribute("class", videoInterface['class']);
644 - }else{
645 - //normal inherit:
646 - embed_video[method]=videoInterface[method];
647 - }
648 - }
649 - //string -> boolean:
650 - if(embed_video[method]=="false")embed_video[method]=false;
651 - if(embed_video[method]=="true")embed_video[method]=true;
652 - }
653 - ///js_log('did vI style');
654 - //now swap out the video element for the embed_video obj:
655 - $j(video_element).after(embed_video).remove();
656 - //js_log('did swap');
657 - $j('#'+embed_video.id).get(0).on_dom_swap();
658 - //remove loading:
659 - $j('#pre_loading_div_'+embed_video.id).remove();
660 - // now that "embed_video" is stable, do more initialization (if we are ready)
661 - if($j('#'+embed_video.id).get(0).loading_external_data==false &&
662 - $j('#'+embed_video.id).get(0).init_with_sources_loadedDone==false){
663 - //load and set ready state since source are available:
664 - $j('#'+embed_video.id).get(0).init_with_sources_loaded();
665 - }
666 - js_log('done with child: ' + embed_video.id + ' len:' + global_player_list.length);
667 - return true;
668 - },
669 - //this should not be needed.
670 - checkClipsReady : function(){
671 - var is_ready=true;
672 - for(var i=0; i < global_player_list.length; i++){
673 - if( $j('#'+global_player_list[i]).length !=0){
674 - var cur_vid = $j('#'+global_player_list[i]).get(0);
675 - is_ready = ( cur_vid.ready_to_play ) ? is_ready : false;
676 - if( !is_ready && cur_vid.load_error ){
677 - is_ready=true;
678 - $j(cur_vid).html( cur_vid.load_error );
679 - }
680 - }
681 - }
682 - if( is_ready ){
683 - mvEmbed.allClipsReady = true;
684 - // run queued functions
685 - js_log('run queded functions:');
686 - while (mvEmbed.flist.length){
687 - mvEmbed.flist.shift()();
688 - }
689 - }else{
690 - setTimeout( 'mvEmbed.checkClipsReady()', 25 );
691 - }
692 - }
693 -}
694 -/* init remote search */
695 -function mv_do_remote_search(initObj){
696 - js_log(':::::mv_do_remote_search::::');
697 -
698 - //issue a load skin request:
699 - if(!styleSheetPresent( mv_embed_path + 'skins/'+mv_skin_name+'/styles.css'))
700 - loadExternalCss( mv_embed_path + 'skins/'+mv_skin_name+'/styles.css');
701 -
702 - //insure we have the basic libs (jquery etc) :
703 - mvJsLoader.jQueryCheck(function(){
704 - //load search specifc extra stuff
705 - mvJsLoader.doLoad({
706 - 'remoteSearchDriver':'libAddMedia/remoteSearchDriver.js'
707 - }, function(){
708 - initObj['instance_name']= 'rsdMVRS';
709 - rsdMVRS = new remoteSearchDriver( initObj );
710 - rsdMVRS.doInitDisplay();
711 - });
712 - });
713 -}
714 -
715 -/* init the sequencer */
716 -function mv_do_sequence(initObj){
717 - //debugger;
718 - //issue a request to get the css file (if not already included):
719 - if(!styleSheetPresent(mv_embed_path+'skins/'+mv_skin_name+'/mv_sequence.css'))
720 - loadExternalCss(mv_embed_path+'skins/'+mv_skin_name+'/mv_sequence.css');
721 - //make sure we have the required mv_embed libs (they are not loaded when no video element is on the page)
722 - mvJsLoader.embedVideoCheck(function(){
723 - //load playlist object and drag,drop,resize,hoverintent,libs
724 - mvJsLoader.doLoad({
725 - 'mvPlayList':'libSequencer/mvPlayList.js',
726 - '$j.ui' :'jquery/jquery.ui-1.7.1/ui/ui.core.js',
727 - '$j.ui.sortable':'jquery/jquery.ui-1.7.1/ui/ui.sortable.js',
728 - '$j.ui.resizable':'jquery/jquery.ui-1.7.1/ui/ui.resizable.js',
729 - '$j.contextMenu':'jquery/plugins/jquery.contextMenu.js'
730 - },function(){
731 - //debugger;
732 - //load the sequencer
733 - mvJsLoader.doLoad({
734 - 'mvSequencer':'libSequencer/mvSequencer.js'
735 - },function(){
736 - js_log('calling new mvSequencer');
737 - //init the sequence object (it will take over from there) no more than one mvSeq obj:
738 - if(!_global['mvSeq']){
739 - _global['mvSeq'] = new mvSequencer(initObj);
740 - }else{
741 - js_log('mvSeq already init');
742 - }
743 - });
744 - });
745 - });
746 -}
747 -/*
748 -* utility functions:
749 -*/
750 -//simple url re-writer for standard temporal and size request urls:
751 -function getURLParamReplace( url, opt ){
752 - var pSrc = parseUri( url );
753 - if(pSrc.protocol != '' ){
754 - var new_url = pSrc.protocol +'://'+ pSrc.authority + pSrc.path +'?';
755 - }else{
756 - var new_url = pSrc.path +'?';
757 - }
758 - var amp = '';
759 - for(var key in pSrc.queryKey){
760 - var val = pSrc.queryKey[ key ];
761 - //do override if requested
762 - if( opt[ key ] )
763 - val = opt[ key ];
764 - new_url+= amp + key + '=' + val;
765 - amp = '&';
766 - };
767 -
768 - return new_url;
769 -}
770 -/**
771 - * seconds2npt given a float seconds returns npt format response:
772 - * @param float seconds
773 - * @param boolean if we should show ms or not.
774 - */
775 -function seconds2npt(sec, show_ms){
776 - if( isNaN( sec ) ){
777 - js_log("warning: trying to get npt time on NaN:" + sec);
778 - return '0:0:0';
779 - }
780 - var hours = Math.floor(sec/ 3600);
781 - var minutes = Math.floor((sec/60) % 60);
782 - var seconds = sec % 60;
783 - //round the second amount requested significant digits
784 - if(show_ms){
785 - seconds = Math.round( seconds * 1000 ) / 1000;
786 - }else{
787 - seconds = Math.round( seconds );
788 - }
789 -
790 - if ( minutes < 10 ) minutes = "0" + minutes;
791 - if ( seconds < 10 ) seconds = "0" + seconds;
792 - return hours+":"+minutes+":"+seconds;
793 -}
794 -/*
795 - * takes hh:mm:ss,ms or hh:mm:ss.ms input returns number of seconds
796 - */
797 -function npt2seconds( npt_str ){
798 - if(!npt_str){
799 - //js_log('npt2seconds:not valid ntp:'+ntp);
800 - return false;
801 - }
802 - //strip npt: time definition if present
803 - npt_str = npt_str.replace('npt:', '');
804 -
805 - times = npt_str.split(':');
806 - if(times.length!=3){
807 - js_log('npt2seconds: ' + npt_str);
808 - return false;
809 - }
810 - //sometimes the comma is used inplace of pereid for ms
811 - times[2] = times[2].replace(/,\s?/,'.');
812 - //return seconds float (ie take seconds float value if present):
813 - return parseInt(times[0]*3600)+parseInt(times[1]*60)+parseFloat(times[2]);
814 -}
815 -
816 -//addLoadEvent for adding functions to be run when the page DOM is done loading
817 -//@@todo depricate in favor of:
818 -function mv_addLoadEvent(func) {
819 - mvLoadEvent.push(func);
820 -}
821 -
822 -//does a remote or local api request based on request url
823 -//@param options: url, data, cbParam, callback
824 -function do_api_req( options, callback ){
825 - if(typeof options.data != 'object'){
826 - return js_error('Error: request paramaters must be an object');;
827 - }
828 - //gennerate the url if its missing:
829 - if( typeof options.url == 'undefined' ){
830 - if(!wgServer || ! wgScriptPath){
831 - return js_error('Error: no api url for api request');;
832 - }
833 - if (wgServer && wgScript)
834 - options.url = wgServer + wgScript;
835 - //update to api.php (if index.php was in the wgScript path):
836 - options.url = options.url.replace(/index.php/, 'api.php');
837 - }
838 - if( typeof options.data == 'undefined' )
839 - options.data = {};
840 -
841 - //force format to json (if not already set)
842 - options.data['format'] = 'json';
843 -
844 - //if action not set assume query
845 - if(!options.data['action'])
846 - options.data['action']='query';
847 -
848 - js_log('do api req: ' + options.url +'?' + jQuery.param(options.data) );
849 - //build request string:
850 - if( parseUri( document.URL ).host == parseUri( options.url ).host ){
851 - //local request do api request directly
852 - $j.ajax({
853 - type: "POST",
854 - url: options.url,
855 - data: options.data,
856 - dataType:'json', //api requests _should_ always return JSON data:
857 - async: false,
858 - success:function(data){
859 - callback( data );
860 - },
861 - error:function(e){
862 - js_error( ' error' + e +' in getting: ' + options.url);
863 - }
864 - });
865 - }else{
866 - //set the callback param if not already set:
867 - if( typeof options.jsonCB == 'undefined')
868 - options.jsonCB = 'callback';
869 -
870 - var req_url = options.url;
871 - var paramAnd = (req_url.indexOf('?')==-1)?'?':'&';
872 - //put all the values into the GET req:
873 - for(var i in options.data){
874 - req_url += paramAnd + encodeURIComponent( i ) + '=' + encodeURIComponent( options.data[i] );
875 - paramAnd ='&';
876 - }
877 - var fname = 'mycpfn_' + ( global_cb_count++ );
878 - _global[ fname ] = callback;
879 - req_url += '&' + options.jsonCB + '=' + fname;
880 - loadExternalJs( req_url );
881 - }
882 -}
883 -//grab wiki form error for wiki html page proccessing (should be depricated)
884 -function grabWikiFormError ( result_page ){
885 - var res = {};
886 - sp = result_page.indexOf('<span class="error">');
887 - if(sp!=-1){
888 - se = result_page.indexOf('</span>', sp);
889 - res.error_txt = result_page.substr(sp, (sp-se)) + '</span>';
890 - }else{
891 - //look for warning:
892 - sp = result_page.indexOf('<ul class="warning">')
893 - if(sp != -1){
894 - se = result_page.indexOf('</ul>', sp);
895 - res.error_txt = result_page.substr(sp, (se-sp)) + '</ul>';
896 - //try and add the ignore form item:
897 - sfp = result_page.indexOf('<form method="post"');
898 - if(sfp!=-1){
899 - sfe = result_page.indexOf('</form>', sfp);
900 - res.form_txt = result_page.substr(sfp, ( sfe - sfp )) + '</form>';
901 - }
902 - }else{
903 - //one more error type check:
904 - sp = result_page.indexOf('class="mw-warning-with-logexcerpt">')
905 - if(sp!=-1){
906 - se = result_page.indexOf('</div>', sp);
907 - res.error_txt = result_page.substr(sp, ( se - sp )) + '</div>';
908 - }
909 - }
910 - }
911 - return res;
912 -}
913 -//do a "normal" request
914 -function do_request(req_url, callback){
915 - //if we are doing a request to the same domain or relative link do a normal GET:
916 - if( parseUri(document.URL).host == parseUri(req_url).host ||
917 - req_url == parseUri( req_url).host ){ //relative url
918 - //do a direct request:
919 - $j.ajax({
920 - type: "GET",
921 - url:req_url,
922 - async: false,
923 - success:function(data){
924 - callback( data );
925 - }
926 - });
927 - }else{
928 - //get data via DOM injection with callback
929 - global_req_cb.push(callback);
930 - //prepend json_ to feed_format if not already requesting json format
931 - if( req_url.indexOf("feed_format=")!=-1 && req_url.indexOf("feed_format=json")==-1)
932 - req_url = req_url.replace(/feed_format=/, 'feed_format=json_');
933 - loadExternalJs(req_url+'&cb=mv_jsdata_cb&cb_inx='+(global_req_cb.length-1));
934 - }
935 -}
936 -
937 -function mv_jsdata_cb(response){
938 - js_log('f:mv_jsdata_cb:'+ response['cb_inx']);
939 - //run the callback from the global req cb object:
940 - if( !global_req_cb[response['cb_inx']] ){
941 - js_log('missing req cb index');
942 - return false;
943 - }
944 - if( !response['pay_load'] ){
945 - js_log("missing pay load");
946 - return false;
947 - }
948 - //switch on content type:
949 - switch(response['content-type']){
950 - case 'text/plain':
951 - break;
952 - case 'text/xml':
953 - if(typeof response['pay_load'] == 'string'){
954 - //js_log('load string:'+"\n"+ response['pay_load']);
955 - //debugger;
956 - //attempt to parse as xml for IE
957 - if( $j.browser.msie ){
958 - var xmldata=new ActiveXObject("Microsoft.XMLDOM");
959 - xmldata.async="false";
960 - xmldata.loadXML(response['pay_load']);
961 - }else{ //for others (firefox, safari etc)
962 - try{
963 - var xmldata = (new DOMParser()).parseFromString(response['pay_load'], "text/xml");
964 - }catch(e) {
965 - js_log('XML parse ERROR: ' + e.message);
966 - }
967 - }
968 - //@@todo hanndle xml parser errors
969 - if(xmldata)response['pay_load']=xmldata;
970 - }
971 - break
972 - default:
973 - js_log('bad response type' + response['content-type']);
974 - return false;
975 - break;
976 - }
977 - global_req_cb[response['cb_inx']]( response['pay_load'] );
978 -}
979 -//load external js via dom injection
980 -function loadExternalJs( url ){
981 - js_log('load js: '+ url);
982 - //if(window['$j']) //use jquery call:
983 - /*$j.ajax({
984 - type: "GET",
985 - url: url,
986 - dataType: 'script',
987 - cache: true
988 - });*/
989 - // else{
990 - var e = document.createElement("script");
991 - e.setAttribute('src', url);
992 - e.setAttribute('type',"text/javascript");
993 - //e.setAttribute('defer', true);
994 - document.getElementsByTagName("head")[0].appendChild(e);
995 - // }
996 -}
997 -
998 -function styleSheetPresent(url){
999 - style_elements = document.getElementsByTagName('link');
1000 - if( style_elements.length > 0) {
1001 - for(i = 0; i < style_elements.length; i++) {
1002 - if(style_elements[i].href==url)
1003 - return true;
1004 - }
1005 - }
1006 - return false;
1007 -}
1008 -function loadExternalCss(url){
1009 - if( url.indexOf('?') == -1 ){
1010 - url+='?'+getMvUniqueReqId();
1011 - }
1012 - js_log('load css: ' + url);
1013 - var e = document.createElement("link");
1014 - e.href = url;
1015 - e.type = "text/css";
1016 - e.rel = 'stylesheet';
1017 - document.getElementsByTagName("head")[0].appendChild(e);
1018 -}
1019 -function getScriptLoaderPath(){
1020 - var eurl = getMvEmbedURL();
1021 - var sln = 'mvwScriptLoader.php';
1022 - if( eurl.indexOf(sln) != -1 ){
1023 - //get just the script loader part of the url:
1024 - return eurl.substr(0, (eurl.indexOf(sln) + sln.length));
1025 - }else{
1026 - return false;
1027 - }
1028 -}
1029 -function getMvEmbedURL(){
1030 - if( _global['mv_embed_url'] )
1031 - return _global['mv_embed_url'];
1032 - var js_elements = document.getElementsByTagName("script");
1033 - for(var i=0; i < js_elements.length; i++){
1034 - //check for normal mv_embed.js and or script loader
1035 - var src = js_elements[i].getAttribute("src");
1036 - if( src ){
1037 - if( src.indexOf('mv_embed.js') !=-1 || ( src.indexOf('mvwScriptLoader.php') != -1 && src.indexOf('mv_embed') != -1) ){
1038 - _global['mv_embed_url'] = src;
1039 - return src;
1040 - }
1041 - }
1042 - }
1043 - js_error('Error: getMvEmbedURL failed to get Embed Path');
1044 - return false;
1045 -}
1046 -//gets a unique request id to ensure fresh javascript
1047 -function getMvUniqueReqId(){
1048 - if( _global['urid'] )
1049 - return _global['urid'];
1050 - var mv_embed_url = getMvEmbedURL();
1051 - //if in debug mode get a fresh unique request key:
1052 - if( parseUri( mv_embed_url ).queryKey['debug'] == 'true'){
1053 - var d = new Date();
1054 - return d.getTime()
1055 - }
1056 - //if we have a uri retun that:
1057 - var urid = parseUri( mv_embed_url).queryKey['urid']
1058 - if( urid ){
1059 - _global['urid'] = urid;
1060 - return urid;
1061 - }
1062 - //else just return the mv_embed version;
1063 - return MV_EMBED_VERSION;
1064 -}
1065 -/*
1066 - * sets the global mv_embed path based on the scripts location
1067 - */
1068 -function getMvEmbedPath(){
1069 - var mv_embed_url = getMvEmbedURL();
1070 -
1071 - if( mv_embed_url.indexOf('mv_embed.js') !== -1 ){
1072 - mv_embed_path = mv_embed_url.substr(0, mv_embed_url.indexOf('mv_embed.js'));
1073 - }else{
1074 - //script load is in the root of mediaWiki so include the default mv_embed extention path (if using the script loader)
1075 - mv_embed_path = mv_embed_url.substr(0, mv_embed_url.indexOf('mvwScriptLoader.php')) + mediaWiki_mvEmbed_path ;
1076 - }
1077 - //absolute the url (if relative) (if we don't have mv_embed path)
1078 - if( mv_embed_path.indexOf('://') == -1){
1079 - var pURL = parseUri( document.URL );
1080 - if(mv_embed_path.charAt(0)=='/'){
1081 - mv_embed_path = pURL.protocol + '://' + pURL.authority + mv_embed_path;
1082 - }else{
1083 - //relative:
1084 - if(mv_embed_path==''){
1085 - mv_embed_path = pURL.protocol + '://' + pURL.authority + pURL.directory + mv_embed_path;
1086 - }
1087 - }
1088 - }
1089 - return mv_embed_path;
1090 -}
1091 -
1092 -if (typeof DOMParser == "undefined") {
1093 - DOMParser = function () {}
1094 - DOMParser.prototype.parseFromString = function (str, contentType) {
1095 - if (typeof ActiveXObject != "undefined") {
1096 - var d = new ActiveXObject("MSXML.DomDocument");
1097 - d.loadXML(str);
1098 - return d;
1099 - } else if (typeof XMLHttpRequest != "undefined") {
1100 - var req = new XMLHttpRequest;
1101 - req.open("GET", "data:" + (contentType || "application/xml") +
1102 - ";charset=utf-8," + encodeURIComponent(str), false);
1103 - if (req.overrideMimeType) {
1104 - req.overrideMimeType(contentType);
1105 - }
1106 - req.send(null);
1107 - return req.responseXML;
1108 - }
1109 - }
1110 -}
1111 -/*
1112 -* utility functions:
1113 -*/
1114 -function js_log(string){
1115 - if( window.console ){
1116 - window.console.log(string);
1117 - }else{
1118 - /*
1119 - * IE and non-firebug debug:
1120 - */
1121 - /*var log_elm = document.getElementById('mv_js_log');
1122 - if(!log_elm){
1123 - document.getElementsByTagName("body")[0].innerHTML = document.getElementsByTagName("body")[0].innerHTML +
1124 - '<div style="position:absolute;z-index:500;top:0px;left:0px;right:0px;height:10px;">'+
1125 - '<textarea id="mv_js_log" cols="120" rows="5"></textarea>'+
1126 - '</div>';
1127 -
1128 - var log_elm = document.getElementById('mv_js_log');
1129 - }
1130 - if(log_elm){
1131 - log_elm.value+=string+"\n";
1132 - }*/
1133 - }
1134 - return false;
1135 -}
1136 -
1137 -function js_error(string){
1138 - alert(string);
1139 - return false;
1140 -}
\ No newline at end of file
Index: trunk/extensions/MetavidWiki/skins/mv_embed/simpleScriptLoader.php
@@ -1,289 +0,0 @@
2 -<?php
3 -/*
4 - * mvwScriptLoader.php
5 -* Script Loading Library for mv_embed
6 -*
7 -* @author Michael Dale mdale@wikimedia.org
8 -* @date feb, 2009
9 -*
10 -* This program is free software; you can redistribute it and/or modify
11 -* it under the terms of the GNU General Public License as published by
12 -* the Free Software Foundation; either version 2 of the License, or
13 -* (at your option) any later version.
14 -*
15 -* This program is distributed in the hope that it will be useful,
16 -* but WITHOUT ANY WARRANTY; without even the implied warranty of
17 -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 -* GNU General Public License for more details.
19 -*
20 -* You should have received a copy of the GNU General Public License along
21 -* with this program; if not, write to the Free Software Foundation, Inc.,
22 -* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 -* http://www.gnu.org/copyleft/gpl.html
24 -*/
25 -
26 -/*
27 - * mvwScriptLoader:
28 - *
29 - * @@TODO this is the self contained verison of the scirpt loader (remove all mediaWiki dependencies)
30 - *
31 - */
32 -
33 -//include WebStart.php (this can be simplified once we move mvwScriptLoader to the root dir:
34 -
35 -if( isset( $_SERVER['SCRIPT_URL'] ) ) {
36 - $url = $_SERVER['SCRIPT_URL'];
37 -} else {
38 - $url = $_SERVER['PHP_SELF'];
39 -}
40 -
41 -//if( strcmp( "$wgScriptPath/mvwScriptLoader$wgScriptExtension", $url ) ) {
42 -if( strpos($url, "simpleScriptLoader") === false){
43 - wfHttpError( 403, 'Forbidden',
44 - 'simpleScriptLoader must be accessed through the primary script entry point.' );
45 - return ;
46 -}
47 -
48 -//run the main action:
49 -$myScriptLoader = new jsScriptLoader();
50 -$myScriptLoader->doScriptLoader();
51 -
52 -//setup page output hook
53 -
54 -class jsScriptLoader{
55 - var $jsFileList = array();
56 - var $jsout = '';
57 - var $rKey = ''; // the request key
58 - var $error_msg ='';
59 - var $debug = false;
60 -
61 - function doScriptLoader(){
62 - global $wgJSAutoloadClasses, $wgEnableScriptLoaderJsFile, $wgRequest, $IP,
63 - $wgEnableScriptMinify, $wgUseFileCache;
64 -
65 - //process the request
66 - $this->procRequestVars();
67 -
68 - $wgUseFileCache=false;
69 - //if cache is on and file is present grab it from there:
70 - if( $wgUseFileCache && !$this->debug ) {
71 - //setup file cache obj:
72 - $this->sFileCache = new simpleFileCache( $this->rKey );
73 - if( $this->sFileCache->isFileCached() ){
74 - $this->outputjsHeaders();
75 - $this->sFileCache->loadFromFileCache();
76 - }
77 - }
78 - //build the output:
79 -
80 - //swap in the appropriate language per js_file
81 - foreach($this->jsFileList as $file_name){
82 - if( trim( $file_name ) != '')
83 - $this->jsout .= $this->doProccessJsFile( $file_name );
84 - }
85 -
86 - //check if we should minify :
87 - if( $wgEnableScriptMinify && !$this->debug){
88 - //do the minification and output
89 - require_once ( dirname(__FILE__) . '/jsmin.php');
90 - $this->jsout = JSMin::minify( $this->jsout);
91 - }
92 - //save to the file cache:
93 - if( $wgUseFileCache && !$this->debug) {
94 - $this->sFileCache->saveToFileCache($this->jsout);
95 - }
96 -
97 - $this->outputjsHeaders();
98 - if( $this->error_msg != '')
99 - echo 'alert(\'' . str_replace("\n", '\'+"\n"+'."\n'", $this->error_msg ). '\');';
100 -
101 - echo trim($this->jsout);
102 -
103 - }
104 - function outputJsHeaders(){
105 - global $wgJsMimeType;
106 - //output js mime type:
107 - header( 'Content-type: '.$wgJsMimeType);
108 - header("Pragma: public");
109 - //cache forever:
110 - //(the point is we never have to re validate since we should always change the request url based on the svn or article version)
111 - $one_year = 60*60*24*365;
112 - header("Expires: " . gmdate( "D, d M Y H:i:s", time() + $one_year ) . " GM");
113 -
114 - }
115 - /*
116 - * updates the proc Request
117 - */
118 - function procRequestVars(){
119 - global $wgRequest, $wgContLanguageCode, $wgEnableScriptMinify, $wgJSAutoloadClasses;
120 -
121 - //set debug flag:
122 - if($wgRequest->getVal('debug') || $wgEnableScriptDebug==true)
123 - $this->debug = true;
124 -
125 - //check for the requested classes
126 - if( $wgRequest->getVal('class') ){
127 - $reqClassList = explode(',', $wgRequest->getVal('class'));
128 - //clean the class list and populate jsFileList
129 - foreach($reqClassList as $reqClass){
130 - if(trim($reqClass)!=''){
131 - $reqClass = ereg_replace("[^A-Za-z0-9_\-\.]", "", $reqClass );
132 - if( isset( $wgJSAutoloadClasses[$reqClass] ) ){
133 - $this->jsFileList[ $reqClass ] = $wgJSAutoloadClasses[ $reqClass ];
134 - $this->rKey.=$reqClass;
135 - }else{
136 - $this->error_msg.= 'Requested class: '.$reqClass.' not found'."\n";
137 - }
138 - }
139 - }
140 - }
141 - //check for requested files if enabled:
142 - if( $wgEnableScriptLoaderJsFile ){
143 - if( $wgRequest->getVal('files')){
144 - $reqFileList = explode(',', $wgRequest->getVal('files'));
145 - //clean the file list and populate jsFileList
146 - foreach($reqFileList as $reqFile){
147 - //no jumping dirs:
148 - $reqFile = str_replace('../','',$reqFile);
149 - //only allow alphanumeric underscores periods and ending with .js
150 - $reqFile = ereg_replace("[^A-Za-z0-9_\-\/\.]", "", $reqFile );
151 - if( substr($reqFile, -3)=='.js'){
152 - if( is_file( $IP . $reqFile) && !in_array($reqFile, $jsFileList ) ){
153 - $this->jsFileList[] = $IP . $reqFile;
154 - $this->rKey.=$reqFile;
155 - }else{
156 - $this->error_msg.= 'Requested File: '.$reqFile.' not found'."\n";
157 - }
158 - }
159 - }
160 - }
161 - }
162 - //check for a unique request id (should be tied to the svn version for "fresh" copies of things
163 - if( $wgRequest->getVal('urid') ) {
164 - $this->urid = $wgRequest->getVal('urid');
165 - }else{
166 - //just give it the current version number:
167 - global $IP;
168 - $this->urid = SpecialVersion::getSvnRevision( $IP );
169 - }
170 - //add the language code to the rKey:
171 - $this->rKey .= '_' . $wgContLanguageCode;
172 -
173 - //add the unique rid to the rKey
174 - $this->rKey .= $this->urid;
175 -
176 - //add a min flag:
177 - if($wgEnableScriptMinify){
178 - $this->rKey.='_min';
179 - }
180 - }
181 - function doProccessJsFile( $file_name ){
182 - $str = file_get_contents($file_name);
183 - $this->cur_file = $file_name;
184 - //strip out js_log debug lines not much luck with this regExp yet:
185 - //if( !$this->debug )
186 - // $str = preg_replace('/\n\s*js_log\s*\([^\)]([^;]|\n])*;/', "\n", $str);
187 - //die('<pre>'.$str);
188 -
189 - // do language swap
190 - $str = preg_replace_callback('/loadGM\s*\(\s*{(.*)}\s*\)\s*/siU', //@@todo fix: will break down if someone does }) in their msg text
191 - array($this, 'languageMsgReplace'),
192 - $str);
193 -
194 - return $str;
195 - }
196 - function languageMsgReplace($jvar){
197 - if(!isset($jvar[1]))
198 - return ;
199 -
200 - $jmsg = json_decode( '{' . $jvar[1] . '}', true );
201 - //do the language lookup:
202 - if($jmsg){
203 - foreach($jmsg as $msgKey => $default_en_value){
204 - $jmsg[$msgKey] = wfMsgNoTrans( $msgKey );
205 - }
206 - //return the updated loadGM json with fixed new lines:
207 - return 'loadGM( ' . json_encode( $jmsg ) . ')';
208 - }else{
209 - $this->error_msg.= "Could not parse JSON language msg in File:\n" .
210 - $this->cur_file ."\n";
211 - }
212 - //could not parse json (throw error?)
213 - return $jvar[0];
214 - }
215 -}
216 -//a simple version of HTMLFileCache (@@todo abstract shared pieces)
217 -class simpleFileCache{
218 - var $mFileCache;
219 - public function __construct( &$rKey ) {
220 - $this->rKey = $rKey;
221 - $this->fileCacheName(); // init name
222 - }
223 - public function fileCacheName() {
224 - if( !$this->mFileCache ) {
225 - global $wgFileCacheDirectory, $wgRequest;
226 -
227 - $hash = md5( $this->rKey );
228 - # Avoid extension confusion
229 - $key = str_replace( '.', '%2E', urlencode( $this->rKey ) );
230 -
231 - $hash1 = substr( $hash, 0, 1 );
232 - $hash2 = substr( $hash, 0, 2 );
233 - $this->mFileCache = "{$wgFileCacheDirectory}/{$subdir}{$hash1}/{$hash2}/{$this->rKey}.js";
234 -
235 - if( $this->useGzip() )
236 - $this->mFileCache .= '.gz';
237 -
238 - wfDebug( " fileCacheName() - {$this->mFileCache}\n" );
239 - }
240 - return $this->mFileCache;
241 - }
242 - public function isFileCached() {
243 - return file_exists( $this->fileCacheName() );
244 - }
245 - public function loadFromFileCache(){
246 - global $wgJsMimeType;
247 - if( $wgUseGzip ) {
248 - if( wfClientAcceptsGzip() ) {
249 - header( 'Content-Encoding: gzip' );
250 - readfile( $filename );
251 - } else {
252 - /* Send uncompressed */
253 - readgzfile( $filename );
254 - return;
255 - }
256 - }
257 - }
258 - public function saveToFileCache( $text ) {
259 - global $wgUseFileCache;
260 - if( !$wgUseFileCache ) {
261 - return $text; // return to output
262 - }
263 - if( strcmp($text,'') == 0 ) return '';
264 -
265 - wfDebug(" simpleSaveToFileCache()\n", false);
266 -
267 - $this->checkCacheDirs();
268 -
269 - $f = fopen( $this->fileCacheName(), 'w' );
270 - if($f) {
271 - $now = wfTimestampNow();
272 - $text = '//cached at: ' . $now . " :: " . $this->rKey . " \n" . $text ;
273 - if( $this->useGzip() ) {
274 - $text = gzencode( $text);
275 - }
276 - fwrite( $f, $text );
277 - fclose( $f );
278 - }
279 - return $text;
280 - }
281 - protected function checkCacheDirs() {
282 - $filename = $this->fileCacheName();
283 - $mydir2 = substr($filename,0,strrpos($filename,'/')); # subdirectory level 2
284 - $mydir1 = substr($mydir2,0,strrpos($mydir2,'/')); # subdirectory level 1
285 -
286 - wfMkdirParents( $mydir1 );
287 - wfMkdirParents( $mydir2 );
288 - }
289 -}
290 -?>
Index: trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_smil.smil.xml
@@ -1,41 +0,0 @@
2 -<smil xmlns="http://www.w3.org/2001/SMIL20/Language">
3 - <head>
4 - <meta name="title" content="Simple Crossfading Example"/>
5 -
6 - <transition id="fromGreen"
7 - type="fade"
8 - subtype="fadeFromColor"
9 - fadeColor="#87CF87"
10 - dur="4s"/>
11 -
12 - <transition id="toGreen"
13 - type="fade"
14 - subtype="fadeToColor"
15 - fadeColor="#87CF87"
16 - dur="4s"/>
17 -
18 - <transition id="xFade"
19 - type="fade"
20 - subtype="crossfade"
21 - dur="4s"/>
22 -
23 - </head>
24 - <body>
25 - <seq>
26 - <video src="sample_fish.ogg?t=0:0:0/0:0:25"
27 - region="video_region"
28 - transIn="fromGreen"
29 - transOut="xFade"
30 - type="video/ogg"
31 - fill="transition"
32 - dur="7s"
33 - poster="sample_fish.jpg"/>
34 -
35 - <video src="sample_jellyfish.ogg?t=0:0:0/0:0:10"
36 - region="video_region"
37 - fill="transition"
38 - type="video/ogg"
39 - poster="sample_jellyfish.jpg"/>
40 - </seq>
41 - </body>
42 -</smil>
Index: trunk/extensions/MetavidWiki/skins/mv_embed/README
@@ -1,91 +1 @@
2 -***********************************************
3 -*
4 -* mv_embed version 1.0rc2
5 -* for details see: http://metavid.ucsc.edu/wiki/index.php/Mv_embed
6 -* and this README
7 -*
8 -* All Metavid Wiki code is Released under the GPL2
9 -* for more info visit http:/metavid.ucsc.edu/code
10 -*
11 -* @author Michael Dale
12 -* @email dale@ucsc.edu
13 -* @url http://metavid.org
14 -*
15 -*********************************************
16 -
17 -v.7
18 -
19 -
20 -v.6
21 -* added msg system for compatibility with translations
22 -* add support for relative file or path names for media files for cortado.
23 -* added support for safari
24 -** will force load javascript instead of DOM injection
25 -** slower on pages without video clips
26 -* added "experimental" support for "sequences" and editing. (see http://metavid.ucsc.edu/blog/
27 -* improved playlists usage
28 -
29 -v.5
30 -* add support for playlists, basic usage: <playlist id="plid" src="playlist.xml"/>
31 - * see sample_page.php for example usage of playlist
32 -* better support for different resolutions.
33 -* inline playlist:
34 -
35 -
36 -
37 -
38 -v.4
39 -* adds support for oggplay with playhead: http://www.annodex.net/software/plugin/index.html
40 -* adds linkback support (for adding a link back to a particular page)
41 -* adds config value for selecting cortado in an iframe or loaded in the page
42 -
43 -v.3 an intermediary release: supports vlc, basic cortado, basic mplayer/totem
44 -well tested browsers are firefox & IE 6 (more testing needed for more browsers)
45 -
46 -
47 -the goal of mv_embed is to create a complete/wrapper fall back system for
48 -the liboggplay API:
49 -
50 -http://wiki.xiph.org/index.php/OggPlayJavascriptAPI
51 -
52 -& integrate the video element as close as possible with the html5 spec:
53 -http://www.whatwg.org/specs/web-apps/current-work/#video
54 -
55 -it attempts to wrap these calls for the following players:
56 -I try to include a link to their Javascript apis if I can find one:
57 -
58 -(initially just cortado and vlc)
59 -cortado applet: a custom build of the fluendos java based applet
60 -(included with the mv_embed package in the future we should get a signed applet hosted
61 -so that cross domain video playing does not require a copy of cortado+iframe on that server)
62 - http://www.flumotion.net/cortado/
63 -
64 -vlc plugin: video lan client plugin
65 - http://www.videolan.org/doc/play-howto/en/ch04.html#id293992
66 -
67 -mplayer plugin: the mplayer plugin
68 - http://mplayerplug-in.cvs.sourceforge.net/mplayerplug-in/mplayerplug-in/DOCS/tech/javascript.txt?view=markup
69 -
70 -totem:
71 - http://www.gnome.org/projects/totem/
72 -
73 -
74 -Sample Usage:
75 -<script type="text/javascript" src="mv_embed.js" />
76 -<video id="video_id" src="video_url"></video>
77 -
78 -once the page loads the video_id object is rewritten as an mv_embed object
79 -
80 -
81 -Supported Attributes for <video> tag:
82 -type name [default] description
83 -bool autoplay [false] if the clip should play on page load
84 -bool controls [true] if the default interface should be displayed (see interface)
85 -string id null the id of the html element useful for grabbing the video object
86 -string src null the url src for the video file
87 -string thumbnail logo the thumbnail to be displayed a frame grab is ideal.
88 -string linkback link a info link back for more info about this stream
89 - (useful for when the clip is embed externally)
90 -int width [320] the video display width
91 -int height [240] the video display height
92 -bool embed_link [ture] if the html to embed this clip on an external page should be displayed
 2+mv_embed has been moved to mwEmbed in js2 folder of the new-upload branch
\ No newline at end of file
Index: trunk/extensions/MetavidWiki/skins/mv_search.js
@@ -1,4 +1,4 @@
2 -mv_addLoadEvent( mv_pre_setup_search);
 2+mwAddOnloadHook( mv_pre_setup_search);
33 var mvSearchSetupFlag =false;
44 var maxFilters = 8;
55 var mv_search_action='';
Index: trunk/extensions/MetavidWiki/skins/mv_allpages.js
@@ -1,6 +1,6 @@
22 //javascript for all pages (adds auto_complete for search, and our linkback logo, and re-writes mvd links)
33 _global = this;
4 -mv_addLoadEvent(mv_setup_allpage);
 4+mwAddOnloadHook(mv_setup_allpage);
55 var mv_setup_allpage_flag=false;
66 if( typeof wgServer!='undefined' && typeof wgScript != 'undefined'){
77 var base_roe_url = wgServer + wgScript + '?title=Special:MvExportStream&feed_format=roe&stream_name=';
Index: trunk/extensions/MetavidWiki/skins/mv_stream.js
@@ -49,7 +49,7 @@
5050
5151 //@@todo context sensitive init scripts
5252 //init the interface on page load
53 -mv_addLoadEvent(mv_load_interface_libs);
 53+mwAddOnloadHook(mv_load_interface_libs);
5454
5555 function mv_load_interface_libs(){
5656 js_log('f:mv_load_interface_libs');
@@ -67,10 +67,8 @@
6868 'mvClipEdit' : 'libClipEdit/mvClipEdit.js',
6969 '$j.ui.draggable' : 'jquery/jquery.ui-1.7.1/ui/ui.draggable.js'
7070 },function(){
71 - //make sure mv_embed has done video re-write:
72 - mv_embed( function(){
73 - mv_stream_interface.init();
74 - });
 71+ //make sure mv_embed has done video re-write:
 72+ mv_stream_interface.init();
7573 });
7674 });
7775 }

Status & tagging log