Skip to main content

Executar script em uma div<div>

Eu possuo esse script, o. O que eu devo acrescentar nele para que, ao ser executado, apareça em uma div<div>?

Aqui está o script.:

// Which flash versions are needed for given format
var FLASH_VERSIONS = {
    '7/0/0': [5],
    '9/0/115': [18, 22, 33, 34, 35, 37, 38, 59, 78, 82, 83, 84, 85, 120, 121],
    '10/1/0': [52, 53, 54, 60],
    };

// Regex to extract the video format
var RE_ITAG = /&itag=([0-9]*)&/i;

function get_fmt(content) {
    var fmt = new Object();
    fmt.list = new Array();
    fmt.stream_map = new Array();

    for (var i=0; i < content.length; i++) {
        var url = content[i]['url'];
        if (url.search("") == -1)
            continue;

        var matches = RE_ITAG.exec(url);
        var itag = matches[1];

        var resolution = '7/0/0';
        for (var possible_resolution in FLASH_VERSIONS.length) {
            if (FLASH_VERSIONS[possible_resolution].indexOf(itag)) {
                resolution = possible_resolution;
            }
        }

        fmt.list.push(itag+'/'+String(content[i].width)+'x'+String(content[i].height)+'/'+resolution);
        fmt.stream_map.push(itag+'|'+content[i].url.replace(/,/g, '%2C'));
    }

    fmt.list.reverse();
    fmt.stream_map.reverse();
    return fmt;
}

function get_embed(content) {
    var fmt = get_fmt(content);
    var flashvars = new Array();
    flashvars.push('fs=1');
    flashvars.push('hl=en');
    flashvars.push('autoplay=1');
    flashvars.push('ps=');
    flashvars.push('playerapiid=uniquePlayerId');
    flashvars.push('fmt_list='+encodeURIComponent(fmt.list.join()));
    flashvars.push('fmt_stream_map='+encodeURIComponent(fmt.stream_map.join()));
    flashvars.push('');
    flashvars.push('t=1');
    flashvars.push('vq=large');
    flashvars.push('auth_timeout=86400000000');

    var embed = document.createElement('');
    embed.setAttribute("src", "");
    embed.setAttribute("type", "application/x-shockwave-flash");
    embed.setAttribute("allowfullscreen", "true");
    embed.setAttribute("allowscriptaccess", "always");
    embed.setAttribute("scale", "noScale");
    embed.setAttribute("wmode", "opaque");
    embed.setAttribute("flashvars", flashvars.join("&"));
    embed.setAttribute("width", "100%");
    embed.setAttribute("height", "100%");
    return embed;
}

 

var ts = Math.round((new Date()).getTime() / 1000);
 
var script = document.createElement('script');
 
var hash = document.location.hash;
var id = hash.substr(1,hash.length);
var head = document.getElementsByTagName('head').item(0);
    var script = document.createElement('script');
     
script.setAttribute('type', 'text/javascript');
    script.setAttribute('src', 'https://');
    head.appendChild(script);

    myFunction(); // Fails because it hasn't loaded from my.js yet.
     
    window.onload = function() {
        // Works most of the time but not all of the time.
        // Especially if my.js injects another script that contains myFunction().
        myFunction();
    };

Executar script em uma div

Eu possuo esse script, o que eu devo acrescentar nele para que ao ser executado, apareça em uma div?

Aqui está o script.

// Which flash versions are needed for given format
var FLASH_VERSIONS = {
    '7/0/0': [5],
    '9/0/115': [18, 22, 33, 34, 35, 37, 38, 59, 78, 82, 83, 84, 85, 120, 121],
    '10/1/0': [52, 53, 54, 60],
    };

// Regex to extract the video format
var RE_ITAG = /&itag=([0-9]*)&/i;

function get_fmt(content) {
    var fmt = new Object();
    fmt.list = new Array();
    fmt.stream_map = new Array();

    for (var i=0; i < content.length; i++) {
        var url = content[i]['url'];
        if (url.search("") == -1)
            continue;

        var matches = RE_ITAG.exec(url);
        var itag = matches[1];

        var resolution = '7/0/0';
        for (var possible_resolution in FLASH_VERSIONS.length) {
            if (FLASH_VERSIONS[possible_resolution].indexOf(itag)) {
                resolution = possible_resolution;
            }
        }

        fmt.list.push(itag+'/'+String(content[i].width)+'x'+String(content[i].height)+'/'+resolution);
        fmt.stream_map.push(itag+'|'+content[i].url.replace(/,/g, '%2C'));
    }

    fmt.list.reverse();
    fmt.stream_map.reverse();
    return fmt;
}

function get_embed(content) {
    var fmt = get_fmt(content);
    var flashvars = new Array();
    flashvars.push('fs=1');
    flashvars.push('hl=en');
    flashvars.push('autoplay=1');
    flashvars.push('ps=');
    flashvars.push('playerapiid=uniquePlayerId');
    flashvars.push('fmt_list='+encodeURIComponent(fmt.list.join()));
    flashvars.push('fmt_stream_map='+encodeURIComponent(fmt.stream_map.join()));
    flashvars.push('');
    flashvars.push('t=1');
    flashvars.push('vq=large');
    flashvars.push('auth_timeout=86400000000');

    var embed = document.createElement('');
    embed.setAttribute("src", "");
    embed.setAttribute("type", "application/x-shockwave-flash");
    embed.setAttribute("allowfullscreen", "true");
    embed.setAttribute("allowscriptaccess", "always");
    embed.setAttribute("scale", "noScale");
    embed.setAttribute("wmode", "opaque");
    embed.setAttribute("flashvars", flashvars.join("&"));
    embed.setAttribute("width", "100%");
    embed.setAttribute("height", "100%");
    return embed;
}

 

var ts = Math.round((new Date()).getTime() / 1000);
 
var script = document.createElement('script');
 
var hash = document.location.hash;
var id = hash.substr(1,hash.length);
var head = document.getElementsByTagName('head').item(0);
    var script = document.createElement('script');
    script.setAttribute('type', 'text/javascript');
    script.setAttribute('src', 'https://');
    head.appendChild(script);

    myFunction(); // Fails because it hasn't loaded from my.js yet.
 
    window.onload = function() {
        // Works most of the time but not all of the time.
        // Especially if my.js injects another script that contains myFunction().
        myFunction();
    };

Executar script em uma <div>

Eu possuo esse script. O que eu devo acrescentar nele para que, ao ser executado, apareça em uma <div>?

Aqui está o script:

// Which flash versions are needed for given format
var FLASH_VERSIONS = {
    '7/0/0': [5],
    '9/0/115': [18, 22, 33, 34, 35, 37, 38, 59, 78, 82, 83, 84, 85, 120, 121],
    '10/1/0': [52, 53, 54, 60],
    };

// Regex to extract the video format
var RE_ITAG = /&itag=([0-9]*)&/i;

function get_fmt(content) {
    var fmt = new Object();
    fmt.list = new Array();
    fmt.stream_map = new Array();

    for (var i=0; i < content.length; i++) {
        var url = content[i]['url'];
        if (url.search("") == -1)
            continue;

        var matches = RE_ITAG.exec(url);
        var itag = matches[1];

        var resolution = '7/0/0';
        for (var possible_resolution in FLASH_VERSIONS.length) {
            if (FLASH_VERSIONS[possible_resolution].indexOf(itag)) {
                resolution = possible_resolution;
            }
        }

        fmt.list.push(itag+'/'+String(content[i].width)+'x'+String(content[i].height)+'/'+resolution);
        fmt.stream_map.push(itag+'|'+content[i].url.replace(/,/g, '%2C'));
    }

    fmt.list.reverse();
    fmt.stream_map.reverse();
    return fmt;
}

function get_embed(content) {
    var fmt = get_fmt(content);
    var flashvars = new Array();
    flashvars.push('fs=1');
    flashvars.push('hl=en');
    flashvars.push('autoplay=1');
    flashvars.push('ps=');
    flashvars.push('playerapiid=uniquePlayerId');
    flashvars.push('fmt_list='+encodeURIComponent(fmt.list.join()));
    flashvars.push('fmt_stream_map='+encodeURIComponent(fmt.stream_map.join()));
    flashvars.push('');
    flashvars.push('t=1');
    flashvars.push('vq=large');
    flashvars.push('auth_timeout=86400000000');

    var embed = document.createElement('');
    embed.setAttribute("src", "");
    embed.setAttribute("type", "application/x-shockwave-flash");
    embed.setAttribute("allowfullscreen", "true");
    embed.setAttribute("allowscriptaccess", "always");
    embed.setAttribute("scale", "noScale");
    embed.setAttribute("wmode", "opaque");
    embed.setAttribute("flashvars", flashvars.join("&"));
    embed.setAttribute("width", "100%");
    embed.setAttribute("height", "100%");
    return embed;
}

