r60257 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60256‎ | r60257 | r60258 >
Date:11:45, 21 December 2009
Author:dale
Status:deferred
Tags:
Comment:
* some add-media-wizard fixes
* some timed text updates
Modified paths:
  • /branches/js2-work/phase3/js/editPage.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/jquery/jquery.ui/themes/redmond/jquery-ui-1.7.1.custom.css (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/loader.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.RemoteSearchDriver.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/ClipEdit/loader.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/loader.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/TimedText/Itext.js (deleted) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/TimedText/loader.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedTextEdit.css (added) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedTextEdit.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/mwEmbed.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/jquery/jquery.ui/themes/redmond/jquery-ui-1.7.1.custom.css
@@ -46,7 +46,7 @@
4747
4848 /* Component containers
4949 ----------------------------------*/
50 -.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1.1em; }
 50+.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 12px; }
5151 .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; }
5252 .ui-widget-content { border: 1px solid #a6c9e2; background: #fcfdfd url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x; color: #222222; }
5353 .ui-widget-content a { color: #222222; }
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/Itext.js
@@ -1,691 +0,0 @@
2 -/* ***** BEGIN LICENSE BLOCK *****
3 - * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 - *
5 - * The contents of this file are subject to the Mozilla Public License Version
6 - * 1.1 (the "License"); you may not use this file except in compliance with
7 - * the License. You may obtain a copy of the License at
8 - * http://www.mozilla.org/MPL/
9 - *
10 - * Software distributed under the License is distributed on an "AS IS" basis,
11 - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 - * for the specific language governing rights and limitations under the
13 - * License.
14 - *
15 - * The Original Code is HTML5 video itext demonstration code.
16 - *
17 - * The Initial Developer of the Original Code is Mozilla Corporation.
18 - * Portions created by the Initial Developer are Copyright (C) 2009
19 - * the Initial Developer. All Rights Reserved.
20 - *
21 - * Contributor(s):
22 - * Silvia Pfeiffer <silvia@siliva-pfeiffer.de>
23 - *
24 - * Adapted by:
25 - * Michael Dale <mdale@wikimedia.org>
26 - *
27 - * Alternatively, the contents of this file may be used under the terms of
28 - * either the GNU General Public License Version 2 or later (the "GPL"), or
29 - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 - * in which case the provisions of the GPL or the LGPL are applicable instead
31 - * of those above. If you wish to allow use of your version of this file only
32 - * under the terms of either the GPL or the LGPL, and not to allow others to
33 - * use your version of this file under the terms of the MPL, indicate your
34 - * decision by deleting the provisions above and replace them with the notice
35 - * and other provisions required by the GPL or the LGPL. If you do not delete
36 - * the provisions above, a recipient may use your version of this file under
37 - * the terms of any one of the MPL, the GPL or the LGPL.
38 - *
39 - * ***** END LICENSE BLOCK ***** */
40 -
41 -// Stop JSLint whinging about globals //
42 -/*global jQuery: true, window: true, ITEXT_ERR: true, ItextCollection: true, Itext: true, LoadFile: true, categoryName: true, languageName: true, parseInt: true, parseSrt: true, parseLrc: true */
43 -
44 -// Function to convert language code to language name
45 -// should be available inside the browser
46 -function languageName(abbrev) {
47 - // see http://www.iana.org/assignments/language-subtag-registry
48 - // no sign languages included right now
49 - var langHash = {
50 - "aa": "Afar",
51 - "ab": "Abkhazian",
52 - "ae": "Avestan",
53 - "af": "Africaans",
54 - "ak": "Akan",
55 - "am": "Amharic",
56 - "an": "Aragonese",
57 - "anp": "Angika",
58 - "ar": "Arabic",
59 - "ar-ae": "Arabic (U.A.E.)",
60 - "ar-bh": "Arabic (Bahrain)",
61 - "ar-dz": "Arabic (Algeria)",
62 - "ar-eg": "Arabic (Egypt)",
63 - "ar-iq": "Arabic (Iraq)",
64 - "ar-jo": "Arabic (Jordan)",
65 - "ar-kw": "Arabic (Kuwait)",
66 - "ar-lb": "Arabic (Lebanon)",
67 - "ar-ly": "Arabic (Libya)",
68 - "ar-ma": "Arabic (Morocco)",
69 - "ar-om": "Arabic (Oman)",
70 - "ar-qa": "Arabic (Qatar)",
71 - "ar-sa": "Arabic (Saudi Arabia)",
72 - "ar-sy": "Arabic (Syria)",
73 - "ar-tn": "Arabic (Tunisia)",
74 - "ar-ye": "Arabic (Yemen)",
75 - "as": "Assamese",
76 - "ast": "Asturian",
77 - "av": "Avaric",
78 - "ay": "Aymara",
79 - "az": "Azerbaijani",
80 - "ba": "Bashkir",
81 - "be": "Belarusian",
82 - "bg": "Bulgarian",
83 - "bg-bg": "Bulgarian (Bulgaria)",
84 - "bh": "Bihari",
85 - "bi": "Bislama",
86 - "bm": "Bambara",
87 - "bn": "Bengali",
88 - "bo": "Tibetan",
89 - "br": "Breton",
90 - "bs": "Bosnian",
91 - "ca": "Catalan",
92 - "ca-es": "Catalan (Catalan)",
93 - "ce": "Chechen",
94 - "ch": "Chamorro",
95 - "co": "Corsican",
96 - "cr": "Cree",
97 - "cs": "Czech",
98 - "cs-cz": "Czech (Czech Republic)",
99 - "cu": "Church Slavic",
100 - "cv": "Cuvash",
101 - "cy": "Welsh",
102 - "da": "Danish",
103 - "da-dk": "Danish (Denmark)",
104 - "de": "German",
105 - "de-at": "German (Austria)",
106 - "de-ch": "German (Swiss)",
107 - "de-de": "German (Germany)",
108 - "de-li": "Deutsch (Lichtenstein)",
109 - "de-lu": "Deutsch (Luxemburg)",
110 - "dv": "Divehi",
111 - "dz": "Dzongkha",
112 - "ee": "Ewe",
113 - "el": "Greek",
114 - "en": "English",
115 - "en-au": "English (Australia)",
116 - "en-bz": "English (Belize)",
117 - "en-ca": "English (Canada)",
118 - "en-gb": "English (Great Britan)",
119 - "en-ie": "English (Ireland)",
120 - "en-jm": "English (Jamaica)",
121 - "en-nz": "English (New Zealand)",
122 - "en-ph": "English (Philippines)",
123 - "en-uk": "English (Great Britan)",
124 - "en-us": "English (United States)",
125 - "en-tt": "English (Trinidad)",
126 - "en-za": "English (South Africa)",
127 - "en-zw": "English (Zimbabwe)",
128 - "eo": "Ensperanto",
129 - "es": "Spanish",
130 - "es-ar": "Spanish (Argentina)",
131 - "es-bo": "Spanish (Bolivia)",
132 - "es-cl": "Spanish (Chile)",
133 - "es-co": "Spanish (Colombia)",
134 - "es-cr": "Spanish (Costa Rica)",
135 - "es-do": "Spanish (Dominican Republic)",
136 - "es-ec": "Spanish (Ecuador)",
137 - "es-es": "Spanish (Spain)",
138 - "es-gt": "Spanish (Guatemala)",
139 - "es-hn": "Spanish (Honduras)",
140 - "es-sv": "Spanish (El Salvador)",
141 - "es-mx": "Spanish (Mexico)",
142 - "es-nt": "Spanish (Nicaragua)",
143 - "es-pa": "Spanish (Panama)",
144 - "es-pe": "Spanish (Peru)",
145 - "es-pr": "Spanish (Puerto Rico)",
146 - "es-py": "Spanish (Paraguay)",
147 - "es-uy": "Spanish (Uruguay)",
148 - "es-ve": "Spanish (Venezuela)",
149 - "et": "Estonian",
150 - "eu": "Basque",
151 - "fa": "Persian",
152 - "ff": "Fulah",
153 - "fi": "Finnish",
154 - "fj": "Fijian",
155 - "fo": "Faroese",
156 - "fr": "French",
157 - "fr-be": "French (Belgium)",
158 - "fr-ca": "French (Canada)",
159 - "fr-ch": "French (Swiss)",
160 - "fr-fr": "French (France)",
161 - "fr-lu": "French (Luxemburg)",
162 - "fr-mc": "French (Mexico)",
163 - "frr": "Frisian",
164 - "fy": "Western Frisian",
165 - "ga": "Irish",
166 - "gd": "Gaelic",
167 - "gl": "Galician",
168 - "gn": "Guarani",
169 - "gu": "Gujarati",
170 - "gv": "Manx",
171 - "ha": "Hausa",
172 - "he": "Hebrew",
173 - "hi": "Hindi",
174 - "ho": "Hiri Motu",
175 - "hr": "Croatian",
176 - "hsb": "High Sorbian",
177 - "ht": "Haitian",
178 - "hu": "Hungarian",
179 - "hy": "Armenian",
180 - "hz": "Herero",
181 - "ia": "Interlingua",
182 - "id": "Indonesian",
183 - "ie": "Interlingue",
184 - "ig": "Igbo",
185 - "ii": "Sichuan Yi",
186 - "ik": "Inupiaq",
187 - "in": "Indonesian",
188 - "io": "Ido",
189 - "is": "Icelandic",
190 - "it": "Italian",
191 - "it-ch": "Italian (Swiss)",
192 - "iu": "Inuktitut",
193 - "iw": "Hebrew",
194 - "ja": "Japanese",
195 - "ji": "Yiddish",
196 - "jv": "Javanese",
197 - "ka": "Georian",
198 - "kg": "Kongo",
199 - "ki": "Kikuyu",
200 - "kj": "Kuanyama",
201 - "kk": "Kasakh",
202 - "kl": "Kalaallisut",
203 - "km": "Central Khmer",
204 - "kn": "Kannada",
205 - "ko": "Korean",
206 - "ko-kp": "Korean (North Korea)",
207 - "ko-kr": "Korean (South Korea)",
208 - "kr": "Kanuri",
209 - "ks": "Kashmiri",
210 - "ku": "Kurdish",
211 - "kv": "Komi",
212 - "kw": "Cornish",
213 - "ky": "Kyrgyz",
214 - "la": "Latin",
215 - "lb": "Luxembourgish",
216 - "lg": "Ganda",
217 - "li": "Limburgan",
218 - "ln": "Lingala",
219 - "lo": "Lao",
220 - "lt": "Lithuanian",
221 - "lu": "Luba-Katanga",
222 - "lv": "Latvian",
223 - "mg": "Malagasy",
224 - "mh": "Marshallese",
225 - "mi": "Maori",
226 - "mk": "Macedonian",
227 - "mk-mk": "Macedonian (F.J.R. Macedonia)",
228 - "ml": "Malayalam",
229 - "mn": "Mongolian",
230 - "mo": "Moldavian",
231 - "mr": "Marathi",
232 - "ms": "Malay",
233 - "mt": "Maltese",
234 - "my": "Burmese",
235 - "na": "Nauru",
236 - "nb": "Nowegian Bokm&#xE5;l",
237 - "nd": "North Ndebele",
238 - "ne": "Nepali",
239 - "ng": "Ndonga",
240 - "nl": "Dutch",
241 - "nl-be": "Dutch (Belgium)",
242 - "nn": "Nowegian Nynorsk",
243 - "no": "Nowegian",
244 - "nr": "South Ndebele",
245 - "nv": "Navajo",
246 - "ny": "Chichewa",
247 - "oc": "Occitan",
248 - "oj": "Ojibwa",
249 - "om": "Oromo",
250 - "or": "Oriya",
251 - "os": "Ossetian",
252 - "pa": "Panjabi",
253 - "pi": "Pali",
254 - "pl": "Polish",
255 - "ps": "Pushto",
256 - "pt": "Portuguese",
257 - "pt-br": "Portuguese (Brasil)",
258 - "qu": "Quechua",
259 - "rm": "Romansh",
260 - "rn": "Rundi",
261 - "ro": "Romanian",
262 - "ru": "Russian",
263 - "rw": "Kinyarwanda",
264 - "sa": "Sanskit",
265 - "sc": "Sardinian",
266 - "sd": "Sindhi",
267 - "se": "Northern Sami",
268 - "sg": "Sango",
269 - "sh": "Serbo-Croatian",
270 - "si": "Sinhala",
271 - "sk": "Slovak",
272 - "sl": "Slovenian",
273 - "sm": "Samoan",
274 - "sn": "Shona",
275 - "so": "Somali",
276 - "sq": "Albanian",
277 - "sr": "Serbian",
278 - "ss": "Swati",
279 - "st": "Southern Sotho",
280 - "su": "Sundanese",
281 - "sv": "Swedish",
282 - "sv-fi": "Swedisch (Finnland)",
283 - "sw": "Swahili",
284 - "ta": "Tamil",
285 - "te": "Telugu",
286 - "tg": "Tajik",
287 - "th": "Thai",
288 - "ti": "Tigrinya",
289 - "tk": "Turkmen",
290 - "tl": "Tagalog",
291 - "tn": "Tswana",
292 - "to": "Tonga",
293 - "tr": "Turkish",
294 - "ts": "Tsonga",
295 - "tt": "Tatar",
296 - "tw": "Twi",
297 - "ty": "Tahitian",
298 - "ug": "Uighur",
299 - "uk": "Ukrainian",
300 - "ur": "Urdu",
301 - "uz": "Uzbek",
302 - "ve": "Venda",
303 - "vi": "Vietnamese",
304 - "vo": "Volap&#xFC;k",
305 - "wa": "Walloon",
306 - "wo": "Wolof",
307 - "xh": "Xhosa",
308 - "yi": "Yiddish",
309 - "yo": "Yoruba",
310 - "za": "Zhuang",
311 - "zh": "Chinese",
312 - "zh-chs": "Chinese (Simplified)",
313 - "zh-cht": "Chinese (Traditional)",
314 - "zh-cn": "Chinese (People's Republic of China)",
315 - "zh-guoyu": "Mandarin",
316 - "zh-hk": "Chinese (Hong Kong S.A.R.)",
317 - "zh-min-nan": "Min-Nan",
318 - "zh-mp": "Chinese (Macau S.A.R.)",
319 - "zh-sg": "Chinese (Singapore)",
320 - "zh-tw": "Chinese (Taiwan)",
321 - "zh-xiang": "Xiang",
322 - "zu": "Zulu"
323 - };
324 - if (langHash[abbrev]) {
325 - return langHash[abbrev];
326 - } else {
327 - return null;
328 - }
329 -}
330 -
331 -// Function to convert category code to category name
332 -function categoryName(abbrev) {
333 - // see http://www.iana.org/assignments/language-subtag-registry
334 - var catHash = {
335 - "CC": "Captions",
336 - "SUB": "Subtitles",
337 - "TAD": "Audio Description",
338 - "KTV": "Karaoke",
339 - "TIK": "Ticker Text",
340 - "AR": "Active Regions",
341 - "NB": "Annotation",
342 - "META": "Timed Metadata",
343 - "TRX": "Transcript",
344 - "LRC": "Lyrics",
345 - "LIN": "Linguistic Markup",
346 - "CUE": "Cue Points"
347 - };
348 - if (catHash[abbrev]) {
349 - return catHash[abbrev];
350 - } else {
351 - return null;
352 - }
353 -}
354 -
355 -
356 -// This is where the implementation of iText starts
357 -// list of potential errors created with iText parsing
358 -var ITEXT_ERR = {
359 - ABORTED: 1, // fetching aborted
360 - NETWORK: 2, // network error
361 - PARSE: 3, // parsing error of itext resource
362 - SRC_NOT_SUPPORTED: 4, // unsuitable itext resource
363 - LANG: 5 // language mismatch
364 -};
365 -
366 -
367 -// class to load a file, call the right parsing function,
368 -// and keep the parsed text segments
369 -var LoadFile = function (url, charset, type) {
370 - this.load(url, charset, type);
371 -};
372 -LoadFile.prototype = {
373 - url: null,
374 - textElements: [],
375 - error: 0,
376 - load: function (url, charset, type) {
377 - this.url = url;
378 - var handler = null;
379 - var content = [];
380 - var error = 0;
381 - // choose parsing function
382 - if (type === "text/srt") {
383 - handler = parseSrt;
384 - } else if (type === "text/lrc") {
385 - handler = parseLrc;
386 - } else {
387 - // no handler for given file type
388 - this.error = ITEXT_ERR.SRC_NOT_SUPPORTED;
389 - }
390 - // set the character encoding before the ajax request
391 - jQuery.ajaxSetup({
392 - 'beforeSend' : function (xhr) {
393 - xhr.overrideMimeType("text/text; charset=" + charset);
394 - }
395 - });
396 - jQuery.ajax({
397 - type: "GET",
398 - url: url,
399 - data: {},
400 - success: function (data, textStatus) {
401 - content = handler(data);
402 - },
403 - error: function () {
404 - error = ITEXT_ERR.NETWORK;
405 - },
406 - dataType: 'text',
407 - async: false,
408 - cache: false // REMOVE AFTER TESTING: FIXME
409 - });
410 - if (!error && !content) {
411 - this.error = ITEXT_ERR.PARSE;
412 - } else if (error) {
413 - this.error = error;
414 - }
415 - this.textElements = content;
416 - }
417 -};
418 -
419 -
420 -// class to hold an itext track
421 -var Itext = function (track) {
422 - this.init(track);
423 -};
424 -Itext.prototype = {
425 - src: null,
426 - lang: null,
427 - langName: null,
428 - type: "text/srt",
429 - charset: null,
430 - delay: 0,
431 - stretch: 100,
432 - fetched: false,
433 - error: 0,
434 - allText: [],
435 - init: function (itext) {
436 - this.src = jQuery(itext).attr("src");
437 - this.lang = jQuery(itext).attr("lang");
438 - this.langName = languageName(this.lang);
439 - this.type = (jQuery(itext).attr("type") || "text/srt");
440 - this.charset = (jQuery(itext).attr("charset") || "UTF-8");
441 - this.delay = (jQuery(itext). attr("delay") || 0);
442 - this.stretch = (jQuery(itext).attr("stretch") || 100);
443 - },
444 - fetch: function () {
445 - if (this.type === "text/srt" || this.type === "text/lrc") {
446 - var file = new LoadFile(this.src, this.charset, this.type);
447 - this.error = file.error;
448 - this.allText = file.textElements;
449 -
450 - // adjust for delay and stretch factor
451 - for (var i = 0; i < this.allText.length; i++) {
452 - this.allText[i].start = (this.allText[i].start * (this.stretch/100.0)) + this.delay;
453 - this.allText[i].end = (this.allText[i].end * (this.stretch/100.0)) + this.delay;
454 - }
455 -
456 - this.fetched = true;
457 - } else {
458 - this.error = ITEXT_ERR.SRC_NOT_SUPPORTED;
459 - }
460 - },
461 - currentText: function ( currentTime ) {
462 - var lines = [];
463 - for (var i = 0; i < this.allText.length; i++) {
464 - if (this.allText[i].end) {
465 - if (currentTime >= this.allText[i].start && currentTime < this.allText[i].end) {
466 - lines.push('<div class="text">' + this.allText[i].content + '</div>');
467 - }
468 - } else {
469 - if (currentTime >= this.allText[i].start) {
470 - lines.push('<div class="text">' + this.allText[i].content + '</div>');
471 - }
472 - }
473 - }
474 - // produce output
475 - var content;
476 - if (lines.length === 0) {
477 - content = null;
478 - } else {
479 - content = lines.join("<br>\n");
480 - }
481 - return content;
482 - }
483 -};
484 -
485 -
486 -// Class to hold an itextlist
487 -var ItextList = function (itextlist) {
488 - this.init(itextlist);
489 -};
490 -ItextList.prototype = {
491 - itextlist: null,
492 - category: null,
493 - active: "auto",
494 - name: null,
495 - itexts: [],
496 - onenter: null,
497 - onleave: null,
498 - primary_lang: null,
499 - secondary_lang: null,
500 - init: function (itextlist) {
501 - this.itextlist = itextlist;
502 - this.category = jQuery(itextlist).attr("category");
503 - this.active = (jQuery(itextlist).attr("active") || "none");
504 - this.name = jQuery(itextlist).attr("name");
505 - this.onenter = jQuery(itextlist).attr("onenter");
506 - this.onleave = jQuery(itextlist).attr("onleave");
507 -
508 - // parse the itext elements
509 - this.load();
510 -
511 - // fetch the appropriate track
512 - var default_lang;
513 - if (this.primary_lang) {
514 - default_lang = this.primary_lang;
515 - } else if (this.secondary_lang) {
516 - default_lang = this.secondary_lang;
517 - }
518 - if (this.active != "none") {
519 - if (this.active == "auto") {
520 - this.active = default_lang;
521 - } else {
522 - if (!this.itexts[this.active]) {
523 - this.active = "none";
524 - }
525 - }
526 - this.itexts[this.active].fetch();
527 - }
528 - },
529 - load: function() {
530 - var tracks_tmp = this.itextlist.find('itext');
531 - var itexts_tmp = {};
532 - var primary_lang_tmp = null;
533 - var secondary_lang_tmp = null;
534 -
535 - tracks_tmp.each(function (i) {
536 - // create the text track and add to the itexts array
537 - var track = new Itext(jQuery(this));
538 - itexts_tmp[track.lang] = {};
539 - itexts_tmp[track.lang] = track;
540 -
541 - // check for appropriate language in this track for later fetching
542 - if (track.lang === window.navigator.language) {
543 - primary_lang_tmp = track.lang; // complete lang match
544 - } else if (track.lang === window.navigator.language.substr(0, 2)) {
545 - secondary_lang_tmp = track.lang; // only main lang match
546 - }
547 - });
548 - this.itexts = itexts_tmp;
549 - this.secondary_lang = secondary_lang_tmp;
550 - this.primary_lang = primary_lang_tmp;
551 - },
552 - enable: function(lang) {
553 - if (lang === 'none') {
554 - this.active = "none";
555 - } else if (this.itexts[lang]) {
556 - this.itexts[lang].fetch();
557 - this.active = lang;
558 - }
559 - }
560 -};
561 -
562 -
563 -
564 -// class to parse all itextlists under a media element
565 -// and create a menu
566 -// would need to be implemented inside Browser
567 -var ItextCollection = function (video, div_id) {
568 - this.init(video, div_id);
569 -};
570 -ItextCollection.prototype = {
571 - video: null,
572 - div_id: null,
573 - itextlist: {},
574 -
575 - init: function (vid, div) {
576 - this.video = vid;
577 - this.div_id = div;
578 - this.load();
579 - // set up display divs for each category
580 - for (var i in this.itextlist) {
581 - jQuery("#" + this.div_id).append("<div class='itext_" + i + "'></div>");
582 - }
583 - },
584 - load: function () {
585 - // go through each itextlist, parse it and add it to itextlist{}
586 - var tracks_tmp = this.video.find('itextlist');
587 - var itextlist_tmp={};
588 -
589 - tracks_tmp.each(function (i) {
590 - // create the itextlist track
591 - var ilist = new ItextList(jQuery(this));
592 - itextlist_tmp[ilist.category] = {};
593 - itextlist_tmp[ilist.category] = ilist;
594 - });
595 - this.itextlist = itextlist_tmp;
596 - },
597 - itextMenu: function (baseEl, elstring) {
598 - var appendText = '<div class="itextMenu" role="presentation">\n';
599 - appendText += '<ul class="catMenu" role="presentation">\n';
600 - for (var i in this.itextlist) {
601 - var subm = this.itextlist[i];
602 - var submenu = subm.name || categoryName(i);
603 - appendText += '<li role="menuitem" aria-haspopup="true" tabindex="0"> &lt; &nbsp;' + submenu + '\n';
604 - appendText += '<ul class="langMenu" role="menu" >\n';
605 - // add a default of "none" element to menu
606 - appendText += '<li role="menuitemradio" tabindex="0"';
607 - if (subm.active === 'none') {
608 - appendText += ' aria-checked="true"';
609 - } else {
610 - appendText += ' aria-checked="false"';
611 - }
612 - appendText += '><a href="#" onclick="'+elstring+'.itexts.itextlist[\'' + i + '\'].enable(\'none\');jQuery(\'.catMenu\').css(\'visibility\', \'hidden\');return false;">None</a></li>\n';
613 - for (var j in subm.itexts) {
614 - var elt = subm.itexts[j];
615 - appendText += '<li role="menuitemradio" tabindex="0"';
616 - if (subm.active === j) {
617 - appendText += ' aria-checked="true"';
618 - } else {
619 - appendText += ' aria-checked="false"';
620 - }
621 - appendText += '><a href="#" onclick="'+elstring+'.itexts.itextlist[\'' + i + '\'].enable(\'' + j + '\');jQuery(\'.catMenu\').css(\'visibility\', \'hidden\');return false;">' + elt.langName + '</a></li>\n';
622 - }
623 - appendText += '</ul>\n</li>\n';
624 - }
625 - appendText += '</ul></div>\n';
626 - jQuery(baseEl).append(appendText);
627 - var videoHeight = jQuery(this.video).css("height").substr(0, jQuery(this.video).css("height").length - 2);
628 - jQuery(".langMenu").css("height", "240px");
629 - jQuery(".catMenu").css("visibility", "hidden");
630 - },
631 - show: function (currentTime) {
632 - // add to correct content container
633 - var mc_width = jQuery('.mc').css("width").substr(0, jQuery('.mc').css("width").length - 2);
634 -
635 - // get content per category, if active, and display it
636 - var content = null;
637 - for (var i in this.itextlist) {
638 - var li = this.itextlist[i];
639 -
640 - // get content for active tracks only
641 - if (li.active != "none") {
642 - content = li.itexts[li.active].currentText(currentTime);
643 -
644 - // update content & styling of itext div if necessary
645 - if (content) {
646 - if (jQuery("#" + this.div_id + " > .itext_" + i).html() !== content) {
647 -
648 - // update content and make it visible
649 - jQuery("#" + this.div_id + " > .itext_" + i).html(content);
650 - jQuery("#" + this.div_id + " > .itext_" + i).css("visibility", "visible");
651 -
652 - // update styling dependent on text length
653 - if (i === "CUE") {
654 - jQuery("#" + this.div_id + " > .itext_" + i + " > .text").prepend("Chapter: ");
655 - }
656 - if (i === "TAD") {
657 - jQuery("#" + this.div_id + " > .itext_TAD").css("max-width", (mc_width) + "px");
658 - }
659 - if (i === "LRC") {
660 - jQuery("#" + this.div_id + " > .itext_LRC").css("max-width", mc_width + "px");
661 - // somehow the setting of "left" encourages the correct width to be calculated
662 - // if I don't do that, the width calculation in text_half_length is too short on some elements
663 - jQuery("#" + this.div_id + " > .itext_LRC").css("left",5);
664 - var text_half_length = jQuery("#" + this.div_id + " > .itext_LRC > .text").css("width").substr(0, jQuery("#" + this.div_id + " > .itext_LRC > .text").css("width").length - 2) / 2;
665 - jQuery("#" + this.div_id + " > .itext_LRC").css("left", ((mc_width / 2) - text_half_length - 7) + "px");
666 - }
667 - if (i === "CC" ||
668 - i === "SUB" ||
669 - i === "KTV" ||
670 - i === "TRX" ||
671 - i === "LIN") {
672 - // anyone with a better idea for how to place the captions bottom center, please speak up
673 - jQuery("#" + this.div_id + " > .itext_" + i).css("max-width", mc_width + "px");
674 - // somehow the setting of "left" encourages the correct width to be calculated
675 - // if I don't do that, the width calculation in text_half_length is too short on some elements
676 - jQuery("#" + this.div_id + " > .itext_" + i).css("left",5);
677 - var text_half_length = jQuery("#" + this.div_id + " > .itext_" + i + " > .text").css("width").substr(0, jQuery("#" + this.div_id + " > .itext_" + i + " > .text").css("width").length - 2) / 2;
678 - jQuery("#" + this.div_id + " > .itext_" + i).css("left", ((mc_width / 2) - text_half_length - 7) + "px");
679 - }
680 - }
681 - } else {
682 - // remove content
683 - jQuery("#" + this.div_id + " > .itext_" + i).css("visibility", "hidden");
684 - }
685 - } else {
686 - // remove content
687 - jQuery("#" + this.div_id + " > .itext_" + i).css("visibility", "hidden");
688 - }
689 - }
690 - }
691 -};
692 -
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/loader.js
@@ -9,7 +9,8 @@
1010
1111 //Add css dependency:
1212 mw.addClassStyleSheets( {
13 - "$j.fn.menu" : "modules/TimedText/jquery.menu.css"
 13+ "$j.fn.menu" : "modules/TimedText/jquery.menu.css",
 14+ "mw.TimedTextEdit": "modules/TimedText/mw.TimedTextEdit.css"
1415 });
1516
1617 // TimedText module
@@ -18,3 +19,19 @@
1920 callback( 'TimedText' );
2021 } );
2122 });
 23+
 24+// TimedText editor:
 25+mw.addModuleLoader( 'TimedText.Edit', function( callback ){
 26+ mw.load([
 27+ [
 28+ '$j.ui',
 29+ 'mw.TimedTextEdit'
 30+ ],
 31+ [
 32+ '$j.ui.dialog',
 33+ '$j.ui.tabs'
 34+ ]
 35+ ], function( ){
 36+ callback( 'TimedText.Edit' );
 37+ });
 38+});
\ No newline at end of file
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js
@@ -362,41 +362,36 @@
363363 // Chouse text menu item ( if there are sources)
364364 if( _this.textSources.length != 0 ){
365365 $menu.append(
366 - _this.getLi( gM( 'mwe-chose-text') ).append(
 366+ _this.getLi( gM( 'mwe-chose-text'), 'comment' ).append(
367367 _this.getLanguageMenu()
368 - )
369 - )
370 - }else{
371 - // Put in the "Make Transcript" link
372 - $menu.append(
373 - _this.getLi( gM( 'mwe-add-timed-text'), 'script', function(){
374 - _this.showTimedTextEditUI( 'add' );
375 - } )
376 - );
377 -
 368+ ),
 369+ // Layout Menu option
 370+ _this.getLi( gM( 'mwe-layout' ), 'image' ).append(
 371+ _this.getLayoutMenu()
 372+ ),
 373+
 374+ // Search Menu option
 375+ _this.getLi( gM('mwe-search'), 'search')
 376+ );
378377 }
379 - $menu.append(
380 - // Layout Menu option
381 - _this.getLi( gM( 'mwe-layout' ) ).append(
382 - _this.getLayoutMenu()
383 - ),
 378+ // Put in the "Make Transcript" link
 379+ $menu.append(
 380+ _this.getLiAddText()
 381+ );
384382
385 - // Search Menu option
386 - _this.getLi( gM('mwe-search'), 'search')
387 - );
 383+
