Hi, zeremy, glad to see you.
I know your script. I used your achievements. You use a script common8 ("% fb2k_profile_path% marc2003 \ common8.js"), but it is too complicated for me.
and I can not download from www.hydrogenaud, always 404.
Список разделов › foobar2000 › Секреты foobar2000
// ==PREPROCESSOR==
// @name "Biography Text theaudiodb.com"
// @author "zeremy"
// @import "%fb2k_profile_path%marc2003\common8.js"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==
// ==PREPROCESSOR==
// @name "Biography Text. www.last.fm"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==
function RGB(r,g,b) { return (0xff000000|(r<<16)|(g<<8)|(b)); }
var a_font = gdi.Font("Arial",12,1);
var b_font = gdi.Font("Arial",12,0);
var ww,wh;
DT_LEFT = 0x00000000;
DT_RIGHT = 0x00000002;
DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_SINGLELINE = 0x00000020;
DT_WORD_ELLIPSIS = 0x00040000;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
var bgcolor = RGB(50,50,50);
var a_color = RGB(150,150,150);
var b_color = RGB(255,255,230);
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
var doc = new ActiveXObject("htmlfile");
var abc = "";
var artist, old_artis;
var text = "", response = "";
var data = ""; b_text = "";
var col = 20;
var r_margin = 10;
var row = 50;
var b_text_row_height0;
var b_text_rows = 0;
var b_text_height = 0;
var s = 0;
var strings_array = [];
var b_text_array = [];
var metadb;
on_item_focus_change();
function on_paint(gr){
!window.IsTransparent && gr.FillSolidRect(0, 0, ww, wh, bgcolor);
gr.GdiDrawText(artist, a_font, a_color, col, 10, ww - 20, wh, DT_LEFT | DT_WORD_ELLIPSIS );
for (var i = 0; i < b_text_height; i++) {
gr.GdiDrawText(b_text_array[i + s], b_font, b_color, col, row + b_text_row_height * i, ww, wh, DT_LEFT );
}
}
function on_mouse_wheel(delta) {
if (b_text_rows > b_text_height){
if (delta < 0) {s = b_text_rows - s <= b_text_height ? b_text_rows - b_text_height : s += 1}
if (delta > 0) {s = s <= 0 ? 0 : s -= 1}
window.Repaint();
}
}
function on_mouse_move(x, y) {
on_mouse = true;
window.SetCursor(32649);
window.Repaint();
}
function on_mouse_leave() {
on_mouse = false;
window.SetCursor(32512);
window.Repaint();
}
function on_size(){
ww = window.Width;
wh = window.Height;
get_b_text_array();
}
function on_item_focus_change() {
text = "";
metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
if (metadb) on_metadb_changed();
}
function on_playlist_switch() {
on_item_focus_change();
}
function on_playback_new_track() {
on_item_focus_change();
}
function on_playback_dynamic_info_track() {
on_item_focus_change();
}
function on_playback_stop() {
on_item_focus_change();
}
function on_selection_changed(metadb) {
on_item_focus_change();
}
function Eval(field) {
if (metadb) {
path = fb.Titleformat("%path%").EvalWithMetadb(metadb);
return path.indexOf('://') > 0 ? fb.TitleFormat("[" + field + "]").Eval(true) : fb.TitleFormat("[" + field + "]").EvalWithMetadb(metadb);
}
}
function on_metadb_changed() {
artist = Eval("%artist%");
if (artist != old_artis){
response = "";
get();
old_artis = artist;
}
window.Repaint();
}
function get(){
if (artist == "" || artist == "?") {get_b_text_array(); return};
var url2 = ("http://www.last.fm/" + abc + "music/" + encodeURIComponent(artist) + "/+wiki");
xmlhttp.open("GET", url2, true);
xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
xmlhttp.send();
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
text = xmlhttp.responsetext;
doc.open();
var div = doc.createElement("div");
div.innerHTML = this.xmlhttp.responsetext;
var data = div.getElementsByTagName("div");
for (i = 0; i < data.length; i++) {
if (data[i].className == "wiki-content") {
text = strip_tags(data[i].innerHTML);
break;
} else {
text = "";
}
}
doc.close();
get_b_text_array();
window.Repaint();
}
}
}
}
function strip_tags(t) {
doc.open();
var div = doc.createElement("div");
div.innerHTML = t.replace(/<[Pp][^>]*>/g, "").replace(/<\/[Pp]>/g, "<br>").replace(/\n/g, "<br>");
var text = div.innerText;
doc.close();
return text;
}
function get_b_text_array() {
s = 0;
strings_array = [];
b_text_array = [];
ww = window.Width;
temp_bmp = gdi.CreateImage(1, 1);
temp_gr = temp_bmp.GetGraphics();
b_text_row_height = temp_gr.CalcTextHeight("text", b_font)
if(text) strings_array = temp_gr.EstimateLineWrap(text, b_font, ww - col - r_margin).toArray();
for (var i = 0; i < strings_array.length; i += 2) {
b_text_array.push(strings_array[i]);
}
b_text_rows = b_text_array.length;
b_text_height = Math.ceil((wh - row - 20) / b_text_row_height);
temp_bmp.ReleaseGraphics(temp_gr);
temp_bmp.Dispose();
temp_gr = null;
temp_bmp = null;
}
function on_mouse_rbtn_up (x, y){
var _menu = window.CreatePopupMenu();
var i = 1;
MF_ENABLED = 0x00000000;
MF_GRAYED = 0x00000001;
_menu.AppendMenuItem(MF_ENABLED, i++, "EN text");
_menu.AppendMenuItem(MF_ENABLED, i++, "RU text");
ShiftDown = utils.IsKeyPressed(0x10) ? true : false;
// if (ShiftDown) {
_menu.AppendMenuItem(0x00000800, 0, 0);
_menu.AppendMenuItem(0x00000000, 10, "Reload");
_menu.AppendMenuItem(0x00000800, 0, 0);
_menu.AppendMenuItem(0x00000000, 20, "Properties");
_menu.AppendMenuItem(0x00000000, 30, "Configure ...");
// }
ret = _menu.TrackPopupMenu(x,y);
switch (ret) {
case 1:
if (metadb)
abc = "";{get();
window.Repaint();
}
break;
case 2:
if (metadb) {get();
abc = "ru/";
get();
}
window.Repaint();
break;
case 10:
window.Reload();
break;
case 20:
window.ShowProperties();
break;
case 30:
window.ShowConfigure();
break;
}
_menu.Dispose();
return true;
}
Я уже спрашивал на писикаре ...сказали невозможно, а автор скрипта и слышать не хочет про это.MC Web:Осталось добавить "бесследную" загрузку картинок и было бы замечательно
img_bg_preload = gdi.Image(pathTheme + "images\\bg_preload.png");
img_bg_preload = img_bg_preload.Resize(img_bg_preload.Width,img_bg_preload.Height);
InFive, например при двойном нажатии на лев.кл.InFive:реагировала на двойной клик мышки для перехода в плейлист, откуда вопроизводится текущий трек
function on_mouse_lbtn_dblclk(x,y) {
fb.RunMainMenuCommand('View/Columns playlist/Activate now playing');
}
я добавил ее в код WSH-панели, затем запустил песню, затем перешел в другой плейлист, делаю двойной клик мышкой по панели, но тут же переход в плейлист, откуда происходит воспроизведение песни, не происходит, а при двойном клике на стандартной строке состояния происходит... не похоже на то, чтобы такой переход совершался засчет вызова/активации команды главного меню...kgena_ua:например при двойном нажатии на лев.кл.
Код:
function on_mouse_lbtn_dblclk(x,y) {
fb.RunMainMenuCommand('View/Columns playlist/Activate now playing');
}
спасибо, кнопку сделал, но я привык за годы кликать мышкой для этого, да и эта сборка программа экспериментальная, в основной программе кнопок поболее...vladj:У тебя там много места правей кнопок, можешь любые надобавлять
оказалось дело в русском интерфейсе, прописал по русскиkgena_ua:Тогда наверное
fb.RunMainMenuCommand('View/Show Nov Playing');
fb.RunMainMenuCommand('Вид/Перейти к текущему треку');
// ==PREPROCESSOR==
// @name "Picrure. www.last.fm"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==
function RGB(r,g,b) { return (0xff000000|(r<<16)|(g<<8)|(b)); }
var a_font = gdi.Font("Arial",12,1);
var b_font = gdi.Font("Arial",12,0);
var ww,wh;
DT_LEFT = 0x00000000;
DT_RIGHT = 0x00000002;
DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_SINGLELINE = 0x00000020;
DT_WORD_ELLIPSIS = 0x00040000;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
var bgcolor = RGB(40,40,40);
var a_color = RGB(255,255,230);
var b_color = RGB(255,255,230);
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
var doc = new ActiveXObject("htmlfile");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var objADOStream = new ActiveXObject("ADODB.Stream");
var tmp_b_path = fb.ProfilePath + "\\tmp_Biography\\";
if(!fso.FolderExists(tmp_b_path)) {fso.CreateFolder(tmp_b_path)};
var artist, old_artis;
var files = [], selected = 0;
var col = 20;
var row = 50;
var limit = window.GetProperty("limit",5);
var metadb;
on_item_focus_change();
function on_paint(gr){
!window.IsTransparent && gr.FillSolidRect(0, 0, ww, wh, bgcolor);
if(fso.FileExists(tmp_b_path + files[selected]) ) {
g_img = gdi.Image(tmp_b_path + files[selected]);
var scale_w = ww / g_img.Width;
var scale_h = wh / g_img.Height;
var scale = Math.min(scale_w, scale_h);
var pos_x = 0;
var pos_y = 0;
if (scale_w < scale_h) pos_y = (wh - g_img.Height * scale) / 2;
else if (scale_w > scale_h) pos_x = (ww - g_img.Width * scale) / 2;
g_img = g_img.CreateRawBitmap();
gr.GdiDrawBitmap(g_img, pos_x, pos_y, g_img.Width * scale, g_img.Height * scale, 0, 0, g_img.Width, g_img.Height);
}
gr.GdiDrawText(artist, a_font, bgcolor, col + 1, 10 + 2, ww - col + 1, wh + 2, DT_LEFT | DT_WORD_ELLIPSIS );
gr.GdiDrawText(artist, a_font, a_color, col, 10, ww - col, wh, DT_LEFT | DT_WORD_ELLIPSIS );
gr.GdiDrawText(selected + 1 + " (" + files.length + ")", a_font, bgcolor, col + 1, 30 + 2, ww - col + 1, wh + 2, DT_LEFT | DT_WORD_ELLIPSIS );
gr.GdiDrawText(selected + 1 + " (" + files.length + ")", a_font, a_color, col, 30, ww - col, wh, DT_LEFT | DT_WORD_ELLIPSIS );
}
function on_mouse_wheel(delta) {
if (delta < 0) {selected = selected <= 0 ? files.length - 1 : selected -= 1}
if (delta > 0) {selected = selected >= files.length - 1 ? 0 : selected += 1}
window.Repaint();
}
function on_mouse_move(x, y) {
on_mouse = true;
window.SetCursor(32649);
window.Repaint();
}
function on_mouse_leave() {
on_mouse = false;
window.SetCursor(32512);
window.Repaint();
}
function on_size(){
ww = window.Width;
wh = window.Height;
}
function on_item_focus_change() {
metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
if (metadb) on_metadb_changed();
}
function on_playlist_switch() {
on_item_focus_change();
}
function on_playback_new_track() {
on_item_focus_change();
}
function on_playback_dynamic_info_track() {
on_item_focus_change();
}
function on_playback_stop() {
on_item_focus_change();
}
function on_selection_changed(metadb) {
on_item_focus_change();
}
function Eval(field) {
if (metadb) {
path = fb.Titleformat("%path%").EvalWithMetadb(metadb);
return path.indexOf('://') > 0 ? fb.TitleFormat("[" + field + "]").Eval(true) : fb.TitleFormat("[" + field + "]").EvalWithMetadb(metadb);
}
}
function on_metadb_changed() {
artist = Eval("%artist%");
if (artist != old_artis){
try {
fso.deleteFile(tmp_b_path + "*.*" );
} catch(e) {};
get();
selected = 0;
old_artis = artist;
}
//window.Repaint();
}
function get(){
if (artist == "" || artist == "?") {return};
var url = ("http://www.last.fm/music/" + encodeURIComponent(artist) + "/+images");
xmlhttp.open("GET", url, true);
xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
xmlhttp.send();
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
doc.open();
var div = doc.createElement("div");
div.innerHTML = xmlhttp.responsetext;
var data = div.getElementsByTagName("img");
var urls = [];
for (i = 0; i < data.length; i++) {
if (data[i].src.indexOf("http://img2-ak.lst.fm/i/u/60x60/") == 0) urls.push(data[i].src.replace("60x60", "ar0"));
}
for (i = 0; i < Math.min(urls.length, limit); i++) {
get_p(urls[i],i);
}
doc.close();
get_files_from_dir();
} else {
artist = ""
}
window.Repaint();
}
}
}
function get_p(url, i){
if(!fso.FileExists(tmp_b_path + i + ".jpg") ) {
xmlhttp.open("GET", url, true);
xmlhttp.send();
//xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
var objADOStream = new ActiveXObject("ADODB.Stream");
objADOStream.Open;
objADOStream.Type = 1;
objADOStream.Write(xmlhttp.ResponseBody);
objADOStream.Position = 0;
try {
objADOStream.SaveToFile(tmp_b_path + i + ".jpg");
} catch(e) {};
objADOStream.Close;
//}
}
}
}
}
function get_files_from_dir() {
files = [];
var e = new Enumerator( fso.GetFolder(tmp_b_path).Files );
while ( !e.atEnd() ) {
var name = e.item().Name;
name = name.toLowerCase(name);
files.push(name);
e.moveNext();
}
}
function on_mouse_rbtn_up (x, y){
var _menu = window.CreatePopupMenu();
var i = 1;
MF_ENABLED = 0x00000000;
MF_GRAYED = 0x00000001;
_menu.AppendMenuItem(MF_ENABLED, i++, "...");
_menu.AppendMenuItem(MF_ENABLED, i++, "...");
ShiftDown = utils.IsKeyPressed(0x10) ? true : false;
// if (ShiftDown) {
_menu.AppendMenuItem(0x00000800, 0, 0);
_menu.AppendMenuItem(0x00000000, 10, "Reload");
_menu.AppendMenuItem(0x00000800, 0, 0);
_menu.AppendMenuItem(0x00000000, 20, "Properties");
_menu.AppendMenuItem(0x00000000, 30, "Configure ...");
// }
ret = _menu.TrackPopupMenu(x,y);
switch (ret) {
case 1:
break;
case 2:
break;
case 10:
window.Reload();
break;
case 20:
window.ShowProperties();
break;
case 30:
window.ShowConfigure();
break;
}
_menu.Dispose();
return true;
}
Ошибка: Панель WSH (модуль) (Picrure. www.last.fm): Ошибка выполнения Microsoft JScript:
Объект не поддерживает это свойство или метод
File: <main>
Ln: 235, Col: 9
<source text only available at compile time>
WSH Panel Mod (Picrure. www.last.fm): initialized in 19 ms
WSH Panel Mod (Picrure. www.last.fm): initialized in 17 ms
var pl = plman.ActivePlaylist;
plman.ClearPlaylistSelection(pl);
plman.SetPlaylistSelection(pl, [0], true);
var sel_pl = plman.GetPlaylistSelectedItems(pl);
fb.RunContextCommandWithMetadb('Properties',sel_pl);
function on_mouse_lbtn_up (x, y){
var items = plman.GetPlaylistItems(plman.ActivePlaylist);
plman.ClearPlaylistSelection(plman.ActivePlaylist);
for (var i = 0; i < items.count; i++) {
plman.SetPlaylistSelectionSingle(plman.ActivePlaylist, i, 1);
}
fb.RunContextCommandWithMetadb('Properties', plman.GetPlaylistSelectedItems(plman.ActivePlaylist));
}
Вернуться в Секреты foobar2000