I am developing a Google Chrome extension that works fine, but now has stopped working with version 2 of the manifest.
This gives me the following error:
Uncaught SyntaxError: Unexpected end of input
popup.js:
chrome.tabs.getSelected(null, function (aba) { link = aba.url; titulo = aba.title; document.getElementById('mensagem').value = link; }); function GrabIFrameURL(feedDescription) { var regex = new RegExp("iframe(?:.*?)src='(.*?)'", 'g'); var matches = regex.exec(feedDescription); var url = ''; if (matches.length == 2) { url = matches[1]; } var quebra = url.split("/"); return quebra[4]; } $(document).ready(function () { if (localStorage.nome == '' || localStorage.nome == null || localStorage.email == '' || localStorage.email == null) { jQuery('#formulario').hide(); jQuery('#erros').html('Configure seus dados <a href="options.html" target="_blank">aqui</a>'); } jQuery("#resposta").ajaxStart(function () { jQuery(this).html("<img src='img/loading.gif'> <b>SugestΓ£o sendo enviada, aguarde...</b>"); }); jQuery('#submit').click(function () { var nome = localStorage.nome; var email = localStorage.email; var mensagem = titulo + "\n\n<br><br>" + link; jQuery('#formulario').hide(); jQuery.post('http://blabloo.com.br/naosalvo/mail.php', { nome: nome, email: email, mensagem: mensagem }, function (data, ajaxStart) { jQuery('#resposta').html(data); console.log(data); }); return false; }); //Listagem de posts var bkg = chrome.extension.getBackgroundPage(); jQuery('#close').click(function () { window.close(); }); jQuery('#markeall').click(function () { bkg.lidoAll(); $('.naolido').attr('class', 'lido'); }); jQuery.each(bkg.getFeed(), function (id, item) { if (item.naolido == '1') lidoClass = 'naolido'; else lidoClass = 'lido'; var thumb = GrabIFrameURL(item.description); $('#feed').append('<li><a id="' + item.id + '" href="' + item.link + '" class="' + lidoClass + '"><img src="' + $.jYoutube(thumb, 'small') + '" class="' + lidoClass + '"/>' + item.title + '</a></li>'); }); $('.naolido').click(function (e) { e.preventDefault(); klicked = $(this).attr('id'); console.log(klicked); bkg.setLido(klicked); $(this).attr('class', 'lido'); openLink($(this).attr('href')); }); $('.lido').click(function (e) { openLink($(this).attr('href')); }); var openLink = function (link) { chrome.tabs.create({ 'url': link, 'selected': true }); window.close(); } });
I think the problem is in this part of popup.js:
jQuery.each(bkg.getFeed(), function (id, item) { if (item.naolido == '1') lidoClass = 'naolido'; else lidoClass = 'lido'; var thumb = GrabIFrameURL(item.description); $('#feed').append('<li><a id="' + item.id + '" href="' + item.link + '" class="' + lidoClass + '"><img src="' + $.jYoutube(thumb, 'small') + '" class="' + lidoClass + '"/>' + item.title + '</a></li>'); });
source share