i just realised there's a stupid typo in my post above, it should on_mouse_lbtn_up. make sure you have no on_mouse_rbtn_up in the panel at all and then my right click menu will work.
Yes it works
If someone already use this, here is new script, with all the right click options provided by Marc script:
// ==PREPROCESSOR==
// @name "Biography Text"
// @author "Mire777"
// @import "%fb2k_profile_path%marc2003\common8.js"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==
//BEGIN-->
var p = new panel("Last.fm", ["metadb", "remap","custom_menu"]);
var t = new text("custom", 6, 30, p.w - 12, p.h - 30);
//properties..
source = window.GetProperty("2k3.download_source", "last.fm");
var fbfolder = (fb.ProfilePath + "Artist_info");
var folder = window.GetProperty("2k3.custom_folder", fbfolder);
//metadb/playback
on_metadb_changed();
on_playback_new_track();
//Folder call
var fso = new ActiveXObject("Scripting.FileSystemObject");
WshShell = new ActiveXObject("WScript.Shell");
//on size
function on_size() {
p.size();
t.w = p.w - 12;
t.h = p.h - 30;
t.size();
}
//on paint
function on_paint(gr) {
if (t.text > "") {
p.draw_background(gr);
p.left_text(gr, p.artist, p.title_font, p.textcolour_hl, 6, 6, p.w - 12, 24);
gr.DrawLine(6, 29, p.w - 6, 29, 1, p.textcolour_hl);
t.draw(gr);
p.menu_btn.draw(gr);
}}
//metadb changed
function on_metadb_changed() {
if (!p.metadb) return;
p.artist = p.eval(p.artist_tf);
if (t.artist == p.artist) return;
t.artist = p.artist;
t.text = "";
if (folder>"")
{
//Create main folder 'Artist_info'
if(!fso.FolderExists(folder)) fso.CreateFolder(folder);
//Create subfolder 'artist'
if(!fso.FolderExists(folder + "\\"+(p.artist.validate()))) fso.CreateFolder(folder + "\\"+(p.artist.validate()));
}
//folder + 'bio.txt'
t.filename = folder + "\\"+(p.artist.validate()) + "\\bio.txt";
//Check if folder exist then >continue..
if (t.filename.is_file()) {
t.text = p.open(t.filename);
if (t.filename.expired(ONE_DAY) && source=="last.fm") {get();}
else
if (t.filename.expired(ONE_DAY) && source=="wikipedia") {get2();}
} else {
if (source=="last.fm") {get();}
else
if (source=="wikipedia") {get2();}
}
t.update();
window.Repaint();
}
//wheel step
function on_mouse_wheel(step) {
t.wheel(step);
}
//on mouse move
function on_mouse_move(x, y) {
p.move(x, y);
t.move(x, y);
}
//on mouse lbtn_up
function on_mouse_lbtn_up(x, y) {
if (p.menu_btn.lbtn_up(x, y)) return;
}
//1st bio text
function get() {
if (t.artist == "" || t.artist == "?") return;
var fn = t.filename;
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(t.artist) + "/+wiki", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (this.xmlhttp.readyState == 4) {
if (this.xmlhttp.status == 200) {
var text = this.xmlhttp.responsetext;
if (!this.doc) this.doc = new ActiveXObject("htmlfile");
this.doc.open();
var div = this.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];
for (i = 0; i < 1; i++) {
if (data[i].id.indexOf("about:/wiki/") == 0);
//find text from tag%tag
var st = text.indexOf( data[i].id.replace("about:/wiki/", ""));
var str = "id=\"wiki\">";
st = text.indexOf(str, st) + str.length;
var et = text.indexOf("</div>", st);
var artt = text.substr(st, et - st);
t.text = artt;
//check if biography exist
if (t.text.indexOf("TYPE")==0) {t.text = "This artist does not have a biography";}
else
//clean text(marc)
t.text = p.strip_tags(t.text);
//clean other
{t.text = t.text.replace(/\n\r/g, "\n").replace(/\n\n/g, "\n").trim();}
//if clean not work use this:
//.replace(/<\/?[^>]+(>|$)/g, "").replace(/\n/g, "<br>").replace(/<BR>/g,"\n").replace(/&/g,"&").replace(/<br>/g,"---").replace(/---/g,"\n\r");
//console
//fb.trace("bio: " + t.text);
{
p.save(t.text, fn);
t.update();
window.Repaint();
};
}
this.doc.close();
} else {
fb.trace("HTTP error: " + this.xmlhttp.status);
{t.text = "This artist does not have a biography";}
p.save(t.text, fn);
t.update();
window.Repaint();
}}}}
//2nd bio text
function get2() {
if (t.artist == "" || t.artist == "?") return;
var fn = t.filename;
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://en.wikipedia.org/wiki/" + encodeURIComponent(t.artist) + "", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (this.xmlhttp.readyState == 4) {
if (this.xmlhttp.status == 200) {
var text = this.xmlhttp.responsetext;
if (!this.doc) this.doc = new ActiveXObject("htmlfile");
this.doc.open();
var div = this.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];
for (i = 0; i < 1; i++) {
if (data[i].id.indexOf("about:/wiki/") == 0);
//find text from tag%tag
var st = text.indexOf( data[i].id.replace("about:/wiki/", ""));
var str = "<p>";
st = text.indexOf(str, st) + str.length;
var et = text.indexOf("</html>", st);
var artt = text.substr(st, et - st);
t.text = artt;
//check if biography exist
if (t.text.indexOf("TYPE")==0) {t.text = "This artist does not have a biography";}
if (t.text.indexOf("may refer to")>0) {t.text = "This artist does not have a biography";}
if (t.text.indexOf("can refer to")>0) {t.text = "This artist does not have a biography";}
else
//clean text(marc)
t.text = p.strip_tags(t.text);
//clean other
{t.text = t.text.replace(/\n\r/g, "\n").replace(/\n/g, "\n\n").replace(/[?[0-9]+?]/g, "").replace(/\[?edit+?]/g, "").replace(/\n+Contents?[^>]+?External links/g, "").replace(/\n+Contents?[^>]+?References/g, "").replace(/[0-9] Filmography/, "").replace(/[0-9] Discography/, "").replace(/[0-9] References/, "").replace(/[0-9] Notes/, "").split("Filmography")[0].split("Discography")[0].split("References")[0].replace(/\n\n\n\n/g, "\n").replace(/\n\n\n/g, "\n").replace(/\n\n\n/g, "\n").replace(/[?[citatio]+?n n/g, "").replace(/Sorry, your browser either has JavaScript disabled or does not have any supported player./g, "").replace(/You can download the clip or download a player to play the clip in your browser./g, "").replace(/Problems playing this file[?]/g, "").replace(/See media help./g, "").replace(/\n\r/g, "\n").replace(/\n\n\n\n/g, "\n").replace(/\n\n\n/g, "\n").trim();}
//if clean not work use this:
//.replace(/<\/?[^>]+(>|$)/g, "").replace(/\n/g, "<br>").replace(/<BR>/g,"\n").replace(/&/g,"&").replace(/<br>/g,"---").replace(/---/g,"\n\r");
//console
//fb.trace("bio: " + t.text);
{
p.save(t.text, fn);
t.update();
window.Repaint();
};
}
this.doc.close();
} else {
fb.trace("HTTP error: " + this.xmlhttp.status);
{t.text = "This artist does not have a biography";}
p.save(t.text, fn);
t.update();
window.Repaint();
}}}}
//menu
p.menu = function() {
var MF_SEPARATOR = 0x00000800;
var MF_STRING = 0x00000000;
var _menu = window.CreatePopupMenu();
var idx;
_menu.AppendMenuItem(MF_STRING, 1, "Refresh");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING, 2, "Last.fm");
_menu.AppendMenuItem(MF_STRING, 3, "Wikipedia");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING, 4, "Open Folder");
if (source=="last.fm") _menu.AppendMenuItem(MF_STRING, 5, "Open Last.fm");
if (source=="wikipedia") _menu.AppendMenuItem(MF_STRING, 5, "Open Wiki.");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING, 6, "Properties");
if (utils.IsKeyPressed(0x10)) _menu.AppendMenuItem(MF_STRING, 7, "Configure...");
_menu.CheckMenuRadioItem(2, 3, source == "last.fm" ? 2 : 3);
var idx = _menu.TrackPopupMenu(p.menu_btn.x, p.menu_btn.y);
if(idx == 1) if (p.metadb) {if (source=="last.fm") {get();} else if (source=="wikipedia") {get2();}}
if(idx == 2) if (p.metadb) {source = idx == 2 ? "last.fm" : "wikipedia"; window.SetProperty("2k3.download_source", source); get();}
if(idx == 3) if (p.metadb) {source = idx == 3 ? "wikipedia" : "last.fm"; window.SetProperty("2k3.download_source", source); get2();}
if(idx == 4) p.run("explorer /select,\"" + t.filename);
if(idx == 5) if (p.metadb) {if (source=="last.fm") {p.browser("http://www.last.fm/music/" + encodeURIComponent(t.artist));} else if (source=="wikipedia") {p.browser("http://en.wikipedia.org/wiki/" + encodeURIComponent(t.artist));}}
if(idx == 6) window.ShowProperties();
if(idx == 7) window.ShowConfigure();
_menu.Dispose();
return true;
}