Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // RUN
- //=================================================// Images directory
- var bt_dir = fb.FoobarPath+"skins\\eini\\bt\\run\\";
- //=================================================// Tools
- function RGB(r, g, b) {
- return (0xff000000 | (r << 16) | (g << 8) | (b));
- }
- //=================================================// OBJECT button
- button = function () {
- this._attrb = {};
- this.create = function (path_normal, path_hover, path_down) {
- this._attrb.normal = gdi.Image(path_normal);
- this._attrb.hover = gdi.Image(path_hover);
- this._attrb.down= gdi.Image(path_down);
- if (typeof this._attrb.x == "undefined") this._attrb.x= 0;
- if (typeof this._attrb.y == "undefined") this._attrb.y= 0;
- this._attrb.w = this._attrb.normal.Width;
- this._attrb.h= this._attrb.normal.Height;
- if (typeof this._attrb.state == "undefined") this._attrb.state=0;
- }
- this.draw = function (gr, bx, by, alpha) {
- var image;
- this._attrb.x = bx;
- this._attrb.y = by;
- switch(this._attrb.state)
- {
- case 0:
- image = this._attrb.normal;
- break;
- case 1:
- image = this._attrb.hover;
- break;
- case 2:
- image = this._attrb.down;
- break;
- }
- gr.DrawImage(image, bx, by, this._attrb.w, this._attrb.h, 0, 0, this._attrb.w, this._attrb.h, 0, alpha);
- }
- this.checkstate = function (action, x, y) {
- switch(action)
- {
- case "down":
- if (x>this._attrb.x && x<this._attrb.x+this._attrb.w && y>this._attrb.y && y<this._attrb.y+this._attrb.h)
- {
- this._attrb.state=2;
- window.Repaint();
- } else if (this._attrb.state==2){
- this._attrb.state=0;
- window.Repaint();
- }
- break;
- case "move":
- if (x>this._attrb.x && x<this._attrb.x+this._attrb.w && y>this._attrb.y && y<this._attrb.y+this._attrb.h)
- {
- this._attrb.state=1;
- window.Repaint();
- } else if (this._attrb.state==1){
- this._attrb.state=0;
- window.Repaint();
- }
- break;
- case "up":
- if (x>this._attrb.x && x<this._attrb.x+this._attrb.w && y>this._attrb.y && y<this._attrb.y+this._attrb.h)
- {
- this._attrb.state=1;
- } else {
- this._attrb.state=0;
- }
- break;
- }
- return this._attrb.state;
- }
- }
- //=================================================// generate new OBJECTs
- var bouton01 = new button;
- var bouton02 = new button;
- var bouton03 = new button;
- var bouton04 = new button;
- var bouton05 = new button;
- //=================================================// Global Variables
- var ButtonStates = {normal: 0,hover: 1,down: 2};
- var g_font = gdi.Font("Tahoma", 8, 1);
- var ww;
- var wh;
- var WshShell = new ActiveXObject("WScript.Shell");
- //==========================================================================/ on_paint
- function on_paint(gr){
- //draw button 01
- bouton01.draw(gr,0,1,255);
- //draw button 02
- bouton02.draw(gr,23,1,255);
- //draw button 03
- bouton03.draw(gr,44,0,255);
- //draw button 04
- bouton04.draw(gr,66,1,255);
- //draw button 05
- bouton05.draw(gr,88,0,255);
- }
- //==========================================================================/ on_size
- function on_size() {
- ww = window.Width;
- wh = window.Height;
- bouton01.create(bt_dir+"google_artist0.png", bt_dir+"google_artist1.png", bt_dir+"google_artist1.png");
- bouton02.create(bt_dir+"google_album0.png", bt_dir+"google_album1.png", bt_dir+"google_album1.png");
- bouton03.create(bt_dir+"wiki0.png", bt_dir+"wiki1.png", bt_dir+"wiki1.png");
- bouton04.create(bt_dir+"yt0.png", bt_dir+"yt1.png", bt_dir+"yt1.png");
- bouton05.create(bt_dir+"as0.png", bt_dir+"as1.png", bt_dir+"as1.png");
- }
- //==========================================================================/ lbtn_down
- function on_mouse_lbtn_down(x,y){
- var state;
- if (bouton01.checkstate("down",x,y)==ButtonStates.down) {
- WshShell.run("http://images.google.com/images?hl=en&q="+fb.TitleFormat("$replace(%artist%,' ','+','&','and')").Eval(true)+"&btnG=Recherche+d%27images&gbv=2");
- }
- if (bouton02.checkstate("down",x,y)==ButtonStates.down) {
- WshShell.run("http://images.google.com/images?hl=en&q="+fb.TitleFormat("$replace(%artist%,' ','+','&','and')").Eval(true)+"%20"+fb.TitleFormat("$replace(%album%,' ','+','&','and')").Eval(true)+"&btnG=Recherche+d%27images&gbv=2");
- }
- if (bouton03.checkstate("down",x,y)==ButtonStates.down) {
- WshShell.run("http://en.wikipedia.org/wiki/"+fb.TitleFormat("$replace(%artist%,' ','_','&','and')").Eval(true));
- }
- if (bouton04.checkstate("down",x,y)==ButtonStates.down) {
- WshShell.run("http://www.youtube.com/results?search_type=&search_query="+fb.TitleFormat("$replace(%artist%+%title%,' ','+','&','and')").Eval(true)+"&aq=2&oq");
- }
- if (bouton05.checkstate("down",x,y)==ButtonStates.down) {
- WshShell.run("http://www.last.fm/music/"+fb.TitleFormat("$replace(%artist%,' ','+','&','and','/','%252F')").Eval(true));
- }
- window.Repaint();
- }
- //==========================================================================/ lbtn_up
- function on_mouse_lbtn_up(x,y) {
- bouton01.checkstate("up",x,y);
- bouton02.checkstate("up",x,y);
- bouton03.checkstate("up",x,y);
- bouton04.checkstate("up",x,y);
- bouton05.checkstate("up",x,y);
- window.Repaint();
- }
- //==========================================================================/ mouse_move
- function on_mouse_move(x,y) {
- bouton01.checkstate("move",x,y);
- bouton02.checkstate("move",x,y);
- bouton03.checkstate("move",x,y);
- bouton04.checkstate("move",x,y);
- bouton05.checkstate("move",x,y);
- window.Repaint();
- }
- //==========================================================================/ mouse_leave
- function on_mouse_leave() {
- bouton01.checkstate("up",0,0);
- bouton02.checkstate("up",0,0);
- bouton03.checkstate("up",0,0);
- bouton04.checkstate("up",0,0);
- bouton05.checkstate("up",0,0);
- window.Repaint();
- }
- function on_mouse_wheel(delta){
- }
- function on_volume_change(val){
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement