Index: trunk/extensions/MetavidWiki/maintenance/ogg_thumb_insert.php |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | USAGE |
25 | 25 | php ogg_thumb_insert.php stream_name filename interval duration |
26 | 26 | |
27 | | -EXAMPLE where stream.ogg is 10min 20 seconds long and we get a frame every 5 seconds: |
| 27 | +EXAMPLE where stream.ogg is 10min 20 seconds long and we get a frame every 5 seconds: |
28 | 28 | ogg_thumb_insert.php stream_name stream.ogg 5 620 |
29 | 29 | |
30 | 30 | Notes: |
— | — | @@ -47,6 +47,6 @@ |
48 | 48 | if(is_file("{$filedir}/{$i}.jpg")){ |
49 | 49 | $dbw->query( "INSERT INTO `mv_stream_images` (`stream_id`, `time`) VALUES ($stream_id, $i)" ); |
50 | 50 | }else{ |
51 | | - print "failed to create file: {$filedir}/{$i}.jpg \n"; |
| 51 | + print "failed to create file: {$filedir}/{$i}.jpg \n"; |
52 | 52 | } |
53 | 53 | } |
Index: trunk/extensions/MetavidWiki/.project |
— | — | @@ -0,0 +1,22 @@ |
| 2 | +<?xml version="1.0" encoding="UTF-8"?> |
| 3 | +<projectDescription> |
| 4 | + <name>Extension MetavidWiki</name> |
| 5 | + <comment></comment> |
| 6 | + <projects> |
| 7 | + </projects> |
| 8 | + <buildSpec> |
| 9 | + <buildCommand> |
| 10 | + <name>org.eclipse.php.core.PhpIncrementalProjectBuilder</name> |
| 11 | + <arguments> |
| 12 | + </arguments> |
| 13 | + </buildCommand> |
| 14 | + <buildCommand> |
| 15 | + <name>org.eclipse.php.core.ValidationManagerWrapper</name> |
| 16 | + <arguments> |
| 17 | + </arguments> |
| 18 | + </buildCommand> |
| 19 | + </buildSpec> |
| 20 | + <natures> |
| 21 | + <nature>org.eclipse.php.core.PHPNature</nature> |
| 22 | + </natures> |
| 23 | +</projectDescription> |
Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialMediaSearch.php |
— | — | @@ -398,27 +398,27 @@ |
399 | 399 | ); |
400 | 400 | $o .= ' <ul id="results">'; |
401 | 401 | //setup the MV_index: |
402 | | - $mvIndex = new MV_Index(); |
| 402 | + $mvIndex = new MV_Index(); |
403 | 403 | foreach ( $this->results as $inx => & $mvd ) { |
404 | | - $mvTitle = new MV_Title( $mvd->wiki_title ); |
405 | | - |
406 | | - //get parent meta if requested: |
407 | | - global $mvGetParentMeta; |
408 | | - $pmeta_out = ''; |
409 | | - if( $mvGetParentMeta && strtolower( $mvTitle->getMvdTypeKey() ) == 'ht_en'){ |
410 | | - $pmvd = $mvIndex->getParentAnnotativeLayers($mvTitle); |
411 | | - |
412 | | - if( $pmvd->wiki_title ){ |
| 404 | + $mvTitle = new MV_Title( $mvd->wiki_title ); |
| 405 | + |
| 406 | + //get parent meta if requested: |
| 407 | + global $mvGetParentMeta; |
| 408 | + $pmeta_out = ''; |
| 409 | + if( $mvGetParentMeta && strtolower( $mvTitle->getMvdTypeKey() ) == 'ht_en'){ |
| 410 | + $pmvd = $mvIndex->getParentAnnotativeLayers($mvTitle); |
| 411 | + |
| 412 | + if( $pmvd->wiki_title ){ |
413 | 413 | $pMvTitle = new MV_Title( $pmvd->wiki_title ); |
414 | 414 | $pAnnoStreamLink = Title :: MakeTitle( MV_NS_STREAM, $pMvTitle->getNearStreamName( 0 ) ); |
415 | 415 | $clip_desc_txt = 'Segment'; |
416 | | - if($pmvd->Speech_by){ |
| 416 | + if($pmvd->Speech_by){ |
417 | 417 | $personTitle = Title :: newFromText( $pmvd->Speech_by ); |
418 | 418 | $clip_desc_txt = 'Speech By ' . $personTitle->getText(); |
419 | | - } |
420 | | - |
| 419 | + } |
| 420 | + |
421 | 421 | $pmeta_out.='This '. $sk->makeKnownLinkObj($pAnnoStreamLink, seconds2Description ( $mvTitle->getSegmentDuration(), true, true ) ). |
422 | | - ' clip is part of a larger '. |
| 422 | + ' clip is part of a larger '. |
423 | 423 | $sk->makeKnownLinkObj($pAnnoStreamLink, seconds2Description ( $pMvTitle->getSegmentDuration(), true, true ) ) . ' Speech'; |
424 | 424 | if($pmvd->category){ |
425 | 425 | $pmeta_out.='<br>Covering: '; |
— | — | @@ -431,13 +431,13 @@ |
432 | 432 | } |
433 | 433 | } |
434 | 434 | if($pmvd->Bill){ |
435 | | - $pmeta_out.='<br>Bill: '; |
| 435 | + $pmeta_out.='<br>Bill: '; |
436 | 436 | $bTitle = Title :: newFromText( $pmvd->Bill ); |
437 | | - $pmeta_out .= $sk->makeKnownLinkObj( $bTitle, $bTitle->getText() ); |
438 | | - assoc_array_increment( $sideBarLinkBucket, 'bill', $pmvd->Bill ); |
439 | | - } |
| 437 | + $pmeta_out .= $sk->makeKnownLinkObj( $bTitle, $bTitle->getText() ); |
| 438 | + assoc_array_increment( $sideBarLinkBucket, 'bill', $pmvd->Bill ); |
| 439 | + } |
440 | 440 | } |
441 | | - } |
| 441 | + } |
442 | 442 | $mvd_cnt_links = ''; |
443 | 443 | if ( isset ( $mvd->spoken_by ) ) { |
444 | 444 | $ptitle = Title :: MakeTitle( NS_MAIN, $mvd->spoken_by ); |
— | — | @@ -472,12 +472,12 @@ |
473 | 473 | } |
474 | 474 | // link directly to the current range: |
475 | 475 | //if the clip length is < $mvDefaultClipLength get range: |
476 | | - global $mvDefaultClipLength; |
477 | | - if( $mvTitle->getSegmentDuration() < $mvDefaultClipLength){ |
| 476 | + global $mvDefaultClipLength; |
| 477 | + if( $mvTitle->getSegmentDuration() < $mvDefaultClipLength){ |
478 | 478 | $mvStreamTitle = Title :: MakeTitle( MV_NS_STREAM, $mvTitle->getNearStreamName( $mvDefaultClipRange ) ); |
479 | 479 | }else{ |
480 | | - $mvStreamTitle = Title :: MakeTitle( MV_NS_STREAM, $mvTitle->getNearStreamName( 0 ) ); |
481 | | - } |
| 480 | + $mvStreamTitle = Title :: MakeTitle( MV_NS_STREAM, $mvTitle->getNearStreamName( 0 ) ); |
| 481 | + } |
482 | 482 | // $mvTitle->getStreamName() .'/'.$mvTitle->getStartTime() .'/'. $mvTitle->getEndTime() ); |
483 | 483 | $mvd_text = $mvd->text; |
484 | 484 | |
— | — | @@ -500,7 +500,7 @@ |
501 | 501 | </div> |
502 | 502 | <div class="result_meta"> |
503 | 503 | <span class="views">Views: ' . htmlspecialchars( $mvd->view_count ) . '</span> |
504 | | - <span class="duration">' . wfMsg( 'mv_duration_label' ) . ':' . htmlspecialchars( $mvTitle->getSegmentDurationNTP( $short_time = true ) ) . '</span> |
| 504 | + <span class="duration">' . wfMsg( 'mv_duration_label' ) . ':' . htmlspecialchars( $mvTitle->getSegmentDurationNTP( $short_time = true ) ) . '</span> |
505 | 505 | <span class="playinline"><a href="javascript:mv_pl(\'' . htmlspecialchars( $mvd->id ) . '\')">' . |
506 | 506 | wfMsg( 'mv_play_inline' ) . '</a></span> |
507 | 507 | </div>'; |
— | — | @@ -861,7 +861,7 @@ |
862 | 862 | if ( $f['t'] != 'match' ) // no desc for text search |
863 | 863 | $o .= ( $query_key ) ? $a : $a . wfMsg( 'mv_' . $f['t'] ) . ' '; |
864 | 864 | if ( $f['t'] == 'date_range' ) { // handle special case of date range: |
865 | | - $o .= ' '+ wfMsg( 'mv_time_separator', $bo . htmlspecialchars( $f['vs'] ) . $bc, $bo . htmlspecialchars( $f['ve'] ) . $bc ); |
| 865 | + $o .= ' '. wfMsg( 'mv_time_separator', $bo . htmlspecialchars( $f['vs'] ) . $bc, $bo . htmlspecialchars( $f['ve'] ) . $bc ); |
866 | 866 | } else { |
867 | 867 | $o .=' '. $bo . str_replace( '_', ' ', htmlspecialchars( $f['v'] ) ) . $bc .' '; |
868 | 868 | } |
— | — | @@ -974,7 +974,7 @@ |
975 | 975 | $result = $dbr->select( 'page', 'page_title', array ( |
976 | 976 | 'page_namespace' => NS_CATEGORY, |
977 | 977 | '`page_title` LIKE \'%' . mysql_escape_string( $val |
978 | | - ) . '%\' COLLATE latin1_general_ci' ), __METHOD__, array ( |
| 978 | + ) . '%\' COLLATE utf8_bin' ), __METHOD__, array ( |
979 | 979 | 'LIMIT' => $result_limit |
980 | 980 | ) ); |
981 | 981 | $match_count = $dbr->numRows( $result ); |
— | — | @@ -996,7 +996,7 @@ |
997 | 997 | $result = $dbr->select( 'categorylinks', 'cl_sortkey', array ( |
998 | 998 | 'cl_to' => $category, |
999 | 999 | '`cl_sortkey` LIKE \'%' . mysql_escape_string( $val |
1000 | | - ) . '%\' COLLATE latin1_general_ci' ), __METHOD__, array ( |
| 1000 | + ) . '%\' COLLATE utf8_bin' ), __METHOD__, array ( |
1001 | 1001 | 'LIMIT' => $result_limit |
1002 | 1002 | ) ); |
1003 | 1003 | // print 'ran: ' . $dbr->lastQuery(); |
— | — | @@ -1023,7 +1023,7 @@ |
1024 | 1024 | $result = $dbr->select( 'categorylinks', 'cl_sortkey', array ( |
1025 | 1025 | 'cl_to' => 'Person', |
1026 | 1026 | '`cl_sortkey` LIKE \'%' . mysql_escape_string( $val |
1027 | | - ) . '%\' COLLATE latin1_general_ci' ), __METHOD__, array ( |
| 1027 | + ) . '%\' COLLATE utf8_bin' ), __METHOD__, array ( |
1028 | 1028 | 'LIMIT' => $result_limit |
1029 | 1029 | ) ); |
1030 | 1030 | $out = ''; |
Index: trunk/extensions/MetavidWiki/skins/add_media_wizard.js |
— | — | @@ -1,215 +0,0 @@ |
2 | | -//add media wizard integration for mediaWiki |
3 | | - |
4 | | -/* config */ |
5 | | -//Setup your content providers (see the remoteSearchDriver::content_providers for all options) |
6 | | -var wg_content_proivers_config = {}; //you can overwrite by defining (after) |
7 | | - |
8 | | -var wg_local_wiki_api_url = wgServer + wgScriptPath + '/api.php'; |
9 | | - |
10 | | -//if mv_embed is hosted somewhere other than near by the add_media_wizard you can define it here: |
11 | | -var force_mv_add_media_wizard_path = false; |
12 | | -//var force_mv_add_media_wizard_path = 'http://metavid.org/w/extensions/MetavidWiki/skins/'; |
13 | | - |
14 | | -var force_mv_embed_path = false; |
15 | | -//var force_mv_embed_path = 'http://metavid.org/w/extensions/MetavidWiki/skins/mv_embed/mvwScriptLoader.php?class=mv_embed'; |
16 | | - |
17 | | -var MV_EMBED_VIDEO_HANDLER = true; // if we should use mv_embed for all ogg_hanlder video embeds. |
18 | | - |
19 | | -//*code should not have to modify anything below*/ |
20 | | - |
21 | | - |
22 | | -//copied utility functions from mv_embed (can remove once utility functions are in js core) |
23 | | -if(typeof gMsg == 'undefined'){ |
24 | | - gMsg = {}; |
25 | | -} |
26 | | -if(typeof loadGM == 'undefined'){ |
27 | | - function loadGM( msgSet ){ |
28 | | - for(var i in msgSet){ |
29 | | - gMsg[ i ] = msgSet[i]; |
30 | | - } |
31 | | - } |
32 | | -} |
33 | | -loadGM( { |
34 | | - 'add_media_to_page' : "Add Media to this Page" |
35 | | -}); |
36 | | - |
37 | | -if( MV_EMBED_VIDEO_HANDLER ){ |
38 | | - var vidIdList = new Array(); |
39 | | - addOnloadHook( function(){ |
40 | | - var divs = document.getElementsByTagName('div'); |
41 | | - for(var i = 0; i < divs.length; i++){ |
42 | | - if( divs[i].id.substring(0,11) == 'ogg_player_'){ |
43 | | - vidIdList.push( divs[i].getAttribute("id") ); |
44 | | - } |
45 | | - } |
46 | | - if( vidIdList.length > 0){ |
47 | | - load_mv_embed( function(){ |
48 | | - mvJsLoader.embedVideoCheck(function(){ |
49 | | - //do utilty rewrite of oggHanlder content: |
50 | | - rewrite_for_oggHanlder( vidIdList ); |
51 | | - }); |
52 | | - }); |
53 | | - } |
54 | | - }); |
55 | | -} |
56 | | - |
57 | | -//check if we are on a edit page: |
58 | | -if( wgAction == 'edit' || wgAction == 'submit' ){ |
59 | | - //add onPage ready request: |
60 | | - addOnloadHook( function(){ |
61 | | - var imE = document.createElement('img'); |
62 | | - imE.style.cursor = 'pointer'; |
63 | | - imE.id = 'mv-add_media'; |
64 | | - imE.src = getAddMediaPath( 'mv_embed/images/Button_add_media.png' ); |
65 | | - imE.title = gMsg['add_media_to_page']; |
66 | | - |
67 | | - var toolbar = document.getElementById("toolbar"); |
68 | | - if(toolbar) |
69 | | - toolbar.appendChild(imE); |
70 | | - |
71 | | - addHandler( imE, 'click', function() { |
72 | | - mv_do_load_wiz(); |
73 | | - }); |
74 | | - }); |
75 | | -} |
76 | | -//add firefog support to Special Upload page: |
77 | | -if( wgPageName== "Special:Upload" ){ |
78 | | - addOnloadHook( function(){ |
79 | | - //(for commons force the &uploadformstyle=plain form |
80 | | - /*var loc = window.location.toString(); |
81 | | - if( loc.indexOf('commons.wikimedia.org')!==-1 ){ |
82 | | - if( loc.indexOf( '&uploadformstyle=plain') == -1){ |
83 | | - window.location = loc + '&uploadformstyle=plain'; |
84 | | - } |
85 | | - }*/ |
86 | | - //alert("!!upload hook"); |
87 | | - load_mv_embed( function(){ |
88 | | - //load jQuery and what not |
89 | | - mvJsLoader.jQueryCheck(function(){ |
90 | | - mvJsLoader.doLoad( { |
91 | | - 'mvFirefogg' : 'libAddMedia/mvFirefogg.js', |
92 | | - 'mvUploader' : 'libAddMedia/mvUploader.js' |
93 | | - },function(){ |
94 | | - mvUp = new mvUploader( { 'api_url' : wg_local_wiki_api_url } ); |
95 | | - }); |
96 | | - }); |
97 | | - }); |
98 | | - }); |
99 | | -} |
100 | | - |
101 | | -var caret_pos={}; |
102 | | -function mv_do_load_wiz(){ |
103 | | - caret_pos={}; |
104 | | - var txtarea = document.editform.wpTextbox1; |
105 | | - var getTextCusorStartPos = function (o){ |
106 | | - if (o.createTextRange) { |
107 | | - var r = document.selection.createRange().duplicate() |
108 | | - r.moveEnd('character', o.value.length) |
109 | | - if (r.text == '') return o.value.length |
110 | | - return o.value.lastIndexOf(r.text) |
111 | | - } else return o.selectionStart; |
112 | | - } |
113 | | - var getTextCusorEndPos = function (o){ |
114 | | - if (o.createTextRange) { |
115 | | - var r = document.selection.createRange().duplicate(); |
116 | | - r.moveStart('character', -o.value.length); |
117 | | - return r.text.length; |
118 | | - } else{ |
119 | | - return o.selectionEnd; |
120 | | - } |
121 | | - } |
122 | | - caret_pos.s = getTextCusorStartPos( txtarea ); |
123 | | - caret_pos.e = getTextCusorEndPos( txtarea ); |
124 | | - caret_pos.text = txtarea.value; |
125 | | - //show the loading screen: |
126 | | - var elm = document.getElementById('modalbox'); |
127 | | - if(elm){ |
128 | | - //use jquery to re-display the search |
129 | | - if( typeof $j != 'undefined'){ |
130 | | - $j('#modalbox,#mv_overlay').show(); |
131 | | - } |
132 | | - }else{ |
133 | | - var body_elm = document.getElementsByTagName("body")[0]; |
134 | | - body_elm.innerHTML = body_elm.innerHTML + ''+ |
135 | | - '<div id="modalbox" style="background:#DDD;border:3px solid #666666;font-size:115%;'+ |
136 | | - 'top:30px;left:20px;right:20px;bottom:30px;position:fixed;z-index:100;">'+ |
137 | | - 'loading external media wizard<blink>...</blink>'+ |
138 | | - '</div>'+ |
139 | | - '<div id="mv_overlay" style="background:#000;cursor:wait;height:100%;left:0;position:fixed;'+ |
140 | | - 'top:0;width:100%;z-index:5;filter:alpha(opacity=60);-moz-opacity: 0.6;'+ |
141 | | - 'opacity: 0.6;"/>'; |
142 | | - } |
143 | | - //make sure the click action is still there |
144 | | - var imE = document.getElementById('mv-add_media'); |
145 | | - if(imE){ |
146 | | - addHandler( imE, 'click', function() { |
147 | | - mv_do_load_wiz(); |
148 | | - }); |
149 | | - } |
150 | | - //load mv_embed and do text search interface: |
151 | | - load_mv_embed( function(){ |
152 | | - //restore text value: |
153 | | - var txtarea = document.editform.wpTextbox1; |
154 | | - txtarea.value = caret_pos.text; |
155 | | - //do the remote search interface: |
156 | | - mv_do_remote_search({ |
157 | | - 'target_id':'modalbox', |
158 | | - 'profile':'mediawiki_edit', |
159 | | - 'target_textbox': 'wpTextbox1', |
160 | | - 'caret_pos': caret_pos, |
161 | | - //note selections in the textbox will take over the default query |
162 | | - 'default_query': wgTitle, |
163 | | - 'target_title':wgPageName, |
164 | | - 'cpconfig':wg_content_proivers_config, |
165 | | - 'local_wiki_api_url': wg_local_wiki_api_url |
166 | | - }); |
167 | | - }); |
168 | | - return false; |
169 | | -} |
170 | | -function load_mv_embed( callback ){ |
171 | | - //inject mv_embed if needed: |
172 | | - if( typeof mvEmbed == 'undefined'){ |
173 | | - //get mv_embed path from _this_ file location: |
174 | | - if( force_mv_embed_path ){ |
175 | | - var mv_embed_url = force_mv_embed_path; |
176 | | - }else{ |
177 | | - var mv_embed_url = getAddMediaPath( 'mv_embed/mv_embed.js' ); |
178 | | - } |
179 | | - //check if we are in debug mode (send a urid to mv_embed too) |
180 | | - if( mv_embed_url.indexOf('debug=true') != -1 ){ |
181 | | - var d = new Date(); |
182 | | - mv_embed_url+='&urid=' + d.getTime(); |
183 | | - } |
184 | | - var e = document.createElement("script"); |
185 | | - e.setAttribute( 'src', mv_embed_url ); |
186 | | - e.setAttribute( 'type', "text/javascript" ); |
187 | | - document.getElementsByTagName("head")[0].appendChild(e); |
188 | | - check_for_mv_embed( callback ); |
189 | | - }else{ |
190 | | - check_for_mv_embed( callback ); |
191 | | - } |
192 | | -} |
193 | | - |
194 | | -function check_for_mv_embed( callback ){ |
195 | | - if( typeof mvEmbed == 'undefined'){ |
196 | | - setTimeout('check_for_mv_embed( ' + callback +');', 25); |
197 | | - }else{ |
198 | | - callback(); |
199 | | - } |
200 | | -} |
201 | | -function getAddMediaPath( replace_str ){ |
202 | | - if(!replace_str) |
203 | | - replace_str = ''; |
204 | | - if( force_mv_add_media_wizard_path ) |
205 | | - return force_mv_add_media_wizard_path + replace_str; |
206 | | - |
207 | | - for(var i=0; i < document.getElementsByTagName('script').length; i++){ |
208 | | - var s = document.getElementsByTagName('script')[i]; |
209 | | - if( s.src.indexOf('add_media_wizard.js') != -1 ){ |
210 | | - //use the external_media_wizard path: |
211 | | - return s.src.replace('add_media_wizard.js', replace_str); |
212 | | - } |
213 | | - } |
214 | | -} |
215 | | - |
216 | | - |
Index: trunk/extensions/MetavidWiki/skins/mv_stream.js |
— | — | @@ -14,8 +14,8 @@ |
15 | 15 | * http://metavid.org/wiki/index.php/Mv_embed |
16 | 16 | * |
17 | 17 | * assumes a few utility functions are available from mv_embed: |
18 | | - * loadExternalJs() |
19 | | - * addLoadEvent() |
| 18 | + * loadExternalJs() |
| 19 | + * addLoadEvent() |
20 | 20 | */ |
21 | 21 | var org_vid_time_req =null; //store the original time req: |
22 | 22 | var org_vid_title = null; //stores the original title |
— | — | @@ -78,109 +78,109 @@ |
79 | 79 | * to take up the full page space. |
80 | 80 | */ |
81 | 81 | var mv_stream_interface = { |
82 | | - cur_mvd_id:'base', |
83 | | - interfaceLoaded:false, |
84 | | - monitorTimerId:0, |
85 | | - init:function(){ |
86 | | - //don't call multiple times: |
87 | | - if(this.interfaceLoaded) |
88 | | - return; |
89 | | - //set interfaceLoaded flag: |
90 | | - this.interfaceLoaded=true; |
91 | | - |
92 | | - js_log('f:mv_stream_interface.init call'); |
93 | | - //add_custom_effects(); |
94 | | - //set up the init values for mouse over restore: |
95 | | - org_vid_title = $j('#mv_stream_time').html(); |
96 | | - if( $j('#embed_vid').length==0 || !$j('#embed_vid').get(0).ready_to_play ){ |
97 | | - //no embed video present stop init |
98 | | - js_log('no clip ready to play'); |
99 | | - return false; |
100 | | - } |
101 | | - org_vid_time_req = $j('#embed_vid').get(0).getTimeReq(); |
102 | | - $j('#embed_vid').get(0).org_thum_src = $j('#embed_vid').get(0).thumbnail; |
| 82 | + cur_mvd_id:'base', |
| 83 | + interfaceLoaded:false, |
| 84 | + monitorTimerId:0, |
| 85 | + init:function(){ |
| 86 | + //don't call multiple times: |
| 87 | + if(this.interfaceLoaded) |
| 88 | + return; |
| 89 | + //set interfaceLoaded flag: |
| 90 | + this.interfaceLoaded=true; |
| 91 | + |
| 92 | + js_log('f:mv_stream_interface.init call'); |
| 93 | + //add_custom_effects(); |
| 94 | + //set up the init values for mouse over restore: |
| 95 | + org_vid_title = $j('#mv_stream_time').html(); |
| 96 | + if( $j('#embed_vid').length==0 || !$j('#embed_vid').get(0).ready_to_play ){ |
| 97 | + //no embed video present stop init |
| 98 | + js_log('no clip ready to play'); |
| 99 | + return false; |
| 100 | + } |
| 101 | + org_vid_time_req = $j('#embed_vid').get(0).getTimeReq(); |
| 102 | + $j('#embed_vid').get(0).org_thum_src = $j('#embed_vid').get(0).thumbnail; |
103 | 103 | |
104 | | - //@@TODO override stop function in player: |
| 104 | + //@@TODO override stop function in player: |
105 | 105 | |
106 | | - //current range or search parameter |
107 | | - stream_current_context =$j('#mv_stream_time').html(); |
108 | | - js_log('set org_vid_time_req: ' + org_vid_time_req ); |
109 | | - ebvid = $j('#embed_vid').get(0); |
110 | | - //setup text scroll monitor: |
111 | | - mv_doTextScrollMonitor(); |
112 | | - |
113 | | - //add all the hover hooks: |
114 | | - this.addHoverHooks(); |
| 106 | + //current range or search parameter |
| 107 | + stream_current_context =$j('#mv_stream_time').html(); |
| 108 | + js_log('set org_vid_time_req: ' + org_vid_time_req ); |
| 109 | + ebvid = $j('#embed_vid').get(0); |
| 110 | + //setup text scroll monitor: |
| 111 | + mv_doTextScrollMonitor(); |
| 112 | + |
| 113 | + //add all the hover hooks: |
| 114 | + this.addHoverHooks(); |
115 | 115 | |
116 | | - //add odd even classes (for non-annoative layers |
117 | | - this.oddEvenPaint(); |
| 116 | + //add odd even classes (for non-annoative layers |
| 117 | + this.oddEvenPaint(); |
118 | 118 | |
119 | | - //add edit/navigate hook |
120 | | - var st_input_mode=false; |
121 | | - $j('#mv_stream_time,#mv_edit_time').click(function(){ |
122 | | - if(!st_input_mode){ |
123 | | - var st = $j('#mv_stream_time .mv_start_time').html(); |
124 | | - var et = $j('#mv_stream_time .mv_end_time').html(); |
125 | | - $j('#mv_stream_time').hide(); |
126 | | - $j('#mv_stream_time').after('<form style="display:inline" action="javascript:alert(\'wtf\');" id="td_st_mv_stream_time">' + |
127 | | - '<input class="videoHeader" id="mv_td_start_time" size="7" value="'+st+'">'+ |
128 | | - '<input class="videoHeader" id="mv_td_end_time" size="7" value="'+et+'"> '+ |
129 | | - '<a href="#" id="mv_td_st_go">go</a> :: '+ |
130 | | - '<a href="#" id="mv_td_st_cancel">cancel</a></form>'); |
131 | | - } |
132 | | - if(!st_input_mode)st_input_mode=true; |
133 | | - //bind actions for go/cancel |
134 | | - function getNavUrl(){ |
135 | | - return wgArticlePath.replace('$1',wgPageName+'/'+$j('#mv_td_start_time').val()+'/'+$j('#mv_td_end_time').val()); |
136 | | - } |
137 | | - $j('#mv_td_st_go').click(function(){ |
138 | | - window.location=getNavUrl(); |
139 | | - return false; |
140 | | - }); |
141 | | - $j('#td_st_mv_stream_time input').keypress(function (e) { |
142 | | - if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) { |
143 | | - window.location=getNavUrl(); |
144 | | - } |
145 | | - }); |
146 | | - $j('#mv_td_st_cancel').click(function(){ |
147 | | - $j('#mv_stream_time').show(); |
148 | | - $j('#td_st_mv_stream_time').remove(); |
149 | | - st_input_mode=false; |
150 | | - return false; |
151 | | - }); |
152 | | - }); |
| 119 | + //add edit/navigate hook |
| 120 | + var st_input_mode=false; |
| 121 | + $j('#mv_stream_time,#mv_edit_time').click(function(){ |
| 122 | + if(!st_input_mode){ |
| 123 | + var st = $j('#mv_stream_time .mv_start_time').html(); |
| 124 | + var et = $j('#mv_stream_time .mv_end_time').html(); |
| 125 | + $j('#mv_stream_time').hide(); |
| 126 | + $j('#mv_stream_time').after('<form style="display:inline" action="javascript:alert(\'wtf\');" id="td_st_mv_stream_time">' + |
| 127 | + '<input class="videoHeader" id="mv_td_start_time" size="7" value="'+st+'">'+ |
| 128 | + '<input class="videoHeader" id="mv_td_end_time" size="7" value="'+et+'"> '+ |
| 129 | + '<a href="#" id="mv_td_st_go">go</a> :: '+ |
| 130 | + '<a href="#" id="mv_td_st_cancel">cancel</a></form>'); |
| 131 | + } |
| 132 | + if(!st_input_mode)st_input_mode=true; |
| 133 | + //bind actions for go/cancel |
| 134 | + function getNavUrl(){ |
| 135 | + return wgArticlePath.replace('$1',wgPageName+'/'+$j('#mv_td_start_time').val()+'/'+$j('#mv_td_end_time').val()); |
| 136 | + } |
| 137 | + $j('#mv_td_st_go').click(function(){ |
| 138 | + window.location=getNavUrl(); |
| 139 | + return false; |
| 140 | + }); |
| 141 | + $j('#td_st_mv_stream_time input').keypress(function (e) { |
| 142 | + if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) { |
| 143 | + window.location=getNavUrl(); |
| 144 | + } |
| 145 | + }); |
| 146 | + $j('#mv_td_st_cancel').click(function(){ |
| 147 | + $j('#mv_stream_time').show(); |
| 148 | + $j('#td_st_mv_stream_time').remove(); |
| 149 | + st_input_mode=false; |
| 150 | + return false; |
| 151 | + }); |
| 152 | + }); |
153 | 153 | |
154 | | - //do any tool specific hooks: |
155 | | - this.tool_key = parseUri(document.URL).queryKey.tool_disp; |
156 | | - if(this.tool_key){ |
157 | | - mv_proc_tool_result(this.tool_key, {'status':'ok','innerHTML':$j('#mv_tool_cont').html()} ); |
158 | | - } |
| 154 | + //do any tool specific hooks: |
| 155 | + this.tool_key = parseUri(document.URL).queryKey.tool_disp; |
| 156 | + if(this.tool_key){ |
| 157 | + mv_proc_tool_result(this.tool_key, {'status':'ok','innerHTML':$j('#mv_tool_cont').html()} ); |
| 158 | + } |
159 | 159 | |
160 | | - //unlock the interface updates once everything is setup: |
161 | | - mv_lock_vid_updates=false; |
162 | | - |
163 | | - //check for #autoplay ancor |
164 | | - var hash = window.location.hash.toString(); |
165 | | - js_log(" hash is: " + hash); |
166 | | - if( hash == '#autoplay'){ |
167 | | - //window.location.hash = ''; |
168 | | - setTimeout('mv_do_play()', 500); |
169 | | - } |
170 | | - |
171 | | - js_log('done with mv_init_inerface'); |
172 | | - //$j('#embed_vid').get(0).stop(); |
173 | | - }, |
174 | | - oddEvenPaint:function(){ |
175 | | - //remove existing class: |
176 | | - $j('.mv_fd_mvd:not(.anno_en)').removeClass("odd").removeClass("even"); |
177 | | - $j('.mv_fd_mvd:odd').filter(':not(.anno_en)').addClass("odd"); |
178 | | - $j('.mv_fd_mvd:even').filter(':not(.anno_en)').addClass("even"); |
179 | | - //remove odd/even class for annoative layer: |
180 | | - $j('.anno_en:odd').addClass("anno_en_odd") |
181 | | - $j('.anno_en:even').addClass("anno_en_even"); |
182 | | - //add annotative odd even collor: |
183 | | - }, |
184 | | - addHoverHooks:function(selector){ |
| 160 | + //unlock the interface updates once everything is setup: |
| 161 | + mv_lock_vid_updates=false; |
| 162 | + |
| 163 | + //check for #autoplay ancor |
| 164 | + var hash = window.location.hash.toString(); |
| 165 | + js_log(" hash is: " + hash); |
| 166 | + if( hash == '#autoplay'){ |
| 167 | + //window.location.hash = ''; |
| 168 | + setTimeout('mv_do_play()', 500); |
| 169 | + } |
| 170 | + |
| 171 | + js_log('done with mv_init_inerface'); |
| 172 | + //$j('#embed_vid').get(0).stop(); |
| 173 | + }, |
| 174 | + oddEvenPaint:function(){ |
| 175 | + //remove existing class: |
| 176 | + $j('.mv_fd_mvd:not(.anno_en)').removeClass("odd").removeClass("even"); |
| 177 | + $j('.mv_fd_mvd:odd').filter(':not(.anno_en)').addClass("odd"); |
| 178 | + $j('.mv_fd_mvd:even').filter(':not(.anno_en)').addClass("even"); |
| 179 | + //remove odd/even class for annoative layer: |
| 180 | + $j('.anno_en:odd').addClass("anno_en_odd") |
| 181 | + $j('.anno_en:even').addClass("anno_en_even"); |
| 182 | + //add annotative odd even collor: |
| 183 | + }, |
| 184 | + addHoverHooks:function(selector){ |
185 | 185 | this_stream=this; |
186 | 186 | if(!selector){ |
187 | 187 | //null selector do init: |
— | — | @@ -214,321 +214,321 @@ |
215 | 215 | ); |
216 | 216 | }, |
217 | 217 | mvdOver:function(mvd_id){ |
218 | | - js_log('f:mvdOver' + mvd_id ); |
219 | | - var vid_elm = $j('#embed_vid').get(0); |
220 | | - //never do mvdOver while video is playing: |
221 | | - if( vid_elm.isPlaying() ){ |
222 | | - return false; |
223 | | - } |
224 | | - //stop the video if not already stopped |
225 | | - vid_elm.stop(); |
226 | | - mv_lock_vid_updates=false; |
227 | | - //set the onClipDone_disp to false: |
228 | | - this.cur_mvd_id=this.delay_cur_mvd_id=mvd_id; |
229 | | - do_video_mvd_update(mvd_id); |
230 | | - highlight_tl_ts(mvd_id); |
231 | | - highlight_fd(mvd_id); |
232 | | - }, |
233 | | - mvdOut:function(mvd_id){ |
234 | | - var vid_elm = $j('#embed_vid').get(0); |
235 | | - //only process out if in "stoped" state |
236 | | - if( vid_elm.isStoped() ){ |
237 | | - js_log('do out ' + mvd_id ); |
238 | | - this.cur_mvd_id='base'; |
239 | | - de_highlight_tl_ts(mvd_id); |
240 | | - de_highlight_fd(mvd_id); |
241 | | - js_log('calling interface restore: '); |
242 | | - vid_elm.hideHighlight(); |
243 | | - setTimeout('mv_stream_interface.doRestore()',500); |
244 | | - }else{ |
245 | | - setTimeout('mv_stream_interface.mvdOut(\''+mvd_id+'\')',100); |
246 | | - } |
247 | | - }, |
248 | | - //delay video updates until we are not playing the clip and clipEnd is not displayed |
249 | | - delayDoVidMvdUpdate:function(){ |
250 | | - if(mv_lock_vid_updates){ |
251 | | - setTimeout("mv_stream_interface.delayDoVidMvdUpdate()", 250); |
252 | | - }else{ |
253 | | - //only restore if the onClipDone_disp is false |
254 | | - if( !$j('#embed_vid').get(0).onClipDone_disp){ |
255 | | - if(this.cur_mvd_id!=this.delay_cur_mvd_id){ |
256 | | - this.cur_mvd_id = this.delay_cur_mvd_id; |
257 | | - do_video_mvd_update(this.cur_mvd_id); |
258 | | - } |
259 | | - } |
260 | | - } |
261 | | - }, |
262 | | - /* based on a a mvd_id update the video thumbnail to the correct location |
263 | | - */ |
264 | | - doRestore:function(){ |
265 | | - //js_log('f:doRestore'); |
266 | | - var vid_elm = $j('#embed_vid').get(0); |
267 | | - if(vid_elm){ |
268 | | - if( vid_elm.isPlaying()){ |
269 | | - //js_log('vid elm is playing delay restore:') |
270 | | - if(!vid_elm.userSlide){ //dont' restore if userSlide is true |
271 | | - if( ! this.monitorTimerId ){ |
272 | | - // this.monitorTimerId = setInterval('mv_stream_interface.doRestore()', 250); |
273 | | - } |
274 | | - } |
275 | | - }else{ |
276 | | - //stop restore monitor: |
277 | | - clearInterval(this.monitorTimerId); |
278 | | - this.monitorTimerId = 0; |
279 | | - //only restore if onClipDone_disp is false |
280 | | - if(!vid_elm.onClipDone_disp){ |
281 | | - //only restore if the cur_mvd = 'base' and interface updates are not locked |
282 | | - if(this.cur_mvd_id=='base'){ |
283 | | - vid_elm.updateThumbnail( $j('#embed_vid').get(0).org_thum_src ); |
284 | | - vid_elm.updateVideoTimeReq(org_vid_time_req); |
285 | | - //vid_elm.updateVideoSrc(org_vid_src); |
286 | | - $j('#mv_videoPlayerTime').html(org_vid_title); |
287 | | - } |
288 | | - } |
289 | | - } |
290 | | - } |
291 | | - } |
| 218 | + js_log('f:mvdOver' + mvd_id ); |
| 219 | + var vid_elm = $j('#embed_vid').get(0); |
| 220 | + //never do mvdOver while video is playing: |
| 221 | + if( vid_elm.isPlaying() ){ |
| 222 | + return false; |
| 223 | + } |
| 224 | + //stop the video if not already stopped |
| 225 | + vid_elm.stop(); |
| 226 | + mv_lock_vid_updates=false; |
| 227 | + //set the onClipDone_disp to false: |
| 228 | + this.cur_mvd_id=this.delay_cur_mvd_id=mvd_id; |
| 229 | + do_video_mvd_update(mvd_id); |
| 230 | + highlight_tl_ts(mvd_id); |
| 231 | + highlight_fd(mvd_id); |
| 232 | + }, |
| 233 | + mvdOut:function(mvd_id){ |
| 234 | + var vid_elm = $j('#embed_vid').get(0); |
| 235 | + //only process out if in "stoped" state |
| 236 | + if( vid_elm.isStoped() ){ |
| 237 | + js_log('do out ' + mvd_id ); |
| 238 | + this.cur_mvd_id='base'; |
| 239 | + de_highlight_tl_ts(mvd_id); |
| 240 | + de_highlight_fd(mvd_id); |
| 241 | + js_log('calling interface restore: '); |
| 242 | + vid_elm.hideHighlight(); |
| 243 | + setTimeout('mv_stream_interface.doRestore()',500); |
| 244 | + }else{ |
| 245 | + setTimeout('mv_stream_interface.mvdOut(\''+mvd_id+'\')',100); |
| 246 | + } |
| 247 | + }, |
| 248 | + //delay video updates until we are not playing the clip and clipEnd is not displayed |
| 249 | + delayDoVidMvdUpdate:function(){ |
| 250 | + if(mv_lock_vid_updates){ |
| 251 | + setTimeout("mv_stream_interface.delayDoVidMvdUpdate()", 250); |
| 252 | + }else{ |
| 253 | + //only restore if the onClipDone_disp is false |
| 254 | + if( !$j('#embed_vid').get(0).onClipDone_disp){ |
| 255 | + if(this.cur_mvd_id!=this.delay_cur_mvd_id){ |
| 256 | + this.cur_mvd_id = this.delay_cur_mvd_id; |
| 257 | + do_video_mvd_update(this.cur_mvd_id); |
| 258 | + } |
| 259 | + } |
| 260 | + } |
| 261 | + }, |
| 262 | + /* based on a a mvd_id update the video thumbnail to the correct location |
| 263 | + */ |
| 264 | + doRestore:function(){ |
| 265 | + //js_log('f:doRestore'); |
| 266 | + var vid_elm = $j('#embed_vid').get(0); |
| 267 | + if(vid_elm){ |
| 268 | + if( vid_elm.isPlaying()){ |
| 269 | + //js_log('vid elm is playing delay restore:') |
| 270 | + if(!vid_elm.userSlide){ //dont' restore if userSlide is true |
| 271 | + if( ! this.monitorTimerId ){ |
| 272 | + // this.monitorTimerId = setInterval('mv_stream_interface.doRestore()', 250); |
| 273 | + } |
| 274 | + } |
| 275 | + }else{ |
| 276 | + //stop restore monitor: |
| 277 | + clearInterval(this.monitorTimerId); |
| 278 | + this.monitorTimerId = 0; |
| 279 | + //only restore if onClipDone_disp is false |
| 280 | + if(!vid_elm.onClipDone_disp){ |
| 281 | + //only restore if the cur_mvd = 'base' and interface updates are not locked |
| 282 | + if(this.cur_mvd_id=='base'){ |
| 283 | + vid_elm.updateThumbnail( $j('#embed_vid').get(0).org_thum_src ); |
| 284 | + vid_elm.updateVideoTimeReq(org_vid_time_req); |
| 285 | + //vid_elm.updateVideoSrc(org_vid_src); |
| 286 | + $j('#mv_videoPlayerTime').html(org_vid_title); |
| 287 | + } |
| 288 | + } |
| 289 | + } |
| 290 | + } |
| 291 | + } |
292 | 292 | } |
293 | 293 | function mv_doTextScrollMonitor(){ |
294 | | - if(!mvTextScrollMonitorTimer) |
295 | | - mvTextScrollMonitorTimer=setInterval('mv_doTextScrollMonitor()',1000); |
296 | | - |
297 | | - if( ! mv_open_edit_mvd ){ |
298 | | - var evid = $j('#embed_vid').get(0); |
299 | | - if( evid.isPlaying() ){ |
300 | | - if(evid.currentTime!=0) |
301 | | - mv_scroll2Time(evid.currentTime); |
302 | | - } |
303 | | - if( evid.userSlide ){ |
304 | | - var mvd_id = mv_scroll2Time( npt2seconds( evid.jump_time ) ); |
305 | | - if( mvd_id ){ |
306 | | - //also update the image: |
307 | | - var img_url = $j('#mv_fd_mvd_'+mvd_id).attr('image_url'); |
308 | | - //js_log('set imag via mv_doTextScrollMonitor:'+img_url); |
309 | | - $j('#embed_vid').get(0).updateThumbnail( img_url ); |
310 | | - }else{ |
311 | | - //update the image based on the time: |
312 | | - $j('#embed_vid').get(0).updateThumbTime( evid.jump_time ); |
313 | | - } |
314 | | - } |
315 | | - |
316 | | - |
317 | | - } |
318 | | - //if userScroll scroll/update |
| 294 | + if(!mvTextScrollMonitorTimer) |
| 295 | + mvTextScrollMonitorTimer=setInterval('mv_doTextScrollMonitor()',1000); |
| 296 | + |
| 297 | + if( ! mv_open_edit_mvd ){ |
| 298 | + var evid = $j('#embed_vid').get(0); |
| 299 | + if( evid.isPlaying() ){ |
| 300 | + if(evid.currentTime!=0) |
| 301 | + mv_scroll2Time(evid.currentTime); |
| 302 | + } |
| 303 | + if( evid.userSlide ){ |
| 304 | + var mvd_id = mv_scroll2Time( npt2seconds( evid.jump_time ) ); |
| 305 | + if( mvd_id ){ |
| 306 | + //also update the image: |
| 307 | + var img_url = $j('#mv_fd_mvd_'+mvd_id).attr('image_url'); |
| 308 | + //js_log('set imag via mv_doTextScrollMonitor:'+img_url); |
| 309 | + $j('#embed_vid').get(0).updateThumbnail( img_url ); |
| 310 | + }else{ |
| 311 | + //update the image based on the time: |
| 312 | + $j('#embed_vid').get(0).updateThumbTime( evid.jump_time ); |
| 313 | + } |
| 314 | + } |
| 315 | + |
| 316 | + |
| 317 | + } |
| 318 | + //if userScroll scroll/update |
319 | 319 | } |
320 | 320 | var previus_scroll2Time_time=null; |
321 | 321 | var previus_scrollMvd_id=null; |
322 | 322 | function mv_scroll2Time(sec_time){ |
323 | | - if(previus_scroll2Time_time!=sec_time){ |
324 | | - var scroll_mvd_id = null; |
325 | | - //init pMvd_id |
326 | | - if( $j('.mv_fd_mvd:first').length != 0 ){ |
327 | | - var pMvd_id=$j('.mv_fd_mvd:first').attr("id").split('_').pop(); |
328 | | - $j('.mv_fd_mvd').each(function(){ |
329 | | - var curTitle = get_titleObject($j(this).attr('name')); |
330 | | - if( curTitle.start_time >= sec_time ){ |
331 | | - //js_log('found mvd pos: ' + curTitle.start_time + ' for sec time: ' + sec_time); |
332 | | - if(previus_scrollMvd_id != pMvd_id){ |
333 | | - scroll_to_pos( pMvd_id ) ; |
334 | | - previus_scrollMvd_id = pMvd_id; |
335 | | - } |
336 | | - return false;//break out of for loop: |
337 | | - } |
338 | | - pMvd_id = $j(this).attr("id").split('_').pop(); |
339 | | - }); |
340 | | - } |
341 | | - } |
342 | | - return pMvd_id; |
| 323 | + if(previus_scroll2Time_time!=sec_time){ |
| 324 | + var scroll_mvd_id = null; |
| 325 | + //init pMvd_id |
| 326 | + if( $j('.mv_fd_mvd:first').length != 0 ){ |
| 327 | + var pMvd_id=$j('.mv_fd_mvd:first').attr("id").split('_').pop(); |
| 328 | + $j('.mv_fd_mvd').each(function(){ |
| 329 | + var curTitle = get_titleObject($j(this).attr('name')); |
| 330 | + if( curTitle.start_time >= sec_time ){ |
| 331 | + //js_log('found mvd pos: ' + curTitle.start_time + ' for sec time: ' + sec_time); |
| 332 | + if(previus_scrollMvd_id != pMvd_id){ |
| 333 | + scroll_to_pos( pMvd_id ) ; |
| 334 | + previus_scrollMvd_id = pMvd_id; |
| 335 | + } |
| 336 | + return false;//break out of for loop: |
| 337 | + } |
| 338 | + pMvd_id = $j(this).attr("id").split('_').pop(); |
| 339 | + }); |
| 340 | + } |
| 341 | + } |
| 342 | + return pMvd_id; |
343 | 343 | } |
344 | 344 | /*function mv_doShowVideoDownload(){ |
345 | | - js_log('f:mv_doShowVideoDownload'); |
346 | | - //restores orginal state before showing download links: |
347 | | - mv_stream_interface.doRestore(); |
348 | | - return $j('#embed_vid').get(0).org_showVideoDownload(); |
| 345 | + js_log('f:mv_doShowVideoDownload'); |
| 346 | + //restores orginal state before showing download links: |
| 347 | + mv_stream_interface.doRestore(); |
| 348 | + return $j('#embed_vid').get(0).org_showVideoDownload(); |
349 | 349 | }*/ |
350 | 350 | /* the mvdObject |
351 | 351 | * |
352 | 352 | * eventually a lot of mvd_based functionality should be ported over to this structure. |
353 | 353 | * */ |
354 | 354 | function getMvdObject(mvd_id){ |
355 | | - if(mvdAry[mvd_id])return mvdAry[mvd_id]; |
356 | | - if($j('#mv_fd_mvd_'+mvd_id).get(0)){ |
357 | | - var mvdObj = new Object({ |
358 | | - id:mvd_id, |
359 | | - name:$j('#mv_fd_mvd_'+mvd_id).attr('name'), |
360 | | - parseTitle:function(){ |
361 | | - parts = this.name.split('/'); |
362 | | - this.start_ntp = parts[1]; |
363 | | - this.end_ntp = parts[2]; |
364 | | - this.start_time = npt2seconds(this.start_ntp); |
365 | | - this.end_time = npt2seconds(this.end_ntp); |
366 | | - } |
367 | | - }); |
368 | | - } |
369 | | - mvdObj.parseTitle(); |
370 | | - mvdAry[mvd_id] = mvdObj; |
371 | | - return mvdAry[mvd_id]; |
| 355 | + if(mvdAry[mvd_id])return mvdAry[mvd_id]; |
| 356 | + if($j('#mv_fd_mvd_'+mvd_id).get(0)){ |
| 357 | + var mvdObj = new Object({ |
| 358 | + id:mvd_id, |
| 359 | + name:$j('#mv_fd_mvd_'+mvd_id).attr('name'), |
| 360 | + parseTitle:function(){ |
| 361 | + parts = this.name.split('/'); |
| 362 | + this.start_ntp = parts[1]; |
| 363 | + this.end_ntp = parts[2]; |
| 364 | + this.start_time = npt2seconds(this.start_ntp); |
| 365 | + this.end_time = npt2seconds(this.end_ntp); |
| 366 | + } |
| 367 | + }); |
| 368 | + } |
| 369 | + mvdObj.parseTitle(); |
| 370 | + mvdAry[mvd_id] = mvdObj; |
| 371 | + return mvdAry[mvd_id]; |
372 | 372 | } |
373 | 373 | |
374 | 374 | function mv_disp_add_mvd(mvd_type){ |
375 | | - if(mv_open_edit_mvd){ |
376 | | - js_error(gMsg['mv_open_edit']); |
377 | | - return ; |
378 | | - } |
379 | | - if($j('#embed_vid').length == 0){ |
380 | | - js_error('Error: no video present'); |
381 | | - return ; |
382 | | - } |
383 | | - mv_open_edit_mvd=mvd_type; |
384 | | - $j('#embed_vid').get(0).preview_mode=true; //turn on clip preivew mode: |
385 | | - |
386 | | - sajax_request_type='GET'; |
387 | | - sajax_do_call( "mv_add_disp",[wgTitle, mvd_type, org_vid_time_req], f ); |
388 | | - //insert before the first mvd: |
389 | | - $j('#mv_add_new_mvd').css( { display : 'inline' } ); |
390 | | - $j('#mv_add_new_mvd').html( gM('loading_txt') ); |
391 | | - var mvd_id='new'; |
392 | | - //scroll to the new (loading) (top of mvd_cont) |
393 | | - $j('#selectionsBox').animate( { scrollTop: 0}, 'slow'); |
394 | | - function f( request ) { |
395 | | - result= request.responseText; |
396 | | - if (request.status != 200){ |
397 | | - $j('#mv_fd_mvd_new').html( "<div class='error'> " + |
398 | | - request.status + " " + request.statusText + ": " + result + "</div>"); |
399 | | - }else{ |
400 | | - $j('#mv_add_new_mvd').html(result); |
401 | | - //add the javascrip based hooks: |
402 | | - if(mvd_type=='ht_en'){ |
403 | | - add_autocomplete('new'); |
404 | | - add_adjust_hooks('new'); |
405 | | - } |
406 | | - if(mvd_type=='anno_en'){ |
407 | | - add_adjust_hooks('new'); |
408 | | - } |
409 | | - //add edit buttons |
410 | | - if(typeof mwSetupToolbar =='function'){ |
411 | | - mwSetupToolbar(); |
412 | | - } |
413 | | - mwEditButtons = []; //empty edit buttons |
414 | | - |
415 | | - if(mvd_type=='anno_en'){ |
416 | | - //add mv_helpers autocompletes |
417 | | - add_mv_helpers_ac(mvd_id); |
418 | | - if($j('#adv_basic_'+mvd_id).val()=='basic'){ |
419 | | - $j('.mv_advanced_edit').hide(); |
420 | | - }else{ |
421 | | - $j('.mv_basic_edit').hide(); |
422 | | - } |
423 | | - } |
424 | | - } |
425 | | - } |
| 375 | + if(mv_open_edit_mvd){ |
| 376 | + js_error(gMsg['mv_open_edit']); |
| 377 | + return ; |
| 378 | + } |
| 379 | + if($j('#embed_vid').length == 0){ |
| 380 | + js_error('Error: no video present'); |
| 381 | + return ; |
| 382 | + } |
| 383 | + mv_open_edit_mvd=mvd_type; |
| 384 | + $j('#embed_vid').get(0).preview_mode=true; //turn on clip preivew mode: |
| 385 | + |
| 386 | + sajax_request_type='GET'; |
| 387 | + sajax_do_call( "mv_add_disp",[wgTitle, mvd_type, org_vid_time_req], f ); |
| 388 | + //insert before the first mvd: |
| 389 | + $j('#mv_add_new_mvd').css( { display : 'inline' } ); |
| 390 | + $j('#mv_add_new_mvd').html( gM('loading_txt') ); |
| 391 | + var mvd_id='new'; |
| 392 | + //scroll to the new (loading) (top of mvd_cont) |
| 393 | + $j('#selectionsBox').animate( { scrollTop: 0}, 'slow'); |
| 394 | + function f( request ) { |
| 395 | + result= request.responseText; |
| 396 | + if (request.status != 200){ |
| 397 | + $j('#mv_fd_mvd_new').html( "<div class='error'> " + |
| 398 | + request.status + " " + request.statusText + ": " + result + "</div>"); |
| 399 | + }else{ |
| 400 | + $j('#mv_add_new_mvd').html(result); |
| 401 | + //add the javascrip based hooks: |
| 402 | + if(mvd_type=='ht_en'){ |
| 403 | + add_autocomplete('new'); |
| 404 | + add_adjust_hooks('new'); |
| 405 | + } |
| 406 | + if(mvd_type=='anno_en'){ |
| 407 | + add_adjust_hooks('new'); |
| 408 | + } |
| 409 | + //add edit buttons |
| 410 | + if(typeof mwSetupToolbar =='function'){ |
| 411 | + mwSetupToolbar(); |
| 412 | + } |
| 413 | + mwEditButtons = []; //empty edit buttons |
| 414 | + |
| 415 | + if(mvd_type=='anno_en'){ |
| 416 | + //add mv_helpers autocompletes |
| 417 | + add_mv_helpers_ac(mvd_id); |
| 418 | + if($j('#adv_basic_'+mvd_id).val()=='basic'){ |
| 419 | + $j('.mv_advanced_edit').hide(); |
| 420 | + }else{ |
| 421 | + $j('.mv_basic_edit').hide(); |
| 422 | + } |
| 423 | + } |
| 424 | + } |
| 425 | + } |
426 | 426 | } |
427 | 427 | function mv_edit_disp(titleKey, mvd_id){ |
428 | | - if(mv_open_edit_mvd && mv_open_edit_mvd!=mvd_id){ |
429 | | - alert(gMsg['mv_open_edit']); |
430 | | - return ; |
431 | | - } |
432 | | - var title_parts = titleKey.split(':'); |
433 | | - var mvd_type = title_parts[0].toLowerCase(); |
| 428 | + if(mv_open_edit_mvd && mv_open_edit_mvd!=mvd_id){ |
| 429 | + alert(gMsg['mv_open_edit']); |
| 430 | + return ; |
| 431 | + } |
| 432 | + var title_parts = titleKey.split(':'); |
| 433 | + var mvd_type = title_parts[0].toLowerCase(); |
434 | 434 | |
435 | | - mv_open_edit_mvd=mvd_id; |
436 | | - //set sajax to do a GET request |
437 | | - sajax_request_type='GET'; |
| 435 | + mv_open_edit_mvd=mvd_id; |
| 436 | + //set sajax to do a GET request |
| 437 | + sajax_request_type='GET'; |
438 | 438 | |
439 | | - sajax_do_call( "mv_edit_disp", [titleKey, mvd_id], f ); |
440 | | - $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); |
441 | | - //handle the response: |
442 | | - function f( request ) { |
443 | | - result= request.responseText; |
444 | | - if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; |
445 | | - $j('#mv_fcontent_'+mvd_id).html( result ); |
446 | | - //add javascript hooks |
447 | | - add_autocomplete(mvd_id); |
448 | | - add_adjust_hooks(mvd_id); |
| 439 | + sajax_do_call( "mv_edit_disp", [titleKey, mvd_id], f ); |
| 440 | + $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); |
| 441 | + //handle the response: |
| 442 | + function f( request ) { |
| 443 | + result= request.responseText; |
| 444 | + if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; |
| 445 | + $j('#mv_fcontent_'+mvd_id).html( result ); |
| 446 | + //add javascript hooks |
| 447 | + add_autocomplete(mvd_id); |
| 448 | + add_adjust_hooks(mvd_id); |
449 | 449 | |
450 | 450 | |
451 | | - //if mvd_type==anno_en |
452 | | - //add buttons |
453 | | - //mwSetupToolbar(); |
454 | | - mwEditButtons = []; //empty edit buttons |
| 451 | + //if mvd_type==anno_en |
| 452 | + //add buttons |
| 453 | + //mwSetupToolbar(); |
| 454 | + mwEditButtons = []; //empty edit buttons |
455 | 455 | |
456 | | - if(mvd_type=='anno_en'){ |
457 | | - //add mv_helpers autocompletes |
458 | | - add_mv_helpers_ac(mvd_id); |
459 | | - if($j('#adv_basic_'+mvd_id).val()=='basic'){ |
460 | | - $j('.mv_advanced_edit').hide(); |
461 | | - }else{ |
462 | | - $j('.mv_basic_edit').hide(); |
463 | | - } |
464 | | - } |
465 | | - } |
| 456 | + if(mvd_type=='anno_en'){ |
| 457 | + //add mv_helpers autocompletes |
| 458 | + add_mv_helpers_ac(mvd_id); |
| 459 | + if($j('#adv_basic_'+mvd_id).val()=='basic'){ |
| 460 | + $j('.mv_advanced_edit').hide(); |
| 461 | + }else{ |
| 462 | + $j('.mv_basic_edit').hide(); |
| 463 | + } |
| 464 | + } |
| 465 | + } |
466 | 466 | }/* interface ajax actions */ |
467 | 467 | function mv_disp_mvd(titleKey, mvd_id){ |
468 | | - if(mvd_id=='new'){ |
469 | | - //@@todo confirm (user will lose text in window |
470 | | - $j('#mv_add_new_mvd').fadeOut("slow", function(){$j(this).empty();}); |
471 | | - //@@todo confirm cancel: |
| 468 | + if(mvd_id=='new'){ |
| 469 | + //@@todo confirm (user will lose text in window |
| 470 | + $j('#mv_add_new_mvd').fadeOut("slow", function(){$j(this).empty();}); |
| 471 | + //@@todo confirm cancel: |
472 | 472 | //if (confirm("unsaved changes will be lost")) { |
473 | | - // $j('#mv_add_mvd_cont').remove(); |
| 473 | + // $j('#mv_add_mvd_cont').remove(); |
474 | 474 | //} |
475 | | - }else{ |
476 | | - //set sajax to do a GET request |
477 | | - sajax_request_type='GET'; |
478 | | - sajax_do_call( "mv_disp_mvd", [titleKey, mvd_id], f ); |
479 | | - $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); |
480 | | - } |
481 | | - //free the editor slot: |
482 | | - js_log('mv_disp_mvd: nset mv_open_edit_mvd'); |
483 | | - mv_open_edit_mvd=null; |
484 | | - $j('#embed_vid').get(0).preview_mode=false;//turn off clip preivew mode: |
485 | | - |
486 | | - function f( request ) { |
487 | | - result= request.responseText; |
488 | | - if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; |
489 | | - //fill in div |
490 | | - $j('#mv_fcontent_'+mvd_id).html( result ); |
491 | | - //add_autocomplete(mvd_id); |
| 475 | + }else{ |
| 476 | + //set sajax to do a GET request |
| 477 | + sajax_request_type='GET'; |
| 478 | + sajax_do_call( "mv_disp_mvd", [titleKey, mvd_id], f ); |
| 479 | + $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); |
| 480 | + } |
| 481 | + //free the editor slot: |
| 482 | + js_log('mv_disp_mvd: nset mv_open_edit_mvd'); |
| 483 | + mv_open_edit_mvd=null; |
| 484 | + $j('#embed_vid').get(0).preview_mode=false;//turn off clip preivew mode: |
| 485 | + |
| 486 | + function f( request ) { |
| 487 | + result= request.responseText; |
| 488 | + if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; |
| 489 | + //fill in div |
| 490 | + $j('#mv_fcontent_'+mvd_id).html( result ); |
| 491 | + //add_autocomplete(mvd_id); |
492 | 492 | //add_adjust_hooks(mvd_id); |
493 | | - } |
| 493 | + } |
494 | 494 | } |
495 | 495 | |
496 | 496 | function mv_history_disp(titleKey, mvd_id){ |
497 | | - sajax_request_type='GET'; |
498 | | - sajax_do_call( "mv_history_disp", [titleKey, mvd_id], f ); |
499 | | - $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); |
500 | | - function f( request ) { |
501 | | - result= request.responseText; |
502 | | - if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; |
503 | | - $j('#mv_fcontent_'+mvd_id).html( result ); |
504 | | - //do javascript actions: |
| 497 | + sajax_request_type='GET'; |
| 498 | + sajax_do_call( "mv_history_disp", [titleKey, mvd_id], f ); |
| 499 | + $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); |
| 500 | + function f( request ) { |
| 501 | + result= request.responseText; |
| 502 | + if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; |
| 503 | + $j('#mv_fcontent_'+mvd_id).html( result ); |
| 504 | + //do javascript actions: |
505 | 505 | } |
506 | 506 | } |
507 | 507 | /*function mv_adjust_disp(titleKey, mvd_id){ |
508 | | - sajax_request_type='GET'; |
509 | | - sajax_do_call( "mv_adjust_disp", [titleKey, mvd_id], f ); |
510 | | - $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); |
511 | | - //hanndle the response: |
512 | | - function f( request ) { |
513 | | - result= request.responseText; |
514 | | - if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; |
515 | | - $j('#mv_fcontent_'+mvd_id).html( result ); |
516 | | - //do javascript actions: |
517 | | - add_adjust_hooks(mvd_id); |
| 508 | + sajax_request_type='GET'; |
| 509 | + sajax_do_call( "mv_adjust_disp", [titleKey, mvd_id], f ); |
| 510 | + $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); |
| 511 | + //hanndle the response: |
| 512 | + function f( request ) { |
| 513 | + result= request.responseText; |
| 514 | + if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; |
| 515 | + $j('#mv_fcontent_'+mvd_id).html( result ); |
| 516 | + //do javascript actions: |
| 517 | + add_adjust_hooks(mvd_id); |
518 | 518 | } |
519 | 519 | }*/ |
520 | 520 | |
521 | 521 | /* non-ajax preview of clip adjustment*/ |
522 | | -function mv_adjust_preview( mvd_id ){ |
523 | | - js_log('start val:#mv_start_hr_'+mvd_id+' ' + $j('#mv_start_hr_'+mvd_id).val() + ' end:'+ $j('#mv_end_hr_'+mvd_id).val() ); |
524 | | - $j('#embed_vid').get(0).hideHighlight(); |
525 | | - $j('#embed_vid').get(0).stop(); |
526 | | - $j('#embed_vid').get(0).preview_mode=true; |
527 | | - mv_lock_vid_updates=false; |
528 | | - do_video_time_update($j('#mv_start_hr_'+mvd_id).val(), $j('#mv_end_hr_'+mvd_id).val() ); |
529 | | - mv_lock_vid_updates=true; |
530 | | - //start playing |
531 | | - $j('#embed_vid').get(0).play(); |
532 | | - //mv_lock_vid_updates=false; |
| 522 | +function mv_adjust_preview( mvd_id ){ |
| 523 | + js_log('start val:#mv_start_hr_'+mvd_id+' ' + $j('#mv_start_hr_'+mvd_id).val() + ' end:'+ $j('#mv_end_hr_'+mvd_id).val() ); |
| 524 | + $j('#embed_vid').get(0).hideHighlight(); |
| 525 | + $j('#embed_vid').get(0).stop(); |
| 526 | + $j('#embed_vid').get(0).preview_mode=true; |
| 527 | + mv_lock_vid_updates=false; |
| 528 | + do_video_time_update($j('#mv_start_hr_'+mvd_id).val(), $j('#mv_end_hr_'+mvd_id).val() ); |
| 529 | + mv_lock_vid_updates=true; |
| 530 | + //start playing |
| 531 | + $j('#embed_vid').get(0).play(); |
| 532 | + //mv_lock_vid_updates=false; |
533 | 533 | } |
534 | 534 | /* |
535 | 535 | * adds autocomplete to semantic forms |
— | — | @@ -536,561 +536,561 @@ |
537 | 537 | * @@todo generalize for all autocompletes |
538 | 538 | */ |
539 | 539 | function add_mv_helpers_ac(mvd_id){ |
540 | | - js_log('add_mv_helpers_ac:'+mvd_id); |
541 | | - $j('.mv_anno_ac_'+mvd_id).each(function(i, input_item){ |
542 | | - var prop_name =$j(input_item).attr('name'); |
543 | | - js_log('add ac for: '+ prop_name); |
544 | | - uri = wgServer + ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); |
545 | | - $j(input_item).autocomplete( |
546 | | - uri, |
547 | | - { |
548 | | - autoFill:true, |
549 | | - onItemSelect:function(v){ |
550 | | - js_log('selected:' + v.innerHTML + 'fill with' + $j(input_item).val() ); |
551 | | - //@@todo better way to determin type |
552 | | - //js_log("img src: " + $j(v).children('img').attr('src')); |
553 | | - //'mv_edit_im_'+mvd_id |
554 | | - if($j(v).children('img').length!=0){ |
555 | | - $j('#smw_Speech_by_img').attr('src', $j(v).children('img').attr('src')); |
556 | | - } |
557 | | - //add category and empty input (@@todo make cat_ns multi-lengual friendly |
558 | | - var cat_ns="Category:" |
559 | | - if($j(input_item).val().indexOf(cat_ns)==0){ |
560 | | - mv_add_category(mvd_id, $j(input_item).val().substr(cat_ns.length)); |
561 | | - $j(input_item).val(''); |
562 | | - } |
563 | | - }, |
564 | | - formatItem:function(row){ |
565 | | - if(row[2]=='no_image'){ |
566 | | - return row[1]; |
567 | | - }else{ |
568 | | - return '<img width="44" src="'+ row[2] + '">'+row[1]; |
569 | | - } |
570 | | - }, |
571 | | - matchSubset:0, |
572 | | - extraParams:{action:'ajax',rs:'mv_helpers_auto_complete',prop_name:prop_name}, |
573 | | - paramName:'rsargs[]', |
574 | | - resultElem:'#'+prop_name+'_choices_'+mvd_id |
575 | | - }); |
576 | | - }); |
| 540 | + js_log('add_mv_helpers_ac:'+mvd_id); |
| 541 | + $j('.mv_anno_ac_'+mvd_id).each(function(i, input_item){ |
| 542 | + var prop_name =$j(input_item).attr('name'); |
| 543 | + js_log('add ac for: '+ prop_name); |
| 544 | + uri = wgServer + ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); |
| 545 | + $j(input_item).autocomplete( |
| 546 | + uri, |
| 547 | + { |
| 548 | + autoFill:true, |
| 549 | + onItemSelect:function(v){ |
| 550 | + js_log('selected:' + v.innerHTML + 'fill with' + $j(input_item).val() ); |
| 551 | + //@@todo better way to determin type |
| 552 | + //js_log("img src: " + $j(v).children('img').attr('src')); |
| 553 | + //'mv_edit_im_'+mvd_id |
| 554 | + if($j(v).children('img').length!=0){ |
| 555 | + $j('#smw_Speech_by_img').attr('src', $j(v).children('img').attr('src')); |
| 556 | + } |
| 557 | + //add category and empty input (@@todo make cat_ns multi-lengual friendly |
| 558 | + var cat_ns="Category:" |
| 559 | + if($j(input_item).val().indexOf(cat_ns)==0){ |
| 560 | + mv_add_category(mvd_id, $j(input_item).val().substr(cat_ns.length)); |
| 561 | + $j(input_item).val(''); |
| 562 | + } |
| 563 | + }, |
| 564 | + formatItem:function(row){ |
| 565 | + if(row[2]=='no_image'){ |
| 566 | + return row[1]; |
| 567 | + }else{ |
| 568 | + return '<img width="44" src="'+ row[2] + '">'+row[1]; |
| 569 | + } |
| 570 | + }, |
| 571 | + matchSubset:0, |
| 572 | + extraParams:{action:'ajax',rs:'mv_helpers_auto_complete',prop_name:prop_name}, |
| 573 | + paramName:'rsargs[]', |
| 574 | + resultElem:'#'+prop_name+'_choices_'+mvd_id |
| 575 | + }); |
| 576 | + }); |
577 | 577 | } |
578 | 578 | function mv_add_category(mvd_id, cat_name){ |
579 | | - js_log("add cat: "+ cat_name); |
580 | | - if(cat_name=='')return false; |
581 | | - var currentDate = new Date() |
582 | | - var unique_inx = currentDate.getUTCMilliseconds(); |
583 | | - $j('#mv_ext_cat_container_'+mvd_id).append('<span id="ext_cat_'+unique_inx+'"><input value="'+cat_name+'" type="hidden" style="display:none;" name="ext_cat_'+unique_inx+'" class="mv_ext_cat">'+ |
584 | | - cat_name.replace(/_/g," ") + |
585 | | - '<a href="#" onclick="$j(\'#ext_cat_'+unique_inx+'\').fadeOut(\'fast\').remove();return false;">'+ |
586 | | - '<img border="0" src="'+mvgScriptPath+'/skins/images/delete.png">'+ |
587 | | - '</a></span><br>'); |
| 579 | + js_log("add cat: "+ cat_name); |
| 580 | + if(cat_name=='')return false; |
| 581 | + var currentDate = new Date() |
| 582 | + var unique_inx = currentDate.getUTCMilliseconds(); |
| 583 | + $j('#mv_ext_cat_container_'+mvd_id).append('<span id="ext_cat_'+unique_inx+'"><input value="'+cat_name+'" type="hidden" style="display:none;" name="ext_cat_'+unique_inx+'" class="mv_ext_cat">'+ |
| 584 | + cat_name.replace(/_/g," ") + |
| 585 | + '<a href="#" onclick="$j(\'#ext_cat_'+unique_inx+'\').fadeOut(\'fast\').remove();return false;">'+ |
| 586 | + '<img border="0" src="'+mvgScriptPath+'/skins/images/delete.png">'+ |
| 587 | + '</a></span><br>'); |
588 | 588 | } |
589 | 589 | /* |
590 | 590 | * @@TODO add_autocomplete should be merged with generalized mv_helpers_ac |
591 | 591 | */ |
592 | 592 | function add_autocomplete(mvd_id){ |
593 | | - js_log("f:auto_comp_choices_:"+mvd_id); |
594 | | - //make sure the target elements exist: |
595 | | - //if(!document.getElementById("auto_comp_"+mvd_id))return ; |
596 | | - //if(!document.getElementById("auto_comp_choices_"+mvd_id))return ; |
597 | | - uri = wgServer + |
598 | | - ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); |
599 | | - $j('#auto_comp_'+mvd_id).autocomplete( |
600 | | - uri, |
601 | | - { |
602 | | - autoFill:true, |
603 | | - onItemSelect:function(v){ |
604 | | - js_log('selected:' + v.innerHTML ); |
605 | | - //update the image: |
606 | | - //js_log("img src: " + $j(v).children('img').attr('src')); |
607 | | - //'mv_edit_im_'+mvd_id |
608 | | - $j('#mv_edit_im_'+mvd_id).attr('src', $j(v).children('img').attr('src')); |
609 | | - }, |
610 | | - formatItem:function(row){ |
611 | | - return '<img width="44" src="'+ row[2] + '">'+row[1]; |
612 | | - }, |
613 | | - matchSubset:0, |
614 | | - extraParams:{action:'ajax',rs:'mv_auto_complete_person'}, |
615 | | - paramName:'rsargs[]', |
616 | | - resultElem:'#auto_comp_choices_'+mvd_id |
617 | | - }); |
| 593 | + js_log("f:auto_comp_choices_:"+mvd_id); |
| 594 | + //make sure the target elements exist: |
| 595 | + //if(!document.getElementById("auto_comp_"+mvd_id))return ; |
| 596 | + //if(!document.getElementById("auto_comp_choices_"+mvd_id))return ; |
| 597 | + uri = wgServer + |
| 598 | + ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); |
| 599 | + $j('#auto_comp_'+mvd_id).autocomplete( |
| 600 | + uri, |
| 601 | + { |
| 602 | + autoFill:true, |
| 603 | + onItemSelect:function(v){ |
| 604 | + js_log('selected:' + v.innerHTML ); |
| 605 | + //update the image: |
| 606 | + //js_log("img src: " + $j(v).children('img').attr('src')); |
| 607 | + //'mv_edit_im_'+mvd_id |
| 608 | + $j('#mv_edit_im_'+mvd_id).attr('src', $j(v).children('img').attr('src')); |
| 609 | + }, |
| 610 | + formatItem:function(row){ |
| 611 | + return '<img width="44" src="'+ row[2] + '">'+row[1]; |
| 612 | + }, |
| 613 | + matchSubset:0, |
| 614 | + extraParams:{action:'ajax',rs:'mv_auto_complete_person'}, |
| 615 | + paramName:'rsargs[]', |
| 616 | + resultElem:'#auto_comp_choices_'+mvd_id |
| 617 | + }); |
618 | 618 | } |
619 | 619 | //submit the adjust |
620 | 620 | |
621 | 621 | //use start time of elements in the to position pieces. |
622 | 622 | function mv_add_new_fd_mvd(titleKey, node_html){ |
623 | | - //js_log('add: ' + mv_result['titleKey'] + node_html); |
624 | | - //get start time and end time from titleKey: |
625 | | - var insertTitle = get_titleObject(titleKey); |
| 623 | + //js_log('add: ' + mv_result['titleKey'] + node_html); |
| 624 | + //get start time and end time from titleKey: |
| 625 | + var insertTitle = get_titleObject(titleKey); |
626 | 626 | |
627 | | - //for each element selectionsBox |
628 | | - var inserted = false; |
629 | | - $j('.mv_fd_mvd').each(function(i){ |
630 | | - if(!inserted){ |
631 | | - var curTitle = get_titleObject($j(this).attr('name')); |
632 | | - if(insertTitle.start_time < curTitle.start_time){ |
633 | | - $j(this).before(node_html).show("slow"); |
634 | | - js_log('inserted before: '+curTitle.title +' id:'+insertTitle.start_time); |
635 | | - inserted=true; |
636 | | - return ; |
637 | | - } |
638 | | - } |
639 | | - }); |
640 | | - //add at the end (if not before some other mvd page) |
641 | | - if(!inserted){ |
642 | | - js_log('insert to end: ' + insertTitle.start_time + "\n" + node_html); |
643 | | - $j('#selectionsBox').append(node_html); |
644 | | - } |
645 | | - //repaint row colors: |
646 | | - mv_stream_interface.oddEvenPaint(); |
| 627 | + //for each element selectionsBox |
| 628 | + var inserted = false; |
| 629 | + $j('.mv_fd_mvd').each(function(i){ |
| 630 | + if(!inserted){ |
| 631 | + var curTitle = get_titleObject($j(this).attr('name')); |
| 632 | + if(insertTitle.start_time < curTitle.start_time){ |
| 633 | + $j(this).before(node_html).show("slow"); |
| 634 | + js_log('inserted before: '+curTitle.title +' id:'+insertTitle.start_time); |
| 635 | + inserted=true; |
| 636 | + return ; |
| 637 | + } |
| 638 | + } |
| 639 | + }); |
| 640 | + //add at the end (if not before some other mvd page) |
| 641 | + if(!inserted){ |
| 642 | + js_log('insert to end: ' + insertTitle.start_time + "\n" + node_html); |
| 643 | + $j('#selectionsBox').append(node_html); |
| 644 | + } |
| 645 | + //repaint row colors: |
| 646 | + mv_stream_interface.oddEvenPaint(); |
647 | 647 | } |
648 | 648 | |
649 | 649 | function get_titleObject(titleKey){ |
650 | | - var titleObj = new Object({ |
651 | | - title:titleKey, |
652 | | - parseTitle:function(){ |
653 | | - parts = this.title.split('/'); |
654 | | - this.start_ntp = parts[1]; |
655 | | - this.end_ntp = parts[2]; |
656 | | - this.start_time = npt2seconds(this.start_ntp); |
657 | | - this.end_time = npt2seconds(this.end_ntp); |
658 | | - } |
659 | | - }); |
660 | | - titleObj.parseTitle(); |
661 | | - return titleObj; |
| 650 | + var titleObj = new Object({ |
| 651 | + title:titleKey, |
| 652 | + parseTitle:function(){ |
| 653 | + parts = this.title.split('/'); |
| 654 | + this.start_ntp = parts[1]; |
| 655 | + this.end_ntp = parts[2]; |
| 656 | + this.start_time = npt2seconds(this.start_ntp); |
| 657 | + this.end_time = npt2seconds(this.end_ntp); |
| 658 | + } |
| 659 | + }); |
| 660 | + titleObj.parseTitle(); |
| 661 | + return titleObj; |
662 | 662 | } |
663 | 663 | function mv_disp_remove_mvd(titleKey, mvd_id){ |
664 | | - sajax_request_type='GET'; |
665 | | - sajax_do_call( "mv_disp_remove_mvd", [titleKey, mvd_id], f ); |
666 | | - $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); |
667 | | - function f( request ) { |
668 | | - result= request.responseText; |
669 | | - if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; |
670 | | - $j('#mv_fcontent_'+mvd_id).html( result ); |
671 | | - //dirty hack to avoid re-write of article->delete(); |
672 | | - update_delete_submit(titleKey, mvd_id); |
| 664 | + sajax_request_type='GET'; |
| 665 | + sajax_do_call( "mv_disp_remove_mvd", [titleKey, mvd_id], f ); |
| 666 | + $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); |
| 667 | + function f( request ) { |
| 668 | + result= request.responseText; |
| 669 | + if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; |
| 670 | + $j('#mv_fcontent_'+mvd_id).html( result ); |
| 671 | + //dirty hack to avoid re-write of article->delete(); |
| 672 | + update_delete_submit(titleKey, mvd_id); |
673 | 673 | } |
674 | 674 | } |
675 | 675 | function update_delete_submit(titleKey, mvd_id){ |
676 | | - $j('#deleteconfirm').attr('id', 'deleteconfirm_'+mvd_id); |
677 | | - $j('#deleteconfirm_'+mvd_id).attr('onSubmit', 'mv_remove_mvd(\'' + |
678 | | - titleKey + '\', \''+ mvd_id+'\', this); return false;'); |
| 676 | + $j('#deleteconfirm').attr('id', 'deleteconfirm_'+mvd_id); |
| 677 | + $j('#deleteconfirm_'+mvd_id).attr('onSubmit', 'mv_remove_mvd(\'' + |
| 678 | + titleKey + '\', \''+ mvd_id+'\', this); return false;'); |
679 | 679 | } |
680 | 680 | function mv_remove_mvd(titleKey, mvd_id, form){ |
681 | | - var post_vars = new Object(); |
682 | | - var args = new Object(); |
683 | | - $j('input', form).each(function(){ |
684 | | - post_vars[this.name] = this.value; |
685 | | - }); |
686 | | - post_vars['title']=titleKey; |
687 | | - post_vars['mvd_id'] = mvd_id; |
| 681 | + var post_vars = new Object(); |
| 682 | + var args = new Object(); |
| 683 | + $j('input', form).each(function(){ |
| 684 | + post_vars[this.name] = this.value; |
| 685 | + }); |
| 686 | + post_vars['title']=titleKey; |
| 687 | + post_vars['mvd_id'] = mvd_id; |
688 | 688 | |
689 | | - var setHtmlId ='#mv_fcontent_'+mvd_id; |
690 | | - //@@todo switch over to jquery ajax |
691 | | - /*uri = wgServer + |
692 | | - ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript) + |
693 | | - "?action=ajax&rs=mv_remove_mvd"; |
694 | | - $j.ajax({ |
695 | | - url:uri, |
696 | | - data:post_vars, |
697 | | - error:function(error){}, |
698 | | - success:function(result){} |
699 | | - } |
700 | | - ); |
701 | | - }*/ |
702 | | - sajax_request_type='POST'; |
703 | | - mv_sajax_do_call('mv_remove_mvd',args, f, post_vars); |
704 | | - js_log('did request'); |
705 | | - function f( request ) { |
706 | | - result = request.responseText; |
707 | | - js_log("got response:"); |
708 | | - if (request.status != 200){ |
709 | | - result= "<div class='error'> " + request.status + " " + request.statusText + ": " + request.responseText + "</div>"; |
710 | | - $j(setHtmlId).html( result) ; |
711 | | - return ; |
| 689 | + var setHtmlId ='#mv_fcontent_'+mvd_id; |
| 690 | + //@@todo switch over to jquery ajax |
| 691 | + /*uri = wgServer + |
| 692 | + ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript) + |
| 693 | + "?action=ajax&rs=mv_remove_mvd"; |
| 694 | + $j.ajax({ |
| 695 | + url:uri, |
| 696 | + data:post_vars, |
| 697 | + error:function(error){}, |
| 698 | + success:function(result){} |
| 699 | + } |
| 700 | + ); |
| 701 | + }*/ |
| 702 | + sajax_request_type='POST'; |
| 703 | + mv_sajax_do_call('mv_remove_mvd',args, f, post_vars); |
| 704 | + js_log('did request'); |
| 705 | + function f( request ) { |
| 706 | + result = request.responseText; |
| 707 | + js_log("got response:"); |
| 708 | + if (request.status != 200){ |
| 709 | + result= "<div class='error'> " + request.status + " " + request.statusText + ": " + request.responseText + "</div>"; |
| 710 | + $j(setHtmlId).html( result) ; |
| 711 | + return ; |
712 | 712 | }else{ |
713 | | - js_log("going to eval: " + request.responseText); |
714 | | - eval(request.responseText); |
715 | | - js_log('status: ' + mv_result['status']); |
716 | | - if(mv_result['status']=='ok'){ |
717 | | - js_log(" status ok should remove: "+mvd_id); |
718 | | - //delete success remove mvd: |
719 | | - $j('#mv_fd_mvd_'+mvd_id).remove(); |
720 | | - $j('#mv_tl_mvd_'+mvd_id).remove(); |
721 | | - //repaint colors: |
722 | | - mv_stream_interface.oddEvenPaint(); |
723 | | - }else if(mv_result['status']=='error'){ |
724 | | - $j(setHtmlId).html( mv_result['error_txt'] ); |
725 | | - update_delete_submit(titleKey, mvd_id); |
726 | | - } |
| 713 | + js_log("going to eval: " + request.responseText); |
| 714 | + eval(request.responseText); |
| 715 | + js_log('status: ' + mv_result['status']); |
| 716 | + if(mv_result['status']=='ok'){ |
| 717 | + js_log(" status ok should remove: "+mvd_id); |
| 718 | + //delete success remove mvd: |
| 719 | + $j('#mv_fd_mvd_'+mvd_id).remove(); |
| 720 | + $j('#mv_tl_mvd_'+mvd_id).remove(); |
| 721 | + //repaint colors: |
| 722 | + mv_stream_interface.oddEvenPaint(); |
| 723 | + }else if(mv_result['status']=='error'){ |
| 724 | + $j(setHtmlId).html( mv_result['error_txt'] ); |
| 725 | + update_delete_submit(titleKey, mvd_id); |
| 726 | + } |
727 | 727 | } |
728 | | - } |
| 728 | + } |
729 | 729 | } |
730 | 730 | //do a form submit to a given function |
731 | 731 | function mv_do_ajax_form_submit(mvd_id, edit_action){ |
732 | | - //set sajax to do a post request |
733 | | - sajax_request_type='POST'; |
734 | | - //init the var: |
735 | | - var args = new Object(); |
736 | | - var post_vars = new Object(); |
737 | | - var buttonList = {'wpSave':true, 'wpPreview':true, 'wpLivePreview':true, 'wpDiff':true}; |
738 | | - var move_on_done=false; |
| 732 | + //set sajax to do a post request |
| 733 | + sajax_request_type='POST'; |
| 734 | + //init the var: |
| 735 | + var args = new Object(); |
| 736 | + var post_vars = new Object(); |
| 737 | + var buttonList = {'wpSave':true, 'wpPreview':true, 'wpLivePreview':true, 'wpDiff':true}; |
| 738 | + var move_on_done=false; |
739 | 739 | |
740 | | - var form = document.getElementById('mvd_form_'+mvd_id); |
741 | | - for(i=0;i<form.elements.length;i++){ |
742 | | - if(buttonList[ form.elements[i].name ]){ |
743 | | - //don't include button unless its the edit action |
744 | | - // (to simulate button press for edit actions (save, preview, show changes) |
745 | | - if(form.elements[i].name.toLowerCase().indexOf( edit_action.toLowerCase() )!=-1){ |
746 | | - post_vars[ form.elements[i].name ]=form.elements[i].value; |
747 | | - } |
748 | | - }else{ |
749 | | - post_vars[ form.elements[i].name ]=form.elements[i].value; |
750 | | - } |
751 | | - //js_log(form.elements[i].name + ' = ' + form.elements[i].value); |
752 | | - } |
753 | | - //do edit action specific calls: |
754 | | - switch(edit_action){ |
755 | | - case 'save': |
756 | | - var setHtmlId ='#mv_fcontent_'+mvd_id; |
757 | | - break; |
758 | | - case 'preview': |
759 | | - mv_lock_vid_updates=true; |
760 | | - var setHtmlId = '#wikiPreview_'+mvd_id |
761 | | - mv_adjust_preview(mvd_id); |
762 | | - break; |
763 | | - } |
764 | | - //check if we are adjusting (if so move then save text) |
765 | | - if(mvd_id=='new'){ |
766 | | - post_vars['do_adjust']=false; |
767 | | - post_vars['wgTitle']=mvTitle; |
768 | | - }else{ |
769 | | - js_log('get title from: ' + $j('#mv_fd_mvd_'+mvd_id).attr('name')); |
770 | | - var curTitle = get_titleObject( $j('#mv_fd_mvd_'+mvd_id).attr('name') ); |
771 | | - if(edit_action=='save'){ |
772 | | - if( curTitle.start_ntp != $j('#mv_start_hr_'+mvd_id).val() || |
773 | | - curTitle.end_ntp != $j('#mv_end_hr_'+mvd_id).val()){ |
774 | | - post_vars['do_adjust']=true; |
775 | | - js_log('do adjustment move '+ curTitle.start_ntp + '!=' + $j('#mv_start_hr_'+mvd_id).val() |
776 | | - + ' & ' + curTitle.end_ntp + '!=' + $j('#mv_end_hr_'+mvd_id).val() ); |
777 | | - post_vars['wgTitle']=mvTitle; |
778 | | - post_vars['titleKey'] = $j('#mv_fd_mvd_'+mvd_id).attr('name'); |
779 | | - //js_log('titlekey:'+post_vars['titleKey'] ); |
780 | | - //get new title: |
781 | | - post_vars['newTitle'] = post_vars['titleKey'].substr(0, post_vars['titleKey'].indexOf('/')) + '/' + |
782 | | - $j('#mv_start_hr_'+mvd_id).val() + "/" + $j('#mv_end_hr_'+mvd_id).val(); |
783 | | - } |
784 | | - } |
785 | | - } |
| 740 | + var form = document.getElementById('mvd_form_'+mvd_id); |
| 741 | + for(i=0;i<form.elements.length;i++){ |
| 742 | + if(buttonList[ form.elements[i].name ]){ |
| 743 | + //don't include button unless its the edit action |
| 744 | + // (to simulate button press for edit actions (save, preview, show changes) |
| 745 | + if(form.elements[i].name.toLowerCase().indexOf( edit_action.toLowerCase() )!=-1){ |
| 746 | + post_vars[ form.elements[i].name ]=form.elements[i].value; |
| 747 | + } |
| 748 | + }else{ |
| 749 | + post_vars[ form.elements[i].name ]=form.elements[i].value; |
| 750 | + } |
| 751 | + //js_log(form.elements[i].name + ' = ' + form.elements[i].value); |
| 752 | + } |
| 753 | + //do edit action specific calls: |
| 754 | + switch(edit_action){ |
| 755 | + case 'save': |
| 756 | + var setHtmlId ='#mv_fcontent_'+mvd_id; |
| 757 | + break; |
| 758 | + case 'preview': |
| 759 | + mv_lock_vid_updates=true; |
| 760 | + var setHtmlId = '#wikiPreview_'+mvd_id |
| 761 | + mv_adjust_preview(mvd_id); |
| 762 | + break; |
| 763 | + } |
| 764 | + //check if we are adjusting (if so move then save text) |
| 765 | + if(mvd_id=='new'){ |
| 766 | + post_vars['do_adjust']=false; |
| 767 | + post_vars['wgTitle']=mvTitle; |
| 768 | + }else{ |
| 769 | + js_log('get title from: ' + $j('#mv_fd_mvd_'+mvd_id).attr('name')); |
| 770 | + var curTitle = get_titleObject( $j('#mv_fd_mvd_'+mvd_id).attr('name') ); |
| 771 | + if(edit_action=='save'){ |
| 772 | + if( curTitle.start_ntp != $j('#mv_start_hr_'+mvd_id).val() || |
| 773 | + curTitle.end_ntp != $j('#mv_end_hr_'+mvd_id).val()){ |
| 774 | + post_vars['do_adjust']=true; |
| 775 | + js_log('do adjustment move '+ curTitle.start_ntp + '!=' + $j('#mv_start_hr_'+mvd_id).val() |
| 776 | + + ' & ' + curTitle.end_ntp + '!=' + $j('#mv_end_hr_'+mvd_id).val() ); |
| 777 | + post_vars['wgTitle']=mvTitle; |
| 778 | + post_vars['titleKey'] = $j('#mv_fd_mvd_'+mvd_id).attr('name'); |
| 779 | + //js_log('titlekey:'+post_vars['titleKey'] ); |
| 780 | + //get new title: |
| 781 | + post_vars['newTitle'] = post_vars['titleKey'].substr(0, post_vars['titleKey'].indexOf('/')) + '/' + |
| 782 | + $j('#mv_start_hr_'+mvd_id).val() + "/" + $j('#mv_end_hr_'+mvd_id).val(); |
| 783 | + } |
| 784 | + } |
| 785 | + } |
786 | 786 | |
787 | | - $j(setHtmlId).html( gM('loading_txt') ); |
788 | | - //@@todo switch over to jquery ajax |
789 | | - mv_sajax_do_call('mv_edit_submit',args, f, post_vars); |
790 | | - //js_log('mv_sajax_do_call ' + fajax +' ' + args); |
791 | | - function f( request ) { |
| 787 | + $j(setHtmlId).html( gM('loading_txt') ); |
| 788 | + //@@todo switch over to jquery ajax |
| 789 | + mv_sajax_do_call('mv_edit_submit',args, f, post_vars); |
| 790 | + //js_log('mv_sajax_do_call ' + fajax +' ' + args); |
| 791 | + function f( request ) { |
792 | 792 | result = request.responseText; |
793 | 793 | if (request.status != 200){ |
794 | | - result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; |
795 | | - mv_lock_vid_updates=false; |
796 | | - $j(setHtmlId).html( result) ; |
797 | | - return ; |
| 794 | + result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; |
| 795 | + mv_lock_vid_updates=false; |
| 796 | + $j(setHtmlId).html( result) ; |
| 797 | + return ; |
798 | 798 | } |
799 | 799 | js_log('req status:'+ request.status); |
800 | | - if(mvd_id=='new' && edit_action=='save'){ |
801 | | - js_log("new and save"); |
802 | | - eval(result); |
803 | | - js_log('newsave status: '+mv_result['status'] ); |
804 | | - if(mv_result['status']=='ok'){ |
805 | | - //empty the add div: |
806 | | - $j('#mv_add_new_mvd').empty(); |
| 800 | + if(mvd_id=='new' && edit_action=='save'){ |
| 801 | + js_log("new and save"); |
| 802 | + eval(result); |
| 803 | + js_log('newsave status: '+mv_result['status'] ); |
| 804 | + if(mv_result['status']=='ok'){ |
| 805 | + //empty the add div: |
| 806 | + $j('#mv_add_new_mvd').empty(); |
807 | 807 | |
808 | | - //add mv_time_line element |
809 | | - $j('#mv_time_line').append(mv_result['tl_mvd']); |
810 | | - mv_add_new_fd_mvd(mv_result['titleKey'], mv_result['fd_mvd']); |
| 808 | + //add mv_time_line element |
| 809 | + $j('#mv_time_line').append(mv_result['tl_mvd']); |
| 810 | + mv_add_new_fd_mvd(mv_result['titleKey'], mv_result['fd_mvd']); |
811 | 811 | |
812 | | - mv_stream_interface.addHoverHooks('#mv_fd_mvd_'+mv_result['mvd_id']+',#mv_tl_mvd_'+mv_result['mvd_id']); |
813 | | - //scroll to the new mvd: |
814 | | - scroll_to_pos(mv_result['mvd_id']); |
815 | | - } |
816 | | - } |
| 812 | + mv_stream_interface.addHoverHooks('#mv_fd_mvd_'+mv_result['mvd_id']+',#mv_tl_mvd_'+mv_result['mvd_id']); |
| 813 | + //scroll to the new mvd: |
| 814 | + scroll_to_pos(mv_result['mvd_id']); |
| 815 | + } |
| 816 | + } |
817 | 817 | if(post_vars['do_adjust']){ |
818 | | - js_log('do_adjust'); |
819 | | - //remove and add encapsulated mvd_fd |
820 | | - eval(result); |
821 | | - if(mv_result['status']=='ok'){ |
822 | | - //@@could be a (fade but first rename) |
823 | | - js_log('remove: #mv_fd_mvd_'+mvd_id + ' len br:'+ $j('#mv_fd_mvd_'+mvd_id).length); |
824 | | - $j('#mv_fd_mvd_'+mvd_id).remove(); |
825 | | - $j('#mv_tl_mvd_'+mvd_id).remove(); |
826 | | - |
827 | | - js_log('removed! len br:'+ $j('#mv_fd_mvd_'+mvd_id).length); |
| 818 | + js_log('do_adjust'); |
| 819 | + //remove and add encapsulated mvd_fd |
| 820 | + eval(result); |
| 821 | + if(mv_result['status']=='ok'){ |
| 822 | + //@@could be a (fade but first rename) |
| 823 | + js_log('remove: #mv_fd_mvd_'+mvd_id + ' len br:'+ $j('#mv_fd_mvd_'+mvd_id).length); |
| 824 | + $j('#mv_fd_mvd_'+mvd_id).remove(); |
| 825 | + $j('#mv_tl_mvd_'+mvd_id).remove(); |
| 826 | + |
| 827 | + js_log('removed! len br:'+ $j('#mv_fd_mvd_'+mvd_id).length); |
828 | 828 | |
829 | 829 | |
830 | | - //add new mv_time_line element (already has position so place at end) |
831 | | - $j('#mv_time_line').append(mv_result['tl_mvd']).show("slow"); |
| 830 | + //add new mv_time_line element (already has position so place at end) |
| 831 | + $j('#mv_time_line').append(mv_result['tl_mvd']).show("slow"); |
832 | 832 | |
833 | | - //add new selectionsBox mvd element (based on start time) |
834 | | - //(use the titleKey returned from ajax request (in case it got clean or whatever) |
835 | | - mv_add_new_fd_mvd(mv_result['titleKey'], mv_result['fd_mvd']); |
| 833 | + //add new selectionsBox mvd element (based on start time) |
| 834 | + //(use the titleKey returned from ajax request (in case it got clean or whatever) |
| 835 | + mv_add_new_fd_mvd(mv_result['titleKey'], mv_result['fd_mvd']); |
836 | 836 | |
837 | | - mv_stream_interface.addHoverHooks('#mv_fd_mvd_'+mvd_id); |
838 | | - //add tails |
839 | | - //mv_add_mvd_tails(mv_result['titleKey']); |
840 | | - //scroll to the new location (it should have keept its id (cuz its just a move) |
841 | | - scroll_to_pos(mvd_id); |
842 | | - }else if(mv_result['status']=='error'){ |
843 | | - $j(setHtmlId).html( mv_result['error_txt']); |
844 | | - } |
| 837 | + mv_stream_interface.addHoverHooks('#mv_fd_mvd_'+mvd_id); |
| 838 | + //add tails |
| 839 | + //mv_add_mvd_tails(mv_result['titleKey']); |
| 840 | + //scroll to the new location (it should have keept its id (cuz its just a move) |
| 841 | + scroll_to_pos(mvd_id); |
| 842 | + }else if(mv_result['status']=='error'){ |
| 843 | + $j(setHtmlId).html( mv_result['error_txt']); |
| 844 | + } |
845 | 845 | }else{ |
846 | | - //just update the current mvd |
847 | | - $j(setHtmlId).html( result) ; |
848 | | - scroll_to_pos(mvd_id); |
| 846 | + //just update the current mvd |
| 847 | + $j(setHtmlId).html( result) ; |
| 848 | + scroll_to_pos(mvd_id); |
849 | 849 | } |
850 | 850 | if(edit_action!='preview'){ |
851 | | - //unlock the interface updates |
852 | | - mv_lock_vid_updates=false; |
853 | | - //free the editor slot: |
854 | | - mv_open_edit_mvd=null; |
855 | | - $j('#embed_vid').get(0).preview_mode=false;//turn off clip preview mode: |
| 851 | + //unlock the interface updates |
| 852 | + mv_lock_vid_updates=false; |
| 853 | + //free the editor slot: |
| 854 | + mv_open_edit_mvd=null; |
| 855 | + $j('#embed_vid').get(0).preview_mode=false;//turn off clip preview mode: |
856 | 856 | } |
857 | | - } |
858 | | - //return false to prevent the form being submitted |
859 | | - return false; |
| 857 | + } |
| 858 | + //return false to prevent the form being submitted |
| 859 | + return false; |
860 | 860 | } |
861 | 861 | function mv_pause(){ |
862 | | - // unlock updates, but issue a pause - if an update occurs, it should |
| 862 | + // unlock updates, but issue a pause - if an update occurs, it should |
863 | 863 | // stop. |
864 | | - var ebvid = $j('#embed_vid').get(0); |
865 | | - if( ebvid.isPlaying()) |
| 864 | + var ebvid = $j('#embed_vid').get(0); |
| 865 | + if( ebvid.isPlaying()) |
866 | 866 | { |
867 | 867 | js_log('f:mv_pause: should pause'); |
868 | 868 | // calling original play_or_pause |
869 | | - ebvid.pause(); |
| 869 | + ebvid.pause(); |
870 | 870 | // lock updates if we're not paused, and vice versa |
871 | | - mv_lock_vid_updates =! ebvid.isPaused(); |
872 | | - }else{ |
873 | | - js_log('f:mv_pause called WHILE Paused: (should play)'); |
874 | | - mv_do_play(); |
875 | | - } |
| 871 | + mv_lock_vid_updates =! ebvid.isPaused(); |
| 872 | + }else{ |
| 873 | + js_log('f:mv_pause called WHILE Paused: (should play)'); |
| 874 | + mv_do_play(); |
| 875 | + } |
876 | 876 | } |
877 | 877 | function mv_do_play( mvd_id ){ |
878 | | - js_log('mv_do_play:' + mvd_id); |
879 | | - $j('#embed_vid').get(0).preview_mode=false |
880 | | - //stop the current |
881 | | - $j('#embed_vid').get(0).stop(); |
882 | | - //stop any deferred updates: |
883 | | - |
884 | | - //force a given mvd if set |
885 | | - if(mvd_id){ |
886 | | - mv_lock_vid_updates=false; |
887 | | - //highlight the current / update url: |
888 | | - mv_stream_interface.mvdOver(mvd_id); |
889 | | - } |
890 | | - $j('#embed_vid').get(0). |
891 | | - //disable interface actions (mouse in out etc) |
892 | | - mv_lock_vid_updates=true; |
893 | | - //update the src if nesesary and no mvd provided: |
894 | | - if(!mvd_id){ |
895 | | - if(mv_stream_interface.cur_mvd_id!=mv_stream_interface.delay_cur_mvd_id){ |
896 | | - mv_stream_interface.cur_mvd_id =mv_stream_interface.delay_cur_mvd_id; |
897 | | - do_video_mvd_update( mv_stream_interface.cur_mvd_id ); |
898 | | - } |
899 | | - } |
900 | | - //check if we are out of range: |
901 | | - if(mvd_id){ |
902 | | - var time_ary = $j('#mv_fd_mvd_'+mvd_id).attr('name').split('/'); |
903 | | - if( npt2seconds( time_ary[1] ) < npt2seconds( $j('#embed_vid').get(0).start_ntp ) ){ |
904 | | - window.location = wgArticlePath.replace( '$1', wgPageName +'/'+ time_ary[1] + '/' + time_ary[2]) + '#autoplay'; |
905 | | - return ; |
906 | | - } |
907 | | - } |
908 | | - //update the embed video actual play time |
909 | | - //time_chunk = $j('#embed_vid').get(0).src.split('t='); |
910 | | - //$j('#mv_videoPlayerTime').html( time_chunk[1] ); |
911 | | - //stop the video if playing and play: |
912 | | - $j('#embed_vid').get(0).didSeekJump=true; |
913 | | - //@@todo extend mv_embed to support src switching |
914 | | - $j('#embed_vid').get(0).play(); |
| 878 | + js_log('mv_do_play:' + mvd_id); |
| 879 | + $j('#embed_vid').get(0).preview_mode=false |
| 880 | + //stop the current |
| 881 | + $j('#embed_vid').get(0).stop(); |
| 882 | + //stop any deferred updates: |
| 883 | + |
| 884 | + //force a given mvd if set |
| 885 | + if(mvd_id){ |
| 886 | + mv_lock_vid_updates=false; |
| 887 | + //highlight the current / update url: |
| 888 | + mv_stream_interface.mvdOver(mvd_id); |
| 889 | + } |
| 890 | + $j('#embed_vid').get(0). |
| 891 | + //disable interface actions (mouse in out etc) |
| 892 | + mv_lock_vid_updates=true; |
| 893 | + //update the src if nesesary and no mvd provided: |
| 894 | + if(!mvd_id){ |
| 895 | + if(mv_stream_interface.cur_mvd_id!=mv_stream_interface.delay_cur_mvd_id){ |
| 896 | + mv_stream_interface.cur_mvd_id =mv_stream_interface.delay_cur_mvd_id; |
| 897 | + do_video_mvd_update( mv_stream_interface.cur_mvd_id ); |
| 898 | + } |
| 899 | + } |
| 900 | + //check if we are out of range: |
| 901 | + if(mvd_id){ |
| 902 | + var time_ary = $j('#mv_fd_mvd_'+mvd_id).attr('name').split('/'); |
| 903 | + if( npt2seconds( time_ary[1] ) < npt2seconds( $j('#embed_vid').get(0).start_ntp ) ){ |
| 904 | + window.location = wgArticlePath.replace( '$1', wgPageName +'/'+ time_ary[1] + '/' + time_ary[2]) + '#autoplay'; |
| 905 | + return ; |
| 906 | + } |
| 907 | + } |
| 908 | + //update the embed video actual play time |
| 909 | + //time_chunk = $j('#embed_vid').get(0).src.split('t='); |
| 910 | + //$j('#mv_videoPlayerTime').html( time_chunk[1] ); |
| 911 | + //stop the video if playing and play: |
| 912 | + $j('#embed_vid').get(0).didSeekJump=true; |
| 913 | + //@@todo extend mv_embed to support src switching |
| 914 | + $j('#embed_vid').get(0).play(); |
915 | 915 | } |
916 | 916 | |
917 | 917 | //adjusts the interface to show the play controls: |
918 | 918 | function mv_disp_play_controls(disp){ |
919 | | - js_log('mv_controls: ' + disp); |
920 | | - if(!org_height_vid_contain) |
921 | | - org_height_vid_contain = $j('#MV_VideoPlayer').height(); |
| 919 | + js_log('mv_controls: ' + disp); |
| 920 | + if(!org_height_vid_contain) |
| 921 | + org_height_vid_contain = $j('#MV_VideoPlayer').height(); |
922 | 922 | |
923 | | - if(!org_top_tool_contain) |
924 | | - org_top_tool_contain= parseInt($j('#MV_Tools').css('top').replace('px','')); |
| 923 | + if(!org_top_tool_contain) |
| 924 | + org_top_tool_contain= parseInt($j('#MV_Tools').css('top').replace('px','')); |
925 | 925 | |
926 | | - if(disp){ |
927 | | - //based on the embed type give space for controls: |
928 | | - //@@todo pull pix_offset from players code |
929 | | - /*switch(embedTypes.getPlayerLib()){ |
930 | | - case 'java': |
931 | | - case 'generic': |
932 | | - var pix_offset= 30; |
933 | | - break; |
934 | | - case 'native': |
935 | | - case 'vlc': |
936 | | - case 'oggplay': |
937 | | - var pix_offset=55; |
938 | | - break; |
939 | | - }*/ |
940 | | - //give room for all players: |
941 | | - var pix_offset=55; |
942 | | - js_log("set con space: " + org_height_vid_contain+parseInt(pix_offset)); |
943 | | - $j('#MV_VideoPlayer').css({'height':(org_height_vid_contain+parseInt(pix_offset))+'px'}); |
944 | | - $j('#MV_StreamMeta,#MV_Tools').css({'top':(org_top_tool_contain+parseInt(pix_offset))+'px'}); |
945 | | - }else{ |
946 | | - js_log('return org height'); |
947 | | - $j('#MV_VideoPlayer').css({'height':org_height_vid_contain+'px'}); |
948 | | - $j('#MV_StreamMeta,#MV_Tools').css({'top':org_top_tool_contain+'px'}); |
949 | | - } |
| 926 | + if(disp){ |
| 927 | + //based on the embed type give space for controls: |
| 928 | + //@@todo pull pix_offset from players code |
| 929 | + /*switch(embedTypes.getPlayerLib()){ |
| 930 | + case 'java': |
| 931 | + case 'generic': |
| 932 | + var pix_offset= 30; |
| 933 | + break; |
| 934 | + case 'native': |
| 935 | + case 'vlc': |
| 936 | + case 'oggplay': |
| 937 | + var pix_offset=55; |
| 938 | + break; |
| 939 | + }*/ |
| 940 | + //give room for all players: |
| 941 | + var pix_offset=55; |
| 942 | + js_log("set con space: " + org_height_vid_contain+parseInt(pix_offset)); |
| 943 | + $j('#MV_VideoPlayer').css({'height':(org_height_vid_contain+parseInt(pix_offset))+'px'}); |
| 944 | + $j('#MV_StreamMeta,#MV_Tools').css({'top':(org_top_tool_contain+parseInt(pix_offset))+'px'}); |
| 945 | + }else{ |
| 946 | + js_log('return org height'); |
| 947 | + $j('#MV_VideoPlayer').css({'height':org_height_vid_contain+'px'}); |
| 948 | + $j('#MV_StreamMeta,#MV_Tools').css({'top':org_top_tool_contain+'px'}); |
| 949 | + } |
950 | 950 | } |
951 | 951 | //hackish globals .. needs a rewrite |
952 | 952 | var mv_currently_scroll_to_pos=false; |
953 | 953 | function scroll_to_pos(mvd_id){ |
954 | | - js_log('scroll_to_pos:'+mvd_id); |
955 | | - var speed = (mv_currently_scroll_to_pos)?'fast':'slow'; |
956 | | - if( $j('#mv_fd_mvd_'+mvd_id).get(0)){ |
957 | | - //@@todo debug IE issues with scrolling |
958 | | - $j('#selectionsBox').animate({ |
959 | | - scrollTop: ($j('#mv_fd_mvd_'+mvd_id).get(0).offsetTop-40) |
960 | | - }, |
961 | | - speed, |
962 | | - function(){ |
963 | | - mv_currently_scroll_to_pos=false; |
964 | | - }); |
965 | | - } |
| 954 | + js_log('scroll_to_pos:'+mvd_id); |
| 955 | + var speed = (mv_currently_scroll_to_pos)?'fast':'slow'; |
| 956 | + if( $j('#mv_fd_mvd_'+mvd_id).get(0)){ |
| 957 | + //@@todo debug IE issues with scrolling |
| 958 | + $j('#selectionsBox').animate({ |
| 959 | + scrollTop: ($j('#mv_fd_mvd_'+mvd_id).get(0).offsetTop-40) |
| 960 | + }, |
| 961 | + speed, |
| 962 | + function(){ |
| 963 | + mv_currently_scroll_to_pos=false; |
| 964 | + }); |
| 965 | + } |
966 | 966 | } |
967 | | -function highlight_fd(mvd_id){ |
968 | | - $j('#mv_fd_mvd_'+mvd_id).css('border','1px solid #F00'); |
| 967 | +function highlight_fd(mvd_id){ |
| 968 | + $j('#mv_fd_mvd_'+mvd_id).css('border','1px solid #F00'); |
969 | 969 | } |
970 | 970 | function de_highlight_fd(mvd_id){ |
971 | | - $j('#mv_fd_mvd_'+mvd_id).css('border', '1px solid #FFF'); |
| 971 | + $j('#mv_fd_mvd_'+mvd_id).css('border', '1px solid #FFF'); |
972 | 972 | } |
973 | 973 | |
974 | 974 | function highlight_tl_ts(mvd_id){ |
975 | | - //make sure we don't set the original as red: |
976 | | - if($j('#mv_tl_mvd_'+mvd_id).get(0)){ |
977 | | - if($j('#mv_tl_mvd_'+mvd_id).css('background').indexOf("red")==-1) |
978 | | - mv_tl_mvd_org_color[mvd_id] = $j('#mv_tl_mvd_'+mvd_id).css('background'); |
979 | | - //js_log(mvd_id + ' org color: ' + mv_tl_mvd_org_color[mvd_id]); |
980 | | - $j('#mv_tl_mvd_'+mvd_id).css({background:'red',opacity:.4}).css("z-index",10); |
981 | | - } |
| 975 | + //make sure we don't set the original as red: |
| 976 | + if($j('#mv_tl_mvd_'+mvd_id).get(0)){ |
| 977 | + if($j('#mv_tl_mvd_'+mvd_id).css('background').indexOf("red")==-1) |
| 978 | + mv_tl_mvd_org_color[mvd_id] = $j('#mv_tl_mvd_'+mvd_id).css('background'); |
| 979 | + //js_log(mvd_id + ' org color: ' + mv_tl_mvd_org_color[mvd_id]); |
| 980 | + $j('#mv_tl_mvd_'+mvd_id).css({background:'red',opacity:.4}).css("z-index",10); |
| 981 | + } |
982 | 982 | } |
983 | 983 | function de_highlight_tl_ts(mvd_id){ |
984 | | - if(mv_tl_mvd_org_color[mvd_id]){ |
985 | | - if($j('#mv_tl_mvd_'+mvd_id).get(0)){ |
986 | | - //alert(mvd_id + ' restore ' + mv_tl_mvd_org_color[mvd_id] + ' ' + rgb2hex(mv_tl_mvd_org_color[mvd_id])); |
987 | | - $j('#mv_tl_mvd_'+mvd_id).css({background:mv_tl_mvd_org_color[mvd_id],opacity:1}).css("z-index",0); |
988 | | - } |
989 | | - } |
| 984 | + if(mv_tl_mvd_org_color[mvd_id]){ |
| 985 | + if($j('#mv_tl_mvd_'+mvd_id).get(0)){ |
| 986 | + //alert(mvd_id + ' restore ' + mv_tl_mvd_org_color[mvd_id] + ' ' + rgb2hex(mv_tl_mvd_org_color[mvd_id])); |
| 987 | + $j('#mv_tl_mvd_'+mvd_id).css({background:mv_tl_mvd_org_color[mvd_id],opacity:1}).css("z-index",0); |
| 988 | + } |
| 989 | + } |
990 | 990 | } |
991 | 991 | |
992 | 992 | function do_video_mvd_update(mvd_id){ |
993 | | - if(mvd_id){ |
994 | | - var time_ary = $j('#mv_fd_mvd_'+mvd_id).attr('name').split('/'); |
995 | | - //get the current thumbnail |
996 | | - var vid_elm = document.getElementById('embed_vid'); |
997 | | - if(!vid_elm)return ''; |
998 | | - //make the play button vissable again (if its hidden) : |
999 | | - $j('#big_play_link_embed_vid').show(); |
1000 | | - //do_video_time_update(time_ary[1], time_ary[2],mvd_id); |
1001 | | - var embedObj = $j('#embed_vid').get(0); |
1002 | | - |
1003 | | - //add coloring to stream where we would play: |
1004 | | - $j('#embed_vid').get(0).highlightPlaySection({ |
1005 | | - 'start': time_ary[1], |
1006 | | - 'end': time_ary[2] |
1007 | | - }); |
1008 | | - } |
| 993 | + if(mvd_id){ |
| 994 | + var time_ary = $j('#mv_fd_mvd_'+mvd_id).attr('name').split('/'); |
| 995 | + //get the current thumbnail |
| 996 | + var vid_elm = document.getElementById('embed_vid'); |
| 997 | + if(!vid_elm)return ''; |
| 998 | + //make the play button vissable again (if its hidden) : |
| 999 | + $j('#big_play_link_embed_vid').show(); |
| 1000 | + //do_video_time_update(time_ary[1], time_ary[2],mvd_id); |
| 1001 | + var embedObj = $j('#embed_vid').get(0); |
| 1002 | + |
| 1003 | + //add coloring to stream where we would play: |
| 1004 | + $j('#embed_vid').get(0).highlightPlaySection({ |
| 1005 | + 'start': time_ary[1], |
| 1006 | + 'end': time_ary[2] |
| 1007 | + }); |
| 1008 | + } |
1009 | 1009 | } |
1010 | 1010 | function mv_tool_disp(tool_id){ |
1011 | | - //set content to loading |
1012 | | - $j('#mv_tool_cont').html( gM('loading_txt') ); |
1013 | | - //populate post vars with any necessary tool specific items: |
1014 | | - var post_vars=new Object(); |
1015 | | - if(tool_id=='navigate'||tool_id=='export'){ |
1016 | | - //assumes stream name ends with time range |
1017 | | - //time_range = org_vid_src.substr( org_vid_src.indexOf('?t=')+3 ); |
1018 | | - post_vars['time_range']=org_vid_time_req; |
1019 | | - } |
1020 | | - //set tracks from mv var: |
1021 | | - if(tool_id=='mang_layers'){ |
1022 | | - post_vars['tracks']=mvTracks; |
1023 | | - } |
1024 | | - sajax_request_type='POST'; |
1025 | | - //@@todo switch over to jquery ajax |
1026 | | - mv_sajax_do_call('mv_tool_disp', [tool_id, wgNamespaceNumber, wgTitle], f, post_vars); |
1027 | | - function f( request ) { |
| 1011 | + //set content to loading |
| 1012 | + $j('#mv_tool_cont').html( gM('loading_txt') ); |
| 1013 | + //populate post vars with any necessary tool specific items: |
| 1014 | + var post_vars=new Object(); |
| 1015 | + if(tool_id=='navigate'||tool_id=='export'){ |
| 1016 | + //assumes stream name ends with time range |
| 1017 | + //time_range = org_vid_src.substr( org_vid_src.indexOf('?t=')+3 ); |
| 1018 | + post_vars['time_range']=org_vid_time_req; |
| 1019 | + } |
| 1020 | + //set tracks from mv var: |
| 1021 | + if(tool_id=='mang_layers'){ |
| 1022 | + post_vars['tracks']=mvTracks; |
| 1023 | + } |
| 1024 | + sajax_request_type='POST'; |
| 1025 | + //@@todo switch over to jquery ajax |
| 1026 | + mv_sajax_do_call('mv_tool_disp', [tool_id, wgNamespaceNumber, wgTitle], f, post_vars); |
| 1027 | + function f( request ) { |
1028 | 1028 | result = request.responseText; |
1029 | | - if (request.status != 200){ |
1030 | | - result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; |
1031 | | - $j('#mv_tool_cont').html( result); |
1032 | | - }else{ |
1033 | | - //result should set up object mv_result |
1034 | | - eval(result); |
1035 | | - mv_proc_tool_result(tool_id, mv_result); |
1036 | | - } |
1037 | | - //unlock the interface updates |
1038 | | - mv_lock_vid_updates=false; |
1039 | | - } |
| 1029 | + if (request.status != 200){ |
| 1030 | + result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; |
| 1031 | + $j('#mv_tool_cont').html( result); |
| 1032 | + }else{ |
| 1033 | + //result should set up object mv_result |
| 1034 | + eval(result); |
| 1035 | + mv_proc_tool_result(tool_id, mv_result); |
| 1036 | + } |
| 1037 | + //unlock the interface updates |
| 1038 | + mv_lock_vid_updates=false; |
| 1039 | + } |
1040 | 1040 | } |
1041 | 1041 | function mv_proc_tool_result(tool_id, mv_result){ |
1042 | | - if(mv_result['status']=='ok'){ |
1043 | | - //run any request javascript call backs |
1044 | | - //do per tool post-req js actions: |
1045 | | - switch(tool_id){ |
1046 | | - /*case 'navigate': |
1047 | | - //set the content payload |
1048 | | - $j('#mv_tool_cont').html( mv_result['innerHTML']); |
1049 | | - eval(mv_result['js_eval']); |
1050 | | - $j('#mv_go_nav').click(function() { |
1051 | | - window.location.href = wgScript+ |
1052 | | - '/'+wgPageName+'/'+$j('#mv_start_hr_nav').val()+ |
1053 | | - '/'+$j('#mv_end_hr_nav').val(); |
1054 | | - }); |
1055 | | - add_adjust_hooks('nav', end_time); |
1056 | | - break;*/ |
1057 | | - case 'search': |
1058 | | - //load search.js ... @@todo cleanup path |
1059 | | - mvJsLoader.doLoad({ |
1060 | | - 'mv_setup_search':'../mv_search.js' |
1061 | | - },function(){ |
1062 | | - $j('#mv_tool_cont').html( mv_result['innerHTML']); |
1063 | | - mv_setup_search(); |
1064 | | - }); |
1065 | | - break; |
1066 | | - case 'mang_layers': |
1067 | | - $j('#mv_tool_cont').html( mv_result['innerHTML']); |
1068 | | - //add in hooks for turnning on off layers (via click on link) |
1069 | | - $j('a.mv_mang_layers').click(function(){ |
1070 | | - $j('#option_'+this.id.substring(2)).get(0).checked = !$j('#option_'+this.id.substring(2)).get(0).checked; |
1071 | | - return false; |
1072 | | - }); |
1073 | | - //add in function for page rewrite on submit |
1074 | | - $j('#submit_mang_layers').click(function(){ |
1075 | | - var track_req = coma = ''; |
1076 | | - //build track_req: |
1077 | | - $j('a.mv_mang_layers').each(function(){ |
1078 | | - if($j('#option_'+this.id.substring(2)).get(0).checked){ |
1079 | | - track_req+=coma+this.id.substring(2); |
1080 | | - coma=','; |
1081 | | - } |
1082 | | - }) |
1083 | | - window.location.href = wgScript+'/'+wgCanonicalNamespace+':'+mvTitle+'?tracks='+track_req+'&tool_disp=mang_layers'; |
1084 | | - return false; |
1085 | | - }); |
1086 | | - break; |
1087 | | - default: |
1088 | | - //set the content payload |
1089 | | - $j('#mv_tool_cont').html( mv_result['innerHTML']); |
1090 | | - break; |
1091 | | - } |
1092 | | - }else if(mv_result['status']=='error'){ |
1093 | | - $j('#mv_tool_cont').html( mv_result['error_txt']); |
1094 | | - } |
| 1042 | + if(mv_result['status']=='ok'){ |
| 1043 | + //run any request javascript call backs |
| 1044 | + //do per tool post-req js actions: |
| 1045 | + switch(tool_id){ |
| 1046 | + /*case 'navigate': |
| 1047 | + //set the content payload |
| 1048 | + $j('#mv_tool_cont').html( mv_result['innerHTML']); |
| 1049 | + eval(mv_result['js_eval']); |
| 1050 | + $j('#mv_go_nav').click(function() { |
| 1051 | + window.location.href = wgScript+ |
| 1052 | + '/'+wgPageName+'/'+$j('#mv_start_hr_nav').val()+ |
| 1053 | + '/'+$j('#mv_end_hr_nav').val(); |
| 1054 | + }); |
| 1055 | + add_adjust_hooks('nav', end_time); |
| 1056 | + break;*/ |
| 1057 | + case 'search': |
| 1058 | + //load search.js ... @@todo cleanup path |
| 1059 | + mvJsLoader.doLoad({ |
| 1060 | + 'mv_setup_search':'../mv_search.js' |
| 1061 | + },function(){ |
| 1062 | + $j('#mv_tool_cont').html( mv_result['innerHTML']); |
| 1063 | + mv_setup_search(); |
| 1064 | + }); |
| 1065 | + break; |
| 1066 | + case 'mang_layers': |
| 1067 | + $j('#mv_tool_cont').html( mv_result['innerHTML']); |
| 1068 | + //add in hooks for turnning on off layers (via click on link) |
| 1069 | + $j('a.mv_mang_layers').click(function(){ |
| 1070 | + $j('#option_'+this.id.substring(2)).get(0).checked = !$j('#option_'+this.id.substring(2)).get(0).checked; |
| 1071 | + return false; |
| 1072 | + }); |
| 1073 | + //add in function for page rewrite on submit |
| 1074 | + $j('#submit_mang_layers').click(function(){ |
| 1075 | + var track_req = coma = ''; |
| 1076 | + //build track_req: |
| 1077 | + $j('a.mv_mang_layers').each(function(){ |
| 1078 | + if($j('#option_'+this.id.substring(2)).get(0).checked){ |
| 1079 | + track_req+=coma+this.id.substring(2); |
| 1080 | + coma=','; |
| 1081 | + } |
| 1082 | + }) |
| 1083 | + window.location.href = wgScript+'/'+wgCanonicalNamespace+':'+mvTitle+'?tracks='+track_req+'&tool_disp=mang_layers'; |
| 1084 | + return false; |
| 1085 | + }); |
| 1086 | + break; |
| 1087 | + default: |
| 1088 | + //set the content payload |
| 1089 | + $j('#mv_tool_cont').html( mv_result['innerHTML']); |
| 1090 | + break; |
| 1091 | + } |
| 1092 | + }else if(mv_result['status']=='error'){ |
| 1093 | + $j('#mv_tool_cont').html( mv_result['error_txt']); |
| 1094 | + } |
1095 | 1095 | } |
1096 | 1096 | /* js functions that are slight modification of |
1097 | 1097 | * existing mediawiki code (if adopted upstream these can be removed) |
— | — | @@ -1098,184 +1098,184 @@ |
1099 | 1099 | */ |
1100 | 1100 | //added in payload submit single dimension key.value pair object: |
1101 | 1101 | function mv_sajax_do_call(func_name, args, target, post_vars) { |
1102 | | - var i, x, n; |
1103 | | - var uri; |
1104 | | - var post_data; |
1105 | | - uri = wgServer + |
1106 | | - ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript) + |
1107 | | - "?action=ajax"; |
1108 | | - if (sajax_request_type == "GET") { |
1109 | | - if (uri.indexOf("?") == -1) |
1110 | | - uri = uri + "?rs=" + encodeURIComponent(func_name); |
1111 | | - else |
1112 | | - uri = uri + "&rs=" + encodeURIComponent(func_name); |
1113 | | - for (i = 0; i < args.length; i++) |
1114 | | - uri = uri + "&rsargs[]=" + encodeURIComponent(args[i]); |
1115 | | - //uri = uri + "&rsrnd=" + new Date().getTime(); |
1116 | | - post_data = null; |
1117 | | - } else { |
1118 | | - post_data = "rs=" + encodeURIComponent(func_name); |
1119 | | - for (i = 0; i < args.length; i++) |
1120 | | - post_data = post_data + "&rsargs[]=" + encodeURIComponent(args[i]); |
1121 | | - //for (i = 0; i < args.length; i++) |
1122 | | - // post_data = post_data + "&rsargs[]=" + encodeURIComponent(args[i]); |
1123 | | - } |
1124 | | - x = sajax_init_object(); |
1125 | | - if (!x) { |
1126 | | - alert("AJAX not supported"); |
1127 | | - return false; |
1128 | | - } |
| 1102 | + var i, x, n; |
| 1103 | + var uri; |
| 1104 | + var post_data; |
| 1105 | + uri = wgServer + |
| 1106 | + ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript) + |
| 1107 | + "?action=ajax"; |
| 1108 | + if (sajax_request_type == "GET") { |
| 1109 | + if (uri.indexOf("?") == -1) |
| 1110 | + uri = uri + "?rs=" + encodeURIComponent(func_name); |
| 1111 | + else |
| 1112 | + uri = uri + "&rs=" + encodeURIComponent(func_name); |
| 1113 | + for (i = 0; i < args.length; i++) |
| 1114 | + uri = uri + "&rsargs[]=" + encodeURIComponent(args[i]); |
| 1115 | + //uri = uri + "&rsrnd=" + new Date().getTime(); |
| 1116 | + post_data = null; |
| 1117 | + } else { |
| 1118 | + post_data = "rs=" + encodeURIComponent(func_name); |
| 1119 | + for (i = 0; i < args.length; i++) |
| 1120 | + post_data = post_data + "&rsargs[]=" + encodeURIComponent(args[i]); |
| 1121 | + //for (i = 0; i < args.length; i++) |
| 1122 | + // post_data = post_data + "&rsargs[]=" + encodeURIComponent(args[i]); |
| 1123 | + } |
| 1124 | + x = sajax_init_object(); |
| 1125 | + if (!x) { |
| 1126 | + alert("AJAX not supported"); |
| 1127 | + return false; |
| 1128 | + } |
1129 | 1129 | |
1130 | | - try { |
1131 | | - x.open(sajax_request_type, uri, true); |
1132 | | - } catch (e) { |
1133 | | - if (window.location.hostname == "localhost") { |
1134 | | - alert("Your browser blocks XMLHttpRequest to 'localhost', try using a real hostname for development/testing."); |
1135 | | - } |
1136 | | - throw e; |
1137 | | - } |
1138 | | - if (sajax_request_type == "POST") { |
1139 | | - x.setRequestHeader("Method", "POST " + uri + " HTTP/1.1"); |
1140 | | - x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); |
1141 | | - } |
1142 | | - x.setRequestHeader("Pragma", "cache=yes"); |
1143 | | - x.setRequestHeader("Cache-Control", "no-transform"); |
1144 | | - x.onreadystatechange = function() { |
1145 | | - if (x.readyState != 4) |
1146 | | - return; |
| 1130 | + try { |
| 1131 | + x.open(sajax_request_type, uri, true); |
| 1132 | + } catch (e) { |
| 1133 | + if (window.location.hostname == "localhost") { |
| 1134 | + alert("Your browser blocks XMLHttpRequest to 'localhost', try using a real hostname for development/testing."); |
| 1135 | + } |
| 1136 | + throw e; |
| 1137 | + } |
| 1138 | + if (sajax_request_type == "POST") { |
| 1139 | + x.setRequestHeader("Method", "POST " + uri + " HTTP/1.1"); |
| 1140 | + x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); |
| 1141 | + } |
| 1142 | + x.setRequestHeader("Pragma", "cache=yes"); |
| 1143 | + x.setRequestHeader("Cache-Control", "no-transform"); |
| 1144 | + x.onreadystatechange = function() { |
| 1145 | + if (x.readyState != 4) |
| 1146 | + return; |
1147 | 1147 | |
1148 | | - sajax_debug("received (" + x.status + " " + x.statusText + ") " + x.responseText); |
| 1148 | + sajax_debug("received (" + x.status + " " + x.statusText + ") " + x.responseText); |
1149 | 1149 | |
1150 | | - //if (x.status != 200) |
1151 | | - // alert("Error: " + x.status + " " + x.statusText + ": " + x.responseText); |
1152 | | - //else |
| 1150 | + //if (x.status != 200) |
| 1151 | + // alert("Error: " + x.status + " " + x.statusText + ": " + x.responseText); |
| 1152 | + //else |
1153 | 1153 | |
1154 | | - if ( typeof( target ) == 'function' ) { |
1155 | | - target( x ); |
1156 | | - } |
1157 | | - else if ( typeof( target ) == 'object' ) { |
1158 | | - if ( target.tagName == 'INPUT' ) { |
1159 | | - if (x.status == 200) target.value= x.responseText; |
1160 | | - //else alert("Error: " + x.status + " " + x.statusText + " (" + x.responseText + ")"); |
1161 | | - } |
1162 | | - else { |
1163 | | - if (x.status == 200) target.innerHTML = x.responseText; |
1164 | | - else target.innerHTML= "<div class='error'>Error: " + x.status + " " + x.statusText + " (" + x.responseText + ")</div>"; |
1165 | | - } |
1166 | | - } |
1167 | | - else { |
1168 | | - alert("bad target for sajax_do_call: not a function or object: " + target); |
1169 | | - } |
| 1154 | + if ( typeof( target ) == 'function' ) { |
| 1155 | + target( x ); |
| 1156 | + } |
| 1157 | + else if ( typeof( target ) == 'object' ) { |
| 1158 | + if ( target.tagName == 'INPUT' ) { |
| 1159 | + if (x.status == 200) target.value= x.responseText; |
| 1160 | + //else alert("Error: " + x.status + " " + x.statusText + " (" + x.responseText + ")"); |
| 1161 | + } |
| 1162 | + else { |
| 1163 | + if (x.status == 200) target.innerHTML = x.responseText; |
| 1164 | + else target.innerHTML= "<div class='error'>Error: " + x.status + " " + x.statusText + " (" + x.responseText + ")</div>"; |
| 1165 | + } |
| 1166 | + } |
| 1167 | + else { |
| 1168 | + alert("bad target for sajax_do_call: not a function or object: " + target); |
| 1169 | + } |
1170 | 1170 | |
1171 | | - return; |
1172 | | - } |
1173 | | - //add payload to post data (as long as i does not equal rs or rsargs |
1174 | | - if(post_vars){ |
1175 | | - for(var i in post_vars){ |
1176 | | - if(i!='rs' && i!='rsargs') |
1177 | | - post_data+= '&'+ i +'='+ encodeURIComponent(post_vars[i]); |
1178 | | - } |
1179 | | - } |
1180 | | - //js_log(func_name + " uri = " + uri + " / post = " + post_data); |
1181 | | - x.send(post_data); |
1182 | | - sajax_debug(func_name + " waiting.."); |
1183 | | - delete x; |
| 1171 | + return; |
| 1172 | + } |
| 1173 | + //add payload to post data (as long as i does not equal rs or rsargs |
| 1174 | + if(post_vars){ |
| 1175 | + for(var i in post_vars){ |
| 1176 | + if(i!='rs' && i!='rsargs') |
| 1177 | + post_data+= '&'+ i +'='+ encodeURIComponent(post_vars[i]); |
| 1178 | + } |
| 1179 | + } |
| 1180 | + //js_log(func_name + " uri = " + uri + " / post = " + post_data); |
| 1181 | + x.send(post_data); |
| 1182 | + sajax_debug(func_name + " waiting.."); |
| 1183 | + delete x; |
1184 | 1184 | |
1185 | | - return true; |
| 1185 | + return true; |
1186 | 1186 | } |
1187 | 1187 | /* |
1188 | 1188 | * togle advanced and simply display of mvd annotation edits |
1189 | 1189 | */ |
1190 | 1190 | function mv_mvd_advs_toggle(mvd_id){ |
1191 | | - js_log('form val:#adv_basic_'+mvd_id+' '+$j('#adv_basic_'+mvd_id).val()); |
1192 | | - if($j('#adv_basic_'+mvd_id).val()=='basic'){ |
1193 | | - js_log('form is currently basic; SET to ADV'); |
1194 | | - //set to advanced |
1195 | | - $j('#adv_basic_'+mvd_id).val('advanced'); |
1196 | | - //hide all basic |
1197 | | - $j('.mv_basic_edit').fadeOut('fast'); |
1198 | | - //show all advanced |
1199 | | - $j('.mv_advanced_edit').fadeIn('fast'); |
1200 | | - }else{ |
1201 | | - js_log('form is currently advanced; SET to basic'); |
1202 | | - //set to basic |
1203 | | - $j('#adv_basic_'+mvd_id).val('basic'); |
1204 | | - //hide all advanced |
1205 | | - $j('.mv_advanced_edit').fadeOut('fast'); |
1206 | | - //show all basic |
1207 | | - $j('.mv_basic_edit').fadeIn('fast'); |
1208 | | - } |
| 1191 | + js_log('form val:#adv_basic_'+mvd_id+' '+$j('#adv_basic_'+mvd_id).val()); |
| 1192 | + if($j('#adv_basic_'+mvd_id).val()=='basic'){ |
| 1193 | + js_log('form is currently basic; SET to ADV'); |
| 1194 | + //set to advanced |
| 1195 | + $j('#adv_basic_'+mvd_id).val('advanced'); |
| 1196 | + //hide all basic |
| 1197 | + $j('.mv_basic_edit').fadeOut('fast'); |
| 1198 | + //show all advanced |
| 1199 | + $j('.mv_advanced_edit').fadeIn('fast'); |
| 1200 | + }else{ |
| 1201 | + js_log('form is currently advanced; SET to basic'); |
| 1202 | + //set to basic |
| 1203 | + $j('#adv_basic_'+mvd_id).val('basic'); |
| 1204 | + //hide all advanced |
| 1205 | + $j('.mv_advanced_edit').fadeOut('fast'); |
| 1206 | + //show all basic |
| 1207 | + $j('.mv_basic_edit').fadeIn('fast'); |
| 1208 | + } |
1209 | 1209 | } |
1210 | 1210 | |
1211 | 1211 | /* custom effects */ |
1212 | 1212 | /*function add_custom_effects(){ |
1213 | | - Effect.ScrollVertical = Class.create(); |
1214 | | - Object.extend(Object.extend(Effect.ScrollVertical.prototype, Effect.Base.prototype), |
1215 | | - { |
1216 | | - initialize: function(element) |
1217 | | - { |
1218 | | - if(typeof element == "string") |
1219 | | - { |
1220 | | - this.element = $(element); |
1221 | | - if(!this.element) |
1222 | | - { |
1223 | | - throw(Effect._elementDoesNotExistError); |
1224 | | - } |
1225 | | - } |
| 1213 | + Effect.ScrollVertical = Class.create(); |
| 1214 | + Object.extend(Object.extend(Effect.ScrollVertical.prototype, Effect.Base.prototype), |
| 1215 | + { |
| 1216 | + initialize: function(element) |
| 1217 | + { |
| 1218 | + if(typeof element == "string") |
| 1219 | + { |
| 1220 | + this.element = $(element); |
| 1221 | + if(!this.element) |
| 1222 | + { |
| 1223 | + throw(Effect._elementDoesNotExistError); |
| 1224 | + } |
| 1225 | + } |
1226 | 1226 | |
1227 | | - var options = Object.extend({ |
1228 | | - from: this.element.scrollTop || 0, |
1229 | | - to: this.element.offsetHeight |
1230 | | - }, arguments[1] || {}); |
1231 | | - //set to pos via target if set |
1232 | | - if(options.target){ |
1233 | | - target_elm = $(options.target); |
1234 | | - Position.prepare(target_elm); |
1235 | | - to_ary=Position.positionedOffset(target_elm); |
1236 | | - //@@todo subtract 1/2 of height of container (as to center) |
1237 | | - //for now just hardcode 227 |
1238 | | - options.to = to_ary[1]-227; |
1239 | | - } |
1240 | | - /*target_elm = $(options.target); |
1241 | | - if(!target_elm)js_log('wft'+ options.target); |
1242 | | - //Position.absolutize(target_elm); |
1243 | | - if(options.target)js_log(Position.positionedOffset(target_elm) ); |
1244 | | - */ /* |
1245 | | - this.start(options); |
1246 | | - }, |
| 1227 | + var options = Object.extend({ |
| 1228 | + from: this.element.scrollTop || 0, |
| 1229 | + to: this.element.offsetHeight |
| 1230 | + }, arguments[1] || {}); |
| 1231 | + //set to pos via target if set |
| 1232 | + if(options.target){ |
| 1233 | + target_elm = $(options.target); |
| 1234 | + Position.prepare(target_elm); |
| 1235 | + to_ary=Position.positionedOffset(target_elm); |
| 1236 | + //@@todo subtract 1/2 of height of container (as to center) |
| 1237 | + //for now just hardcode 227 |
| 1238 | + options.to = to_ary[1]-227; |
| 1239 | + } |
| 1240 | + /*target_elm = $(options.target); |
| 1241 | + if(!target_elm)js_log('wft'+ options.target); |
| 1242 | + //Position.absolutize(target_elm); |
| 1243 | + if(options.target)js_log(Position.positionedOffset(target_elm) ); |
| 1244 | + */ /* |
| 1245 | + this.start(options); |
| 1246 | + }, |
1247 | 1247 | |
1248 | | - update: function(position) |
1249 | | - { |
1250 | | - this.element.scrollTop = position; |
1251 | | - } |
1252 | | - }); |
| 1248 | + update: function(position) |
| 1249 | + { |
| 1250 | + this.element.scrollTop = position; |
| 1251 | + } |
| 1252 | + }); |
1253 | 1253 | |
1254 | | - Effect.ScrollHorizontal = Class.create(); |
1255 | | - Object.extend(Object.extend(Effect.ScrollHorizontal.prototype, Effect.Base.prototype), |
1256 | | - { |
1257 | | - initialize: function(element) |
1258 | | - { |
1259 | | - if(typeof element == "string") |
1260 | | - { |
1261 | | - this.element = $(element); |
1262 | | - if(!this.element) |
1263 | | - { |
1264 | | - throw(Effect._elementDoesNotExistError); |
1265 | | - } |
1266 | | - } |
| 1254 | + Effect.ScrollHorizontal = Class.create(); |
| 1255 | + Object.extend(Object.extend(Effect.ScrollHorizontal.prototype, Effect.Base.prototype), |
| 1256 | + { |
| 1257 | + initialize: function(element) |
| 1258 | + { |
| 1259 | + if(typeof element == "string") |
| 1260 | + { |
| 1261 | + this.element = $(element); |
| 1262 | + if(!this.element) |
| 1263 | + { |
| 1264 | + throw(Effect._elementDoesNotExistError); |
| 1265 | + } |
| 1266 | + } |
1267 | 1267 | |
1268 | | - var options = Object.extend({ |
1269 | | - from: this.element.scrollLeft || 0, |
1270 | | - to: this.element.offsetWidth |
1271 | | - }, arguments[1] || {}); |
| 1268 | + var options = Object.extend({ |
| 1269 | + from: this.element.scrollLeft || 0, |
| 1270 | + to: this.element.offsetWidth |
| 1271 | + }, arguments[1] || {}); |
1272 | 1272 | |
1273 | | - this.start(options); |
1274 | | - }, |
| 1273 | + this.start(options); |
| 1274 | + }, |
1275 | 1275 | |
1276 | | - update: function(position) |
1277 | | - { |
1278 | | - this.element.scrollLeft = position; |
1279 | | - } |
1280 | | - }); |
| 1276 | + update: function(position) |
| 1277 | + { |
| 1278 | + this.element.scrollLeft = position; |
| 1279 | + } |
| 1280 | + }); |
1281 | 1281 | } |
1282 | 1282 | */ |
Index: trunk/extensions/MetavidWiki/skins/add_media_wizard.OFF.js |
— | — | @@ -0,0 +1,215 @@ |
| 2 | +//add media wizard integration for mediaWiki |
| 3 | + |
| 4 | +/* config */ |
| 5 | +//Setup your content providers (see the remoteSearchDriver::content_providers for all options) |
| 6 | +var wg_content_proivers_config = {}; //you can overwrite by defining (after) |
| 7 | + |
| 8 | +var wg_local_wiki_api_url = wgServer + wgScriptPath + '/api.php'; |
| 9 | + |
| 10 | +//if mv_embed is hosted somewhere other than near by the add_media_wizard you can define it here: |
| 11 | +var force_mv_add_media_wizard_path = false; |
| 12 | +//var force_mv_add_media_wizard_path = 'http://metavid.org/w/extensions/MetavidWiki/skins/'; |
| 13 | + |
| 14 | +var force_mv_embed_path = false; |
| 15 | +//var force_mv_embed_path = 'http://metavid.org/w/extensions/MetavidWiki/skins/mv_embed/mvwScriptLoader.php?class=mv_embed'; |
| 16 | + |
| 17 | +var MV_EMBED_VIDEO_HANDLER = true; // if we should use mv_embed for all ogg_hanlder video embeds. |
| 18 | + |
| 19 | +//*code should not have to modify anything below*/ |
| 20 | + |
| 21 | + |
| 22 | +//copied utility functions from mv_embed (can remove once utility functions are in js core) |
| 23 | +if(typeof gMsg == 'undefined'){ |
| 24 | + gMsg = {}; |
| 25 | +} |
| 26 | +if(typeof loadGM == 'undefined'){ |
| 27 | + function loadGM( msgSet ){ |
| 28 | + for(var i in msgSet){ |
| 29 | + gMsg[ i ] = msgSet[i]; |
| 30 | + } |
| 31 | + } |
| 32 | +} |
| 33 | +loadGM( { |
| 34 | + 'add_media_to_page' : "Add Media to this Page" |
| 35 | +}); |
| 36 | + |
| 37 | +if( MV_EMBED_VIDEO_HANDLER ){ |
| 38 | + var vidIdList = new Array(); |
| 39 | + addOnloadHook( function(){ |
| 40 | + var divs = document.getElementsByTagName('div'); |
| 41 | + for(var i = 0; i < divs.length; i++){ |
| 42 | + if( divs[i].id.substring(0,11) == 'ogg_player_'){ |
| 43 | + vidIdList.push( divs[i].getAttribute("id") ); |
| 44 | + } |
| 45 | + } |
| 46 | + if( vidIdList.length > 0){ |
| 47 | + load_mv_embed( function(){ |
| 48 | + mvJsLoader.embedVideoCheck(function(){ |
| 49 | + //do utilty rewrite of oggHanlder content: |
| 50 | + rewrite_for_oggHanlder( vidIdList ); |
| 51 | + }); |
| 52 | + }); |
| 53 | + } |
| 54 | + }); |
| 55 | +} |
| 56 | + |
| 57 | +//check if we are on a edit page: |
| 58 | +if( wgAction == 'edit' || wgAction == 'submit' ){ |
| 59 | + //add onPage ready request: |
| 60 | + addOnloadHook( function(){ |
| 61 | + var imE = document.createElement('img'); |
| 62 | + imE.style.cursor = 'pointer'; |
| 63 | + imE.id = 'mv-add_media'; |
| 64 | + imE.src = getAddMediaPath( 'mv_embed/images/Button_add_media.png' ); |
| 65 | + imE.title = gMsg['add_media_to_page']; |
| 66 | + |
| 67 | + var toolbar = document.getElementById("toolbar"); |
| 68 | + if(toolbar) |
| 69 | + toolbar.appendChild(imE); |
| 70 | + |
| 71 | + addHandler( imE, 'click', function() { |
| 72 | + mv_do_load_wiz(); |
| 73 | + }); |
| 74 | + }); |
| 75 | +} |
| 76 | +//add firefog support to Special Upload page: |
| 77 | +if( wgPageName== "Special:Upload" ){ |
| 78 | + addOnloadHook( function(){ |
| 79 | + //(for commons force the &uploadformstyle=plain form |
| 80 | + /*var loc = window.location.toString(); |
| 81 | + if( loc.indexOf('commons.wikimedia.org')!==-1 ){ |
| 82 | + if( loc.indexOf( '&uploadformstyle=plain') == -1){ |
| 83 | + window.location = loc + '&uploadformstyle=plain'; |
| 84 | + } |
| 85 | + }*/ |
| 86 | + //alert("!!upload hook"); |
| 87 | + load_mv_embed( function(){ |
| 88 | + //load jQuery and what not |
| 89 | + mvJsLoader.jQueryCheck(function(){ |
| 90 | + mvJsLoader.doLoad( { |
| 91 | + 'mvFirefogg' : 'libAddMedia/mvFirefogg.js', |
| 92 | + 'mvUploader' : 'libAddMedia/mvUploader.js' |
| 93 | + },function(){ |
| 94 | + mvUp = new mvUploader( { 'api_url' : wg_local_wiki_api_url } ); |
| 95 | + }); |
| 96 | + }); |
| 97 | + }); |
| 98 | + }); |
| 99 | +} |
| 100 | + |
| 101 | +var caret_pos={}; |
| 102 | +function mv_do_load_wiz(){ |
| 103 | + caret_pos={}; |
| 104 | + var txtarea = document.editform.wpTextbox1; |
| 105 | + var getTextCusorStartPos = function (o){ |
| 106 | + if (o.createTextRange) { |
| 107 | + var r = document.selection.createRange().duplicate() |
| 108 | + r.moveEnd('character', o.value.length) |
| 109 | + if (r.text == '') return o.value.length |
| 110 | + return o.value.lastIndexOf(r.text) |
| 111 | + } else return o.selectionStart; |
| 112 | + } |
| 113 | + var getTextCusorEndPos = function (o){ |
| 114 | + if (o.createTextRange) { |
| 115 | + var r = document.selection.createRange().duplicate(); |
| 116 | + r.moveStart('character', -o.value.length); |
| 117 | + return r.text.length; |
| 118 | + } else{ |
| 119 | + return o.selectionEnd; |
| 120 | + } |
| 121 | + } |
| 122 | + caret_pos.s = getTextCusorStartPos( txtarea ); |
| 123 | + caret_pos.e = getTextCusorEndPos( txtarea ); |
| 124 | + caret_pos.text = txtarea.value; |
| 125 | + //show the loading screen: |
| 126 | + var elm = document.getElementById('modalbox'); |
| 127 | + if(elm){ |
| 128 | + //use jquery to re-display the search |
| 129 | + if( typeof $j != 'undefined'){ |
| 130 | + $j('#modalbox,#mv_overlay').show(); |
| 131 | + } |
| 132 | + }else{ |
| 133 | + var body_elm = document.getElementsByTagName("body")[0]; |
| 134 | + body_elm.innerHTML = body_elm.innerHTML + ''+ |
| 135 | + '<div id="modalbox" style="background:#DDD;border:3px solid #666666;font-size:115%;'+ |
| 136 | + 'top:30px;left:20px;right:20px;bottom:30px;position:fixed;z-index:100;">'+ |
| 137 | + 'loading external media wizard<blink>...</blink>'+ |
| 138 | + '</div>'+ |
| 139 | + '<div id="mv_overlay" style="background:#000;cursor:wait;height:100%;left:0;position:fixed;'+ |
| 140 | + 'top:0;width:100%;z-index:5;filter:alpha(opacity=60);-moz-opacity: 0.6;'+ |
| 141 | + 'opacity: 0.6;"/>'; |
| 142 | + } |
| 143 | + //make sure the click action is still there |
| 144 | + var imE = document.getElementById('mv-add_media'); |
| 145 | + if(imE){ |
| 146 | + addHandler( imE, 'click', function() { |
| 147 | + mv_do_load_wiz(); |
| 148 | + }); |
| 149 | + } |
| 150 | + //load mv_embed and do text search interface: |
| 151 | + load_mv_embed( function(){ |
| 152 | + //restore text value: |
| 153 | + var txtarea = document.editform.wpTextbox1; |
| 154 | + txtarea.value = caret_pos.text; |
| 155 | + //do the remote search interface: |
| 156 | + mv_do_remote_search({ |
| 157 | + 'target_id':'modalbox', |
| 158 | + 'profile':'mediawiki_edit', |
| 159 | + 'target_textbox': 'wpTextbox1', |
| 160 | + 'caret_pos': caret_pos, |
| 161 | + //note selections in the textbox will take over the default query |
| 162 | + 'default_query': wgTitle, |
| 163 | + 'target_title':wgPageName, |
| 164 | + 'cpconfig':wg_content_proivers_config, |
| 165 | + 'local_wiki_api_url': wg_local_wiki_api_url |
| 166 | + }); |
| 167 | + }); |
| 168 | + return false; |
| 169 | +} |
| 170 | +function load_mv_embed( callback ){ |
| 171 | + //inject mv_embed if needed: |
| 172 | + if( typeof mvEmbed == 'undefined'){ |
| 173 | + //get mv_embed path from _this_ file location: |
| 174 | + if( force_mv_embed_path ){ |
| 175 | + var mv_embed_url = force_mv_embed_path; |
| 176 | + }else{ |
| 177 | + var mv_embed_url = getAddMediaPath( 'mv_embed/mv_embed.js' ); |
| 178 | + } |
| 179 | + //check if we are in debug mode (send a urid to mv_embed too) |
| 180 | + if( mv_embed_url.indexOf('debug=true') != -1 ){ |
| 181 | + var d = new Date(); |
| 182 | + mv_embed_url+='&urid=' + d.getTime(); |
| 183 | + } |
| 184 | + var e = document.createElement("script"); |
| 185 | + e.setAttribute( 'src', mv_embed_url ); |
| 186 | + e.setAttribute( 'type', "text/javascript" ); |
| 187 | + document.getElementsByTagName("head")[0].appendChild(e); |
| 188 | + check_for_mv_embed( callback ); |
| 189 | + }else{ |
| 190 | + check_for_mv_embed( callback ); |
| 191 | + } |
| 192 | +} |
| 193 | + |
| 194 | +function check_for_mv_embed( callback ){ |
| 195 | + if( typeof mvEmbed == 'undefined'){ |
| 196 | + setTimeout('check_for_mv_embed( ' + callback +');', 25); |
| 197 | + }else{ |
| 198 | + callback(); |
| 199 | + } |
| 200 | +} |
| 201 | +function getAddMediaPath( replace_str ){ |
| 202 | + if(!replace_str) |
| 203 | + replace_str = ''; |
| 204 | + if( force_mv_add_media_wizard_path ) |
| 205 | + return force_mv_add_media_wizard_path + replace_str; |
| 206 | + |
| 207 | + for(var i=0; i < document.getElementsByTagName('script').length; i++){ |
| 208 | + var s = document.getElementsByTagName('script')[i]; |
| 209 | + if( s.src.indexOf('add_media_wizard.js') != -1 ){ |
| 210 | + //use the external_media_wizard path: |
| 211 | + return s.src.replace('add_media_wizard.js', replace_str); |
| 212 | + } |
| 213 | + } |
| 214 | +} |
| 215 | + |
| 216 | + |
Property changes on: trunk/extensions/MetavidWiki/skins/add_media_wizard.OFF.js |
___________________________________________________________________ |
Added: svn:mergeinfo |
Added: svn:eol-style |
1 | 217 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_search.js |
— | — | @@ -3,320 +3,321 @@ |
4 | 4 | var maxFilters = 8; |
5 | 5 | var mv_search_action=''; |
6 | 6 | function mv_pre_setup_search(req_mode){ |
7 | | - //make sure we have jQuery and any base required libs: |
8 | | - mvJsLoader.jQueryCheck(function(){ |
9 | | - mv_setup_search(req_mode); |
10 | | - }); |
| 7 | + //make sure we have jQuery and any base required libs: |
| 8 | + mvJsLoader.jQueryCheck(function(){ |
| 9 | + mv_setup_search(req_mode); |
| 10 | + }); |
11 | 11 | } |
12 | 12 | function mv_setup_search(req_mode){ |
13 | | - if(!mvSearchSetupFlag) |
14 | | - mv_do_setup_search(req_mode); |
15 | | - mvSearchSetupFlag=true; |
| 13 | + if(!mvSearchSetupFlag) |
| 14 | + mv_do_setup_search(req_mode); |
| 15 | + mvSearchSetupFlag=true; |
16 | 16 | } |
17 | | -function mv_do_setup_search(req_mode){ |
18 | | - js_log('f:mv_setup_search: '); |
19 | | - add_highlight_function(); |
20 | | - //look for existing auto completes: |
21 | | - for(i=0;i<maxFilters;i++){ |
22 | | - if( $j('#mv_person_input_'+i).get(0)){ |
23 | | - mv_add_person_ac(i); |
24 | | - } |
25 | | - } |
26 | | - //if in ajax req mode (re-write "run_search" button) |
27 | | - if(req_mode=='ajax'){ |
28 | | - //store action |
29 | | - mv_search_action = $j('#mv_media_search').attr('action'); |
30 | | - //change form action |
31 | | - $j('#mv_media_search').attr('action','javascript:mv_do_ajax_search()'); |
32 | | - } |
| 17 | +function mv_do_setup_search(req_mode){ |
| 18 | + js_log('f:mv_setup_search: '); |
| 19 | + add_highlight_function(); |
| 20 | + //look for existing auto completes: |
| 21 | + for(i=0;i<maxFilters;i++){ |
| 22 | + if( $j('#mv_person_input_'+i).get(0)){ |
| 23 | + mv_add_person_ac(i); |
| 24 | + } |
| 25 | + } |
| 26 | + //if in ajax req mode (re-write "run_search" button) |
| 27 | + if(req_mode=='ajax'){ |
| 28 | + //store action |
| 29 | + mv_search_action = $j('#mv_media_search').attr('action'); |
| 30 | + //change form action |
| 31 | + $j('#mv_media_search').attr('action','javascript:mv_do_ajax_search()'); |
| 32 | + } |
33 | 33 | |
34 | | - //look for search results (enable button actions) |
35 | | - $j('.mv_stream_play_button').click(function(){ |
36 | | - window.location.href = wgScript+ '/'+ |
37 | | - $j(this).attr('name'); |
38 | | - }) |
39 | | - //set up bindings for existing date range: |
40 | | - if(typeof mvDateInitObj!='undefined'){ |
41 | | - $j('.mv_search_select').each(function(){ |
42 | | - //get mv_sel_# number |
43 | | - id_parts = $j(this).attr('id').split('_'); |
44 | | - var type = id_parts[1]; |
45 | | - var inx = id_parts[2]; |
46 | | - //js_log('looking at: '+ $j("#"+this.id+" option:selected").val()) |
47 | | - if($j("#"+this.id+" option:selected").val()=='date_range'){ |
48 | | - add_date_binddings(inx, mvDateInitObj); |
49 | | - } |
50 | | - }); |
51 | | - }else{ |
52 | | - js_log('mvDateInitObj is undefined'); |
53 | | - } |
54 | | - //remove all old search_text bindings: |
55 | | - $j('.mv_search_select').unbind(); |
56 | | - //set up actions: |
57 | | - $j('.mv_search_select').each(function(){ |
58 | | - js_log("SHOULD ADD change for: " + this.id); |
59 | | - }); |
60 | | - $j('.mv_search_select').change(function(){ |
61 | | - js_log('mv_search_select:' + $j("#"+this.id+" option:selected").val()); |
62 | | - //get mv_sel_# number |
63 | | - id_parts = $j(this).attr('id').split('_'); |
64 | | - var type = id_parts[1]; |
65 | | - var inx = id_parts[2]; |
66 | | - js_log("id: "+$j(this).attr('id')+" got t:" + type+ ' Index:' + inx + ' val:' + $j("#"+this.id + " option:selected").val() ); |
67 | | - switch($j("#"+this.id+" option:selected").val()){ |
68 | | - case 'category': |
69 | | - $j('#mvs_'+inx+'_tc').html('<input class="mv_search_text"' + |
70 | | - 'size="9" type="text" name="f['+inx+'][v]" value="" >'); |
71 | | - //@@todo add autocomplete for category names |
72 | | - break; |
73 | | - case 'stream_name': |
74 | | - $j('#mvs_'+inx+'_tc').html('<input class="mv_search_text" ' + |
75 | | - 'size="9" type="text" name="f['+inx+'][v]" value="" >'); |
76 | | - ////@@todo add autocomplete for stream name |
77 | | - break; |
78 | | - case 'match': |
79 | | - //match text is special cuz it gets highlighted in resutls with class: mv_hl_text |
80 | | - $j('#mvs_'+inx+'_tc').html('<input class="mv_search_text mv_hl_text" ' + |
81 | | - 'size="9" type="text" name="f['+inx+'][v]" value="" >'); |
82 | | - break; |
83 | | - case 'date_range': |
| 34 | + //look for search results (enable button actions) |
| 35 | + $j('.mv_stream_play_button').click(function(){ |
| 36 | + window.location.href = wgScript+ '/'+ |
| 37 | + $j(this).attr('name'); |
| 38 | + }) |
| 39 | + //set up bindings for existing date range: |
| 40 | + if(typeof mvDateInitObj!='undefined'){ |
| 41 | + $j('.mv_search_select').each(function(){ |
| 42 | + //get mv_sel_# number |
| 43 | + id_parts = $j(this).attr('id').split('_'); |
| 44 | + var type = id_parts[1]; |
| 45 | + var inx = id_parts[2]; |
| 46 | + //js_log('looking at: '+ $j("#"+this.id+" option:selected").val()) |
| 47 | + if($j("#"+this.id+" option:selected").val()=='date_range'){ |
| 48 | + add_date_binddings(inx, mvDateInitObj); |
| 49 | + } |
| 50 | + }); |
| 51 | + }else{ |
| 52 | + js_log('mvDateInitObj is undefined'); |
| 53 | + } |
| 54 | + //remove all old search_text bindings: |
| 55 | + $j('.mv_search_select').unbind(); |
| 56 | + //set up actions: |
| 57 | + $j('.mv_search_select').each(function(){ |
| 58 | + js_log("SHOULD ADD change for: " + this.id); |
| 59 | + }); |
| 60 | + $j('.mv_search_select').change(function(){ |
| 61 | + js_log('mv_search_select:' + $j("#"+this.id+" option:selected").val()); |
| 62 | + //get mv_sel_# number |
| 63 | + id_parts = $j(this).attr('id').split('_'); |
| 64 | + var type = id_parts[1]; |
| 65 | + var inx = id_parts[2]; |
| 66 | + js_log("id: "+$j(this).attr('id')+" got t:" + type+ ' Index:' + inx + ' val:' + $j("#"+this.id + " option:selected").val() ); |
| 67 | + switch($j("#"+this.id+" option:selected").val()){ |
| 68 | + case 'category': |
| 69 | + $j('#mvs_'+inx+'_tc').html('<input class="mv_search_text"' + |
| 70 | + 'size="9" type="text" name="f['+inx+'][v]" value="" >'); |
| 71 | + //@@todo add autocomplete for category names |
| 72 | + break; |
| 73 | + case 'stream_name': |
| 74 | + $j('#mvs_'+inx+'_tc').html('<input class="mv_search_text" ' + |
| 75 | + 'size="9" type="text" name="f['+inx+'][v]" value="" >'); |
| 76 | + ////@@todo add autocomplete for stream name |
| 77 | + break; |
| 78 | + case 'match': |
| 79 | + //match text is special cuz it gets highlighted in resutls with class: mv_hl_text |
| 80 | + $j('#mvs_'+inx+'_tc').html('<input class="mv_search_text mv_hl_text" ' + |
| 81 | + 'size="9" type="text" name="f['+inx+'][v]" value="" >'); |
| 82 | + break; |
| 83 | + case 'date_range': |
84 | 84 | $j('#mvs_'+inx+'_tc').html( gM('loading_txt') ); |
85 | 85 | //@@todo refactor to new date range method |
86 | 86 | var load_js_set = ['$j.fn.datePicker']; |
87 | 87 | uri = wgServer + |
88 | 88 | ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); |
| 89 | + |
89 | 90 | mvJsLoader.doLoad(load_js_set,function(){ |
90 | | - searchDateObj = $j.get(uri, |
91 | | - {action:'ajax',rs:'mv_date_obj'}, |
92 | | - function(data){ |
93 | | - eval(data); |
94 | | - if(mv_result){ |
95 | | - //we ave to load the jQuery date plugin & the date_range data set (and mesg) |
96 | | - $j('#mvs_'+inx+'_tc').html('<input class="date-pick_'+inx+' mv_search_text" '+ |
97 | | - 'size="9" type="text" id="vs_'+inx+'" name="f['+inx+'][vs]" value="" > to ' + |
98 | | - '<input class="date-pick_'+inx+' mv_search_text" '+ |
99 | | - 'size="9" type="text" id="ve_'+inx+'" name="f['+inx+'][ve]" value="" >'); |
100 | | - add_date_binddings(inx, mv_result); |
101 | | - } |
102 | | - }); |
103 | | - }); |
104 | | - break; |
105 | | - case 'bill': |
106 | | - $j('#mvs_'+inx+'_tc').html('<input onclick="this.value=\'\';" size="35" id="mv_bill_input_' + inx + |
107 | | - '" class="mv_search_text" ' + |
108 | | - 'size="9" type="text" name="f['+inx+'][v]" value="" >' + |
109 | | - '<div class="autocomplete" id="mv_bill_choices_'+inx+'" style="display: none;"/>'); |
110 | | - //add a bill autocomplete: |
111 | | - mv_add_bill_ac(inx); |
112 | | - break; |
113 | | - case 'spoken_by': |
114 | | - $j('#mvs_'+inx+'_tc').html( $j('#mv_person') |
115 | | - .clone().css('display','inline').attr('id', 'mv_person_'+inx).children().each(function(){ |
116 | | - //append the inx to each: |
117 | | - $j(this).attr('id', $j(this).attr('id')+'_'+inx); |
118 | | - js_log('' + this.id); |
119 | | - })); |
120 | | - //update the input name: |
121 | | - $j('#mv_person_input_'+inx).attr({'name':'f['+inx+'][v]', 'onclick':'this.value=\'\';'}); |
122 | | - //for more logical default behavior: |
123 | | - //default to OR if any other "spoken by" are present in list else AND |
124 | | - var default_sel_inx=0; |
125 | | - $j('.mv_search_select').each(function(){ |
126 | | - if(this.id!='mvsel_t_'+inx){ |
127 | | - if(this.value=='spoken_by'){ |
128 | | - default_sel_inx=1; //set to OR |
129 | | - } |
130 | | - } |
131 | | - }) |
132 | | - $j('#mvsel_a_'+inx).get(0).selectedIndex=default_sel_inx; |
133 | | - mv_add_person_ac(inx); |
134 | | - break; |
135 | | - case 'smw_property': |
136 | | - break; |
137 | | - default: |
138 | | - js_log('no select action for:'+ $j("#"+this.id+" option:selected").val()); |
139 | | - break; |
140 | | - }; |
141 | | - }); |
| 91 | + searchDateObj = $j.get(uri, |
| 92 | + {action:'ajax',rs:'mv_date_obj'}, |
| 93 | + function(data){ |
| 94 | + eval(data); |
| 95 | + if(mv_result){ |
| 96 | + //we ave to load the jQuery date plugin & the date_range data set (and mesg) |
| 97 | + $j('#mvs_'+inx+'_tc').html('<input class="date-pick_'+inx+' mv_search_text" '+ |
| 98 | + 'size="9" type="text" id="vs_'+inx+'" name="f['+inx+'][vs]" value="" > to ' + |
| 99 | + '<input class="date-pick_'+inx+' mv_search_text" '+ |
| 100 | + 'size="9" type="text" id="ve_'+inx+'" name="f['+inx+'][ve]" value="" >'); |
| 101 | + add_date_binddings(inx, mv_result); |
| 102 | + } |
| 103 | + }); |
| 104 | + }); |
| 105 | + break; |
| 106 | + case 'bill': |
| 107 | + $j('#mvs_'+inx+'_tc').html('<input onclick="this.value=\'\';" size="35" id="mv_bill_input_' + inx + |
| 108 | + '" class="mv_search_text" ' + |
| 109 | + 'size="9" type="text" name="f['+inx+'][v]" value="" >' + |
| 110 | + '<div class="autocomplete" id="mv_bill_choices_'+inx+'" style="display: none;"/>'); |
| 111 | + //add a bill autocomplete: |
| 112 | + mv_add_bill_ac(inx); |
| 113 | + break; |
| 114 | + case 'spoken_by': |
| 115 | + $j('#mvs_'+inx+'_tc').html( $j('#mv_person') |
| 116 | + .clone().css('display','inline').attr('id', 'mv_person_'+inx).children().each(function(){ |
| 117 | + //append the inx to each: |
| 118 | + $j(this).attr('id', $j(this).attr('id')+'_'+inx); |
| 119 | + js_log('' + this.id); |
| 120 | + })); |
| 121 | + //update the input name: |
| 122 | + $j('#mv_person_input_'+inx).attr({'name':'f['+inx+'][v]', 'onclick':'this.value=\'\';'}); |
| 123 | + //for more logical default behavior: |
| 124 | + //default to OR if any other "spoken by" are present in list else AND |
| 125 | + var default_sel_inx=0; |
| 126 | + $j('.mv_search_select').each(function(){ |
| 127 | + if(this.id!='mvsel_t_'+inx){ |
| 128 | + if(this.value=='spoken_by'){ |
| 129 | + default_sel_inx=1; //set to OR |
| 130 | + } |
| 131 | + } |
| 132 | + }) |
| 133 | + $j('#mvsel_a_'+inx).get(0).selectedIndex=default_sel_inx; |
| 134 | + mv_add_person_ac(inx); |
| 135 | + break; |
| 136 | + case 'smw_property': |
| 137 | + break; |
| 138 | + default: |
| 139 | + js_log('no select action for:'+ $j("#"+this.id+" option:selected").val()); |
| 140 | + break; |
| 141 | + }; |
| 142 | + }); |
142 | 143 | } |
143 | 144 | function mv_do_ajax_search(){ |
144 | | - js_log('mv_do_ajax_search '); |
145 | | - //build req url: |
146 | | - var req_query=(mv_search_action.indexOf('?')!==-1)?'&':'?'; |
147 | | - req_query+= 'seq_inline=true'; |
148 | | - $j('#mv_media_search :input').each(function(){ |
149 | | - if($j(this).attr('name')){ |
150 | | - req_query+='&'+$j(this).attr('name')+'='+$j(this).val(); |
151 | | - } |
152 | | - }); |
153 | | - mv_do_ajax_search_request( mv_search_action+ req_query); |
| 145 | + js_log('mv_do_ajax_search '); |
| 146 | + //build req url: |
| 147 | + var req_query=(mv_search_action.indexOf('?')!==-1)?'&':'?'; |
| 148 | + req_query+= 'seq_inline=true'; |
| 149 | + $j('#mv_media_search :input').each(function(){ |
| 150 | + if($j(this).attr('name')){ |
| 151 | + req_query+='&'+$j(this).attr('name')+'='+$j(this).val(); |
| 152 | + } |
| 153 | + }); |
| 154 | + mv_do_ajax_search_request( mv_search_action+ req_query); |
154 | 155 | |
155 | 156 | } |
156 | 157 | function mv_do_ajax_search_request(url){ |
157 | | - //(don't) annimate the transition: |
158 | | - //$j('#mv_search_results_container').fadeOut(function(){ |
159 | | - //}); |
160 | | - $j('#mv_search_results_container').html(gM('loading_txt')); |
161 | | - $j.get(url, function(data){ |
162 | | - //populate results |
163 | | - $j('#mv_search_results_container').html(data); |
164 | | - //run callback: |
165 | | - if(typeof mv_ajax_search_callback == 'function'){ |
166 | | - mv_ajax_search_callback(); |
167 | | - }else{ |
168 | | - js_log('ajax_search_callback type was: '+ typeof mv_ajax_search_callback); |
169 | | - } |
170 | | - }); |
| 158 | + //(don't) annimate the transition: |
| 159 | + //$j('#mv_search_results_container').fadeOut(function(){ |
| 160 | + //}); |
| 161 | + $j('#mv_search_results_container').html(gM('loading_txt')); |
| 162 | + $j.get(url, function(data){ |
| 163 | + //populate results |
| 164 | + $j('#mv_search_results_container').html(data); |
| 165 | + //run callback: |
| 166 | + if(typeof mv_ajax_search_callback == 'function'){ |
| 167 | + mv_ajax_search_callback(); |
| 168 | + }else{ |
| 169 | + js_log('ajax_search_callback type was: '+ typeof mv_ajax_search_callback); |
| 170 | + } |
| 171 | + }); |
171 | 172 | } |
172 | 173 | function add_date_binddings(inx, mvDateInitObj){ |
173 | | - //@@todo load the date format from the server |
174 | | - Date.format = 'mm/dd/yyyy'; |
175 | | - //populate with default start and end times (if empty): |
176 | | - $j('.date-pick_'+inx).each(function(){ |
177 | | - if($j(this).attr('name')=='f[1][vs]'){ |
178 | | - if($j(this).val()=='')$j(this).val(mvDateInitObj['sd']); |
179 | | - }else{ |
180 | | - if($j(this).val()=='')$j(this).val(mvDateInitObj['ed']); |
181 | | - } |
182 | | - //update start end times: |
183 | | - d = new Date($j(this).val()); |
184 | | - if($j(this).id=='vs_'+inx){ |
185 | | - $j('#ve_'+inx).dpSetStartDate(d.addDays(1).asString()); |
186 | | - }else if($j(this).id=='ve_'+inx){ |
187 | | - $j('#vs_'+inx).dpSetStartDate(d.addDays(-1).asString()); |
188 | | - } |
189 | | - }).trigger('change');//apply the current val as selected date |
190 | | - //set up date range: |
191 | | - $j('.date-pick_'+inx).datePicker({ |
192 | | - clickInput:true, |
193 | | - startDate:mvDateInitObj['sd'], |
194 | | - endDate:mvDateInitObj['ed'], |
195 | | - renderCallback:function($td, thisDate, month, year){ |
196 | | - //@@todo fix upstream...month seems to be off by 1 ? or it starts at 0? |
197 | | - month= thisDate.getMonth()+1; |
198 | | - //js_log('renderCallback: '+ thisDate.getDate() +' '+ month +' '+ year ); |
199 | | - //js_log(mvDateInitObj['sdays']); |
200 | | - //check if thisDate is in db (mvDateInitObj) |
201 | | - if(typeof mvDateInitObj['sdays'][year] != 'undefined'){ |
202 | | - if(typeof mvDateInitObj['sdays'][year][month] != 'undefined'){ |
203 | | - if(typeof mvDateInitObj['sdays'][year][month][thisDate.getDate()]!='undefined'){ |
204 | | - js_log("FOUND date match" + thisDate.getDate()); |
205 | | - $td.addClass('has_streams'); |
206 | | - $td.attr('title',mvDateInitObj['sdays'][year][month][thisDate.getDate()] + ' Streams'); |
207 | | - } |
208 | | - } |
209 | | - } |
210 | | - } |
211 | | - }); |
212 | | - //eliminate the "chose date text (don't ask why we need 4 's) |
213 | | - $j('.dp-choose-date').html(' '); |
| 174 | + //@@todo load the date format from the server |
| 175 | + Date.format = 'mm/dd/yyyy'; |
| 176 | + //populate with default start and end times (if empty): |
| 177 | + $j('.date-pick_'+inx).each(function(){ |
| 178 | + if($j(this).attr('name')=='f[1][vs]'){ |
| 179 | + if($j(this).val()=='')$j(this).val(mvDateInitObj['sd']); |
| 180 | + }else{ |
| 181 | + if($j(this).val()=='')$j(this).val(mvDateInitObj['ed']); |
| 182 | + } |
| 183 | + //update start end times: |
| 184 | + d = new Date($j(this).val()); |
| 185 | + if($j(this).id=='vs_'+inx){ |
| 186 | + $j('#ve_'+inx).dpSetStartDate(d.addDays(1).asString()); |
| 187 | + }else if($j(this).id=='ve_'+inx){ |
| 188 | + $j('#vs_'+inx).dpSetStartDate(d.addDays(-1).asString()); |
| 189 | + } |
| 190 | + }).trigger('change');//apply the current val as selected date |
| 191 | + //set up date range: |
| 192 | + $j('.date-pick_'+inx).datePicker({ |
| 193 | + clickInput:true, |
| 194 | + startDate:mvDateInitObj['sd'], |
| 195 | + endDate:mvDateInitObj['ed'], |
| 196 | + renderCallback:function($td, thisDate, month, year){ |
| 197 | + //@@todo fix upstream...month seems to be off by 1 ? or it starts at 0? |
| 198 | + month= thisDate.getMonth()+1; |
| 199 | + //js_log('renderCallback: '+ thisDate.getDate() +' '+ month +' '+ year ); |
| 200 | + //js_log(mvDateInitObj['sdays']); |
| 201 | + //check if thisDate is in db (mvDateInitObj) |
| 202 | + if(typeof mvDateInitObj['sdays'][year] != 'undefined'){ |
| 203 | + if(typeof mvDateInitObj['sdays'][year][month] != 'undefined'){ |
| 204 | + if(typeof mvDateInitObj['sdays'][year][month][thisDate.getDate()]!='undefined'){ |
| 205 | + js_log("FOUND date match" + thisDate.getDate()); |
| 206 | + $td.addClass('has_streams'); |
| 207 | + $td.attr('title',mvDateInitObj['sdays'][year][month][thisDate.getDate()] + ' Streams'); |
| 208 | + } |
| 209 | + } |
| 210 | + } |
| 211 | + } |
| 212 | + }); |
| 213 | + //eliminate the "chose date text (don't ask why we need 4 's) |
| 214 | + $j('.dp-choose-date').html(' '); |
214 | 215 | |
215 | | - //add cell render function cb (to show which days have videos) |
| 216 | + //add cell render function cb (to show which days have videos) |
216 | 217 | |
217 | 218 | |
218 | | - //bind start date end date ranges (so you can select invalid date range): |
219 | | - $j('#vs_'+inx).bind( |
220 | | - 'dpClosed', |
221 | | - function(e, selectedDates) |
222 | | - { |
223 | | - var d = selectedDates[0]; |
224 | | - if (d) { |
225 | | - d = new Date(d); |
226 | | - $j('#ve_'+inx).dpSetStartDate(d.addDays(1).asString()); |
227 | | - } |
228 | | - } |
229 | | - ); |
230 | | - $j('#ve_'+inx).bind( |
231 | | - 'dpClosed', |
232 | | - function(e, selectedDates) |
233 | | - { |
234 | | - var d = selectedDates[0]; |
235 | | - if (d) { |
236 | | - d = new Date(d); |
237 | | - $j('#vs_'+inx).dpSetEndDate(d.addDays(-1).asString()); |
238 | | - } |
239 | | - } |
240 | | - ); |
| 219 | + //bind start date end date ranges (so you can select invalid date range): |
| 220 | + $j('#vs_'+inx).bind( |
| 221 | + 'dpClosed', |
| 222 | + function(e, selectedDates) |
| 223 | + { |
| 224 | + var d = selectedDates[0]; |
| 225 | + if (d) { |
| 226 | + d = new Date(d); |
| 227 | + $j('#ve_'+inx).dpSetStartDate(d.addDays(1).asString()); |
| 228 | + } |
| 229 | + } |
| 230 | + ); |
| 231 | + $j('#ve_'+inx).bind( |
| 232 | + 'dpClosed', |
| 233 | + function(e, selectedDates) |
| 234 | + { |
| 235 | + var d = selectedDates[0]; |
| 236 | + if (d) { |
| 237 | + d = new Date(d); |
| 238 | + $j('#vs_'+inx).dpSetEndDate(d.addDays(-1).asString()); |
| 239 | + } |
| 240 | + } |
| 241 | + ); |
241 | 242 | } |
242 | 243 | function mv_pl(mvd_id){ |
243 | | - uri = wgServer +((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); |
244 | | - $j.get(uri, |
245 | | - {action:'ajax',rs:'mv_pl_wt', "rsargs[0]":mvd_id, 'size':'small'}, |
246 | | - function(data){ |
247 | | - //run highlighter on data: |
248 | | - //js_log('set to: '+ data); |
249 | | - $j('#mvimg_'+mvd_id).html(data); |
250 | | - //rewrite video tag: |
251 | | - rewrite_by_id('vid_'+mvd_id); |
252 | | - }); |
| 244 | + uri = wgServer +((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); |
| 245 | + $j.get(uri, |
| 246 | + {action:'ajax',rs:'mv_pl_wt', "rsargs[0]":mvd_id, 'size':'small'}, |
| 247 | + function(data){ |
| 248 | + //run highlighter on data: |
| 249 | + //js_log('set to: '+ data); |
| 250 | + $j('#mvimg_'+mvd_id).html(data); |
| 251 | + //rewrite video tag: |
| 252 | + rewrite_by_id('vid_'+mvd_id); |
| 253 | + }); |
253 | 254 | } |
254 | 255 | function mv_ex(mvd_id){ |
255 | | - uri = wgServer +((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); |
256 | | - js_log('expand ' + mvd_id); |
257 | | - //swap the image: |
258 | | - img_parts = $j('#mv_img_ex_'+mvd_id).attr('src').split('/'); |
259 | | - if(img_parts.pop()=='closed.png'){ |
260 | | - //$j('#mvr_desc_'+mvd_id).fadeOut('fast'); |
| 256 | + uri = wgServer +((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); |
| 257 | + js_log('expand ' + mvd_id); |
| 258 | + //swap the image: |
| 259 | + img_parts = $j('#mv_img_ex_'+mvd_id).attr('src').split('/'); |
| 260 | + if(img_parts.pop()=='closed.png'){ |
| 261 | + //$j('#mvr_desc_'+mvd_id).fadeOut('fast'); |
261 | 262 | |
262 | | - $j('#mv_img_ex_'+mvd_id).attr('src', img_parts.join('/') + '/opened.png'); |
263 | | - $j('#mv_watch_clip_'+mvd_id).fadeOut('fast', function(){ |
264 | | - $j('#mv_close_clip_'+mvd_id).fadeIn('fast'); |
265 | | - }); |
| 263 | + $j('#mv_img_ex_'+mvd_id).attr('src', img_parts.join('/') + '/opened.png'); |
| 264 | + $j('#mv_watch_clip_'+mvd_id).fadeOut('fast', function(){ |
| 265 | + $j('#mv_close_clip_'+mvd_id).fadeIn('fast'); |
| 266 | + }); |
266 | 267 | |
267 | | - $j('#mvr_'+mvd_id).css('display', 'block').html( gM('loading_txt') ); |
268 | | - //grab search terms: |
269 | | - var terms=''; |
270 | | - $j('.mv_hl_text').each(function(){ |
271 | | - terms+='|'+$j(this).val().replace(/|/, ''); |
272 | | - }); |
273 | | - $j.get(uri, |
274 | | - {action:'ajax',rs:'mv_expand_wt', "rsargs[0]":mvd_id, "st":terms}, |
275 | | - function(data){ |
276 | | - //run highlighter on data: |
277 | | - //js_log('set to: '+ data); |
278 | | - $j('#mvr_'+mvd_id).html(data); |
279 | | - hl_search_terms('#mvr_'+mvd_id); |
280 | | - //rewrite video tag: |
281 | | - rewrite_by_id('vid_'+mvd_id); |
282 | | - }); |
283 | | - }else{ |
284 | | - $j('#mv_close_clip_'+mvd_id).fadeOut('fast', function(){ |
285 | | - $j('#mv_watch_clip_'+mvd_id).fadeIn('fast'); |
286 | | - }); |
287 | | - //$j('#mvr_desc_'+mvd_id).fadeIn('fast'); |
288 | | - //$j('#vrdesc_'+mvd_id).fadeIn('fast'); |
289 | | - $j('#mv_img_ex_'+mvd_id).attr('src', img_parts.join('/') + '/closed.png'); |
290 | | - $j('#mvr_'+mvd_id).css('display', 'none'); |
291 | | - } |
| 268 | + $j('#mvr_'+mvd_id).css('display', 'block').html( gM('loading_txt') ); |
| 269 | + //grab search terms: |
| 270 | + var terms=''; |
| 271 | + $j('.mv_hl_text').each(function(){ |
| 272 | + terms+='|'+$j(this).val().replace(/|/, ''); |
| 273 | + }); |
| 274 | + $j.get(uri, |
| 275 | + {action:'ajax',rs:'mv_expand_wt', "rsargs[0]":mvd_id, "st":terms}, |
| 276 | + function(data){ |
| 277 | + //run highlighter on data: |
| 278 | + //js_log('set to: '+ data); |
| 279 | + $j('#mvr_'+mvd_id).html(data); |
| 280 | + hl_search_terms('#mvr_'+mvd_id); |
| 281 | + //rewrite video tag: |
| 282 | + rewrite_by_id('vid_'+mvd_id); |
| 283 | + }); |
| 284 | + }else{ |
| 285 | + $j('#mv_close_clip_'+mvd_id).fadeOut('fast', function(){ |
| 286 | + $j('#mv_watch_clip_'+mvd_id).fadeIn('fast'); |
| 287 | + }); |
| 288 | + //$j('#mvr_desc_'+mvd_id).fadeIn('fast'); |
| 289 | + //$j('#vrdesc_'+mvd_id).fadeIn('fast'); |
| 290 | + $j('#mv_img_ex_'+mvd_id).attr('src', img_parts.join('/') + '/closed.png'); |
| 291 | + $j('#mvr_'+mvd_id).css('display', 'none'); |
| 292 | + } |
292 | 293 | } |
293 | 294 | function hl_search_terms(result_selector){ |
294 | | - //get all the terms |
295 | | - var terms = new Array(); |
| 295 | + //get all the terms |
| 296 | + var terms = new Array(); |
296 | 297 | |
297 | | - $j('.mv_hl_text').each(function(){ |
298 | | - js_log('on val: '+ $j(this).val()); |
299 | | - //do_node_replace($j(result_selector).get(0), $j(this).val()); |
300 | | - result = $j(this).val().replace(/\'|"/g, ''); |
| 298 | + $j('.mv_hl_text').each(function(){ |
| 299 | + js_log('on val: '+ $j(this).val()); |
| 300 | + //do_node_replace($j(result_selector).get(0), $j(this).val()); |
| 301 | + result = $j(this).val().replace(/\'|"/g, ''); |
301 | 302 | result = result.split(/[\s,\+\.]+/); |
302 | 303 | for(i=0;i<result.length;i++){ |
303 | | - terms.push( result[i].toUpperCase() ); |
| 304 | + terms.push( result[i].toUpperCase() ); |
304 | 305 | } |
305 | | - }); |
306 | | - $j(result_selector).each(function(){ |
307 | | - for(i in terms){ |
308 | | - term = terms[i]; |
309 | | - //js_log("do hl call: "+ term); |
310 | | - $j.highlight(this, term); |
311 | | - } |
312 | | - }); |
| 306 | + }); |
| 307 | + $j(result_selector).each(function(){ |
| 308 | + for(i in terms){ |
| 309 | + term = terms[i]; |
| 310 | + //js_log("do hl call: "+ term); |
| 311 | + $j.highlight(this, term); |
| 312 | + } |
| 313 | + }); |
313 | 314 | |
314 | | - //if(terms.length!=0){ |
315 | | - //var regex = new RegExp().compile('('+terms.join('|')+')', "ig"); |
316 | | - //console.log(terms + ' reex: ' + regex); |
317 | | - //$j(result_selector).each(function(){ |
318 | | - // $j(this).html($j(this).html().replace(regex, '<span class="hl_term">$1</span>')); |
319 | | - //}); |
320 | | - //} |
| 315 | + //if(terms.length!=0){ |
| 316 | + //var regex = new RegExp().compile('('+terms.join('|')+')', "ig"); |
| 317 | + //console.log(terms + ' reex: ' + regex); |
| 318 | + //$j(result_selector).each(function(){ |
| 319 | + // $j(this).html($j(this).html().replace(regex, '<span class="hl_term">$1</span>')); |
| 320 | + //}); |
| 321 | + //} |
321 | 322 | } |
322 | 323 | /*function do_node_replace(node, te) { |
323 | 324 | js_log('n_id:'+ node.id +' '+ node.tagName +' inner:'+ node.innerHTML); |
— | — | @@ -348,96 +349,96 @@ |
349 | 350 | //@@todo should group autocompletes.. |
350 | 351 | // and abstract auto_complete functions from mv_stream.js to mv_common.js |
351 | 352 | function mv_add_bill_ac(inx){ |
352 | | - uri = wgServer + ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); |
353 | | - js_log('looking for: '+ '#mv_bill_choices_'+inx); |
354 | | - $j('#mv_bill_choices_'+inx).prependTo("body"); |
355 | | - $j('#mv_bill_input_'+inx).autocomplete( |
356 | | - uri, |
357 | | - { |
358 | | - autoFill:true, |
359 | | - onItemSelect:function(v){ |
360 | | - js_log('selected:' + v.innerHTML ); |
361 | | - //update the image: |
362 | | - $j('#mv_person_img_'+inx).attr('src', $j(v).children('img').attr('src')); |
363 | | - }, |
364 | | - matchSubset:0, |
365 | | - extraParams:{action:'ajax',rs:'mv_helpers_auto_complete',prop_name:'smw_bill'}, |
366 | | - paramName:'rsargs[]', |
367 | | - resultElem:'#mv_bill_choices_'+inx |
368 | | - }); |
369 | | - $j('#mv_bill_choices_'+inx).css({ |
370 | | - 'left':$j('#mv_bill_input_'+inx).get(0).offsetLeft, |
371 | | - 'top':$j('#mv_bill_input_'+inx).get(0).offsetTop + $j('#mv_bill_input_'+inx).height()+6 }); |
| 353 | + uri = wgServer + ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); |
| 354 | + js_log('looking for: '+ '#mv_bill_choices_'+inx); |
| 355 | + $j('#mv_bill_choices_'+inx).prependTo("body"); |
| 356 | + $j('#mv_bill_input_'+inx).autocomplete( |
| 357 | + uri, |
| 358 | + { |
| 359 | + autoFill:true, |
| 360 | + onItemSelect:function(v){ |
| 361 | + js_log('selected:' + v.innerHTML ); |
| 362 | + //update the image: |
| 363 | + $j('#mv_person_img_'+inx).attr('src', $j(v).children('img').attr('src')); |
| 364 | + }, |
| 365 | + matchSubset:0, |
| 366 | + extraParams:{action:'ajax',rs:'mv_helpers_auto_complete',prop_name:'smw_bill'}, |
| 367 | + paramName:'rsargs[]', |
| 368 | + resultElem:'#mv_bill_choices_'+inx |
| 369 | + }); |
| 370 | + $j('#mv_bill_choices_'+inx).css({ |
| 371 | + 'left':$j('#mv_bill_input_'+inx).get(0).offsetLeft, |
| 372 | + 'top':$j('#mv_bill_input_'+inx).get(0).offsetTop + $j('#mv_bill_input_'+inx).height()+6 }); |
372 | 373 | } |
373 | 374 | function mv_add_person_ac(inx){ |
374 | | - //now add the auto complete to mv_person_input_{inx} |
375 | | - uri = wgServer + |
376 | | - ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); |
| 375 | + //now add the auto complete to mv_person_input_{inx} |
| 376 | + uri = wgServer + |
| 377 | + ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); |
377 | 378 | |
378 | | - //pop mv_person_choices_ out to body (to put it on top) |
379 | | - $j('#mv_person_choices_'+inx).prependTo("body"); |
| 379 | + //pop mv_person_choices_ out to body (to put it on top) |
| 380 | + $j('#mv_person_choices_'+inx).prependTo("body"); |
380 | 381 | |
381 | | - $j('#mv_person_input_'+inx).autocomplete( |
382 | | - uri, |
383 | | - { |
384 | | - autoFill:true, |
385 | | - onItemSelect:function(v){ |
386 | | - js_log('selected:' + v.innerHTML ); |
387 | | - //update the image: |
388 | | - $j('#mv_person_img_'+inx).attr('src', $j(v).children('img').attr('src')); |
389 | | - //update the text: |
390 | | - $j('#mv_person_input_'+inx).val( $j('#mv_person_input_'+inx).val().replace('_', ' ') ); |
391 | | - }, |
392 | | - formatItem:function(row){ |
393 | | - //return '<img width="44" src="'+ row[2] + '">'+row[1]; |
394 | | - return '<img width="44" src="'+ row[2] + '"><span class="ac_img_txt">'+row[1]+'</span>'; |
| 382 | + $j('#mv_person_input_'+inx).autocomplete( |
| 383 | + uri, |
| 384 | + { |
| 385 | + autoFill:true, |
| 386 | + onItemSelect:function(v){ |
| 387 | + js_log('selected:' + v.innerHTML ); |
| 388 | + //update the image: |
| 389 | + $j('#mv_person_img_'+inx).attr('src', $j(v).children('img').attr('src')); |
| 390 | + //update the text: |
| 391 | + $j('#mv_person_input_'+inx).val( $j('#mv_person_input_'+inx).val().replace('_', ' ') ); |
| 392 | + }, |
| 393 | + formatItem:function(row){ |
| 394 | + //return '<img width="44" src="'+ row[2] + '">'+row[1]; |
| 395 | + return '<img width="44" src="'+ row[2] + '"><span class="ac_img_txt">'+row[1]+'</span>'; |
395 | 396 | |
396 | | - }, |
397 | | - matchSubset:0, |
398 | | - extraParams:{action:'ajax',rs:'mv_auto_complete_person'}, |
399 | | - paramName:'rsargs[]', |
400 | | - resultElem:'#mv_person_choices_'+inx |
401 | | - }); |
402 | | - $j('#mv_person_choices_'+inx).css({ |
403 | | - 'left':$j('#mv_person_input_'+inx).get(0).offsetLeft, |
404 | | - 'top':$j('#mv_person_input_'+inx).get(0).offsetTop + $j('#mv_person_input_'+inx).height()+6 }); |
| 397 | + }, |
| 398 | + matchSubset:0, |
| 399 | + extraParams:{action:'ajax',rs:'mv_auto_complete_person'}, |
| 400 | + paramName:'rsargs[]', |
| 401 | + resultElem:'#mv_person_choices_'+inx |
| 402 | + }); |
| 403 | + $j('#mv_person_choices_'+inx).css({ |
| 404 | + 'left':$j('#mv_person_input_'+inx).get(0).offsetLeft, |
| 405 | + 'top':$j('#mv_person_input_'+inx).get(0).offsetTop + $j('#mv_person_input_'+inx).height()+6 }); |
405 | 406 | } |
406 | 407 | function mv_add_filter(){ |
407 | | - //give us another 50px if on frontPage: |
408 | | - if($j('#frontPageTop').height()) |
409 | | - $j('#frontPageTop').css('height', ($j('#frontPageTop').height()+55)+'px'); |
410 | | - |
411 | | - |
412 | | - //close the first filter select rename inx to inx+1 |
413 | | - var new_t_id = 'mvsel_t_'+ ($j(".mv_search_select").length-1); |
414 | | - var new_a_id = 'mvsel_a_'+ ($j(".mv_search_select").length-1); |
415 | | - var inx = ($j(".mv_search_select").length-1); |
416 | | - //this could be cleaned up a bit: |
417 | | - $j("#mv_active_filters").append('<br><span id="mvs_'+inx+'" > </span>'); |
418 | | - $j('#mvs_'+inx).append( |
419 | | - $j("#mvsel_a_0").clone().attr({id:new_a_id,name:'f['+inx+'][a]'}), |
420 | | - $j("#mvsel_t_0").clone().attr({id:new_t_id,name:'f['+inx+'][t]'}) |
421 | | - ); |
422 | | - //reset the selector for both selectors: : |
423 | | - $j('#'+new_t_id+',#'+new_a_id).get(0).selectedIndex=null; |
424 | | - $j('#'+new_a_id).css('display', 'inline'); |
425 | | - $j('#mvs_'+inx).append('<span id="mvs_'+inx+'_tc"></span>'); |
426 | | - $j('#mvs_'+inx).append( $j("#mv_ref_remove") |
427 | | - .clone().css('display', 'inline') |
428 | | - .attr({id:'', href:'javascript:mv_remove_filter('+inx+')'})); |
429 | | - mvSearchSetupFlag=false; |
430 | | - mv_setup_search(); |
431 | | - //console.log("new id: " + new_id); |
432 | | - //$j('mv_sel_') |
| 408 | + //give us another 50px if on frontPage: |
| 409 | + if($j('#frontPageTop').height()) |
| 410 | + $j('#frontPageTop').css('height', ($j('#frontPageTop').height()+55)+'px'); |
| 411 | + |
| 412 | + |
| 413 | + //close the first filter select rename inx to inx+1 |
| 414 | + var new_t_id = 'mvsel_t_'+ ($j(".mv_search_select").length-1); |
| 415 | + var new_a_id = 'mvsel_a_'+ ($j(".mv_search_select").length-1); |
| 416 | + var inx = ($j(".mv_search_select").length-1); |
| 417 | + //this could be cleaned up a bit: |
| 418 | + $j("#mv_active_filters").append('<br><span id="mvs_'+inx+'" > </span>'); |
| 419 | + $j('#mvs_'+inx).append( |
| 420 | + $j("#mvsel_a_0").clone().attr({id:new_a_id,name:'f['+inx+'][a]'}), |
| 421 | + $j("#mvsel_t_0").clone().attr({id:new_t_id,name:'f['+inx+'][t]'}) |
| 422 | + ); |
| 423 | + //reset the selector for both selectors: : |
| 424 | + $j('#'+new_t_id+',#'+new_a_id).get(0).selectedIndex=null; |
| 425 | + $j('#'+new_a_id).css('display', 'inline'); |
| 426 | + $j('#mvs_'+inx).append('<span id="mvs_'+inx+'_tc"></span>'); |
| 427 | + $j('#mvs_'+inx).append( $j("#mv_ref_remove") |
| 428 | + .clone().css('display', 'inline') |
| 429 | + .attr({id:'', href:'javascript:mv_remove_filter('+inx+')'})); |
| 430 | + mvSearchSetupFlag=false; |
| 431 | + mv_setup_search(); |
| 432 | + //console.log("new id: " + new_id); |
| 433 | + //$j('mv_sel_') |
433 | 434 | } |
434 | 435 | //remove filter of given inx |
435 | 436 | function mv_remove_filter(inx){ |
436 | | - //remove 50 px if on front page: |
437 | | - if($j('#frontPageTop').height()) |
438 | | - $j('#frontPageTop').css('height', ($j('#frontPageTop').height()-50)+'px'); |
439 | | - $j('#mvs_'+inx).remove(); |
440 | | - //also remove the person input (since we moved it out of mvs) |
441 | | - $j('#mv_person_choices_'+inx).remove(); |
| 437 | + //remove 50 px if on front page: |
| 438 | + if($j('#frontPageTop').height()) |
| 439 | + $j('#frontPageTop').css('height', ($j('#frontPageTop').height()-50)+'px'); |
| 440 | + $j('#mvs_'+inx).remove(); |
| 441 | + //also remove the person input (since we moved it out of mvs) |
| 442 | + $j('#mv_person_choices_'+inx).remove(); |
442 | 443 | } |
443 | 444 | |
444 | 445 | /* |
— | — | @@ -452,52 +453,52 @@ |
453 | 454 | function add_highlight_function(){ |
454 | 455 | $j(function() { |
455 | 456 | jQuery.highlight = document.body.createTextRange ? |
456 | | - /* |
457 | | - Version for IE using TextRanges. |
458 | | - */ |
459 | | - function(node, te) { |
460 | | - var r = document.body.createTextRange(); |
461 | | - r.moveToElementText(node); |
462 | | - for (var i = 0; r.findText(te); i++) { |
463 | | - r.pasteHTML('<span class="searchmatch">' + r.text + '<\/span>'); |
464 | | - r.collapse(false); |
465 | | - } |
466 | | - } |
467 | | - : |
468 | | - /* |
469 | | - (Complicated) version for Mozilla and Opera using span tags. |
470 | | - */ |
471 | | - function(node, te) { |
472 | | - js_log('hl:'+ te + ' nt:'+node.nodeType + ' tn:' + node.tagName); |
473 | | - var pos, skip, spannode, middlebit, endbit, middleclone; |
474 | | - skip = 0; |
475 | | - if (node.nodeType == 3) { |
476 | | - pos = node.data.toUpperCase().indexOf(te); |
477 | | - if (pos >= 0) { |
478 | | - spannode = document.createElement('span'); |
479 | | - spannode.className = 'searchmatch'; |
480 | | - middlebit = node.splitText(pos); |
481 | | - endbit = middlebit.splitText(te.length); |
482 | | - middleclone = middlebit.cloneNode(true); |
483 | | - spannode.appendChild(middleclone); |
484 | | - middlebit.parentNode.replaceChild(spannode, middlebit); |
485 | | - skip = 1; |
486 | | - } |
487 | | - } |
488 | | - else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) { |
489 | | - for (var i = 0; i < node.childNodes.length; ++i) { |
490 | | - i += $j.highlight(node.childNodes[i], te); |
491 | | - } |
492 | | - } |
493 | | - return skip; |
494 | | - } |
495 | | - |
496 | | - ; |
497 | | - }); |
498 | | - |
499 | | - jQuery.fn.removeHighlight = function() { |
500 | | - return this.find("span.highlight").each(function() { |
501 | | - this.parentNode.replaceChild(this.firstChild, this).normalize(); |
502 | | - }); |
503 | | - }; |
| 457 | + /* |
| 458 | + Version for IE using TextRanges. |
| 459 | + */ |
| 460 | + function(node, te) { |
| 461 | + var r = document.body.createTextRange(); |
| 462 | + r.moveToElementText(node); |
| 463 | + for (var i = 0; r.findText(te); i++) { |
| 464 | + r.pasteHTML('<span class="searchmatch">' + r.text + '<\/span>'); |
| 465 | + r.collapse(false); |
| 466 | + } |
| 467 | + } |
| 468 | + : |
| 469 | + /* |
| 470 | + (Complicated) version for Mozilla and Opera using span tags. |
| 471 | + */ |
| 472 | + function(node, te) { |
| 473 | + js_log('hl:'+ te + ' nt:'+node.nodeType + ' tn:' + node.tagName); |
| 474 | + var pos, skip, spannode, middlebit, endbit, middleclone; |
| 475 | + skip = 0; |
| 476 | + if (node.nodeType == 3) { |
| 477 | + pos = node.data.toUpperCase().indexOf(te); |
| 478 | + if (pos >= 0) { |
| 479 | + spannode = document.createElement('span'); |
| 480 | + spannode.className = 'searchmatch'; |
| 481 | + middlebit = node.splitText(pos); |
| 482 | + endbit = middlebit.splitText(te.length); |
| 483 | + middleclone = middlebit.cloneNode(true); |
| 484 | + spannode.appendChild(middleclone); |
| 485 | + middlebit.parentNode.replaceChild(spannode, middlebit); |
| 486 | + skip = 1; |
| 487 | + } |
| 488 | + } |
| 489 | + else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) { |
| 490 | + for (var i = 0; i < node.childNodes.length; ++i) { |
| 491 | + i += $j.highlight(node.childNodes[i], te); |
| 492 | + } |
| 493 | + } |
| 494 | + return skip; |
| 495 | + } |
| 496 | + |
| 497 | + ; |
| 498 | + }); |
| 499 | + |
| 500 | + jQuery.fn.removeHighlight = function() { |
| 501 | + return this.find("span.highlight").each(function() { |
| 502 | + this.parentNode.replaceChild(this.firstChild, this).normalize(); |
| 503 | + }); |
| 504 | + }; |
504 | 505 | } |
Index: trunk/extensions/MetavidWiki/skins/mv_allpages.js |
— | — | @@ -3,14 +3,14 @@ |
4 | 4 | mwAddOnloadHook(mv_setup_allpage); |
5 | 5 | var mv_setup_allpage_flag=false; |
6 | 6 | if( typeof wgServer!='undefined' && typeof wgScript != 'undefined'){ |
7 | | - var base_roe_url = wgServer + wgScript + '?title=Special:MvExportStream&feed_format=roe&stream_name='; |
| 7 | + var base_roe_url = wgServer + wgScript + '?title=Special:MvExportStream&feed_format=roe&stream_name='; |
8 | 8 | }else{ |
9 | | - var base_roe_url=''; |
| 9 | + var base_roe_url=''; |
10 | 10 | } |
11 | 11 | //force wgScript path for blog support |
12 | 12 | if(typeof wgScript=='undefined') |
13 | | - var wgScript = "/w/index.php"; |
14 | | - |
| 13 | + var wgScript = "/w/index.php"; |
| 14 | + |
15 | 15 | if(typeof wgScriptPath=='undefined') |
16 | 16 | var wgScriptPath = '/w'; |
17 | 17 | |
— | — | @@ -35,256 +35,255 @@ |
36 | 36 | }); |
37 | 37 | } |
38 | 38 | function mv_do_sequence_edit_swap(mode){ |
39 | | - if(mode=='text'){ |
40 | | - $j('#seq_edit_container,#swich_seq_text').hide(); |
41 | | - $j('#mv_text_edit_container,#switch_seq_wysiwyg').show(); |
42 | | - }else if(mode=='seq' || mode=='seq_update'){ |
43 | | - $j('#mv_text_edit_container,#switch_seq_wysiwyg').hide(); |
44 | | - $j('#seq_edit_container,#swich_seq_text').show(); |
45 | | - if( mode == 'seq_update' ){ |
46 | | - js_log('do server side text parse'); |
47 | | - //$j('#seq_edit_container').html( gMsg('loading') ); |
48 | | - } |
49 | | - //check if the seq is already ready: |
50 | | - if( typeof _global['mvSeq'] == 'undefined' ){ |
51 | | - mv_do_sequence({ |
52 | | - "sequence_container_id": 'seq_edit_container', |
53 | | - "mv_pl_src":mvSeqExportUrl |
54 | | - }); |
55 | | - } |
56 | | - } |
| 39 | + if(mode=='text'){ |
| 40 | + $j('#seq_edit_container,#swich_seq_text').hide(); |
| 41 | + $j('#mv_text_edit_container,#switch_seq_wysiwyg').show(); |
| 42 | + }else if(mode=='seq' || mode=='seq_update'){ |
| 43 | + $j('#mv_text_edit_container,#switch_seq_wysiwyg').hide(); |
| 44 | + $j('#seq_edit_container,#swich_seq_text').show(); |
| 45 | + if( mode == 'seq_update' ){ |
| 46 | + js_log('do server side text parse'); |
| 47 | + //$j('#seq_edit_container').html( gMsg('loading') ); |
| 48 | + } |
| 49 | + //check if the seq is already ready: |
| 50 | + if( typeof _global['mvSeq'] == 'undefined' ){ |
| 51 | + $j('#seq_edit_container').sequencer({ |
| 52 | + 'mv_pl_src':mvSeqExportUrl |
| 53 | + }); |
| 54 | + } |
| 55 | + } |
57 | 56 | } |
58 | 57 | function mv_page_specific_rewrites(){ |
59 | | - var mvAskTitle = 'Special:MvExportAsk'; |
60 | | - var rssImg = '<img border="0" src="'+wgScriptPath+'/extensions/MetavidWiki/skins/images/feed-icon-28x28.png"/>'; |
61 | | - var msg_video_rss = 'video rss'; |
62 | | - if($j('#NOTITLEHACK').length!=0)$j('.firstHeading').hide(); |
63 | | - //add in rss-media feed link if on Special:Ask page |
64 | | - if(typeof wgPageName!='undefined'){ |
65 | | - if(wgPageName=='Special:Ask'){ |
66 | | - js_log("url : " + document.location); |
67 | | - var sURL = parseUri(document.location); |
68 | | - var podLink=wgArticlePath.replace('$1', mvAskTitle); |
69 | | - if(sURL.queryKey['title']){ |
70 | | - //pass along all url params (update the title) |
71 | | - podLink+='?'; |
72 | | - for(i in sURL.queryKey){ |
73 | | - if(i !='title')podLink+=i+'='+sURL.queryKey[i]+'&'; |
74 | | - } |
75 | | - }else{ |
76 | | - // /title/askparam format |
77 | | - var pInx =sURL.relative.indexOf(wgPageName); |
78 | | - if(pInx!==false){ |
79 | | - podLink+= sURL.relative.substring(pInx+wgPageName.length); |
80 | | - } |
81 | | - } |
82 | | - //@@todo add to javascript msg system |
83 | | - $j('#bodyContent').before('<span style="float: right;"><a title="'+ |
84 | | - msg_video_rss+'" href="'+podLink+'">'+ rssImg + '</a></span>'); |
85 | | - } |
86 | | - } |
87 | | - //move the search filter if #msms_form_search_row |
88 | | - if($j('#msms_form_search_row').get(0)!=null){ |
89 | | - $j('#msms_form_search_row').appendTo("#searchHeader"); |
90 | | - } |
91 | | - //if we have an inline query add a search link |
92 | | - $j('.smwtable').each(function(){ |
93 | | - if($j('#'+this.id+' .smwfooter a').length!=0){ |
94 | | - var pLink = $j('#'+this.id+' .smwfooter a').attr('href').replace('Special:Ask',mvAskTitle ); |
95 | | - var colspan = $j('.smwfooter .sortbottom').attr('colspan'); |
96 | | - var pHTML = '<a title="'+msg_video_rss+'" href="'+pLink+'">'+rssImg+'</a>'; |
97 | | - js_log("plink: "+pLink + ' colspan:'+ colspan + ' ph:'+pHTML); |
98 | | - $j('#'+this.id+' tbody').prepend('<tr><td colspan="'+colspan+'">'+pHTML+'</td></tr>'); |
99 | | - } |
100 | | - }); |
| 58 | + var mvAskTitle = 'Special:MvExportAsk'; |
| 59 | + var rssImg = '<img border="0" src="'+wgScriptPath+'/extensions/MetavidWiki/skins/images/feed-icon-28x28.png"/>'; |
| 60 | + var msg_video_rss = 'video rss'; |
| 61 | + if($j('#NOTITLEHACK').length!=0)$j('.firstHeading').hide(); |
| 62 | + //add in rss-media feed link if on Special:Ask page |
| 63 | + if(typeof wgPageName!='undefined'){ |
| 64 | + if(wgPageName=='Special:Ask'){ |
| 65 | + js_log("url : " + document.location); |
| 66 | + var sURL = parseUri(document.location); |
| 67 | + var podLink=wgArticlePath.replace('$1', mvAskTitle); |
| 68 | + if(sURL.queryKey['title']){ |
| 69 | + //pass along all url params (update the title) |
| 70 | + podLink+='?'; |
| 71 | + for(i in sURL.queryKey){ |
| 72 | + if(i !='title')podLink+=i+'='+sURL.queryKey[i]+'&'; |
| 73 | + } |
| 74 | + }else{ |
| 75 | + // /title/askparam format |
| 76 | + var pInx =sURL.relative.indexOf(wgPageName); |
| 77 | + if(pInx!==false){ |
| 78 | + podLink+= sURL.relative.substring(pInx+wgPageName.length); |
| 79 | + } |
| 80 | + } |
| 81 | + //@@todo add to javascript msg system |
| 82 | + $j('#bodyContent').before('<span style="float: right;"><a title="'+ |
| 83 | + msg_video_rss+'" href="'+podLink+'">'+ rssImg + '</a></span>'); |
| 84 | + } |
| 85 | + } |
| 86 | + //move the search filter if #msms_form_search_row |
| 87 | + if($j('#msms_form_search_row').get(0)!=null){ |
| 88 | + $j('#msms_form_search_row').appendTo("#searchHeader"); |
| 89 | + } |
| 90 | + //if we have an inline query add a search link |
| 91 | + $j('.smwtable').each(function(){ |
| 92 | + if($j('#'+this.id+' .smwfooter a').length!=0){ |
| 93 | + var pLink = $j('#'+this.id+' .smwfooter a').attr('href').replace('Special:Ask',mvAskTitle ); |
| 94 | + var colspan = $j('.smwfooter .sortbottom').attr('colspan'); |
| 95 | + var pHTML = '<a title="'+msg_video_rss+'" href="'+pLink+'">'+rssImg+'</a>'; |
| 96 | + js_log("plink: "+pLink + ' colspan:'+ colspan + ' ph:'+pHTML); |
| 97 | + $j('#'+this.id+' tbody').prepend('<tr><td colspan="'+colspan+'">'+pHTML+'</td></tr>'); |
| 98 | + } |
| 99 | + }); |
101 | 100 | } |
102 | 101 | function mv_do_mvd_link_rewrite(){ |
103 | | - js_log('mv_do_mvd_link_rewrite'); |
104 | | - var patt_mvd = new RegExp("MVD:([^:]*):([^\/]*)\/([0-9]+:[0-9]+:[^\/]+)\/([0-9]+:[0-9]+:[^\&]+)(&?.*)"); |
105 | | - var i =0; |
106 | | - $j('a').each(function(){ |
107 | | - if(this.href.indexOf('Special:')==-1 && this.href.indexOf('action=')==-1){ |
108 | | - titleTest = this.title.match(patt_mvd); |
109 | | - if(titleTest){ |
110 | | - res = this.href.match(patt_mvd); |
111 | | - if(res){ |
112 | | - if(res[5]!='')return ; |
113 | | - //skip if res[4] not at end: |
114 | | - //js_log(res); |
115 | | - i++; |
116 | | - if(!gMvd[i])gMvd[i]={}; |
117 | | - gMvd[i]['url']=res[0]; |
118 | | - gMvd[i]['sn']=res[2]; //stream name |
119 | | - gMvd[i]['st']=res[3]; //start time |
120 | | - gMvd[i]['et']=res[4]; //end time |
| 102 | + js_log('mv_do_mvd_link_rewrite'); |
| 103 | + var patt_mvd = new RegExp("MVD:([^:]*):([^\/]*)\/([0-9]+:[0-9]+:[^\/]+)\/([0-9]+:[0-9]+:[^\&]+)(&?.*)"); |
| 104 | + var i =0; |
| 105 | + $j('a').each(function(){ |
| 106 | + if(this.href.indexOf('Special:')==-1 && this.href.indexOf('action=')==-1){ |
| 107 | + titleTest = this.title.match(patt_mvd); |
| 108 | + if(titleTest){ |
| 109 | + res = this.href.match(patt_mvd); |
| 110 | + if(res){ |
| 111 | + if(res[5]!='')return ; |
| 112 | + //skip if res[4] not at end: |
| 113 | + //js_log(res); |
| 114 | + i++; |
| 115 | + if(!gMvd[i])gMvd[i]={}; |
| 116 | + gMvd[i]['url']=res[0]; |
| 117 | + gMvd[i]['sn']=res[2]; //stream name |
| 118 | + gMvd[i]['st']=res[3]; //start time |
| 119 | + gMvd[i]['et']=res[4]; //end time |
121 | 120 | |
122 | | - //js_log(this.href); |
123 | | - //js_log(res); |
124 | | - //replace with: |
125 | | - //check if we are instance of smwb-title (if so reduce font size) |
126 | | - var fsize = ( $j(this).parents().is(".smwb-title") )? '50%':'100%'; |
127 | | - //TEMP: |
128 | | - $j(this).replaceWith('<div id="mvd_link_'+i+'" ' + |
129 | | - 'style="display:inline-block;font-size:'+fsize+';vertical-align: middle;margin:.5em;border:solid thin black;width:300px;height:60px;">' + |
130 | | - get_mvdrw_img(i) + |
131 | | - '</div>'); |
132 | | - $j('#mv_mvd_ex_'+i).click(function(){ |
133 | | - inx = this.id.substr(10); |
134 | | - mv_ext(inx); |
135 | | - }); |
136 | | - $j('#mv_pglink_'+i).click(function(){ |
137 | | - inx = this.id.substr(10); |
138 | | - js_log('inx: '+ inx); |
139 | | - window.location = wgArticlePath.replace('$1',gMvd[inx]['url']); |
140 | | - }) |
141 | | - } |
142 | | - } |
143 | | - } |
144 | | - }); |
145 | | - js_log('got to I: '+i); |
146 | | - $j('#mvd_link_'+i).after('<div style="clear:both"></div>') |
| 121 | + //js_log(this.href); |
| 122 | + //js_log(res); |
| 123 | + //replace with: |
| 124 | + //check if we are instance of smwb-title (if so reduce font size) |
| 125 | + var fsize = ( $j(this).parents().is(".smwb-title") )? '50%':'100%'; |
| 126 | + //TEMP: |
| 127 | + $j(this).replaceWith('<div id="mvd_link_'+i+'" ' + |
| 128 | + 'style="display:inline-block;font-size:'+fsize+';vertical-align: middle;margin:.5em;border:solid thin black;width:300px;height:60px;">' + |
| 129 | + get_mvdrw_img(i) + |
| 130 | + '</div>'); |
| 131 | + $j('#mv_mvd_ex_'+i).click(function(){ |
| 132 | + inx = this.id.substr(10); |
| 133 | + mv_ext(inx); |
| 134 | + }); |
| 135 | + $j('#mv_pglink_'+i).click(function(){ |
| 136 | + inx = this.id.substr(10); |
| 137 | + js_log('inx: '+ inx); |
| 138 | + window.location = wgArticlePath.replace('$1',gMvd[inx]['url']); |
| 139 | + }) |
| 140 | + } |
| 141 | + } |
| 142 | + } |
| 143 | + }); |
| 144 | + js_log('got to I: '+i); |
| 145 | + $j('#mvd_link_'+i).after('<div style="clear:both"></div>') |
147 | 146 | } |
148 | 147 | function get_mvdrw_img(i, size){ |
149 | | - var size = (!size)?{'w':80,'h':60}:size; |
150 | | - var stream_link = wgScript+'?title=Stream:'+gMvd[i]['sn']+'/'+gMvd[i]['st']+'/'+gMvd[i]['et']; |
151 | | - var stream_desc = gMvd[i]['sn'].substr(0,1).toUpperCase() + gMvd[i]['sn'].substr(1).replace('_', ' ')+' '+ gMvd[i]['st'] + ' to '+ gMvd[i]['et']; |
152 | | - //@@todo localize javascript msg |
153 | | - var wiki_link = '<span title="Edited Wiki Page" id="mv_pglink_'+i+'" style="cursor:pointer;width:16px;height:16px;float:left;background:url(\''+wgScriptPath+'/extensions/MetavidWiki/skins/images/run_mediawiki.png\');"/>'; |
154 | | - var expand_link = '<span title="Play Inline" id="mv_mvd_ex_'+i+'" style="cursor:pointer;width:16px;height:16px;float:left;background:url(\''+wgScriptPath+'/extensions/MetavidWiki/skins/images/closed.png\');"/>'; |
155 | | - var img_url = wgScript+'?action=ajax&rs=mv_frame_server&stream_name='+gMvd[i]['sn']+'&t='+gMvd[i]['st']+'&size=icon'; |
156 | | - return '<img id="mvd_link_im_'+i+'" onclick="mv_ext('+i+')" ' + |
157 | | - 'style="cursor:pointer;float:left;height:'+size['h']+'px;width:'+size['w']+'px;" src="'+img_url+'">'+expand_link+wiki_link+' '+ |
158 | | - '<a title="'+stream_desc+'" href="'+stream_link+'">'+stream_desc+'</a><br>'; |
| 148 | + var size = (!size)?{'w':80,'h':60}:size; |
| 149 | + var stream_link = wgScript+'?title=Stream:'+gMvd[i]['sn']+'/'+gMvd[i]['st']+'/'+gMvd[i]['et']; |
| 150 | + var stream_desc = gMvd[i]['sn'].substr(0,1).toUpperCase() + gMvd[i]['sn'].substr(1).replace('_', ' ')+' '+ gMvd[i]['st'] + ' to '+ gMvd[i]['et']; |
| 151 | + //@@todo localize javascript msg |
| 152 | + var wiki_link = '<span title="Edited Wiki Page" id="mv_pglink_'+i+'" style="cursor:pointer;width:16px;height:16px;float:left;background:url(\''+wgScriptPath+'/extensions/MetavidWiki/skins/images/run_mediawiki.png\');"/>'; |
| 153 | + var expand_link = '<span title="Play Inline" id="mv_mvd_ex_'+i+'" style="cursor:pointer;width:16px;height:16px;float:left;background:url(\''+wgScriptPath+'/extensions/MetavidWiki/skins/images/closed.png\');"/>'; |
| 154 | + var img_url = wgScript+'?action=ajax&rs=mv_frame_server&stream_name='+gMvd[i]['sn']+'&t='+gMvd[i]['st']+'&size=icon'; |
| 155 | + return '<img id="mvd_link_im_'+i+'" onclick="mv_ext('+i+')" ' + |
| 156 | + 'style="cursor:pointer;float:left;height:'+size['h']+'px;width:'+size['w']+'px;" src="'+img_url+'">'+expand_link+wiki_link+' '+ |
| 157 | + '<a title="'+stream_desc+'" href="'+stream_link+'">'+stream_desc+'</a><br>'; |
159 | 158 | } |
160 | 159 | function mv_ext(inx){ |
161 | | - js_log('f:inx:'+inx); |
162 | | - //grow the window to 300+240 540 |
163 | | - js_log('i: is '+ inx); |
164 | | - $j('#mvd_link_'+inx).animate({width:'400px','height':'370px'},1000); |
165 | | - $j('#mvd_link_im_'+inx).animate({width:'400px','height':'300px'},1000,function(){ |
166 | | - //do mv_embed swap |
167 | | - $j('#mvd_link_im_'+inx).replaceWith('<div style="height:300px;width:400px;">' + |
168 | | - '<video roe="'+base_roe_url + gMvd[inx]['sn']+'&t='+gMvd[inx]['st']+'/'+gMvd[inx]['et']+'" ' + |
169 | | - 'autoplay="true" id="mvd_vid_'+inx +'"></video>' + |
170 | | - '</div>'); |
171 | | - init_mv_embed(true); |
172 | | - }); |
173 | | - $j('#mv_mvd_ex_'+inx).css('background', 'url(\''+wgScriptPath+'/extensions/MetavidWiki/skins/images/opened.png\')'); |
174 | | - $j('#mv_mvd_ex_'+inx).unbind(); |
175 | | - $j('#mv_mvd_ex_'+inx).click(function(){ |
176 | | - inx = this.id.substr(10); |
177 | | - mv_cxt(inx); |
178 | | - }); |
| 160 | + js_log('f:inx:'+inx); |
| 161 | + //grow the window to 300+240 540 |
| 162 | + js_log('i: is '+ inx); |
| 163 | + $j('#mvd_link_'+inx).animate({width:'400px','height':'370px'},1000); |
| 164 | + $j('#mvd_link_im_'+inx).animate({width:'400px','height':'300px'},1000,function(){ |
| 165 | + //do mv_embed swap |
| 166 | + $j('#mvd_link_im_'+inx).replaceWith('<div style="height:300px;width:400px;">' + |
| 167 | + '<video roe="'+base_roe_url + gMvd[inx]['sn']+'&t='+gMvd[inx]['st']+'/'+gMvd[inx]['et']+'" ' + |
| 168 | + 'autoplay="true" id="mvd_vid_'+inx +'"></video>' + |
| 169 | + '</div>'); |
| 170 | + init_mv_embed(true); |
| 171 | + }); |
| 172 | + $j('#mv_mvd_ex_'+inx).css('background', 'url(\''+wgScriptPath+'/extensions/MetavidWiki/skins/images/opened.png\')'); |
| 173 | + $j('#mv_mvd_ex_'+inx).unbind(); |
| 174 | + $j('#mv_mvd_ex_'+inx).click(function(){ |
| 175 | + inx = this.id.substr(10); |
| 176 | + mv_cxt(inx); |
| 177 | + }); |
179 | 178 | } |
180 | 179 | function mv_cxt(inx){ |
181 | | - //stop the video: |
182 | | - $j('#mvd_vid_'+inx).get(0).stop(); |
183 | | - //replace the html: |
184 | | - $j('#mvd_link_'+inx).html(get_mvdrw_img(inx, {'w':320,'h':240})); |
185 | | - $j('#mvd_link_'+inx).animate({width:'300px','height':'60px'},1000); |
186 | | - $j('#mvd_link_im_'+inx).animate({width:'80px','height':'60px'},1000); |
187 | | - $j('#mv_mvd_ex_'+inx).css('background', 'url(\''+wgScriptPath+'/extensions/MetavidWiki/skins/images/closed.png\')'); |
188 | | - $j('#mv_mvd_ex_'+inx).unbind(); |
189 | | - $j('#mv_mvd_ex_'+inx).click(function(){ |
190 | | - inx = this.id.substr(10); |
191 | | - mv_ext(inx); |
192 | | - }); |
| 180 | + //stop the video: |
| 181 | + $j('#mvd_vid_'+inx).get(0).stop(); |
| 182 | + //replace the html: |
| 183 | + $j('#mvd_link_'+inx).html(get_mvdrw_img(inx, {'w':320,'h':240})); |
| 184 | + $j('#mvd_link_'+inx).animate({width:'300px','height':'60px'},1000); |
| 185 | + $j('#mvd_link_im_'+inx).animate({width:'80px','height':'60px'},1000); |
| 186 | + $j('#mv_mvd_ex_'+inx).css('background', 'url(\''+wgScriptPath+'/extensions/MetavidWiki/skins/images/closed.png\')'); |
| 187 | + $j('#mv_mvd_ex_'+inx).unbind(); |
| 188 | + $j('#mv_mvd_ex_'+inx).click(function(){ |
| 189 | + inx = this.id.substr(10); |
| 190 | + mv_ext(inx); |
| 191 | + }); |
193 | 192 | } |
194 | 193 | /* toggles advanced search */ |
195 | 194 | function mv_toggle_advs(){ |
196 | | - js_log('called mv_toggle_advs:' + $j('#advs').val()); |
197 | | - if($j('#advs').val()=='0'){ |
198 | | - $j('#advs').val('1'); |
199 | | - //sync values from basic -> avanced |
200 | | - $j("input[@name$='f[0][v]']").val( $j('#searchInput').val() ); |
201 | | - var _fadecalled = false; |
202 | | - $j('.advs_basic').fadeOut('fast',function(){ |
203 | | - if(!_fadecalled){ |
204 | | - if($j('#tmp_loading_txt').length==0){ |
205 | | - $j('.advanced_search_tag').before('<span id="tmp_loading_txt">'+gM('loading_txt')+'</span>'); |
206 | | - } |
207 | | - if(typeof(mv_setup_search)=='undefined'){ |
208 | | - $j.getScript(mv_embed_path +'../mv_search.js', function(){ |
209 | | - mv_do_disp_adv_search(); |
210 | | - }); |
211 | | - }else{ |
212 | | - mv_do_disp_adv_search(); |
213 | | - } |
214 | | - } |
215 | | - _fadecalled=true; |
216 | | - }); |
217 | | - }else{ |
218 | | - $j('#advs').val('0'); |
219 | | - //sync values from advanced -> basic |
220 | | - $j('#searchInput').val( $j("input[@name$='f[0][v]']").val() ); |
221 | | - //do style display swap |
222 | | - $j('.advs_adv').fadeOut('fast',function(){ |
223 | | - $j('.advs_basic').fadeIn('fast'); |
224 | | - $j('#frontPageTop').animate({'height':'233px'},'fast'); |
225 | | - }); |
226 | | - } |
| 195 | + js_log('called mv_toggle_advs:' + $j('#advs').val()); |
| 196 | + if($j('#advs').val()=='0'){ |
| 197 | + $j('#advs').val('1'); |
| 198 | + //sync values from basic -> avanced |
| 199 | + $j("input[@name$='f[0][v]']").val( $j('#searchInput').val() ); |
| 200 | + var _fadecalled = false; |
| 201 | + $j('.advs_basic').fadeOut('fast',function(){ |
| 202 | + if(!_fadecalled){ |
| 203 | + if($j('#tmp_loading_txt').length==0){ |
| 204 | + $j('.advanced_search_tag').before('<span id="tmp_loading_txt">'+gM('loading_txt')+'</span>'); |
| 205 | + } |
| 206 | + if(typeof(mv_setup_search)=='undefined'){ |
| 207 | + $j.getScript(mv_embed_path +'../mv_search.js', function(){ |
| 208 | + mv_do_disp_adv_search(); |
| 209 | + }); |
| 210 | + }else{ |
| 211 | + mv_do_disp_adv_search(); |
| 212 | + } |
| 213 | + } |
| 214 | + _fadecalled=true; |
| 215 | + }); |
| 216 | + }else{ |
| 217 | + $j('#advs').val('0'); |
| 218 | + //sync values from advanced -> basic |
| 219 | + $j('#searchInput').val( $j("input[@name$='f[0][v]']").val() ); |
| 220 | + //do style display swap |
| 221 | + $j('.advs_adv').fadeOut('fast',function(){ |
| 222 | + $j('.advs_basic').fadeIn('fast'); |
| 223 | + $j('#frontPageTop').animate({'height':'233px'},'fast'); |
| 224 | + }); |
| 225 | + } |
227 | 226 | } |
228 | 227 | function mv_do_disp_adv_search(){ |
229 | | - $j('#tmp_loading_txt').remove(); |
230 | | - js_log('should fade in: .advs_adv'); |
231 | | - $j('.advs_adv').fadeIn('fast', function(){ |
232 | | - $j(this).css('display', 'inline'); |
233 | | - }); |
234 | | - //give some extra room for advanced search: |
235 | | - $j('#frontPageTop').animate({'height':'350px'},'fast'); |
| 228 | + $j('#tmp_loading_txt').remove(); |
| 229 | + js_log('should fade in: .advs_adv'); |
| 230 | + $j('.advs_adv').fadeIn('fast', function(){ |
| 231 | + $j(this).css('display', 'inline'); |
| 232 | + }); |
| 233 | + //give some extra room for advanced search: |
| 234 | + $j('#frontPageTop').animate({'height':'350px'},'fast'); |
236 | 235 | } |
237 | 236 | function mv_setup_search_ac(){ |
238 | | - var uri = wgScript; |
239 | | - //add the person choices div to searchInput |
240 | | - //turn off browser baseed autocomplete: |
241 | | - $j('#searchInput').attr('autocomplete',"off"); |
242 | | - |
243 | | - // add the sugestions div (abolute positioned so it can be ontop of everything) |
244 | | - $j('body').prepend('<div id="suggestions" style="position:absolute;display:none;z-index:50;">'+ |
245 | | - '<div id="suggestionsTop"></div>'+ |
246 | | - '<div id="suggestionsInner" class="suggestionsBox">'+ |
247 | | - '</div>'+ |
248 | | - '<div id="suggestionsBot"></div>'+ |
249 | | - '</div>'); |
250 | | - //position the sugestions below the search field: |
251 | | - if( $j('#searchInput').get(0)!=null){ |
252 | | - sf_pos = $j('#searchInput').offset(); |
253 | | - sf_pos['top']=sf_pos['top']+40; |
254 | | - sf_pos['left']=sf_pos['left']-220; |
255 | | - //js_log("moved sugest to: " + sf_pos['top'] + ' '+ sf_pos['left']); |
256 | | - $j('#suggestions').css(sf_pos); |
257 | | - } |
258 | | - //add hook: |
259 | | - $j('#searchInput').autocomplete( |
260 | | - uri, |
261 | | - { |
262 | | - autoFill:false, |
263 | | - onItemSelect:function(v){ |
264 | | - //alert('selected:' + v.innerHTML + ' page:'+$j('#searchInput').val()); |
265 | | - //jump to page: |
266 | | - if($j('#searchInput').val()=='do_search'){ |
267 | | - qs = v.innerHTML.toLowerCase().indexOf('<b>')+3; |
268 | | - qe = v.innerHTML.toLowerCase().indexOf('</b>'); |
269 | | - //update the search input (incase redirect fails) |
270 | | - $j('#searchInput').val(v.innerHTML.substring(qs,qe)); |
271 | | - window.location = uri+'/'+'Special:MediaSearch?mv_search='+v.innerHTML.substring(qs,qe); |
272 | | - }else{ |
273 | | - window.location = uri+'/'+$j('#searchInput').val(); |
274 | | - } |
275 | | - }, |
276 | | - formatItem:function(row){ |
277 | | - if(row[0]=='do_search'){ |
278 | | - return '<span class="ac_txt">'+row[1].replace('$1',$j('#searchInput').val())+'</span>'; |
279 | | - }else if(row[2]=='no_image'){ |
280 | | - return '<span class="ac_txt">'+row[1]+'</span>'; |
281 | | - }else{ |
282 | | - return '<img width="44" src="'+ row[2] + '"><span class="ac_img_txt">'+row[1]+'</span>'; |
283 | | - } |
284 | | - }, |
285 | | - matchSubset:0, |
286 | | - extraParams:{action:'ajax',rs:'mv_auto_complete_all'}, |
287 | | - paramName:'rsargs[]', |
288 | | - resultElem:'#suggestionsInner', |
289 | | - resultContainer:'#suggestions' |
290 | | - }); |
| 237 | + var uri = wgScript; |
| 238 | + //add the person choices div to searchInput |
| 239 | + //turn off browser baseed autocomplete: |
| 240 | + $j('#searchInput').attr('autocomplete',"off"); |
| 241 | + |
| 242 | + // add the sugestions div (abolute positioned so it can be ontop of everything) |
| 243 | + $j('body').prepend('<div id="suggestions" style="position:absolute;display:none;z-index:50;">'+ |
| 244 | + '<div id="suggestionsTop"></div>'+ |
| 245 | + '<div id="suggestionsInner" class="suggestionsBox">'+ |
| 246 | + '</div>'+ |
| 247 | + '<div id="suggestionsBot"></div>'+ |
| 248 | + '</div>'); |
| 249 | + //position the sugestions below the search field: |
| 250 | + if( $j('#searchInput').get(0)!=null){ |
| 251 | + sf_pos = $j('#searchInput').offset(); |
| 252 | + sf_pos['top']=sf_pos['top']+40; |
| 253 | + sf_pos['left']=sf_pos['left']-220; |
| 254 | + //js_log("moved sugest to: " + sf_pos['top'] + ' '+ sf_pos['left']); |
| 255 | + $j('#suggestions').css(sf_pos); |
| 256 | + } |
| 257 | + //add hook: |
| 258 | + $j('#searchInput').autocomplete( |
| 259 | + uri, |
| 260 | + { |
| 261 | + autoFill:false, |
| 262 | + onItemSelect:function(v){ |
| 263 | + //alert('selected:' + v.innerHTML + ' page:'+$j('#searchInput').val()); |
| 264 | + //jump to page: |
| 265 | + if($j('#searchInput').val()=='do_search'){ |
| 266 | + qs = v.innerHTML.toLowerCase().indexOf('<b>')+3; |
| 267 | + qe = v.innerHTML.toLowerCase().indexOf('</b>'); |
| 268 | + //update the search input (incase redirect fails) |
| 269 | + $j('#searchInput').val(v.innerHTML.substring(qs,qe)); |
| 270 | + window.location = uri+'/'+'Special:MediaSearch?mv_search='+v.innerHTML.substring(qs,qe); |
| 271 | + }else{ |
| 272 | + window.location = uri+'/'+$j('#searchInput').val(); |
| 273 | + } |
| 274 | + }, |
| 275 | + formatItem:function(row){ |
| 276 | + if(row[0]=='do_search'){ |
| 277 | + return '<span class="ac_txt">'+row[1].replace('$1',$j('#searchInput').val())+'</span>'; |
| 278 | + }else if(row[2]=='no_image'){ |
| 279 | + return '<span class="ac_txt">'+row[1]+'</span>'; |
| 280 | + }else{ |
| 281 | + return '<img width="44" src="'+ row[2] + '"><span class="ac_img_txt">'+row[1]+'</span>'; |
| 282 | + } |
| 283 | + }, |
| 284 | + matchSubset:0, |
| 285 | + extraParams:{action:'ajax',rs:'mv_auto_complete_all'}, |
| 286 | + paramName:'rsargs[]', |
| 287 | + resultElem:'#suggestionsInner', |
| 288 | + resultContainer:'#suggestions' |
| 289 | + }); |
291 | 290 | } |
\ No newline at end of file |