388384 return $menu;
389385 },
390386
391387 /**
392388 * Shows the timed text edit ui
393 - */
394 -
 389+ */
395390 showTimedTextEditUI: function( mode ){
396391 var _this = this;
397392 // Show a loader:
398393 $j.addLoaderDialog( gM( 'mwe-loading-text-edit' ));
399394 // Load the timedText edit interface
400 - mw.load( 'mw.TimedTextEdit', function(){
 395+ mw.load( 'TimedText.Edit', function(){
401396 $j.closeLoaderDialog();
402397 if( ! _this.editText ){
403398 _this.editText = new mw.TimedTextEdit();
@@ -409,9 +404,20 @@
410405 * Get menu line item (li) html: <li><a> msgKey </a></li>
411406 *
412407 * @param {String} msgKey Msg key for menu item
413 - */
 408+ */
414409
415410 /**
 411+ * get the add text menu item:
 412+ */
 413+ getLiAddText: function(){
 414+ var _this = this;
 415+ return '';
 416+ return _this.getLi( gM( 'mwe-add-timed-text'), 'script', function(){
 417+ _this.showTimedTextEditUI( 'add' );
 418+ } )
 419+ },
 420+
 421+ /**
416422 * Get line item (li) from source object
417423 * @param {Object} source Source to get menu line item from
418424 */
@@ -453,7 +459,9 @@
454460 .click( callback )
455461 )
456462 if( icon )
457 - $li.find( 'a' ).append( $j('<span style="float:left;" class="ui-icon ui-icon-' + icon + '"/>') )
 463+ $li.find( 'a' ).append(
 464+ $j('<span style="float:left;">').addClass( 'ui-icon ui-icon-' + icon )
 465+ )
458466 $li.find( 'a' ).append( $j('<span>').text( string ) );
459467 return $li;
460468 },
@@ -629,6 +637,12 @@
630638 for(var i in sourcesWithoutCategory){
631639 $langMenu.append( sourcesWithoutCategory[i] )
632640 }
 641+
 642+ //Add in the "add text" to the end of the interface:
 643+ $langMenu.append(
 644+ _this.getLiAddText()
 645+ );
 646+
633647 return $langMenu;
634648 },
635649
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedTextEdit.css
@@ -0,0 +1,201 @@
 2+.TimedTextEdit .leftcolumn #textinput textarea
 3+{
 4+ width:512px;
 5+ height:200px;
 6+}
 7+
 8+.TimedTextEdit .leftcolumn #textinput
 9+{
 10+ display: block;
 11+ margin: auto;
 12+ position:absolute;
 13+ top: 340px;
 14+}
 15+
 16+.TimedTextEdit .leftcolumn
 17+{
 18+ padding: 10px;
 19+ width: 890px;
 20+ margin: auto;
 21+}
 22+
 23+.TimedTextEdit .rightcolumn
 24+{
 25+ padding: 10px;
 26+ width: 350px;
 27+ background-color: #606060;
 28+ color: #efefef;
 29+ border: 0px solid black;
 30+ line-height:100%;
 31+ margin-left: 300px;
 32+ position: absolute;
 33+ right: 10px;
 34+ top: 50px;
 35+ bottom: 75px;
 36+}
 37+
 38+.TimedTextEdit .tabs
 39+{
 40+ position:absolute;
 41+ top: 530px;
 42+}
 43+
 44+.TimedTextEdit .tab{
 45+ position:absolute;
 46+ background:#888;
 47+ border:1px solid black;
 48+ height:30px;
 49+ width:160px;
 50+ padding:4px;
 51+ text-align: center;
 52+}
 53+
 54+.TimedTextEdit .selected{
 55+ background:#bbb;
 56+ height:40px;
 57+}
 58+
 59+.TimedTextEdit #step1tab
 60+{
 61+ left: 0px;
 62+}
 63+
 64+.TimedTextEdit #step2tab
 65+{
 66+ left: 171px;
 67+}
 68+
 69+.TimedTextEdit #step3tab
 70+{
 71+ left: 342px;
 72+}
 73+
 74+.TimedTextEdit .nextstep
 75+{
 76+ position:absolute;
 77+ top: 600px;
 78+ left:197px;
 79+ width:100px;
 80+ height:25px;
 81+ text-align:center;
 82+ background:#77bb40;
 83+ color:white;
 84+ font-weight:bold;
 85+ padding:12px;
 86+ border: 1px solid black;
 87+}
 88+
 89+.TimedTextEdit #titles_list
 90+{
 91+ background: #ddd;
 92+ padding: 12px;
 93+ text-align:center;
 94+ position:absolute;
 95+ top:340px;
 96+ width:488px;
 97+ height:164px;
 98+}
 99+
 100+.TimedTextEdit .current_title
 101+{
 102+ font-size: larger;
 103+ background: #dd8
 104+}
 105+
 106+.TimedTextEdit .time_in
 107+{
 108+ font-size: xx-small;
 109+ position:absolute;
 110+ margin-top:2px;
 111+ margin-left:2em;
 112+}
 113+
 114+.TimedTextEdit .time_out
 115+{
 116+ font-size: xx-small;
 117+ position:absolute;
 118+ margin-top:2px;
 119+ margin-left:438px;
 120+}
 121+
 122+.TimedTextEdit a {
 123+ color:#aaa;
 124+}
 125+
 126+.TimedTextEdit video
 127+{
 128+ height:290px;
 129+ width:512px;
 130+}
 131+
 132+.TimedTextEdit .videodiv
 133+{
 134+ display: block;
 135+ margin: auto;
 136+ position:absolute;
 137+}
 138+
 139+.TimedTextEdit .subtitles
 140+{
 141+ width: 80%;
 142+ margin: auto;
 143+ position: relative;
 144+ text-align: center;
 145+ font-family: sans-serif;
 146+ line-height: 2em;
 147+ color: rgba(255,255,128, 1);
 148+ text-shadow: rgba(0,0,0, 0.6) 1px 1px;
 149+ background: rgba(0,0,0, 0.6);
 150+}
 151+
 152+.TimedTextEdit .subtitleslines1
 153+{
 154+ top: -4.8em;
 155+}
 156+
 157+.TimedTextEdit.subtitleslines2
 158+{
 159+ top: -6.8em;
 160+}
 161+
 162+.TimedTextEdit.subtitleslines3
 163+{
 164+ top: -8.8em;
 165+}
 166+
 167+.TimedTextEdit input[type=number]
 168+{
 169+ width:1.2em;
 170+ padding:2px;
 171+ background: #ffd;
 172+ border:none;
 173+}
 174+
 175+.TimedTextEdit input[type=text]
 176+{
 177+ background: #ffd;
 178+ border:none;
 179+ width:70%;
 180+}
 181+
 182+.TimedTextEdit .hotkeybox {
 183+ background: #333;
 184+ padding: 5px;
 185+ line-height: 200%;
 186+ font-size: small;
 187+ position:absolute;
 188+ width:340px;
 189+ bottom:10px;
 190+}
 191+
 192+.TimedTextEdit #titles_textarea {
 193+ font-family: helvetica, sans-serif;
 194+ line-height: 1.5em;
 195+}
 196+
 197+.TimedTextEdit .step-help{
 198+ bottom:155px;
 199+ overflow:auto;
 200+ position:absolute;
 201+ top:10px;
 202+}
\ No newline at end of file
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedTextEdit.js
@@ -1,21 +1,167 @@
22 /**
33 * Timed text edit interface based off of participatory culture foundation timed text mockups.
44 */
 5+mw.addMessages( {
 6+ "mew-timedtext-editor" : "Timed text editor",
 7+ "mwe-stage-transcribe" : "Transcribe",
 8+ "mwe-stage-sync" : "Sync",
 9+ "mwe-stage-translate" : "Translate",
 10+ "mwe-stage-upload" : "Upload from local file"
 11+} );
512
613 mw.TimedTextEdit = function(){
714 return this.init();
815 }
916 mw.TimedTextEdit.prototype = {
 17+ // The target container for the interface:
 18+ target_container: null,
 19+
 20+ // Interface steps can be "transcribe", "sync", "translate"
 21+ textEditStages:{
 22+ 'transcribe':{
 23+ 'icon' : 'comment'
 24+ },
 25+ 'sync':{
 26+ 'icon' : 'clock'
 27+ },
 28+ 'translate':{
 29+ 'icon' : 'flag'
 30+ },
 31+ 'upload':{
 32+ 'icon' : 'folder-open'
 33+ }
 34+ },
 35+
1036 /**
1137 * @constructor
1238 */
13 - init: function(){
 39+ init: function( options ){
1440
1541 },
 42+
1643 /**
1744 * Show the editor UI
1845 */
19 - showUI: function(){
 46+ showUI: function(){
 47+ // Setup the parent container:
 48+ this.createDialogContainer();
2049
 50+ // Setup the timedText editor interface
 51+ this.initDialog();
 52+ },
 53+
 54+ /**
 55+ * Setup the dialog layout: s
 56+ */
 57+ initDialog: function(){
 58+ var _this =this;
 59+
 60+ _this.createTabs();
 61+
 62+ },
 63+
 64+ /**
 65+ * Creates interface tabs from the textEditStages
 66+ */
 67+ createTabs: function(){
 68+ var _this = this;
 69+ $tabContainer = $j('<div id="TimedTextEdit-tabs"><ul></ul></div>');
 70+ for(var edit_stage_id in this.textEditStages){
 71+ var editStage = this.textEditStages[ edit_stage_id ];
 72+ // Append the menu item:
 73+ $tabContainer.find('ul').append(
 74+ $j('<li>').append(
 75+ $j('<a>')
 76+ .attr( 'href', '#' + edit_stage_id )
 77+ .append(
 78+ $j('<span style="float:left;">')
 79+ .addClass( 'ui-icon ui-icon-' + editStage.icon )
 80+ ,
 81+ $j('<span>')
 82+ .text( gM('mwe-stage-' + edit_stage_id) )
 83+ )
 84+ )
 85+ );
 86+ // Append the menu item content container
 87+ $tabContainer.append(
 88+ $j('<div>')
 89+ .attr( 'id', edit_stage_id )
 90+ .append(
 91+ _this.createInterface( edit_stage_id )
 92+ )
 93+ );
 94+ }
 95+ //debugger
 96+ // Add the tags to the target:
 97+ $j( _this.target_container ).append( $tabContainer );
 98+
 99+ //Add tabs interface
 100+ $j('#TimedTextEdit-tabs').tabs( {
 101+ select: function( event, ui ) {
 102+ _this.selectTab( $j( ui.tab ).attr( 'href' ).replace('#','') );
 103+ }
 104+ });
 105+
 106+ },
 107+ selectTab: function( tab_id ){
 108+ mw.log('sel: ' + tab_id);
 109+
 110+ },
 111+
 112+ /**
 113+ * Creates an interface for a given stage id
 114+ * @return the jquery interface
 115+ * @type {Object}
 116+ */
 117+ createInterface: function( edit_stage_id){
 118+
 119+ },
 120+ createDialogContainer: function(){
 121+ var _this = this;
 122+ //Setup the target container:
 123+ _this.target_container = '#timedTextEdit_target';
 124+ $j( _this.target_container ).remove();
 125+ $j( 'body' ).append(
 126+ $j('<div>')
 127+ .attr({
 128+ 'id' : 'timedTextEdit_target',
 129+ 'title' : gM( 'mew-timedtext-editor' )
 130+ })
 131+ .addClass('TimedTextEdit')
 132+ );
 133+
 134+ // Build cancel button
 135+ var cancelButton = {};
 136+ cancelButton[ gM( 'mwe-cancel' ) ] = function() {
 137+ _this.onCancelClipEdit();
 138+ }
 139+
 140+ $j( _this.target_container ).dialog( {
 141+ bgiframe: true,
 142+ autoOpen: true,
 143+ modal: true,
 144+ draggable: false,
 145+ resizable: false,
 146+ buttons: cancelButton,
 147+ close: function() {
 148+ // if we are 'editing' we should confirm they want to exist:
 149+ $j( this ).parents( '.ui-dialog' ).fadeOut( 'slow' );
 150+ }
 151+ } );
 152+
 153+ $j( _this.target_container ).dialogFitWindow();
 154+
 155+ // Add the window resize hook to keep dialog layout
 156+ $j( window ).resize( function() {
 157+ $j( _this.target_container ).dialogFitWindow();
 158+ } );
 159+
 160+ },
 161+
 162+ onCancelClipEdit: function(){
 163+ var _this = this;
 164+ // cancel edit
 165+ //debugger;
 166+ $j( _this.target_container ).dialog( 'close' );
21167 }
22168 }
\ No newline at end of file
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/loader.js
@@ -129,72 +129,4 @@
130130 ], function() {
131131 callback( 'AddMedia.firefoggRender' );
132132 });
133 -});
134 -
135 - /*
136 - var queuedFirefoggConf = { };
137 - // Take an input player as the selector and expose basic rendering controls
138 - $.fn.firefoggRender = function( options, callback ) {
139 - // Check if we already have render loaded then just pass on updates/actions
140 - var sElm = $j( this.selector ).get( 0 );
141 - //add a special attribute to the selector:
142 - if ( sElm['fogg_render'] ) {
143 - if ( sElm['fogg_render'] == 'loading' ) {
144 - mw.log( "Error: called firefoggRender while loading" );
145 - return false;
146 - }
147 - // Call or update the property:
148 - }
149 - sElm['fogg_render'] = 'loading';
150 - // Add the selector
151 - options['player_target'] = this.selector;
152 - mw.load( [
153 - 'mvBaseUploadInterface',
154 - 'mvFirefogg',
155 - 'mvFirefoggRender'
156 - ], function() {
157 - // Attach the firefoggRender obj to the selected elm:
158 - sElm['fogg_render'] = new mvFirefoggRender( options );
159 - if ( callback && typeof callback == 'function' )
160 - callback( sElm['fogg_render'] );
161 - } );
162 - }
163 -
164 - $.fn.baseUploadInterface = function( options ) {
165 - mw.load( [
166 - [
167 - 'mvBaseUploadInterface',
168 - '$j.ui'
169 - ],
170 - [
171 - '$j.ui.progressbar',
172 - '$j.ui.dialog'
173 - ]
174 - ], function() {
175 - myUp = new mvBaseUploadInterface( options );
176 - myUp.setupForm();
177 - } );
178 - }
179 -
180 -
181 - // Check if we already have Firefogg loaded (the call just updates the element's
182 - // properties)
183 - var sElm = $j( this.selector ).get( 0 );
184 - if ( sElm['firefogg'] ) {
185 - if ( sElm['firefogg'] == 'loading' ) {
186 - mw.log( "Queued firefogg operations ( firefogg " +
187 - "not done loading ) " );
188 - $j.extend( queuedFirefoggConf, options );
189 - return false;
190 - }
191 - // Update properties
192 - for ( var i in options ) {
193 - mw.log( "firefogg::updated: " + i + ' to ' + options[i] );
194 - sElm['firefogg'][i] = options[i];
195 - }
196 - return sElm['firefogg'];
197 - } else {
198 - // Avoid concurrency
199 - sElm['firefogg'] = 'loading';
200 - }
201 -*/
\ No newline at end of file
 133+});
