1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761
| function jKeyboard($){
var sMode = false;
var c = 0;
var events = [];
var canvas, ctx, kbCanvas;
var strokes = [];
var drawing = false, clicked = false, grip = false;
var trashLetters = [];
var autofire, autoFireInt = 200, autofireX;
var objFocus;
function simpleSprite() { return {
}
}
function Sprite(o) {
var s = simpleSprite();
// Use new keys
for (var k in o) {
s[k] = o[k];
}
return s;
}
var fps = 50;
var fdur = 1000/fps;
var lastU = new Date();
function frameRate() {
var n = (new Date()).getTime();
if ((n-lastU)<fdur) return;
lastU = n;
if (events['mousemove']) {
$('#out').html('Mouse moving');
var e = events['mousemove'];
strokes.push({x:e.x, y:e.y});
kbCanvas.mousemove(e);
kbCanvas.paint();
if (sMode && drawing) { // For drawing keyboard paths
ctx.beginPath();
ctx.moveTo(strokes[0].x,strokes[0].y);
for (var s=1; s<strokes.length;s++) {
ctx.lineTo(strokes[s].x,strokes[s].y);
}
ctx.stroke();
}
} else {
$('#out').html('Nothing');
}
//events = [];
}
var keyObjects = [];
var startKb = function() {
var canvas = document.createElement('canvas');
if ($.browser.msie) {
// IE is still not supported YET.
// We have to load Excanvas on demand and render
// We also have to use a different API to access textarea.
//http://ajaxpatterns.org/On-Demand_Javascript
dhtmlLoadScript('excanvas.js');
G_vmlCanvasManager.initElement(canvas);
/* */
/*
jQuery.getScript("excanvas.js", function(){
if (typeof(G_vmlCanvasManager) != 'undefined') {
G_vmlCanvasManager.initElement(canvas);
}
});
*/
}
if (!canvas.getContext){
alert("Sorry, your browser does not support html 5 keyboard. Please try with another browser!!");
return;
}
var kbWidth = $(window).width();
var kbHeight = 250;
// Setting Keyboard DOM attributes
$(canvas).attr('id', 'jKeyboard').attr('name', 'Kb')
.attr('width', kbWidth)
.attr('height', kbHeight)
.attr('style', 'border: solid 2px #666; padding:5px; position: fixed; left:100px;\
top:100px;\
-moz-border-radius: 15px;\
-webkit-border-radius: 15px;\
background:#fff;\
filter:alpha(opacity=1);\
-moz-opacity:1;\
-khtml-opacity: 1;\
opacity: 1;\
');
// Centers Keyboard
$(canvas).css({left: ($(window).width()-kbWidth)/2, top: ($(window).height()-kbHeight)});
$('body').append(canvas);
ctx = canvas.getContext("2d");
CanvasTextFunctions.enable(ctx);
var zz = 0;
handleKeyboardDrag = function(e) {
if (grip) {
$('#jKeyboard').css({left:e.pageX - gripXY.x,
top:e.pageY - gripXY.y});
}
}
kbCanvas = {
elements:[],
paint:function() {
ctx.clearRect(0,0,canvas.width,canvas.height);
for (var e in this.elements) {
this.elements[e].paint();
}
},
mousemove:function(e) {
if (clicked) {
drawing = true;
}
$('#out').html('Mouse moving');
var hit = false;
for (var o in this.elements) {
var o2 = this.elements[o];
if (o2.ispressed) {
o2.isdragged = true;
if (typeof o2.drag == 'function')
o2.drag(e);
}
if (typeof o2.hover != 'function') continue;
if ((o2.x<e.x)&&(o2.y<e.y)&&
((o2.x+o2.w)>e.x)&&
((o2.y+o2.h)>e.y)) {
if (typeof o2.hover == 'function')
o2.hover(e);
hit = true;
} else {
if (o2.ishover) {
o2.hoveroff(e);
}
}
}
if (!hit) {
$('#jKeyboard').css({cursor:'auto'});
}
},
mousedown:function(e) {
clicked =true;
strokes = [];
grip = true;
gripXY = e;
strokes.push({x:e.x, y:e.y});
$('#out').html('Mouse Down');
for (var o in this.elements) {
var o2 = this.elements[o];
if ((o2.x<e.x)&&(o2.y<e.y)&&
((o2.x+o2.w)>e.x)&&
((o2.y+o2.h)>e.y)) {
o2.clicked = true;
grip = false;
if (typeof o2.mousedown == 'function') {
o2.ispress = true;
o2.mousedown(e);
}
o2.paint();
break;
}
}
if (grip) {
//$(document).mousemove(handleKeyboardDrag);
}
},
mouseup:function(e) {
if (grip) {
$(document).unbind('mousemove', handleKeyboardDrag);
}
grip = false;
clicked = false; drawing = false;
for (var o in this.elements) {
var o2 = this.elements[o];
if (o2.ispress) {
if (typeof o2.mouseup != 'function') continue;
if ((o2.x<e.x)&&(o2.y<e.y)&&
((o2.x+o2.w)>e.x)&&
((o2.y+o2.h)>e.y)) {
o2.mouseup(e);
hit = true;
}
o2.ispress = false;
}
}
}
};
// Keyboard Layout.
var kbItems = [];
kbItems[0] = [ '_','1','2','3','4','5','6','7','8','9','0','-','.','Retour'];
kbItems[1] = [ 'Tab','a','z','e','r','t','y','u','i','o','p','[',']','\\'];
kbItems[2] = [ 'Maj','q','s','d','f','g','h','j','k','l', ';','\'','Entrer'];
kbItems[4] = [ 'Shift','w','x','c','v','b','n','m',',','=','/',];
kbItems[5] = [ 'Espace'];
function roundedRect(ctx,x,y,width,height,radius,hover, click){
ctx.beginPath();
ctx.moveTo(x,y+radius);
ctx.lineTo(x,y+height-radius);
ctx.quadraticCurveTo(x,y+height,x+radius,y+height);
ctx.lineTo(x+width-radius,y+height);
ctx.quadraticCurveTo(x+width,y+height,x+width,y+height-radius);
ctx.lineTo(x+width,y+radius);
ctx.quadraticCurveTo(x+width,y,x+width-radius,y);
ctx.lineTo(x+radius,y);
ctx.quadraticCurveTo(x,y,x,y+radius);
// 000 333 666 dark light ligher
// click hover default 000 555 aaa , 000 999 555
if (click) {
ctx.strokeStyle = "#000";
ctx.stroke();
} else
if (hover) {
ctx.strokeStyle = "#999";
ctx.stroke();
//ctx.fillStyle = "yellow";
//ctx.fill();
} else {
ctx.strokeStyle = "#555";
ctx.stroke();
}
}
function hover() {
$('#out').html(':)');
this.ishover = true;
//kbCanvas.paint();
$('#jKeyboard').css({cursor:'pointer'});
}
function hoveroff() {
this.ishover = false;
this.ispress = false;
$('#jKeyboard').css({cursor:'auto'});
}
function replaceIt(txtarea, newtxt) {
if (!txtarea) return;
// IE txtarea.selection
//document.selection.createRange().text = 'Some new text';
var oldtxt = $(txtarea).val();
var start = txtarea.selectionStart;
var end = txtarea.selectionEnd;
if (autofireX > -1) { autofireX+= newtxt.length ;
start = end = autofireX; } // Work around for Chrome
else { autofireX = start; }
var select = end - start;
//$('#out2').append('start '+start + ' end ' +end+ ' select ' + select + ' ' + newtxt.length + '<br />');
$(txtarea).val(
oldtxt.substr(0, start)+
newtxt+
oldtxt.substr(end)
);
//if (select>0) // There's no need for checking selection here?
if (txtarea.setSelectionRange) {
txtarea.setSelectionRange(start+newtxt.length , start+newtxt.length);
}
// txtarea.focus();
}
function lettermousepress() {
replaceIt(findFocusTarget(),this.txt);
// Set autofire
autofire = window.setInterval(replaceIt, autoFireInt,
findFocusTarget(),this.txt);
}
function mouseup() {
this.ispress = false;
}
function paint() {
roundedRect(ctx, this.x , this.y, this.w, this.h, 10, this.ishover, this.ispress );
//ctx.strokeRect(this.x , this.y, this.w, this.h ); //ctx.fillText(this.txt, this.x + this.w/2, this.y + this.h/2);
ctx.drawTextCenter(null,16,this.x + this.w/2, this.y + this.h/2+5, this.txt);
}
function lookupwidth(c) {
if (c=='Tab') return $(window).width()/14;
if (c=='Retour') return $(window).width()/14;
if (c=='Maj') return $(window).width()/13;
if (c=='Entrer') return $(window).width()/13;
if (c=='Shift') return $(window).width()/10;
if (c=='Espace') return $(window).width()-50;
return $(window).width()/15;
}
// Init Objects
var kx,ky;
var padding = 5;
ky = padding;
for (var i1 in kbItems) {
kx = padding;
for (i2 in kbItems[i1]) {
var key1 = kbItems[i1][i2]
var item = {txt: key1, x:kx, y:ky, w:lookupwidth(key1), h:40,
paint:paint,
hover:hover,
hoveroff:hoveroff,
mousedown:lettermousepress,
mouseup:mouseup};
kx+= item.w + padding;
keyObjects[key1] = item;
kbCanvas.elements.push(keyObjects[key1]);
}
ky+= padding + 40;
}
/* Key Bindings*/
function kd(key) {
if ($(findFocusTarget()).attr('type')=='password') return;
keyObjects[key].ispress = true; keyObjects[key].paint();
}
function ku(key) { keyObjects[key].ispress = false; kbCanvas.paint(); }
function findFocusTarget() {
var target = $(':focus');
if (target.is('input') || target.is('textarea') ) {
return target[0];
} else {
return null;
}
}
$(document).bind('keydown', '`', function() { kd('`') } )
.bind('keyup', '`', function() { ku('`')} )
.bind('keydown', '1', function() { kd('1') } )
.bind('keyup', '1', function() { ku('1')} )
.bind('keydown', '2', function() { kd('2') } )
.bind('keyup', '2', function() { ku('2')} )
.bind('keydown', '3', function() { kd('3') } )
.bind('keyup', '3', function() { ku('3')} )
.bind('keydown', '4', function() { kd('4') } )
.bind('keyup', '4', function() { ku('4')} )
.bind('keydown', '5', function() { kd('5') } )
.bind('keyup', '5', function() { ku('5')} )
.bind('keydown', '6', function() { kd('6') } )
.bind('keyup', '6', function() { ku('6')} )
.bind('keydown', '7', function() { kd('7') } )
.bind('keyup', '7', function() { ku('7')} )
.bind('keydown', '8', function() { kd('8') } )
.bind('keyup', '8', function() { ku('8')} )
.bind('keydown', '9', function() { kd('9') } )
.bind('keyup', '9', function() { ku('9')} )
.bind('keydown', '0', function() { kd('0') } )
.bind('keyup', '0', function() { ku('0')} )
.bind('keydown', '-', function() { kd('-') } )
.bind('keyup', '-', function() { ku('-')} )
.bind('keydown', '=', function() { kd('=') } )
.bind('keyup', '=', function() { ku('=')} )
.bind('keydown', 'backspace', function() { kd('Retour') } )
.bind('keyup', 'backspace', function() { ku('Retour')} )
.bind('keydown', 'tab', function() { kd('Tab') } )
.bind('keyup', 'tab', function() { ku('Tab')} )
.bind('keydown', 'q', function() { kd('q') } )
.bind('keyup', 'q', function() { ku('q')} )
.bind('keydown', 'w', function() { kd('w') } )
.bind('keyup', 'w', function() { ku('w')} )
.bind('keydown', 'e', function() { kd('e') } )
.bind('keyup', 'e', function() { ku('e')} )
.bind('keydown', 'r', function() { kd('r') } )
.bind('keyup', 'r', function() { ku('r')} )
.bind('keydown', 't', function() { kd('t') } )
.bind('keyup', 't', function() { ku('t')} )
.bind('keydown', 'y', function() { kd('y') } )
.bind('keyup', 'y', function() { ku('y')} )
.bind('keydown', 'u', function() { kd('u') } )
.bind('keyup', 'u', function() { ku('u')} )
.bind('keydown', 'i', function() { kd('i') } )
.bind('keyup', 'i', function() { ku('i')} )
.bind('keydown', 'o', function() { kd('o') } )
.bind('keyup', 'o', function() { ku('o')} )
.bind('keydown', 'p', function() { kd('p') } )
.bind('keyup', 'p', function() { ku('p')} )
.bind('keydown', '[', function() { kd('[') } )
.bind('keyup', '[', function() { ku('[')} )
.bind('keydown', ']', function() { kd(']') } )
.bind('keyup', ']', function() { ku(']')} )
.bind('keydown', '\\', function() { kd('\\') } )
.bind('keyup', '\\', function() { ku('\\')} )
.bind('keydown', 'capslock', function() { kd('Maj') } )
.bind('keyup', 'capslock', function() { ku('Maj')} )
.bind('keydown', 'a', function() { kd('a') } )
.bind('keyup', 'a', function() { ku('a')} )
.bind('keydown', 's', function() { kd('s') } )
.bind('keyup', 's', function() { ku('s')} )
.bind('keydown', 'd', function() { kd('d') } )
.bind('keyup', 'd', function() { ku('d')} )
.bind('keydown', 'f', function() { kd('f') } )
.bind('keyup', 'f', function() { ku('f')} )
.bind('keydown', 'g', function() { kd('g') } )
.bind('keyup', 'g', function() { ku('g')} )
.bind('keydown', 'h', function() { kd('h') } )
.bind('keyup', 'h', function() { ku('h')} )
.bind('keydown', 'j', function() { kd('j') } )
.bind('keyup', 'j', function() { ku('j')} )
.bind('keydown', 'k', function() { kd('k') } )
.bind('keyup', 'k', function() { ku('k')} )
.bind('keydown', 'l', function() { kd('l') } )
.bind('keyup', 'l', function() { ku('l')} )
.bind('keydown', ';', function() { kd(';') } )
.bind('keyup', ';', function() { ku(';')} )
.bind('keydown', '\'', function() { kd('\'') } )
.bind('keyup', '\'', function() { ku('\'')} )
.bind('keydown', 'enter', function() { kd('Entrer') } )
.bind('keyup', 'enter', function() { ku('Entrer')} )
.bind('keydown', 'shift', function() { kd('Shift') } )
.bind('keyup', 'shift', function() { ku('Shift')} )
.bind('keydown', 'z', function() { kd('z') } )
.bind('keyup', 'z', function() { ku('z')} )
.bind('keydown', 'x', function() { kd('x') } )
.bind('keyup', 'x', function() { ku('x')} )
.bind('keydown', 'c', function() { kd('c') } )
.bind('keyup', 'c', function() { ku('c')} )
.bind('keydown', 'v', function() { kd('v') } )
.bind('keyup', 'v', function() { ku('v')} )
.bind('keydown', 'b', function() { kd('b') } )
.bind('keyup', 'b', function() { ku('b')} )
.bind('keydown', 'n', function() { kd('n') } )
.bind('keyup', 'n', function() { ku('n')} )
.bind('keydown', 'm', function() { kd('m') } )
.bind('keyup', 'm', function() { ku('m')} )
.bind('keydown', ',', function() { kd(',') } )
.bind('keyup', ',', function() { ku(',')} )
.bind('keydown', '.', function() { kd('.') } )
.bind('keyup', '.', function() { ku('.')} )
.bind('keydown', '/', function() { kd('/') } )
.bind('keyup', '/', function() { ku('/')} )
.bind('keydown', 'space', function() { kd('Espace') } )
.bind('keyup', 'space', function() { ku('Espace')} );
/* Code Generatation for Keybindings
for (var key in keyObjects) {
$('#out2').append("$(document).bind('keydown', 'keyz', function() { kd('keyz') } );".replace(/keyz/g,key));
$('#out2').append("<br/>");
$('#out2').append("$(document).bind('keyup', 'keyz', function() { ku('keyz')} );".replace(/keyz/g,key));
$('#out2').append("<br/>");
}*/
keyObjects['Maj'].mousedown = function() {
var lower = ( keyObjects['a'].txt=='a');
var az = 'abcdefghijklmnopqrstuvwxyz';
if (lower) az = az.toUpperCase();
for (var i in az) {
keyObjects[az[i].toLowerCase()].txt = az[i];
}
var charsLower = '`1234567890-=[]\\;\',./';
var charsUpper = '~!@#$%^&*()_+{}|:"<>?';
if (lower) {
for (var i in charsLower) {
keyObjects[charsLower[i]].txt = charsUpper[i];
}
} else {
for (var i in charsLower) {
keyObjects[charsLower[i]].txt = charsLower[i];
}
}
kbCanvas.paint();
}
// To implement proper shift
keyObjects['Shift'].mousedown = keyObjects['Maj'].mousedown;
keyObjects['Espace'].mousedown = function() {
replaceIt(findFocusTarget(),' ');
autofire = window.setInterval(replaceIt, autoFireInt,
findFocusTarget(),' ');
}
keyObjects['Entrer'].mousedown = function() {
replaceIt(findFocusTarget(),'\n');
autofire = window.setInterval(replaceIt, autoFireInt,
findFocusTarget(),'\n');
}
keyObjects['Retour'].mousedown = function() {
txtarea = objFocus;
if (!txtarea) return;
var start = txtarea.selectionStart;
var end = txtarea.selectionEnd;
var oldtxt = $(txtarea).val();
var af = (autofireX > -1);
if (af) { start = end = --autofireX; } // Work around for Chrome
var selection = end - start;
if ((selection ==0) || af) {
var newstr = oldtxt.substr(0, start-1)+
oldtxt.substr(end);
$(txtarea).val(newstr);
if (txtarea.setSelectionRange) {
txtarea.setSelectionRange(start-1,start-1);
}
} else {
replaceIt(objFocus,'');
}
if (!af) { autofireX = start; }
autofire = window.setTimeout(keyObjects['Retour'].mousedown, autoFireInt);
}
keyObjects['Tab'].mousedown = function() {
replaceIt(findFocusTarget(),'\t');
}
/*
$('*').focus(function() {
alert(this);
objFocus = findFocusTarget();
});*/
// Set event handlers for the main Canvas
$('#jKeyboard').mousemove(function(e) {
var x = e.pageX - $(this).offset().left;
var y = e.pageY - $(this).offset().top;
//kbCanvas.mousemove({x:x,y:y});
events['mousemove'] = {x:x,y:y};
frameRate();
}).mousedown(function(e) {
var x = e.pageX - $(this).offset().left;
var y = e.pageY - $(this).offset().top;
objFocus = findFocusTarget();
kbCanvas.mousedown({x:x,y:y});
}).mouseup(function(e) {
var x = e.pageX - $(this).offset().left;
var y = e.pageY - $(this).offset().top;
kbCanvas.mouseup({x:x,y:y});
// Stop the auto fire!
window.clearInterval(autofire);
autofireX = -1;
if (objFocus) objFocus.focus();
});
kbCanvas.paint();
//setInterval(frameRate,1000/fps); // Auto fire rate
}
//$(document).ready(_
//$( "search" ).on( 'focus', '#search', startKb());
// if (target.is('input'))
// startKb();
//else
// wait(5);
startKb();
}//
function startScripts($) {
var canvastxtsrc = 'UI/js/canvastext.js';
var hotkeyssrc = 'UI/js/jquery.hotkeys-0.7.9.min.js';
if ($('#jKeyboard').size()==0) {
// Load scripts
$.getScript(canvastxtsrc,
function() {
$.getScript(hotkeyssrc,function(){ jKeyboard(jQuery);});
}
);
} else {
$('#jKeyboard').toggle();
}
}
// This is for the orginal bookmarklet
/*
(function(){
var e = document.createElement('script');
e.type='text/javascript';
e.src = 'http://jabtunes.com/notation/jKeyboard.js.php';
document.getElementsByTagName('head')[0].appendChild(e);
})(); // Encapsulation
(function(){var e=document.createElement('script');e.type='text/javascript';e.src='http://jabtunes.com/notation/jKeyboard.js.php';document.getElementsByTagName('head')[0].appendChild(e);})();
*/
// This is taken from http://coder-zone.blogspot.com/2009/05/jquery-bookmarklet.html
(function(){
// Check if jQuery is loaded
if(typeof window.jQuery != 'undefined' && $.fn.jquery=='1.4.1') {
startScripts(window.jQuery);
} else {
// Check for conflicts
var conflict = typeof window.$ != 'undefined';
// Create the script and point to Google API
var script = document.createElement('script');
script.setAttribute('src','UI/js/jquery-1.4.1.min.js');
// Add the script to the 'head' for processing
document.getElementsByTagName('head')[0].appendChild(script);
/*
// Create a way to wait until script loading - Polling method
var attempts = 15;
(function(){
// Check again if jQuery is undefined
if(typeof window.jQuery == 'undefined') {
if(--attempts > 0) {
// Calls himself in a few milliseconds
window.setTimeout(arguments.callee, 250)
} else {
// Too much attempts to load, send error
alert('An error ocurred while loading jQuery')
}
} else {
//message('jQuery '+jQuery.fn.jquery+' loaded'+ (conflict && jQuery.noConflict() ? ' with noConflict' : ''));
startScripts(window.jQuery);
})();
*/
function start() {
startScripts(window.jQuery);
};
}
start();
function message(msg) {
var element = jQuery('<a>')
.html(msg)
.attr('href', '#')
.css({
width: 'auto',
opacity: 0.9,
position: 'fixed',
zIndex: 9000,
top: '15px',
right: '20px',
background: '#000',
'float': 'right',
padding: '7px 10px',
color: '#fff',
border: 'solid 2px #fff',
textDecoration: 'none',
textAlign: 'center',
font: '12px "Arial",Arial',
borderRadius: '5px',
MozBorderRadius: '5px',
MozBoxShadow: '0 0 20px #000',
WebkitBorderRadius: '5px',
WebkitBoxShadow: '0 0 20px #000'
})
.click(function(evt){
evt.preventDefault();
jQuery(this).fadeOut('slow', function(){jQuery(this).remove()});
})
.appendTo('body');
window.setTimeout(function(){ element.trigger('click') }, 2500);
};
})() |
Partager