home *** CD-ROM | disk | FTP | other *** search
HTML Component | 2002-08-19 | 3.6 KB | 113 lines |
- <PUBLIC:COMPONENT lightWeight=true>
- <PUBLIC:ATTACH EVENT="oncontentready" ONEVENT="load()" />
- <PUBLIC:METHOD NAME="reload" />
- <PUBLIC:METHOD NAME="updateMedia" />
- <PUBLIC:METHOD NAME="scriptCommand" />
- <PUBLIC:METHOD NAME="edit" />
-
- <SCRIPT LANGUAGE="JScript">
-
- function reload() { load(); }
-
- function load()
- {
- var s = '<table width=368 class=pane border=0 cellpadding=0 cellspacing=0>';
-
- s += '<tr><td class=artist>' + L_LyricsTitle_Text + '</td></tr>';
- s += '<tr><td height=16><table width=368 border=0 cellpadding=0 cellspacing=0><td id=trackNameLyrics class=text></td><td class=textTitle align=right id=lyricsEditButton onbuttonclick="return oCurrentPage.edit(true);" style="behavior:url(barbutton.htc)" text="' + L_AddLyricsButton_Text + '"></td></tr></table></td></tr>';
- s += '<tr><td height=14><span class=textGray id=lyricsArtistName></span> <span class=textGray id=lyricsSep>/</span> <span id=lyricsAlbumName class=textGray></span></td></tr>';
- s += '<tr><td height=10></td></tr>';
- s += '<tr><td class=text id=syncLyrics height=40></td></tr>';
- s += '<tr><td><table border=0 cellpadding=0 cellspacing=0>';
-
- s += '<tr><td width=368 height=100% valign=top><div id=lyricsText class=text style="overflow-y: scroll; width: 368; height: expression(Math.max(144, document.body.clientHeight - 176))"></div><textarea id=lyricsTextEdit class=text style="display:none; width:100%; height:expression(Math.max(144, document.body.clientHeight - 176))"></textarea></td></tr>';
-
- s += '</table></td></tr></table>';
- element.innerHTML = s;
- }
-
- var fIsEditing = false;
- function updateMedia(media)
- {
- var c, s = '', a = element.document.all, oButton;
- a('trackNameLyrics').innerText = a('trackNameSaved').innerText;
- a('lyricsArtistName').innerText = a('artistNameSaved').innerText;
- oButton = a('lyricsEditButton');
- if (media)
- {
- a('lyricsAlbumName').innerHTML = fixText(media.getItemInfo('WM/AlbumTitle'));
-
- s = media.getItemInfo('WM/Lyrics');
- if (s == '')
- {
- s = L_NoLyrics_Text;
- oButton.text = L_AddLyricsButton_Text;
- }
- else
- oButton.text = L_EditLyricsButton_Text;
-
- a('lyricsText').innerHTML = s;
- }
-
- if (fIsEditing) edit(false);
-
- if (!media || media.isReadOnlyItem('WM/Lyrics'))
- oButton.style.display = 'none';
- else
- oButton.style.display = 'inline';
-
- if (a('lyricsAlbumName').innerText.length)
- a('lyricsSep').style.display = 'inline';
- else
- a('lyricsSep').style.display = 'none';
- }
-
- function edit(fSave)
- {
- if (fIsEditing)
- {
- var p = element.document.all('player');
- var m = p.currentMedia;
-
- if (fSave)
- if (m && !m.isReadOnlyItem('WM/Lyrics'))
- m.setItemInfo('WM/Lyrics', element.document.all('lyricsTextEdit').innerText);
-
- element.document.all('lyricsText').style.display = 'block';
- element.document.all('lyricsTextEdit').style.display = 'none';
- element.document.all('lyricsEditButton').text = L_AddLyricsButton_Text;
- fIsEditing = false;
- updateUI();
- }
- else
- {
- element.document.all('lyricsText').style.display = 'none';
- element.document.all('lyricsTextEdit').style.display = 'block';
- element.document.all('lyricsTextEdit').innerText = element.document.all('lyricsText').innerText;
- element.document.all('lyricsEditButton').text = L_SaveLyricsButton_Text;
- fIsEditing = true;
- }
- return false;
- }
-
- function updateUI()
- {
- try
- {
- var p = element.document.all('player');
- var m = p.currentMedia;
- updateMedia(m);
- } catch(e)
- {
- }
- }
-
- function scriptCommand(sCommand, sText)
- {
- if (sCommand == 'SynchronizedLyricLyric')
- element.document.all('syncLyrics').innerText = sText;
- }
-
- </SCRIPT>
- </PUBLIC:COMPONENT>
-