\ No newline at end of file
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.RemoteSearchDriver.js
@@ -717,12 +717,19 @@
718718
719719 _this.target_container = '#rsd_modal_target';
720720 $j( 'body' ).append(
721 - '<div ' +
722 - 'id="rsd_modal_target" ' +
723 - 'style="position:absolute;top:3em;left:0px;bottom:3em;right:0px;" ' +
724 - 'title="' + gM( 'mwe-add_media_wizard' ) + '" >' +
725 - '</div>' );
726 -
 721+ $j('<div>')
 722+ .attr({
 723+ 'id' : 'rsd_modal_target',
 724+ 'title' : gM( 'mwe-add_media_wizard' )
 725+ })
 726+ .css( {
 727+ 'position' : 'absolute',
 728+ 'top' : '3em',
 729+ 'left' : '0px',
 730+ 'bottom' : '3em',
 731+ 'right' : '0px'
 732+ })
 733+ );
727734 // Get layout
728735 mw.log( 'width: ' + $j( window ).width() + ' height: ' + $j( window ).height() );
729736
@@ -1426,7 +1433,7 @@
14271434 o += '<div id="mv_result_' + resIndex + '" class="mv_clip_list_result" style="width:90%">';
14281435 o += '<img ' +
14291436 'title="' + resource.title + '" ' +
1430 - 'class="rsd_res_item" id="res_' + cp_id + '__' + resIndex + '" ' +
 1437+ 'class="rsd_res_item" id="res_' + provider.id + '__' + resIndex + '" ' +
