A suggestion...
Added multilanguage support.
- Код: Выделить всё
// ==PREPROCESSOR==
// @name "Biography Text && Picture. www.last.fm"
// @author "kgena_ua"
// @version "27022016"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==
//START mod multilanguage support//
// Define values to be processed/translated in your script
// as e.g "Open.." to _("Open...")
// START USER SET DEFAULT LANGUAGE
var fb_lang = "ru";
// END USER SET DEFAULT LANGUAGE
function _(s) {
switch (fb_lang) {
case "ru": if (typeof(ru) != 'undefined' && ru[s]) {return ru[s];} return s; break;
case "gr": if (typeof(gr) != 'undefined' && gr[s]) {return gr[s];} return s; break;
default: return s;
}
}
//Russian
var ru = {
"Nothing found" : "Ничего не найдено",
"off" : "Отключено",
"sec" : "сек",
"auto cycle" : "Зацикливание изображений",
"EN text" : "Английский язык",
"RU text" : "Русский язык",
"Prefer now playing" : "Предпочитать воспроизводимый",
"Follow selected track" : "Следовать за выбранным треком",
"Artist pictures" : "Фото исполнителя",
"Albums pictures" : "Обложка альбома",
"last.fm Artist" : "Страничка исполнителя на Last.fm",
"Reload" : "Перезагрузить",
"Properties" : "Свойства WSH",
"Configure..." : "Настройки WSH...",
};
//Greek
var gr = {
"Nothing found" : "Δεν βρέθηκε τίποτα",
"off" : "κλειστό",
"sec" : "δευτ.",
"auto cycle" : "αυτόματος κύκλος",
"EN text" : "Αγγλικό κείμενο",
"RU text" : "Ρώσικο κείμενο",
"Prefer now playing" : "Προτίμηση τρέχουσας αναπαραγωγής",
"Follow selected track" : "Ακολουθώ επιλεγμένo κομμάτι",
"Artist pictures" : "Φωτογραφίες Καλιτέχνη",
"Albums pictures" : "Φωτογραφίες Αλμπουμ",
"last.fm Artist" : "Καλιτέχνης στο Last.fm",
"Reload" : "Επαναφόρτωση",
"Properties" : "Ιδιότητες WSH",
"Configure..." : "Ρυθμίσεις WSH...",
};
//END mod multilanguage support//
function RGB(r,g,b) { return (0xff000000|(r<<16)|(g<<8)|(b)); }
function RGBA(r,g,b,a) { return ((a << 24) | (r << 16) | (g << 8) | (b)); }
function getRed(color) {return ((color >> 16) & 0xff);};
function getGreen(color) {return ((color >> 8) & 0xff);};
function getBlue(color) {return (color & 0xff);};
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 ww,wh;
var font_name_a = window.GetProperty("font name: artist", "Arial");
var font_name_b = window.GetProperty("font name: biography", "Arial");
var font_size_a_d = window.GetProperty("font size: artist (delta)", 0);
var font_size_b = window.GetProperty("font size: biography", 12);
var a_font_style = window.GetProperty("font style: artist", 1);
var b_font_style = window.GetProperty("font style: biography", 0);
var min_font_size = 10;
var max_font_size = 16;
var a_font, b_font;
get_font();
function get_font(){
a_font = gdi.Font(font_name_a, font_size_b + font_size_a_d, a_font_style);
b_font = gdi.Font(font_name_b, font_size_b, b_font_style);
}
ColorTypeCUI = {
text: 0,
selection_text: 1,
inactive_selection_text: 2,
background: 3,
selection_background: 4,
inactive_selection_background: 5,
active_item_frame: 6
};
/*
function get_color(){
bgcolor = window.GetColorCUI(ColorTypeCUI.background);
a_color = window.GetColorCUI(ColorTypeCUI.text);
b_color = window.GetColorCUI(ColorTypeCUI.inactive_selection_text);
}
get_color();
*/
var bgcolor = RGB(31,41,48);
var a_color = RGB(220,220,220);
var b_color = RGB(255,255,230);
var transparent = 200;
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
var doc = new ActiveXObject("htmlfile");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var WshShell = new ActiveXObject("WScript.Shell");
var script_path = fb.ProfilePath + "\\tmp_Biography\\download\\";
var vbs = "cscript //nologo \"" + script_path + "download.vbs\"";
var tmp_b_path = fb.ProfilePath + "\\tmp_Biography\\";
if(!fso.FolderExists(tmp_b_path)) {fso.CreateFolder(tmp_b_path)};
if(!fso.FolderExists(tmp_b_path + "\\download\\")) {fso.CreateFolder(tmp_b_path + "\\download\\")};
if(!fso.FileExists(tmp_b_path + "\\download\\" + "download.vbs")) {create_download_file()};
var nocover_path = window.GetProperty("nocover path",".\\nocover\\nocover.png");
var nocover = window.GetProperty("nocover image", false);
var last_fm_logo;
load_last_fm_logo();
var artist, old_artis;
var g_img = null;
var p_margin = window.GetProperty("margin: picture", 10);
var files = [], selected = 0;
var limit = window.GetProperty("download limit",5);
var cycle = window.GetProperty("auto cycle (sec)", 0);
var pic_scroll = false;
var scrollbar = window.GetProperty("scrollbar", false);
var sb_down = false;
var sb_scroll = false;
var scrollbar_k;
var posy = 0;
var t_margin = window.GetProperty("margin: text", 10);
var txt_x = window.GetProperty("txt_x", window.Width / 2);
var txt_y = window.GetProperty("txt_y", window.Height / 2);
var delta_x, delta_y;
var artist_x, artist_y;
var b_x = 0, b_y = 0;
var text = "";
var s_text = 0;
var string_width;
var strings_array = [];
var b_text_rows = 0;
var b_text_row_height = 0;
var b_text_visable_rows = 0;
var b_text_visable_height = 0;
var b_text_array = [];
var k_down = false;
var text_scroll = false;
var abc_lang = new Array("", "ru/");
var abc = window.GetProperty("abc", 0);
var if_not_found = new Array(_("Nothing found"), _("Nothing found"));
var select_p_a = window.GetProperty("pictures/albums", 0);
var select_p_a_old;
var p_a = new Array("images", "albums");
var selection_mode = window.GetProperty("selection mode", 0);
var metadb;
on_item_focus_change();
function on_paint(gr){
!window.IsTransparent && gr.FillSolidRect(0, 0, ww, wh, bgcolor);
paint(gr);
if(set_cycle){
gr.FillSolidRect(0, 0, ww, wh, RGBA(getRed(bgcolor),getGreen(bgcolor),getBlue(bgcolor),transparent));
var txt_cycle = cycle == 0 ? _("off") : cycle + " " + _("sec");
set_cycle && gr.GdiDrawText(_("auto cycle") + " \n" + txt_cycle, b_font, b_color, 15, 15, ww, wh, DT_LEFT | DT_WORD_ELLIPSIS );
} else{
gr.FillSolidRect(txt_x, txt_y, ww - txt_x, wh - txt_y, RGBA(getRed(bgcolor),getGreen(bgcolor),getBlue(bgcolor),transparent));
}
gr.GdiDrawText(artist, a_font, RGB(0,0,0), artist_x + 1, artist_y + 2, ww - artist_x - t_margin, wh, DT_LEFT | DT_WORD_ELLIPSIS );
gr.GdiDrawText(artist, a_font, a_color, artist_x, artist_y, ww - artist_x - t_margin, wh, DT_LEFT | DT_WORD_ELLIPSIS );
for (var i = 0; i < b_text_visable_rows; i++) {
gr.GdiDrawText(b_text_array[i + s_text], b_font, RGB(0,0,0), b_x + 1, b_y + b_text_row_height * i + 2, ww, wh, DT_LEFT );
gr.GdiDrawText(b_text_array[i + s_text], b_font, b_color, b_x, b_y + b_text_row_height * i, ww, wh, DT_LEFT );
}
scrollbar && draw_scrollbar(gr);
gr.GdiDrawText("", b_font, b_color, 15, 0, ww, wh, DT_LEFT | DT_WORD_ELLIPSIS );
}
function paint(gr){
g_img = gdi.Image(files[selected]);
if (!g_img && nocover){
try {
g_img = gdi.Image(nocover_path);
} catch(e) {};
}
if (g_img){
var scale_w = (ww - p_margin * 2) / g_img.Width;
var scale_h = (wh - p_margin * 2) / g_img.Height;
var scale = Math.min(scale_w, scale_h);
if (files.length > 0){
g_img = g_img.CreateRawBitmap();
gr.GdiDrawBitmap(g_img, p_margin, p_margin, g_img.Width * scale, g_img.Height * scale, 0, 0, g_img.Width, g_img.Height);
} else {
gr.DrawImage(g_img, p_margin, p_margin, g_img.Width * scale, g_img.Height * scale, 0, 0, g_img.Width, g_img.Height, 0, 100);
}
}
logo_img = gdi.Image(tmp_b_path + "\\download\\" + "last_fm_logo.jpg");
if (logo_img && files.length == 0 && !nocover){
gr.DrawImage(logo_img, p_margin, p_margin, logo_img.Width * 0.8, logo_img.Height * 0.8, 0, 0, logo_img.Width, logo_img.Height, 0, 255);
}
}
function draw_scrollbar(gr){
scrollbar_h = b_text_rows > b_text_visable_rows ? b_text_visable_height * (b_text_visable_rows / b_text_rows) : 0;
scrollbar_y = s_text > 0 ? s_text * scrollbar_k : 0;
gr.FillSolidRect(ww - 4, b_y + scrollbar_y, 2, scrollbar_h, a_color);
}
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 on_item_focus_change() {
switch (selection_mode) {
case 0:
metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
break;
case 1:
metadb = fb.GetFocusItem();
break;
}
if (metadb) on_metadb_changed();
}
function Eval(field) {
if (!metadb) return;
path = fb.Titleformat("%path%").EvalWithMetadb(metadb);
//return path.indexOf('://') > 0 ? fb.TitleFormat("[" + field + "]").Eval() : fb.TitleFormat("[" + field + "]").EvalWithMetadb(metadb);
return fb.Titleformat("[" + field + "]").EvalWithMetadb(metadb) ? fb.TitleFormat("[" + field + "]").EvalWithMetadb(metadb) : fb.TitleFormat("[" + field + "]").Eval(true);
}
function on_metadb_changed() {
if (!metadb) return;
artist = Eval("%artist%");
if (artist != old_artis || select_p_a != select_p_a_old){
CollectGarbage();
g_img = null;
files = [];
del_files_from_dir();
selected = 0;
s_text = 0;
text = "";
get_b_text_array()
get_pic();
old_artis = artist;
select_p_a_old = select_p_a;
}
}
function get_pic(){
var url1 = ("http://www.last.fm/music/" + encodeURIComponent(artist) + "/+" + p_a[select_p_a]);
xmlhttp.open("GET", url1, 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].className == "image-list-image"){
if (data[i].src.indexOf("http://img2-ak.lst.fm/i/u/avatar170s") == 0) urls.push(data[i].src.replace("avatar170s", ""));
}
if (data[i].className == "album-grid-album-art"){
if (data[i].src.indexOf("http://img2-ak.lst.fm/i/u/300") == 0 && data[i].src.indexOf("c6f59c1e5e7240a4c0d427abd71f3dbb") < 0) urls.push(data[i].src.replace("300", ""));
}
}
for (i = 0; i < Math.min(urls.length, limit); i++) {
file = "\"" + tmp_b_path + artist + "_" + i + "_" +p_a[select_p_a] + ".jpg" + "\"";
WshShell.Run(vbs + " " + urls[i] + " " + file, false);
}
doc.close();
}
get_b_text();
}
}
}
function get_files_from_dir() {
files = [];
var e = new Enumerator( fso.GetFolder(tmp_b_path).Files );
while ( !e.atEnd() ) {
var name = e.item().Name;
if (name.indexOf(artist) == 0){
files.push(tmp_b_path + name);
}
e.moveNext();
}
}
/*function get_files_from_dir() {
files = [];
files = utils.Glob(tmp_b_path + artist + "*.*").toArray();
}
*/
function get_b_text(){
var url2 = ("http://www.last.fm/" + abc_lang[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) {
doc.open();
var div = doc.createElement("div");
div.innerHTML = 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;
}
}
doc.close();
}
if (text == "") text = if_not_found[abc];
get_b_text_array();
}
}
}
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() {
artist_x = txt_x + t_margin;
artist_y = txt_y + t_margin;
strings_array = [];
b_text_array = [];
temp_bmp = gdi.CreateImage(1, 1);
temp_gr = temp_bmp.GetGraphics();
b_x = txt_x + t_margin;
b_y = txt_y + temp_gr.CalcTextHeight("text", a_font) + t_margin * 2;
b_text_row_height = temp_gr.CalcTextHeight("text", b_font)
string_width = Math.max(ww - b_x - 10, 0);
if (text) strings_array = temp_gr.EstimateLineWrap(text, b_font, string_width).toArray();
for (var i = 0; i < strings_array.length; i += 2) {
b_text_array.push(strings_array[i].replace(/^\s+|\s+$/g, ""));
}
b_text_rows = b_text_array.length;
b_text_visable_rows = Math.round((wh - b_y - 10) / b_text_row_height);
b_text_visable_height = Math.round(wh - b_y - 10);
temp_bmp.ReleaseGraphics(temp_gr);
temp_bmp.Dispose();
temp_gr = null;
temp_bmp = null;
if (b_text_visable_rows + s_text > b_text_rows && s_text > 0) {
s_text = b_text_rows - b_text_visable_rows;
};
scrollbar_k = b_text_visable_height / b_text_rows;
window.Repaint();
}
function on_mouse_rbtn_up (x, y){
var _menu = window.CreatePopupMenu();
var i = 1;
MF_ENABLED = 0x00000000;
MF_GRAYED = 0x00000001;
MF_SEPARATOR = 0x00000800;
_menu.AppendMenuItem(MF_ENABLED, i++, _("EN text"));
_menu.AppendMenuItem(MF_ENABLED, i++, _("RU text"));
_menu.CheckMenuRadioItem(1, i, abc + 1);
_menu.EnableMenuItem(abc + 1, 1);
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_ENABLED, i++, _("Prefer now playing"));
_menu.AppendMenuItem(MF_ENABLED, i++, _("Follow selected track"));
_menu.CheckMenuRadioItem(i - 2, i , selection_mode + 3);
_menu.EnableMenuItem(selection_mode + 3, 1);
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_ENABLED, i++, _("Artist pictures"));
_menu.AppendMenuItem(MF_ENABLED, i++, _("Albums pictures"));
_menu.CheckMenuRadioItem(i - 2, i , select_p_a + 5);
_menu.EnableMenuItem(select_p_a + 5, 1);
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
var is_artist = artist ? MF_ENABLED : MF_GRAYED;
_menu.AppendMenuItem(is_artist, i++, _("last.fm Artist"));
// if (ShiftDown) {
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_ENABLED, 10, _("Reload"));
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_ENABLED, 20, _("Properties"));
_menu.AppendMenuItem(MF_ENABLED, 30, _("Configure..."));
// }
ret = _menu.TrackPopupMenu(x,y);
switch (ret) {
case 1:
abc = 0;
window.SetProperty("abc", abc);
s_text = 0;
text = "";
get_b_text();
break;
case 2:
abc = 1;
window.SetProperty("abc", abc);
s_text = 0;
text = "";
get_b_text();
break;
case 3:
selection_mode = 0;
window.SetProperty("selection_mode", selection_mode);
on_item_focus_change();
break;
case 4:
selection_mode = 1;
window.SetProperty("selection_mode", selection_mode);
on_item_focus_change();
break;
case 5:
select_p_a = 0;
window.SetProperty("pictures/albums", select_p_a);
on_metadb_changed();
break;
case 6:
select_p_a = 1;
window.SetProperty("pictures/albums", select_p_a);
on_metadb_changed();
break;
case 7:
WshShell.run("http://www.last.fm/" + abc_lang[abc] + "music/" + encodeURIComponent(artist));
break;
case 10:
window.Reload();
break;
case 20:
window.ShowProperties();
break;
case 30:
window.ShowConfigure();
break;
}
_menu.Dispose();
return true;
}
var timer = window.SetInterval(on_timer, 1000);
var step = 0;
var set_cycle = false;
var dis_timer, dis = 0;
function on_timer(id) {
step = set_cycle || cycle == 0 ? 0 : step + 1;
if (files.length == 0) {get_files_from_dir(); window.Repaint();};
if (cycle > 0 && step >= cycle){
selected = selected >= files.length - 1 ? 0 : selected = selected + 1;
window.Repaint();
step = 0;
}
}
function on_key_down(vkey) {
if (vkey == 16){
set_cycle = true;
dis_set();
window.Repaint();
}
}
function dis_set(){
dis = 0;
dis_timer && window.ClearInterval(dis_timer);
dis_timer = window.SetInterval(function() {
if (set_cycle) {
dis++;
if(dis == 1) {
set_cycle = false;
window.ClearInterval(dis_timer);
window.Repaint();
};
}
}, 1000 );
}
var delay = false;
function fdelay(){
var delay_timer = window.SetTimeout(function() {
delay = false;
window.ClearTimeout(delay_timer);
}, 200);
}
function del_files_from_dir() {
var del_files = [];
var e = new Enumerator( fso.GetFolder(tmp_b_path).Files );
while ( !e.atEnd() ) {
var name = e.item().Name;
try {
fso.deleteFile(tmp_b_path + name );
} catch(e) {};
e.moveNext();
}
}
/*
function del_files_from_dir() {
del_files = [];
del_files = utils.Glob(tmp_b_path + "*.*").toArray();
for (i in del_files) {
try {
fso.deleteFile(del_files[i]);
} catch(e) {};
}
}
*/
function load_last_fm_logo(){
if(!fso.FileExists(tmp_b_path + "\\download\\" + "last_fm_logo.jpg")) {
var url = "http://www.last.fm/static/images/logo_beta.png?eb6d3ca20e73"
var file = "\"" + tmp_b_path + "\\download\\" + "last_fm_logo.jpg" + "\"";
WshShell.Run(vbs + " " + url + " " + file, false);
var url = "http://static-web.last.fm/static/images/favicon.702b239b6194.ico"
var file = "\"" + tmp_b_path + "\\download\\" + "last_fm_ico.ico" + "\"";
WshShell.Run(vbs + " " + url + " " + file, false);
}
}
function create_download_file() {
try {
file = fso.CreateTextFile(tmp_b_path + "\\download\\" + "download.vbs" )
var text =
"If (WScript.Arguments.Count <> 2) Then" + "\n\r" +
" WScript.Quit" + "\n\r" +
"End If" + "\n\r" + "\n\r" +
"url = WScript.Arguments(0)" + "\n\r" +
"file = WScript.Arguments(1)" + "\n\r" + "\n\r" +
"Set objFSO = Createobject(" + '"Scripting.FileSystemObject"' + ")" + "\n\r" +
"If objFSO.Fileexists(file) Then" + "\n\r" +
" Set objFSO = Nothing" + "\n\r" +
" WScript.Quit" + "\n\r" +
"End If" + "\n\r" + "\n\r" +
"Set objXMLHTTP = CreateObject(" + '"MSXML2.XMLHTTP"' + ")" + "\n\r" +
"objXMLHTTP.open " + '"GET"' + ", url,false" + "\n\r" +
"objXMLHTTP.send()" + "\n\r" + "\n\r" +
"If objXMLHTTP.Status = 200 Then" + "\n\r" +
" Set objADOStream = CreateObject(" + '"ADODB.Stream"' + ")" + "\n\r" +
" objADOStream.Open" + "\n\r" +
" objADOStream.Type = 1" + "\n\r" +
" objADOStream.Write objXMLHTTP.ResponseBody" + "\n\r" +
" objADOStream.Position = 0" + "\n\r" +
" objADOStream.SaveToFile file" + "\n\r" +
" objADOStream.Close" + "\n\r" +
" Set objADOStream = Nothing" + "\n\r" +
"End If" + "\n\r" + "\n\r" +
"Set objFSO = Nothing" + "\n\r" +
"Set objXMLHTTP = Nothing"
;
file.WriteLine(text);
file.Close();
} catch(e) {};
}
function on_mouse_move(x, y) {
window.SetCursor(32649);
text_scroll = x >= txt_x && x < ww - 20 && y >= txt_y ? true : false;
sb_scroll = x > ww - 20 && y >= txt_y ? true : false;
pic_scroll = !text_scroll && !sb_scroll ? true : false;
if (k_down){
txt_x = x - delta_x ;
txt_y = y - delta_y;
txt_x = txt_x <= 0 ? 0 : txt_x >= ww - 50 ? ww - 50: txt_x;
txt_y = txt_y <= 0 ? 0 : txt_y >= wh - 50 ? wh - 50: txt_y;
get_b_text_array();
}
if (sb_down && scrollbar){
posy = y + delta_y;
s_text = y + delta_y >= 0 ? y + delta_y <= (b_text_rows - b_text_visable_rows) * scrollbar_k ? Math.round(posy / scrollbar_k) : b_text_rows - b_text_visable_rows : 0;
window.Repaint();
}
}
function on_mouse_wheel(delta) {
ShiftDown = utils.IsKeyPressed(0x10) ? true : false;
if (!delay && pic_scroll && !ShiftDown){
delay = true;
fdelay();
get_files_from_dir();
if (delta < 0) {selected = selected <= 0 ? files.length - 1 : selected = selected - 1};
if (delta > 0) {selected = selected >= files.length - 1 ? 0 : selected = selected + 1};
}
if (text_scroll && !ShiftDown){
if (b_text_rows > b_text_visable_rows){
if (delta < 0) {s_text = b_text_rows - s_text <= b_text_visable_rows ? b_text_rows - b_text_visable_rows : s_text += 1}
if (delta > 0) {s_text = s_text <= 0 ? 0 : s_text -= 1}
}
}
if (!delay && text_scroll && ShiftDown){
delay = true;
fdelay();
if (delta < 0) {font_size_b = font_size_b <= min_font_size ? min_font_size : font_size_b - 2;};
if (delta > 0) {font_size_b = font_size_b >= max_font_size ? max_font_size : font_size_b + 2;};
window.SetProperty("font size: biography", font_size_b);
get_font();
get_b_text_array();
}
if (set_cycle && pic_scroll) {
if (delta < 0) {cycle = cycle <= 0 ? 0 : cycle - 5;};
if (delta > 0) {cycle = cycle >= 60 ? 60 : cycle + 5;};
window.SetProperty("auto cycle (sec)", cycle);
}
window.Repaint();
}
function on_mouse_lbtn_down(x,y){
if (text_scroll){
k_down = true;
delta_x = x - txt_x;
delta_y = y - txt_y;
}
if (sb_scroll){
sb_down = true;
posy = s_text * scrollbar_k;
delta_y = posy - y;
}
}
function on_mouse_lbtn_up(x,y){
window.SetProperty("txt_x", txt_x);
window.SetProperty("txt_y", txt_y);
k_down = false;
sb_down = false;
}
function on_mouse_lbtn_dblclk (x,y){
if (text_scroll){
abc = abc == 1 ? 0 : 1;
window.SetProperty("abc", abc);
s_text = 0;
b_text_array = [];
text = "";
get_b_text();
}
if (files[selected] && pic_scroll) WshShell.run( '"' + files[selected] + '"' );
}
function on_mouse_leave() {
window.SetCursor(32512);
window.Repaint();
}
function on_size(){
ww = window.Width;
wh = window.Height;
txt_x = window.GetProperty("txt_x");
txt_y = window.GetProperty("txt_y");
txt_x = txt_x >= ww - 50 && txt_x >= 0 ? ww - 50 : txt_x;
txt_y = txt_y >= wh - 50 && txt_y >= 0 ? wh - 50 : txt_y;
get_b_text_array();
}