var tab_title = '';

function display_h1 (results) {
  source = document.getElementById('video');

  //console.log(results);
  var url = results[0];
  // var url="https://www.youtube.com/embed/MtJ0lrIGSAE"
  var url = url.replace("watch?v=", "embed/");

  if (url.indexOf('www.youtube') !== -1) {
    //daca link-ul este unul de youtube
    source.setAttribute('src', url);
  }else if (url.indexOf('www.vimeo') !== -1) {
    source.setAttribute('src', url);
    source.setAttribute('src', "https://vimeo.com/channels/staffpicks/194312144");
  }else {
	   source.setAttribute('src', "https://www.youtube.com/watch?v=MtJ0lrIGSAE");
  }
}

chrome.tabs.query({active: true}, function(tabs) {
  var tab = tabs[0];
  tab_title = tab.title;
  chrome.tabs.executeScript(tab.id, {
    code: 'document.URL'
  }, display_h1);
});

function saveAnnotation() {
  // Get a value saved in a form.
  // Check that there's some code there.
  console.log(document.getElementById("name_annotation").value);
  if (!url) {
    message('Error: No value specified');
    return;
  }

  // Save it using the Chrome extension storage API.
  chrome.storage.sync.set({url: theValue}, function() {
    // Notify that we saved.
    message('Settings saved');
  });
}

@@ -1143,16 +1143,17 @@
 rl: 
+'
 theValue
 %7D, f
@@ -1148,16 +1148,17 @@
 theValue
+'
 %7D, funct
@@ -1194,16 +1194,17 @@
  saved.%0A
+%0A
     mess
@@ -1234,8 +1234,1238 @@
   %7D);%0A%7D%0A
+%0A//////////////////%0Afunction save() %7B%0A  var annotationObject = %7B%0A      'annotation_name': document.getElementById('annotation_name').value,%0A      'tags': document.getElementById('tags').value,%0A      'geo_cord': document.getElementById('geo_cord').value,%0A      'video_links': document.getElementById('video_links').value,%0A      'notes': document.getElementById('notes').value,%0A  %7D;%0A%0A  chrome.storage.sync.set(%7B'annotation_name': annotationObject%5B'annotation_name'%5D,%0A                           'tags': annotationObject%5B'tags'%5D,%0A                           'geo_cord': annotationObject%5B'geo_cord'%5D,%0A                           'video_links': annotationObject%5B'video_links'%5D,%0A                           'notes': annotationObject%5B'notes'%5D%7D, function() %7B%0A     console.log('Settings saved');%0A  %7D);%0A%0A  chrome.storage.sync.get(%5B'annotation_name', 'tags', 'geo_cord', 'video_links', 'notes'%5D, function(items) %7B%0A      console.log('Settings retrieved', items);%0A  %7D);%0A%7D%0A%0Adocument.getElementById('submit').onclick = save;%0A////////%0A%0A%0Achrome.storage.sync.set(%7B'foo': 'hello', 'bar': 'hi'%7D, function() %7B%0A   console.log('Settings saved');%0A%7D);%0A%0Achrome.storage.sync.get(%5B'foo', 'bar'%5D, function(items) %7B%0A  console.log('Settings retrieved', items);%0A%7D);%0A

change structure