var ts = Math.round((new Date()).getTime() / 1000);
var script = document.createElement('script');
var hash = document.location.hash;
var id = hash.substr(1,hash.length);
var head = document.getElementsByTagName('head').item(0);
var script = document.createElement('script');
 
script.setAttribute('type', 'text/javascript');
script.setAttribute('src', 'https://');
head.appendChild(script);

myFunction(); // Fails because it hasn't loaded from my.js yet.    
    window.onload = function() {
        // Works most of the time but not all of the time.
        // Especially if my.js injects another script that contains myFunction().
        myFunction();
    };
removeu 103 caracteres do conteúdo
Fonte Link
Endou
  • 695
  • 1
  • 13
  • 23
// Which flash versions are needed for given format
var FLASH_VERSIONS = {
    '7/0/0': [5],
    '9/0/115': [18, 22, 33, 34, 35, 37, 38, 59, 78, 82, 83, 84, 85, 120, 121],
    '10/1/0': [52, 53, 54, 60],
    };

// Regex to extract the video format
var RE_ITAG = /&itag=([0-9]*)&/i;

function get_fmt(content) {
    var fmt = new Object();
    fmt.list = new Array();
    fmt.stream_map = new Array();

    for (var i=0; i < content.length; i++) {
        var url = content[i]['url'];
        if (url.search("") == -1)
            continue;

        var matches = RE_ITAG.exec(url);
        var itag = matches[1];

        var resolution = '7/0/0';
        for (var possible_resolution in FLASH_VERSIONS.length) {
            if (FLASH_VERSIONS[possible_resolution].indexOf(itag)) {
                resolution = possible_resolution;
            }
        }

        fmt.list.push(itag+'/'+String(content[i].width)+'x'+String(content[i].height)+'/'+resolution);
        fmt.stream_map.push(itag+'|'+content[i].url.replace(/,/g, '%2C'));
    }

    fmt.list.reverse();
    fmt.stream_map.reverse();
    return fmt;
}

function get_embed(content) {
    var fmt = get_fmt(content);
    var flashvars = new Array();
    flashvars.push('fs=1');
    flashvars.push('hl=en');
    flashvars.push('autoplay=1');
    flashvars.push('ps=');
    flashvars.push('playerapiid=uniquePlayerId');
    flashvars.push('fmt_list='+encodeURIComponent(fmt.list.join()));
    flashvars.push('fmt_stream_map='+encodeURIComponent(fmt.stream_map.join()));
    flashvars.push('');
    flashvars.push('t=1');
    flashvars.push('vq=large');
    flashvars.push('auth_timeout=86400000000');

    var embed = document.createElement('');
    embed.setAttribute("src", "");
    embed.setAttribute("type", "application/x-shockwave-flash");
    embed.setAttribute("allowfullscreen", "true");
    embed.setAttribute("allowscriptaccess", "always");
    embed.setAttribute("scale", "noScale");
    embed.setAttribute("wmode", "opaque");
    embed.setAttribute("flashvars", flashvars.join("&"));
    embed.setAttribute("width", "100%");
    embed.setAttribute("height", "100%");
    return embed;
}

function picasa_callback(obj) {
    document.body.appendChild(get_embed(obj['']['']['']));
}

var ts = Math.round((new Date()).getTime() / 1000);

var script = document.createElement('script');

var hash = document.location.hash;
var id = hash.substr(1,hash.length);
var head = document.getElementsByTagName('head').item(0);
    var script = document.createElement('script');
    script.setAttribute('type', 'text/javascript');
    script.setAttribute('src', 'https://');
    head.appendChild(script);

    myFunction(); // Fails because it hasn't loaded from my.js yet.

    window.onload = function() {
        // Works most of the time but not all of the time.
        // Especially if my.js injects another script that contains myFunction().
        myFunction();
    };
// Which flash versions are needed for given format
var FLASH_VERSIONS = {
    '7/0/0': [5],
    '9/0/115': [18, 22, 33, 34, 35, 37, 38, 59, 78, 82, 83, 84, 85, 120, 121],
    '10/1/0': [52, 53, 54, 60],
    };