14311438 'style="float:left;width:' + this.thumb_width + 'px;" ' +
14321439 'src="' + provider.sObj.getImageTransform( resource, { 'width': this.thumb_width } ) + '">';
14331440
@@ -1802,7 +1809,7 @@
18031810
18041811 // Add libraries resizable and hoverIntent to support video edit tools
18051812 var librarySet = [
1806 - 'mvClipEdit',
 1813+ 'mw.ClipEdit',
18071814 '$j.ui.resizable',
18081815 '$j.fn.hoverIntent'
18091816 ]
@@ -1810,7 +1817,7 @@
18111818 // Make sure the rsd_edit_img is removed:
18121819 $j( '#rsd_edit_img' ).remove();
18131820 // Run the image clip tools
1814 - _this.clipEdit = new mvClipEdit( options );
 1821+ _this.clipEdit = new mw.ClipEdit( options );
18151822 } );
18161823 } );
18171824 } );
@@ -2185,14 +2192,14 @@
21862193 // Load the BaseUploadInterface:
21872194 mw.load(
21882195 [
2189 - 'mvBaseUploadInterface',
 2196+ 'mw.BaseUploadInterface',
21902197 '$j.ui.progressbar'
21912198 ],
21922199 function() {
21932200 mw.log( 'mvBaseUploadInterface ready' );
21942201 // Initiate a upload object ( similar to url copy ):
21952202 // ( mvBaseUploadInterface handles upload errors )
2196 - var uploader = new mvBaseUploadInterface( {
 2203+ var uploader = new mw.BaseUploadInterface( {
21972204 'api_url' : _this.upload_api_target,
21982205 'done_upload_cb':function() {
21992206 mw.log( 'doApiImport:: run callback::' );
@@ -2261,11 +2268,20 @@
22622269
22632270 // Put another window ontop:
22642271 $j( _this.target_container ).append(
2265 - '<div id="rsd_preview_display"' +
2266 - 'style="position:absolute;overflow:hidden;z-index:4;' +
2267 - 'top:0px;bottom:0px;right:0px;left:0px;background-color:#FFF;">' +
2268 - mw.loading_spinner( 'top:30px;left:30px' ) +
2269 - '</div>' );
 2272+ $j('<div>').attr({
 2273+ 'id': 'rsd_preview_display'
 2274+ })
 2275+ .css({
 2276+ 'position' : 'absolute',
 2277+ 'overflow' : 'auto',
 2278+ 'z-index' : 4,
 2279+ 'top' : '0px',
 2280+ 'bottom' : '0px',
 2281+ 'right' : '0px',
 2282+ 'left' : '0px',
 2283+ 'background-color' : '#FFF'
 2284+ })
 2285+ )
22702286
22712287 var buttonPaneSelector = _this.target_container + '~ .ui-dialog-buttonpane';
22722288 var origTitle = $j( _this.target_container ).dialog( 'option', 'title' );
@@ -2301,8 +2317,12 @@
23022318 _this.target_title,
23032319 function( phtml ) {
23042320 $j( '#rsd_preview_display' ).html( phtml );
2305 - // Update the display of video tag items (if any)
2306 - $j( mw.getConfig( 'rewritePlayerTags' ) ).embedPlayer();
 2321+ if( mw.documentHasPlayerTags() ){
 2322+ mw.load( 'EmbedPlayer', function(){
 2323+ // Update the display of video tag items (if any)
 2324+ $j( mw.getConfig( 'rewritePlayerTags' ) ).embedPlayer();
 2325+ });
 2326+ }
23072327 }
23082328 );
23092329 } );
@@ -2440,14 +2460,17 @@
24412461 var _this = this;
24422462 mw.log( "close all:: " + _this.target_container );
24432463 _this.onCancelClipEdit();
 2464+
 2465+ $j( _this.target_container ).dialog( 'close' );
24442466 // Give a chance for the events to complete
24452467 // (somehow at least in firefox a rare condition occurs where
24462468 // the modal of the edit-box stick around even after the
2447 - // close request has been issued. )
 2469+ // close request has been issued. )
24482470 setTimeout(
24492471 function() {
24502472 $j( _this.target_container ).dialog( 'close' );
2451 - }, 10
 2473+ $j( '#rsd_modal_target').remove();
 2474+ }, 25
24522475 );
24532476 },
24542477 /**
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/loader.js
@@ -112,7 +112,6 @@
113113 if( typeof HTMLVideoElement == 'object' && !$j.browser.safari ){
114114 dependencyRequest[0].push( 'nativeEmbed' )
115115 }
116 -
117116
118117
119118 // Load the video libs:
Index: branches/js2-work/phase3/js/mwEmbed/modules/ClipEdit/loader.js
@@ -6,4 +6,12 @@
77 "mw.ClipEdit" : "modules/ClipEdit/mw.ClipEdit.js",
88 "$j.fn.ColorPicker" : "modules/ClipEdit/colorpicker/js/colorpicker.js",
99 "$j.Jcrop" : "modules/ClipEdit/Jcrop/js/jquery.Jcrop.js"
 10+} );
 11+
 12+/*
 13+* Adds style sheets to be loaded with particular classes
 14+*/
 15+mw.addClassStyleSheets( {
 16+ "$j.Jcrop" : "modules/ClipEdit/Jcrop/css/jquery.Jcrop.css",
 17+ "$j.fn.ColorPicker" : "modules/ClipEdit/colorpicker/css/colorpicker.css"
1018 } );
\ No newline at end of file
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js
@@ -1057,7 +1057,7 @@
10581058 if( this.classPaths[ loadName ] ) {
10591059 groupClassKey += coma + loadName
10601060 coma = ',';
1061 - }else if( moduleLoaders[ loadName ] ) {
 1061+ }else if( this.moduleLoaders[ loadName ] ) {
10621062 // Module loaders break up grouped script requests ( add the current groupClassKey )
10631063 if( groupClassKey != '' ){
10641064 loadStates[ groupClassKey ] = 0;
@@ -2273,15 +2273,7 @@
22742274
22752275 } );
22762276
2277 -/*
2278 -* Adds style sheets to be loaded with particular classes
2279 -*/
2280 -mw.addClassStyleSheets( {
2281 - '$j.Jcrop' : 'libClipEdit/Jcrop/css/jquery.Jcrop.css',
2282 - '$j.fn.ColorPicker' : 'libClipEdit/colorpicker/css/colorpicker.css'
2283 -} );
22842277
2285 -
22862278 // Add the core mvEmbed Messages ( will be localized by script server )
22872279 mw.addMessages( {
22882280 "mwe-loading_txt" : "Loading ...",
@@ -2420,7 +2412,7 @@
24212413 var opt_default = { 'hspace':50, 'vspace':50 };
24222414 if ( !opt )
24232415 var opt = { };
2424 - $j.extend( opt, opt_default );
 2416+ opt = $j.extend( opt_default, opt );
24252417 $j( this.selector ).dialog( 'option', 'width', $j( window ).width() - opt.hspace );
24262418 $j( this.selector ).dialog( 'option', 'height', $j( window ).height() - opt.vspace );
24272419 $j( this.selector ).dialog( 'option', 'position', 'center' );
Index: branches/js2-work/phase3/js/editPage.js
@@ -41,9 +41,9 @@
4242 'execute': function() {
4343 mw.log( 'Added via wikiEditor bind' );
4444 // Display a loader ( since its triggered onClick )
45 - $.addLoaderDialog( gM( 'mwe-loading-add-media-wiz' ) );
 45+ $j.addLoaderDialog( gM( 'mwe-loading-add-media-wiz' ) );
4646 mw.load( 'AddMedia.addMediaWizard', function(){
47 - $.closeLoaderDialog();
 47+ $j.closeLoaderDialog();
4848 $j.addMediaWizard( amwConf );
4949 });
5050 }

Status & tagging log