Skip to content

Instantly share code, notes, and snippets.

@bagrow
Created April 29, 2012 21:08

Revisions

  1. bagrow revised this gist Apr 29, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion mutateyoutube.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    javascript:
    var youtubeid = getQueryVariable("v");
    if (youtubeid != undefined){
    window.location="http://youtube.googleapis.com/v/"+youtubeid;
    window.location="http://youtube.googleapis.com/v/"+youtubeid+"&autoplay=1";
    }

    function getQueryVariable(variable) {
  2. bagrow created this gist Apr 29, 2012.
    18 changes: 18 additions & 0 deletions mutateyoutube.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    javascript:
    var youtubeid = getQueryVariable("v");
    if (youtubeid != undefined){
    window.location="http://youtube.googleapis.com/v/"+youtubeid;
    }

    function getQueryVariable(variable) {
    /* courtesy: http://stackoverflow.com/a/1623707 */
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i=0; i < vars.length; i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
    return pair[1];
    }
    }
    /*alert('Query Variable ' + variable + ' not found');*/
    }