// Regex to extract the video format
var RE_ITAG = /&itag=([0-9]*)&/i;

function get_fmt(content) {
    var fmt = new Object();
    fmt.list = new Array();
    fmt.stream_map = new Array();

    for (var i=0; i < content.length; i++) {
        var url = content[i]['url'];
        if (url.search("") == -1)
            continue;

        var matches = RE_ITAG.exec(url);
        var itag = matches[1];

        var resolution = '7/0/0';
        for (var possible_resolution in FLASH_VERSIONS.length) {
            if (FLASH_VERSIONS[possible_resolution].indexOf(itag)) {
                resolution = possible_resolution;
            }
        }

        fmt.list.push(itag+'/'+String(content[i].width)+'x'+String(content[i].height)+'/'+resolution);
        fmt.stream_map.push(itag+'|'+content[i].url.replace(/,/g, '%2C'));
    }

    fmt.list.reverse();
    fmt.stream_map.reverse();
    return fmt;
}

function get_embed(content) {
    var fmt = get_fmt(content);
    var flashvars = new Array();
    flashvars.push('fs=1');
    flashvars.push('hl=en');
    flashvars.push('autoplay=1');
    flashvars.push('ps=');
    flashvars.push('playerapiid=uniquePlayerId');
    flashvars.push('fmt_list='+encodeURIComponent(fmt.list.join()));
    flashvars.push('fmt_stream_map='+encodeURIComponent(fmt.stream_map.join()));
    flashvars.push('');
    flashvars.push('t=1');
    flashvars.push('vq=large');
    flashvars.push('auth_timeout=86400000000');

    var embed = document.createElement('');
    embed.setAttribute("src", "");
    embed.setAttribute("type", "application/x-shockwave-flash");
    embed.setAttribute("allowfullscreen", "true");
    embed.setAttribute("allowscriptaccess", "always");
    embed.setAttribute("scale", "noScale");
    embed.setAttribute("wmode", "opaque");
    embed.setAttribute("flashvars", flashvars.join("&"));
    embed.setAttribute("width", "100%");
    embed.setAttribute("height", "100%");
    return embed;
}

function picasa_callback(obj) {
    document.body.appendChild(get_embed(obj['']['']['']));
}

var ts = Math.round((new Date()).getTime() / 1000);

var script = document.createElement('script');

var hash = document.location.hash;
var id = hash.substr(1,hash.length);
var head = document.getElementsByTagName('head').item(0);
    var script = document.createElement('script');
    script.setAttribute('type', 'text/javascript');
    script.setAttribute('src', 'https://');
    head.appendChild(script);

    myFunction(); // Fails because it hasn't loaded from my.js yet.

    window.onload = function() {
        // Works most of the time but not all of the time.
        // Especially if my.js injects another script that contains myFunction().
        myFunction();
    };
// Which flash versions are needed for given format
var FLASH_VERSIONS = {
    '7/0/0': [5],
    '9/0/115': [18, 22, 33, 34, 35, 37, 38, 59, 78, 82, 83, 84, 85, 120, 121],
    '10/1/0': [52, 53, 54, 60],
    };

// Regex to extract the video format
var RE_ITAG = /&itag=([0-9]*)&/i;

function get_fmt(content) {
    var fmt = new Object();
    fmt.list = new Array();
    fmt.stream_map = new Array();

    for (var i=0; i < content.length; i++) {
        var url = content[i]['url'];
        if (url.search("") == -1)
            continue;

        var matches = RE_ITAG.exec(url);
        var itag = matches[1];

        var resolution = '7/0/0';
        for (var possible_resolution in FLASH_VERSIONS.length) {
            if (FLASH_VERSIONS[possible_resolution].indexOf(itag)) {
                resolution = possible_resolution;
            }
        }

        fmt.list.push(itag+'/'+String(content[i].width)+'x'+String(content[i].height)+'/'+resolution);
        fmt.stream_map.push(itag+'|'+content[i].url.replace(/,/g, '%2C'));
    }

    fmt.list.reverse();
    fmt.stream_map.reverse();
    return fmt;
}

function get_embed(content) {
    var fmt = get_fmt(content);
    var flashvars = new Array();
    flashvars.push('fs=1');
    flashvars.push('hl=en');
    flashvars.push('autoplay=1');
    flashvars.push('ps=');
    flashvars.push('playerapiid=uniquePlayerId');
    flashvars.push('fmt_list='+encodeURIComponent(fmt.list.join()));
    flashvars.push('fmt_stream_map='+encodeURIComponent(fmt.stream_map.join()));
    flashvars.push('');
    flashvars.push('t=1');
    flashvars.push('vq=large');
    flashvars.push('auth_timeout=86400000000');

    var embed = document.createElement('');
    embed.setAttribute("src", "");
    embed.setAttribute("type", "application/x-shockwave-flash");
    embed.setAttribute("allowfullscreen", "true");
    embed.setAttribute("allowscriptaccess", "always");
    embed.setAttribute("scale", "noScale");
    embed.setAttribute("wmode", "opaque");
    embed.setAttribute("flashvars", flashvars.join("&"));
    embed.setAttribute("width", "100%");
    embed.setAttribute("height", "100%");
    return embed;
}



var ts = Math.round((new Date()).getTime() / 1000);

var script = document.createElement('script');

var hash = document.location.hash;
var id = hash.substr(1,hash.length);
var head = document.getElementsByTagName('head').item(0);
    var script = document.createElement('script');
    script.setAttribute('type', 'text/javascript');
    script.setAttribute('src', 'https://');
    head.appendChild(script);

    myFunction(); // Fails because it hasn't loaded from my.js yet.

    window.onload = function() {
        // Works most of the time but not all of the time.
        // Especially if my.js injects another script that contains myFunction().
        myFunction();
    };
removeu 102 caracteres do conteúdo
Fonte Link
Endou
  • 695
  • 1
  • 13
  • 23
// Which flash versions are needed for given format
var FLASH_VERSIONS = {
    '7/0/0': [5],
    '9/0/115': [18, 22, 33, 34, 35, 37, 38, 59, 78, 82, 83, 84, 85, 120, 121],
    '10/1/0': [52, 53, 54, 60],
    };

// Regex to extract the video format
var RE_ITAG = /&itag=([0-9]*)&/i;

function get_fmt(content) {
    var fmt = new Object();
    fmt.list = new Array();
    fmt.stream_map = new Array();

    for (var i=0; i < content.length; i++) {
        var url = content[i]['url'];
        if (url.search("googlevideo.com/videoplayback""") == -1)
            continue;

        var matches = RE_ITAG.exec(url);
        var itag = matches[1];

        var resolution = '7/0/0';
        for (var possible_resolution in FLASH_VERSIONS.length) {
            if (FLASH_VERSIONS[possible_resolution].indexOf(itag)) {
                resolution = possible_resolution;
            }
        }

        fmt.list.push(itag+'/'+String(content[i].width)+'x'+String(content[i].height)+'/'+resolution);
        fmt.stream_map.push(itag+'|'+content[i].url.replace(/,/g, '%2C'));
    }

    fmt.list.reverse();
    fmt.stream_map.reverse();
    return fmt;
}

function get_embed(content) {
    var fmt = get_fmt(content);
    var flashvars = new Array();
    flashvars.push('fs=1');
    flashvars.push('hl=en');
    flashvars.push('autoplay=1');
    flashvars.push('ps=picasaweb''ps=');
    flashvars.push('playerapiid=uniquePlayerId');
    flashvars.push('fmt_list='+encodeURIComponent(fmt.list.join()));
    flashvars.push('fmt_stream_map='+encodeURIComponent(fmt.stream_map.join()));
    flashvars.push('video_id=picasacid''');
    flashvars.push('t=1');
    flashvars.push('vq=large');
    flashvars.push('auth_timeout=86400000000');

    var embed = document.createElement('embed''');
    embed.setAttribute("src", "https://www.youtube.com/get_player?enablejsapi=1""");
    embed.setAttribute("type", "application/x-shockwave-flash");
    embed.setAttribute("allowfullscreen", "true");
    embed.setAttribute("allowscriptaccess", "always");
    embed.setAttribute("scale", "noScale");
    embed.setAttribute("wmode", "opaque");
    embed.setAttribute("flashvars", flashvars.join("&"));
    embed.setAttribute("width", "100%");
    embed.setAttribute("height", "100%");
    return embed;
}

