aide sur la méthode match()
Bonjour,
J'suis loin d'être bon en javascript, donc j'avance aléatoirement .. :?
Je tente de modifier un plugin de TinyMCE (media) pour qu'il reconnaisse une source de média supplémentaire .
J'ai tenté le code suivant ( bon, il marche pas)
Code:
1 2 3 4 5 6 7
| // Archive Host
if ( v.match(/dewplayer\.swf\?son=(.*)(.*)/) ) {
f.width.value = '235';
f.height.value = '20';
f.src.value = 'http://www.archive-host.com/dewplayer.swf/' + v.match(/son=(.*)(.*)/)[0].split('=')[1];
return 'flash';
} |
Pour intégrer ça
Code:
http://www.archive-host.com/dewplayer.swf?son=http://sd-1.archive-host.com/membres/playlist/108751062716077859/space_life.mp3&autostart=1&autoreplay=1
En m'inspirant de ça :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| // YouTube
if (v.match(/watch\?v=(.+)(.*)/)) {
f.width.value = '425';
f.height.value = '350';
f.src.value = 'http://www.youtube.com/v/' + v.match(/v=(.*)(.*)/)[0].split('=')[1];
return 'flash';
}
// Google video
if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) {
f.width.value = '425';
f.height.value = '326';
f.src.value = 'http://video.google.com/googleplayer.swf?docId=' + v.substring('http://video.google.com/videoplay?docid='.length) + '&hl=fr';
return 'flash';
} |
Qui marche ...
Je sais, j'suis pas au point .. mais si quelqu'un peu me donner un coup de main ...
Merci d'avance :calim2: