Subversion Repositories DevTools

Rev

Rev 6873 | Rev 7003 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6873 Rev 6971
Line 423... Line 423...
423
    event.stopPropagation();
423
    event.stopPropagation();
424
    return false;
424
    return false;
425
});
425
});
426
 
426
 
427
// Copy text to clipboard
427
// Copy text to clipboard
-
 
428
// Need to append a dummy eleemnt to a point inthe document that can be selected
-
 
429
// In a modal dialog, the 'body' cannot be used. Use 'clipRoot' if its available
428
function vixTextToClipBoard(txt, options){
430
function vixTextToClipBoard(txt, options){
429
    if ( txt == null ) {
431
    if ( txt == null ) {
430
        return;
432
        return;
431
    }
433
    }
432
    var opts  = {
434
    var opts  = {
Line 436... Line 438...
436
        timeout : 100,
438
        timeout : 100,
437
        duration: 2000,
439
        duration: 2000,
438
    }
440
    }
439
    $.extend(opts, options);
441
    $.extend(opts, options);
440
 
442
 
-
 
443
    var useEl = $('#clipRoot');
-
 
444
    if ( useEl.length === 0  ){
-
 
445
        useEl =$('body') ;
-
 
446
    }
-
 
447
    
441
    var $temp = $("<textarea>");
448
    var $temp = $("<textarea>");
442
    $("body").prepend($temp);
449
    useEl.prepend($temp);
443
    $temp.val(txt).select();
450
    $temp.val(txt).select();
444
    document.execCommand("copy");
451
    document.execCommand("copy");
445
    $temp.remove();
452
    $temp.remove();
446
 
453
 
447
    if ( opts.notify ) {
454
    if ( opts.notify ) {