function picasa_callback(obj) {
    document.body.appendChild(get_embed(obj['feed']['media']['content']obj['']['']['']));
}

var ts = Math.round((new Date()).getTime() / 1000);

var script = document.createElement('script');

var hash = document.location.hash;
var id = hash.substr(1,hash.length);
var head = document.getElementsByTagName('head').item(0);
    var script = document.createElement('script');
    script.setAttribute('type', 'text/javascript');
    script.setAttribute('src', 'https://picasaweb.google.com/data/feed/tiny/user/100642868990821651444/albumid/5720909216955340593/photoid/5720909218315234178?authuser=0&alt=jsonm&urlredir=1&commentreason=1&fd=shapes&thumbsize=d&max-results=100&callback=picasa_callback&t='');
    head.appendChild(script);

    myFunction(); // Fails because it hasn't loaded from my.js yet.

    window.onload = function() {
        // Works most of the time but not all of the time.
        // Especially if my.js injects another script that contains myFunction().
        myFunction();
    };
// Which flash versions are needed for given format
var FLASH_VERSIONS = {
    '7/0/0': [5],
    '9/0/115': [18, 22, 33, 34, 35, 37, 38, 59, 78, 82, 83, 84, 85, 120, 121],
    '10/1/0': [52, 53, 54, 60],
    };

// Regex to extract the video format
var RE_ITAG = /&itag=([0-9]*)&/i;

function get_fmt(content) {
    var fmt = new Object();
    fmt.list = new Array();
    fmt.stream_map = new Array();

    for (var i=0; i < content.length; i++) {
        var url = content[i]['url'];
        if (url.search("googlevideo.com/videoplayback") == -1)
            continue;

        var matches = RE_ITAG.exec(url);
        var itag = matches[1];

        var resolution = '7/0/0';
        for (var possible_resolution in FLASH_VERSIONS.length) {
            if (FLASH_VERSIONS[possible_resolution].indexOf(itag)) {
                resolution = possible_resolution;
            }
        }

        fmt.list.push(itag+'/'+String(content[i].width)+'x'+String(content[i].height)+'/'+resolution);
        fmt.stream_map.push(itag+'|'+content[i].url.replace(/,/g, '%2C'));
    }

    fmt.list.reverse();
    fmt.stream_map.reverse();
    return fmt;
}

function get_embed(content) {
    var fmt = get_fmt(content);
    var flashvars = new Array();
    flashvars.push('fs=1');
    flashvars.push('hl=en');
    flashvars.push('autoplay=1');
    flashvars.push('ps=picasaweb');
    flashvars.push('playerapiid=uniquePlayerId');
    flashvars.push('fmt_list='+encodeURIComponent(fmt.list.join()));
    flashvars.push('fmt_stream_map='+encodeURIComponent(fmt.stream_map.join()));
    flashvars.push('video_id=picasacid');
    flashvars.push('t=1');
    flashvars.push('vq=large');
    flashvars.push('auth_timeout=86400000000');

    var embed = document.createElement('embed');
    embed.setAttribute("src", "https://www.youtube.com/get_player?enablejsapi=1");
    embed.setAttribute("type", "application/x-shockwave-flash");
    embed.setAttribute("allowfullscreen", "true");
    embed.setAttribute("allowscriptaccess", "always");
    embed.setAttribute("scale", "noScale");
    embed.setAttribute("wmode", "opaque");
    embed.setAttribute("flashvars", flashvars.join("&"));
    embed.setAttribute("width", "100%");
    embed.setAttribute("height", "100%");
    return embed;
}

function picasa_callback(obj) {
    document.body.appendChild(get_embed(obj['feed']['media']['content']));
}

var ts = Math.round((new Date()).getTime() / 1000);

var script = document.createElement('script');

var hash = document.location.hash;
var id = hash.substr(1,hash.length);
var head = document.getElementsByTagName('head').item(0);
    var script = document.createElement('script');
    script.setAttribute('type', 'text/javascript');
    script.setAttribute('src', 'https://picasaweb.google.com/data/feed/tiny/user/100642868990821651444/albumid/5720909216955340593/photoid/5720909218315234178?authuser=0&alt=jsonm&urlredir=1&commentreason=1&fd=shapes&thumbsize=d&max-results=100&callback=picasa_callback&t=');
    head.appendChild(script);

    myFunction(); // Fails because it hasn't loaded from my.js yet.

    window.onload = function() {
        // Works most of the time but not all of the time.
        // Especially if my.js injects another script that contains myFunction().
        myFunction();
    };
// Which flash versions are needed for given format
var FLASH_VERSIONS = {
    '7/0/0': [5],
    '9/0/115': [18, 22, 33, 34, 35, 37, 38, 59, 78, 82, 83, 84, 85, 120, 121],
    '10/1/0': [52, 53, 54, 60],
    };

// Regex to extract the video format
var RE_ITAG = /&itag=([0-9]*)&/i;

function get_fmt(content) {
    var fmt = new Object();
    fmt.list = new Array();
    fmt.stream_map = new Array();

    for (var i=0; i < content.length; i++) {
        var url = content[i]['url'];
        if (url.search("") == -1)
            continue;

        var matches = RE_ITAG.exec(url);
        var itag = matches[1];

        var resolution = '7/0/0';
        for (var possible_resolution in FLASH_VERSIONS.length) {
            if (FLASH_VERSIONS[possible_resolution].indexOf(itag)) {
                resolution = possible_resolution;
            }
        }

        fmt.list.push(itag+'/'+String(content[i].width)+'x'+String(content[i].height)+'/'+resolution);
        fmt.stream_map.push(itag+'|'+content[i].url.replace(/,/g, '%2C'));
    }

    fmt.list.reverse();
    fmt.stream_map.reverse();
    return fmt;
}

function get_embed(content) {
    var fmt = get_fmt(content);
    var flashvars = new Array();
    flashvars.push('fs=1');
    flashvars.push('hl=en');
    flashvars.push('autoplay=1');
    flashvars.push('ps=');
    flashvars.push('playerapiid=uniquePlayerId');
    flashvars.push('fmt_list='+encodeURIComponent(fmt.list.join()));
    flashvars.push('fmt_stream_map='+encodeURIComponent(fmt.stream_map.join()));
    flashvars.push('');
    flashvars.push('t=1');
    flashvars.push('vq=large');
    flashvars.push('auth_timeout=86400000000');

    var embed = document.createElement('');
    embed.setAttribute("src", "");
    embed.setAttribute("type", "application/x-shockwave-flash");
    embed.setAttribute("allowfullscreen", "true");
    embed.setAttribute("allowscriptaccess", "always");
    embed.setAttribute("scale", "noScale");
    embed.setAttribute("wmode", "opaque");
    embed.setAttribute("flashvars", flashvars.join("&"));
    embed.setAttribute("width", "100%");
    embed.setAttribute("height", "100%");
    return embed;
}

function picasa_callback(obj) {
    document.body.appendChild(get_embed(obj['']['']['']));
}

var ts = Math.round((new Date()).getTime() / 1000);

var script = document.createElement('script');

var hash = document.location.hash;
var id = hash.substr(1,hash.length);
var head = document.getElementsByTagName('head').item(0);
    var script = document.createElement('script');
    script.setAttribute('type', 'text/javascript');
    script.setAttribute('src', 'https://');
    head.appendChild(script);

    myFunction(); // Fails because it hasn't loaded from my.js yet.

    window.onload = function() {
        // Works most of the time but not all of the time.
        // Especially if my.js injects another script that contains myFunction().
        myFunction();
    };
Reversão para edição 9
Fonte Link
Paulo
  • 10,3mil
  • 15
  • 51
  • 83
Carregando
removeu 3740 caracteres do conteúdo
Fonte Link
Endou
  • 695
  • 1
  • 13
  • 23
Carregando
inserido código linkado em comentário
Fonte Link
bfavaretto
  • 66,2mil
  • 11
  • 151
  • 228
Carregando
removeu 164 caracteres do conteúdo
Fonte Link
Endou
  • 695
  • 1
  • 13
  • 23
Carregando
adicionou 653 caracteres ao conteúdo
Fonte Link
Endou
  • 695
  • 1
  • 13
  • 23
Carregando
Correção de Português
Fonte Link
CesarMiguel
  • 4,8mil
  • 2
  • 38
  • 61
Carregando
adicionou 20 caracteres ao conteúdo
Fonte Link
CesarMiguel
  • 4,8mil
  • 2
  • 38
  • 61
Carregando
Fonte Link
Endou
  • 695
  • 1
  • 13
  • 23
Carregando