Changeset 1930
- Timestamp:
- 07/26/11 10:33:24 (22 months ago)
- Location:
- plugins/related
- Files:
-
- 27 added
- 3 deleted
- 1 edited
- 4 copied
-
assets (copied) (copied from plugins/related/v5/assets)
-
build (copied) (copied from plugins/related/v5/build)
-
build/build.bat (deleted)
-
build/build.sh (deleted)
-
build/build.xml (added)
-
build/encode-images.py (added)
-
build/yuicompressor.jar (added)
-
doc (added)
-
doc/assets (added)
-
doc/assets/dimensions.png (added)
-
doc/examples (added)
-
lib (added)
-
lib/jwplayer-5-classes.xml (added)
-
lib/jwplayer-5-lib.swc (added)
-
related.swf (added)
-
related.xml (added)
-
src (added)
-
src/as (copied) (copied from plugins/related/v5/src)
-
src/js (added)
-
src/js/related.js (added)
-
test (copied) (copied from plugins/related/v5/test)
-
test/advanced.html (added)
-
test/assets/bigbuck.flv (added)
-
test/assets/jwplayer.js (added)
-
test/assets/player.swf (added)
-
test/assets/rabbit.jpg (added)
-
test/assets/rabbit2.jpg (added)
-
test/basic.html (added)
-
test/flash.html (added)
-
test/icons.html (added)
-
test/index.html (modified) (1 diff)
-
test/pause.html (added)
-
test/playlist.html (added)
-
test/redirect.html (added)
-
v5 (deleted)
Legend:
- Unmodified
- Added
- Removed
-
plugins/related/test/index.html
r1622 r1930 1 1 <html> 2 2 <head> 3 <title>JW Player Testing</title> 4 <link rel="stylesheet" href="assets/style.css" type="text/css"> 5 <script type="text/javascript" src="assets/jquery.js"></script> 6 <script type="text/javascript" src="assets/swfobject.js"></script> 7 <script type="text/javascript" src="assets/settings.js"></script> 8 <script type="text/javascript"> 9 $(document).ready(function() { 10 $.extend({ 11 /** Insert a new example in the page. **/ 12 insert: function(evt) { 13 evt.preventDefault(); 14 var obj = settings.examples[$('#examples :selected').text()]; 15 var arr = []; 16 if(obj['plugins']) { 17 arr = obj['plugins'].split(','); 18 } 19 $('#plugins').val(arr); 20 $.fieldsets(); 21 $.fillout("flashvarsform"); 22 }, 23 /** Fill out the flashvars with example data. **/ 24 fillout: function(set) { 25 var obj = settings.examples[$('#examples :selected').text()]; 26 var arr = $("#"+set).find('input'); 27 for(var i=0; i<arr.length; i++) { 28 var nam = $(arr[i]).attr('name'); 29 if(obj[nam] == null) { 30 $(arr[i]).val(''); 31 } else { 32 $(arr[i]).val(obj[nam]); 33 } 34 } 35 $("#flashvarsform").submit(); 36 }, 37 /** Set the tab functions. **/ 38 tabs: function() { 39 $('li').click(function() { 40 $('li').removeClass('active'); 41 $(this).addClass('active'); 42 var itm = $(this).text().toLowerCase(); 43 $.tab($.trim(itm)); 44 }); 45 }, 46 /** Flip to a tab. **/ 47 tab: function(itm) { 48 var arr = $("#flashvarsform").find('fieldset'); 49 for(var i=0; i<arr.length; i++) { 50 if($(arr[i]).attr('id') == itm) { 51 $(arr[i]).css('display','block'); 52 } else { 53 $(arr[i]).css('display','none'); 54 } 55 } 56 }, 57 /** Check for inserting of fieldsets. **/ 58 fieldsets: function(evt) { 59 $("#fieldsettabs > .plugin").remove(); 60 $("#fieldsetspan").empty(); 61 var str = $("#plugins").val(); 62 if(str != null) { 63 arr = str.toString().split(','); 64 for (var i=0; i<arr.length; i++) { 65 var swf = settings.plugins[arr[i]].swf; 66 var xml = settings.plugins[arr[i]].xml; 67 $.fieldset(xml,arr[i]); 68 } 69 } 70 }, 71 /** Insert a specific plugin fieldset. **/ 72 fieldset: function(url,nam) { 73 $.get(url,{},function(xml) { 74 var arr = $('flashvars',xml).find('flashvar'); 75 if(arr.length > 0) { 76 var tit = nam.substr(0,1).toUpperCase()+nam.substr(1); 77 $("#fieldsettabs").append('<li class="plugin">'+tit+'</li>'); 78 $.tabs(); 79 var set = '<fieldset id="'+nam+'">'; 80 for (var i=0; i<arr.length; i++) { 81 var val = $('name',arr[i]).text(); 82 set +='<label>'+nam+'.'+val+'</label><input type="text" name="'+nam+'.'+val+'" />'; 83 } 84 set += '</fieldset>'; 85 $('#fieldsetspan').append(set); 86 $.fillout(nam); 87 } 88 }); 89 }, 90 /** Reload the flashvars into the player. **/ 91 reload: function(evt) { 92 evt.preventDefault(); 93 var vrs = {}; 94 var arr = $("#flashvarsform").find('input'); 95 for(var i=0; i<arr.length; i++) { 96 if($(arr[i]).val()) { 97 vrs[$(arr[i]).attr('name')] = $(arr[i]).val(); 98 } 99 } 100 if($("#skins").val() != 'none') { 101 vrs['skin'] = settings.skins[$("#skins").val()]; 102 } 103 if($("#plugins").val() != null) { 104 var plg = ''; 105 var arr = $("#plugins").val(); 106 for(var i=0; i<arr.length; i++) { 107 plg += settings.plugins[arr[i]].swf+','; 108 } 109 vrs['plugins'] = plg.substr(0,plg.length-1); 110 } 111 $('#preview').css('height',vrs['height']); 112 $('#preview').html('<div id="container"></div>'); 113 swfobject.embedSWF( 114 settings.players[$('#players').val()], 115 'container', 116 vrs['width'], 117 vrs['height'], 118 '9.0.0', 119 null, 120 vrs, 121 {allowfullscreen:'true',allowscriptaccess:'always'}, 122 {id:'ply',name:'ply'} 123 ); 124 }, 125 /** Get a variable from the player. **/ 126 getVariable: function(evt) { 127 evt.preventDefault(); 128 switch($('#vartype').val().toString()) { 129 case 'config': 130 var obj = player.getConfig(); 131 break; 132 case 'playlist': 133 var obj = player.getPlaylist(); 134 break; 135 case 'plugin.config': 136 var obj = player.getPluginConfig($('#configplugin').val()); 137 break; 138 } 139 $.alert(obj); 140 }, 141 /** Send an event to the player. **/ 142 sendEvent: function(evt) { 143 evt.preventDefault(); 144 var typ = $('#sendevent').val(); 145 var dat = $('#sendeventdata').val(); 146 if(typ == 'LOAD' && dat.indexOf(':') > 0) { 147 var arr = new Array(); 148 var ply = dat.split(';'); 149 for(var i=0; i<ply.length; i++) { 150 var obj = new Object(); 151 var itm = ply[i].split(','); 152 for(var j=0; j<itm.length; j++) { 153 obj[itm[j].split(':')[0]] = itm[j].split(':')[1]; 154 } 155 arr.push(obj); 156 } 157 if(arr.length > 1) { 158 dat = arr; 159 } else { 160 dat = obj; 161 } 162 } 163 player.sendEvent(typ,dat); 164 }, 165 /** Set a listener to the player. **/ 166 setListener: function(evt) { 167 evt.preventDefault(); 168 var arr = $('#eventtype').val().toString().split(': '); 169 var sel = $('#addremove').val().toString(); 170 var fcn = '$.alert'; 171 if(arr.length == 2 && sel == 'add') { 172 if(arr[0] == 'Model') { 173 player.addModelListener(arr[1],fcn); 174 } else { 175 player.addControllerListener(arr[1],fcn); 176 } 177 } else if(arr.length == 2 && sel == 'remove') { 178 if(arr[0] == 'Model') { 179 player.removeModelListener(arr[1],fcn); 180 } else { 181 player.removeControllerListener(arr[1],fcn); 182 } 183 } 184 }, 185 /** Alert responses from the player. **/ 186 alert: function(obj) { 187 var txt = ''; 188 for (itm in obj) { 189 if(typeof(obj[itm]) == 'object') { 190 txt += itm+':\n'; 191 for (ent in obj[itm]) { 192 txt += ' '+ent+': '+obj[itm][ent]+'\n'; 193 } 194 } else { 195 txt += itm+': '+obj[itm]+'\n'; 196 } 197 } 198 alert(txt); 199 } 200 }); 201 /** Attach handlers to all buttons and select fields. **/ 202 $("#examples").change(function(evt) { $.insert(evt); }); 203 $("#players").change(function(evt) { $.reload(evt); }); 204 $("#skins").change(function(evt) { $.reload(evt); }); 205 $("#plugins").change(function(evt) { $.fieldsets(evt); }); 206 $("#examplesform").submit(function(evt) { $.insert(evt); }); 207 $("#flashvarsform").submit(function(evt) { $.reload(evt); }); 208 $("#variablesform").submit(function(evt) { $.getVariable(evt); }); 209 $("#sendeventform").submit(function(evt) { $.sendEvent(evt); }); 210 $("#listenersform").submit(function(evt) { $.setListener(evt); }); 211 /** Load all settings into the player. **/ 212 for (dct in settings) { 213 for (itm in settings[dct]) { 214 $("#"+dct).append("<option>"+itm+"</option>"); 215 } 216 } 217 $.tabs(); 218 $('#examplesform').css('display','block'); 219 $('#sources').css('display','block'); 220 }); 221 window.onbeforeunload = function(){ return "Reload this page?";} 222 </script> 3 4 <title>Related Plugin Tests</title> 5 <style> 6 body { padding: 50px; font: 13px/20px Arial; background: #EEE; } 7 #player, p, ul { margin-top: 20px; display: block; } 8 </style> 223 9 224 10 </head> 225 11 <body> 226 12 13 <h2>Related Plugin Tests</h2> 227 14 228 <form id="examplesform"> 229 <fieldset> 230 <label>Example</label> 231 <select name="examples" id="examples"></select> 232 </fieldset> 233 <button type="submit" id="examplesbutton">Insert example</button> 234 </form> 235 236 237 238 239 <div id="javascript"> 240 <form id="variablesform"> 241 <fieldset> 242 <label>Variable</label> 243 <select type="text" id="vartype"> 244 <option>config</option> 245 <option>playlist</option> 246 <option>plugin.config</option> 247 </select> 248 <label>Plugin</label> 249 <input type="text" id="configplugin" /> 250 </fieldset> 251 <button type="submit" id="variablesbutton">Get variable</button> 252 </form> 253 <form id="sendeventform"> 254 <fieldset> 255 <label>Event</label> 256 <select type="text" id="sendevent"> 257 <option>ITEM</option> 258 <option>LINK</option> 259 <option>LOAD</option> 260 <option>MUTE</option> 261 <option>NEXT</option> 262 <option>PLAY</option> 263 <option>PREV</option> 264 <option>REDRAW</option> 265 <option>SEEK</option> 266 <option>STOP</option> 267 <option>VOLUME</option> 268 </select> 269 <label>Data</label> 270 <input type="text" id="sendeventdata" /> 271 </fieldset> 272 <button type="submit" id="sendeventbutton">Send event</button> 273 </form> 274 <form id="listenersform"> 275 <fieldset> 276 <label>Type</label> 277 <select type="text" id="addremove"> 278 <option>add</option> 279 <option>remove</option> 280 </select> 281 <label>Event</label> 282 <select type="text" id="eventtype"> 283 <option>Controller: ERROR</option> 284 <option>Controller: ITEM</option> 285 <option>Controller: MUTE</option> 286 <option>Controller: PLAY</option> 287 <option>Controller: PLAYLIST</option> 288 <option>Controller: RESIZE</option> 289 <option>Controller: SEEK</option> 290 <option>Controller: STOP</option> 291 <option>Controller: VOLUME</option> 292 <option></option> 293 <option>Model: BUFFER</option> 294 <option>Model: ERROR</option> 295 <option>Model: LOADED</option> 296 <option>Model: META</option> 297 <option>Model: STATE</option> 298 <option>Model: TIME</option> 299 </select> 300 </fieldset> 301 <button type="submit" id="listenersbutton">Set listener</button> 302 </form> 303 </div> 304 305 306 307 308 <div id="preview"> 309 <p>Testing is simple: choose an example, change the flashvars and see if it works.<br/> 310 You can also download this testing page as part of the <a href="http://developer.longtailvideo.com/trac/changeset/HEAD/trunk/sdk?old_path=/&format=zip">plugin development SDK</a>.</p> 311 </div> 312 313 <script type="text/javascript"> 314 var player; 315 function playerReady(obj) { 316 player = document.getElementById(obj['id']); 317 $('#javascript').css('display','block'); 318 }; 319 </script> 320 321 322 323 324 325 <form id="flashvarsform"> 326 <ul id="fieldsettabs"> 327 <li class="active">Sources</li> 328 <li>Properties</li> 329 <li>Layout</li> 330 <li>Behaviour</li> 331 <li>Miscellaneous</li> 332 </ul> 333 <fieldset></fieldset> 334 <fieldset id="sources"> 335 <label>player</label> 336 <select id="players"></select> 337 <label>skin</label> 338 <select id="skins"></select> 339 <label>plugins</label> 340 <select multiple="multiple" id="plugins"></select> 341 </fieldset> 342 <fieldset id="properties"> 343 <label>author</label> 344 <input type="text" name="date" /> 345 <label>date</label> 346 <input type="text" name="author" /> 347 <label>description</label> 348 <input type="text" name="description" /> 349 <label>duration</label> 350 <input type="text" name="duration" /> 351 <label>file</label> 352 <input type="text" name="file" /> 353 <label>image</label> 354 <input type="text" name="image" /> 355 <label>link</label> 356 <input type="text" name="link" /> 357 <label>start</label> 358 <input type="text" name="start" /> 359 <label>streamer</label> 360 <input type="text" name="streamer" /> 361 <label>tags</label> 362 <input type="text" name="tags" /> 363 <label>title</label> 364 <input type="text" name="title" /> 365 <label>type</label> 366 <input type="text" name="type" /> 367 </fieldset> 368 <fieldset id="layout"> 369 <label>backcolor</label> 370 <input type="text" name="backcolor" /> 371 <label>controlbar</label> 372 <input type="text" name="controlbar" /> 373 <label>dock</label> 374 <input type="text" name="dock" /> 375 <label>frontcolor</label> 376 <input type="text" name="frontcolor" /> 377 <label>height</label> 378 <input type="text" name="height" value="260" /> 379 <label>icons</label> 380 <input type="text" name="icons" /> 381 <label>lightcolor</label> 382 <input type="text" name="lightcolor" /> 383 <label>playlist</label> 384 <input type="text" name="playlist" /> 385 <label>playlistsize</label> 386 <input type="text" name="playlistsize" /> 387 <label>screencolor</label> 388 <input type="text" name="screencolor" /> 389 <label>width</label> 390 <input type="text" name="width" value="400" /> 391 </fieldset> 392 <fieldset id="behaviour"> 393 <label>autostart</label> 394 <input type="text" name="autostart" /> 395 <label>bufferlength</label> 396 <input type="text" name="bufferlength" /> 397 <label>displayclick</label> 398 <input type="text" name="displayclick" /> 399 <label>displaytitle</label> 400 <input type="text" name="displaytitle" /> 401 <label>item</label> 402 <input type="text" name="item" /> 403 <label>linktarget</label> 404 <input type="text" name="linktarget" /> 405 <label>logo</label> 406 <input type="text" name="logo" /> 407 <label>mute</label> 408 <input type="text" name="mute" /> 409 <label>repeat</label> 410 <input type="text" name="repeat" /> 411 <label>shuffle</label> 412 <input type="text" name="shuffle" /> 413 <label>smoothing</label> 414 <input type="text" name="smoothing" /> 415 <label>stretching</label> 416 <input type="text" name="stretching" /> 417 <label>volume</label> 418 <input type="text" name="volume" /> 419 </fieldset> 420 <fieldset id="miscellaneous"> 421 <label>config</label> 422 <input type="text" name="config" /> 423 <label>debug</label> 424 <input type="text" name="debug" /> 425 <label>id</label> 426 <input type="text" name="id" /> 427 </fieldset> 428 <span id="fieldsetspan"></span> 429 <button type="submit" id="flashvarsbutton">Reload player</button> 430 </form> 431 432 15 <ul> 16 <li><a href="basic.html">Basic setup</a></li> 17 <li><a href="options.html">Configuration options</a></li> 18 <li><a href="modes.html">Rendering modes</a></li> 19 </ul> 20 <ul> 21 <li><a href="playlist.html">Playlist support</a></li> 22 <li><a href="recursion.html">Recursive related</a></li> 23 <li><a href="dimensions.html">Various Dimensions</a></li> 24 </ul> 25 <ul> 26 <li><a href="compatibility.html">Backward compatibility</a></li> 27 </ul> 433 28 434 29 </body> 435 30 </html> 436
Note: See TracChangeset
for help on using the changeset viewer.
